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>

int solve(int n,int m){
	int L[105],i=0,ave,sum=0;
	for(;i<n;++i)
		scanf("%d",L+i);
	ave=m/n;
	--i;
	while(i>=0){
		if(L[i]>=ave) sum+=ave;
		else sum+=L[i];
		--i;}
	return sum;
}

int main(){
	while(1){
		int n,m;
		scanf("%d%d",&n,&m);
		if(n&&m) printf("%d\n",solve(n,m));
		else break;}
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L9
	leaq	16(%rsp), %r12
	leal	-1(%rdi), %ebx
	movl	%edi, %r15d
	movq	%r12, %rbp
	leaq	20(%rsp,%rbx,4), %r14
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r14, %rbp
	jne	.L3
	movl	12(%rsp), %eax
	xorl	%r8d, %r8d
	cltd
	idivl	%r15d
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%r12,%rdx,4), %ecx
	leal	(%r8,%rax), %esi
	addl	%ecx, %r8d
	cmpl	%ecx, %eax
	cmovle	%esi, %r8d
	subq	$1, %rdx
	cmpl	$-1, %edx
	jne	.L7
.L1:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L27:
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L17
	call	solve
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L27
.L17:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L9
	leaq	16(%rsp), %r12
	leal	-1(%rdi), %ebx
	movl	%edi, %r15d
	movq	%r12, %rbp
	leaq	20(%rsp,%rbx,4), %r14
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r14, %rbp
	jne	.L3
	movl	12(%rsp), %eax
	xorl	%r8d, %r8d
	cltd
	idivl	%r15d
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%r12,%rdx,4), %ecx
	leal	(%r8,%rax), %esi
	addl	%ecx, %r8d
	cmpl	%ecx, %eax
	cmovle	%esi, %r8d
	subq	$1, %rdx
	cmpl	$-1, %edx
	jne	.L7
.L1:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L27:
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L17
	call	solve
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L27
.L17:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L9
	leaq	16(%rsp), %r12
	leal	-1(%rdi), %ebx
	movl	%edi, %r15d
	movq	%r12, %rbp
	leaq	20(%rsp,%rbx,4), %r14
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r14, %rbp
	jne	.L3
	movl	12(%rsp), %eax
	xorl	%r8d, %r8d
	cltd
	idivl	%r15d
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%r12,%rdx,4), %ecx
	leal	(%r8,%rax), %esi
	addl	%ecx, %r8d
	cmpl	%ecx, %eax
	cmovle	%esi, %r8d
	subq	$1, %rdx
	cmpl	$-1, %edx
	jne	.L7
.L1:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L27:
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L17
	call	solve
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L27
.L17:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.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>

int solve(int n,int m){
	int L[105],i=0,ave,sum=0;
	for(;i<n;++i)
		scanf("%d",L+i);
	ave=m/n;
	--i;
	while(i>=0){
		if(L[i]>=ave) sum+=ave;
		else sum+=L[i];
		--i;}
	return sum;
}

int main(){
	while(1){
		int n,m;
		scanf("%d%d",&n,&m);
		if(n&&m) printf("%d\n",solve(n,m));
		else break;}
	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int solve(int n,int m){
	int L[105],i=0,ave,sum=0;
	for(;i<n;++i)
		scanf("%d",L+i);
	ave=m/n;
	--i;
	while(i>=0){
		if(L[i]>=ave) sum+=ave;
		else sum+=L[i];
		--i;}
	return sum;
}

int main(){
	while(1){
		int n,m;
		scanf("%d%d",&n,&m);
		if(n&&m) printf("%d\n",solve(n,m));
		else break;}
	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:

3 300
120 100 80
3 5
10 20 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 100 80
3 5
10 20 5
4 1000
100 260 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 100 80
2 5
10 34 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 632
0 0
 3 300
120 101 80
3 5
10 34 5
4 1000
100 200 159 400
5 5
183 8430 3 4199 632
0 0
 3 276
120 101 80
3 5
10 34 10
4 1000
100 200 159 400
5 5
183 8430 3 4199 632
0 0
 3 276
120 101 93
3 5
10 34 10
4 1000
100 200 159 400
5 5
127 8430 3 4199 632
0 0
 3 276
120 101 93
3 5
10 34 10
4 1000
100 200 159 400
5 5
127 8430 0 4199 632
0 0
 3 300
120 010 80
2 5
12 34 5
4 0000
110 200 300 400
5 5
2523 8430 3 4199 201
0 0
 3 300
120 100 80
3 30
10 20 5
4 1000
100 200 300 400
5 5
2523 8430 3 4199 987
0 0
 3 300
120 101 80
3 5
10 34 5
4 1000
100 200 300 400
5 1
2523 8430 3 4199 632
0 0

280
3
800
5
 280
3
850
5
 280
4
0
5
 280
3
709
5
 264
3
709
5
 276
3
709
5
 276
3
709
4
 190
4
0
5
 280
25
800
5
 280
3
800
0

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>

int solve(int n,int m){
	int L[105],i=0,ave,sum=0;
	for(;i<n;++i)
		scanf("%d",L+i);
	ave=m/n;
	--i;
	while(i>=0){
		if(L[i]>=ave) sum+=ave;
		else sum+=L[i];
		--i;}
	return sum;
}

int main(){
	while(1){
		int n,m;
		scanf("%d%d",&n,&m);
		if(n&&m) printf("%d\n",solve(n,m));
		else break;}
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L9
	leaq	16(%rsp), %r12
	leal	-1(%rdi), %ebx
	movl	%edi, %r15d
	movq	%r12, %rbp
	leaq	20(%rsp,%rbx,4), %r14
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r14, %rbp
	jne	.L3
	movl	12(%rsp), %eax
	xorl	%r8d, %r8d
	cltd
	idivl	%r15d
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%r12,%rdx,4), %ecx
	leal	(%r8,%rax), %esi
	addl	%ecx, %r8d
	cmpl	%ecx, %eax
	cmovle	%esi, %r8d
	subq	$1, %rdx
	cmpl	$-1, %edx
	jne	.L7
.L1:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L27:
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L17
	call	solve
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L27
.L17:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movl	%esi, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L9
	leaq	16(%rsp), %r12
	leal	-1(%rdi), %ebx
	movl	%edi, %r15d
	movq	%r12, %rbp
	leaq	20(%rsp,%rbx,4), %r14
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r14, %rbp
	jne	.L3
	movl	12(%rsp), %eax
	xorl	%r8d, %r8d
	cltd
	idivl	%r15d
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%r12,%rdx,4), %ecx
	leal	(%r8,%rax), %esi
	addl	%ecx, %r8d
	cmpl	%ecx, %eax
	cmovle	%esi, %r8d
	subq	$1, %rdx
	cmpl	$-1, %edx
	jne	.L7
.L1:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L27:
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L17
	call	solve
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edi
	testl	%edi, %edi
	jne	.L27
.L17:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.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:
```