Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define N 100000
int n, k;
double T[N];
int check(double P){
  int i = 0, j = 0;
  double s;
  for(j=0;j<k;j++){
    s = 0.0;
    while(s+T[i] <= P){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }
  return i;
}

int solve(){
  double left = 0.0;
  double right = 100000*10000;
  double mid;
  int v;
  while(right - left > 1){
    mid = (left+right) / 2;
    v = check(mid);
    if(v >= n) right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  int i;
  double ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%lf", &T[i]);
  ans = solve();
  printf("%d\n",(int)ans);  
  return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	movl	k(%rip), %edi
	testl	%edi, %edi
	jle	.L6
	movl	n(%rip), %ecx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	T(%rip), %r8
.L3:
	movslq	%eax, %rdx
	pxor	%xmm1, %xmm1
	leaq	(%r8,%rdx,8), %rdx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$8, %rdx
	cmpl	%eax, %ecx
	je	.L1
.L5:
	addsd	(%rdx), %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L4
	addl	$1, %esi
	cmpl	%edi, %esi
	jne	.L3
.L1:
	ret
.L6:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB24:
	.cfi_startproc
	endbr64
	pxor	%xmm4, %xmm4
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	leaq	T(%rip), %rcx
	movsd	.LC1(%rip), %xmm2
	movsd	.LC3(%rip), %xmm5
	movapd	%xmm4, %xmm3
	movsd	.LC2(%rip), %xmm6
	.p2align 4,,10
	.p2align 3
.L20:
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	jbe	.L21
.L15:
	movapd	%xmm2, %xmm1
	xorl	%edx, %edx
	xorl	%edi, %edi
	addsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm1
	testl	%r8d, %r8d
	jle	.L11
.L10:
	movslq	%edx, %rax
	movapd	%xmm4, %xmm0
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	cmpl	%eax, %esi
	je	.L18
.L14:
	addsd	(%rcx,%rax,8), %xmm0
	movl	%eax, %edx
	comisd	%xmm0, %xmm1
	jnb	.L13
	addl	$1, %edi
	cmpl	%r8d, %edi
	jne	.L10
.L11:
	cmpl	%edx, %esi
	jle	.L18
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	ja	.L15
.L21:
	cvttsd2sil	%xmm2, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movapd	%xmm1, %xmm2
	jmp	.L20
	.cfi_endproc
.LFE24:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"%d%d"
.LC5:
	.string	"%lf"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC4(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	T(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L24
.L23:
	xorl	%eax, %eax
	call	solve
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 800000
T:
	.zero	800000
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1104006501
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	movl	k(%rip), %edi
	testl	%edi, %edi
	jle	.L6
	movl	n(%rip), %ecx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	T(%rip), %r8
.L3:
	movslq	%eax, %rdx
	pxor	%xmm1, %xmm1
	leaq	(%r8,%rdx,8), %rdx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$8, %rdx
	cmpl	%eax, %ecx
	je	.L1
.L5:
	addsd	(%rdx), %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L4
	addl	$1, %esi
	cmpl	%edi, %esi
	jne	.L3
.L1:
	ret
.L6:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB24:
	.cfi_startproc
	endbr64
	pxor	%xmm4, %xmm4
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	leaq	T(%rip), %rcx
	movsd	.LC1(%rip), %xmm2
	movsd	.LC3(%rip), %xmm5
	movapd	%xmm4, %xmm3
	movsd	.LC2(%rip), %xmm6
	.p2align 4,,10
	.p2align 3
.L20:
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	jbe	.L21
.L15:
	movapd	%xmm2, %xmm1
	xorl	%edx, %edx
	xorl	%edi, %edi
	addsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm1
	testl	%r8d, %r8d
	jle	.L11
.L10:
	movslq	%edx, %rax
	movapd	%xmm4, %xmm0
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	cmpl	%eax, %esi
	je	.L18
.L14:
	addsd	(%rcx,%rax,8), %xmm0
	movl	%eax, %edx
	comisd	%xmm0, %xmm1
	jnb	.L13
	addl	$1, %edi
	cmpl	%r8d, %edi
	jne	.L10
.L11:
	cmpl	%edx, %esi
	jle	.L18
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	ja	.L15
.L21:
	cvttsd2sil	%xmm2, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movapd	%xmm1, %xmm2
	jmp	.L20
	.cfi_endproc
.LFE24:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"%d%d"
.LC5:
	.string	"%lf"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC4(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	T(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L24
.L23:
	xorl	%eax, %eax
	call	solve
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 800000
T:
	.zero	800000
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1104006501
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	movl	k(%rip), %edi
	testl	%edi, %edi
	jle	.L6
	movl	n(%rip), %ecx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	T(%rip), %r8
.L3:
	movslq	%eax, %rdx
	pxor	%xmm1, %xmm1
	leaq	(%r8,%rdx,8), %rdx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$8, %rdx
	cmpl	%eax, %ecx
	je	.L1
.L5:
	addsd	(%rdx), %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L4
	addl	$1, %esi
	cmpl	%edi, %esi
	jne	.L3
.L1:
	ret
.L6:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB24:
	.cfi_startproc
	endbr64
	pxor	%xmm4, %xmm4
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	leaq	T(%rip), %rcx
	movsd	.LC1(%rip), %xmm2
	movsd	.LC3(%rip), %xmm5
	movapd	%xmm4, %xmm3
	movsd	.LC2(%rip), %xmm6
	.p2align 4,,10
	.p2align 3
.L20:
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	jbe	.L21
.L15:
	movapd	%xmm2, %xmm1
	xorl	%edx, %edx
	xorl	%edi, %edi
	addsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm1
	testl	%r8d, %r8d
	jle	.L11
.L10:
	movslq	%edx, %rax
	movapd	%xmm4, %xmm0
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	cmpl	%eax, %esi
	je	.L18
.L14:
	addsd	(%rcx,%rax,8), %xmm0
	movl	%eax, %edx
	comisd	%xmm0, %xmm1
	jnb	.L13
	addl	$1, %edi
	cmpl	%r8d, %edi
	jne	.L10
.L11:
	cmpl	%edx, %esi
	jle	.L18
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	ja	.L15
.L21:
	cvttsd2sil	%xmm2, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movapd	%xmm1, %xmm2
	jmp	.L20
	.cfi_endproc
.LFE24:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"%d%d"
.LC5:
	.string	"%lf"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC4(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	T(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L24
.L23:
	xorl	%eax, %eax
	call	solve
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 800000
T:
	.zero	800000
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1104006501
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include <stdio.h>
#define N 100000
int n, k;
double T[N];
int check(double P){
  int i = 0, j = 0;
  double s;
  for(j=0;j<k;j++){
    s = 0.0;
    while(s+T[i] <= P){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }
  return i;
}

int solve(){
  double left = 0.0;
  double right = 100000*10000;
  double mid;
  int v;
  while(right - left > 1){
    mid = (left+right) / 2;
    v = check(mid);
    if(v >= n) right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  int i;
  double ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%lf", &T[i]);
  ans = solve();
  printf("%d\n",(int)ans);  
  return 0;
}

```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define N 100000
int n, k;
double T[N];
int check(double P){
  int i = 0, j = 0;
  double s;
  for(j=0;j<k;j++){
    s = 0.0;
    while(s+T[i] <= P){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }
  return i;
}

int solve(){
  double left = 0.0;
  double right = 100000*10000;
  double mid;
  int v;
  while(right - left > 1){
    mid = (left+right) / 2;
    v = check(mid);
    if(v >= n) right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  int i;
  double ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%lf", &T[i]);
  ans = solve();
  printf("%d\n",(int)ans);  
  return 0;
}

```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

5 3
4
1
7
3
9
 4 2
1
1
2
6
 5 3
4
1
7
3
5
 5 6
4
1
7
3
5
 4 2
1
1
3
1
 4 2
1
1
3
0
 4 2
1
4
3
0
 5 3
6
2
8
5
4
 5 3
6
2
8
7
4
 5 3
8
2
9
7
5

10
 6
 8
 7
 4
 3
 5
 9
 11
 12

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define N 100000
int n, k;
double T[N];
int check(double P){
  int i = 0, j = 0;
  double s;
  for(j=0;j<k;j++){
    s = 0.0;
    while(s+T[i] <= P){
      s += T[i];
      i++;
      if(i == n) return n;
    }
  }
  return i;
}

int solve(){
  double left = 0.0;
  double right = 100000*10000;
  double mid;
  int v;
  while(right - left > 1){
    mid = (left+right) / 2;
    v = check(mid);
    if(v >= n) right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  int i;
  double ans;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%lf", &T[i]);
  ans = solve();
  printf("%d\n",(int)ans);  
  return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	movl	k(%rip), %edi
	testl	%edi, %edi
	jle	.L6
	movl	n(%rip), %ecx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	T(%rip), %r8
.L3:
	movslq	%eax, %rdx
	pxor	%xmm1, %xmm1
	leaq	(%r8,%rdx,8), %rdx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$8, %rdx
	cmpl	%eax, %ecx
	je	.L1
.L5:
	addsd	(%rdx), %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L4
	addl	$1, %esi
	cmpl	%edi, %esi
	jne	.L3
.L1:
	ret
.L6:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB24:
	.cfi_startproc
	endbr64
	pxor	%xmm4, %xmm4
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	leaq	T(%rip), %rcx
	movsd	.LC1(%rip), %xmm2
	movsd	.LC3(%rip), %xmm5
	movapd	%xmm4, %xmm3
	movsd	.LC2(%rip), %xmm6
	.p2align 4,,10
	.p2align 3
.L20:
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	jbe	.L21
.L15:
	movapd	%xmm2, %xmm1
	xorl	%edx, %edx
	xorl	%edi, %edi
	addsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm1
	testl	%r8d, %r8d
	jle	.L11
.L10:
	movslq	%edx, %rax
	movapd	%xmm4, %xmm0
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	cmpl	%eax, %esi
	je	.L18
.L14:
	addsd	(%rcx,%rax,8), %xmm0
	movl	%eax, %edx
	comisd	%xmm0, %xmm1
	jnb	.L13
	addl	$1, %edi
	cmpl	%r8d, %edi
	jne	.L10
.L11:
	cmpl	%edx, %esi
	jle	.L18
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	ja	.L15
.L21:
	cvttsd2sil	%xmm2, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movapd	%xmm1, %xmm2
	jmp	.L20
	.cfi_endproc
.LFE24:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"%d%d"
.LC5:
	.string	"%lf"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC4(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	T(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L24
.L23:
	xorl	%eax, %eax
	call	solve
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 800000
T:
	.zero	800000
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1104006501
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	movl	k(%rip), %edi
	testl	%edi, %edi
	jle	.L6
	movl	n(%rip), %ecx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	T(%rip), %r8
.L3:
	movslq	%eax, %rdx
	pxor	%xmm1, %xmm1
	leaq	(%r8,%rdx,8), %rdx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$8, %rdx
	cmpl	%eax, %ecx
	je	.L1
.L5:
	addsd	(%rdx), %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L4
	addl	$1, %esi
	cmpl	%edi, %esi
	jne	.L3
.L1:
	ret
.L6:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB24:
	.cfi_startproc
	endbr64
	pxor	%xmm4, %xmm4
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	leaq	T(%rip), %rcx
	movsd	.LC1(%rip), %xmm2
	movsd	.LC3(%rip), %xmm5
	movapd	%xmm4, %xmm3
	movsd	.LC2(%rip), %xmm6
	.p2align 4,,10
	.p2align 3
.L20:
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	jbe	.L21
.L15:
	movapd	%xmm2, %xmm1
	xorl	%edx, %edx
	xorl	%edi, %edi
	addsd	%xmm3, %xmm1
	mulsd	%xmm6, %xmm1
	testl	%r8d, %r8d
	jle	.L11
.L10:
	movslq	%edx, %rax
	movapd	%xmm4, %xmm0
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	cmpl	%eax, %esi
	je	.L18
.L14:
	addsd	(%rcx,%rax,8), %xmm0
	movl	%eax, %edx
	comisd	%xmm0, %xmm1
	jnb	.L13
	addl	$1, %edi
	cmpl	%r8d, %edi
	jne	.L10
.L11:
	cmpl	%edx, %esi
	jle	.L18
	movapd	%xmm1, %xmm3
	movapd	%xmm2, %xmm0
	subsd	%xmm3, %xmm0
	comisd	%xmm5, %xmm0
	ja	.L15
.L21:
	cvttsd2sil	%xmm2, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movapd	%xmm1, %xmm2
	jmp	.L20
	.cfi_endproc
.LFE24:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"%d%d"
.LC5:
	.string	"%lf"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC4(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	T(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$8, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L24
.L23:
	xorl	%eax, %eax
	call	solve
	leaq	.LC6(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 800000
T:
	.zero	800000
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1104006501
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```