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>
#include <string.h>
#include <stdlib.h>

int i,j,k;
int n,tim[61];
long long int ans;

int main(){

	while(scanf("%d",&n)*n){
		ans=0;
		for(i=0;i<61;i++)tim[i]=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			tim[k]++;
		}
		for(i=0;i<61 && n>1;i++){
			for(;tim[i]>0 && n>1;tim[i]--){
				n--;
				ans+=i*n;
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	k(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	tim(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$30, %ecx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	$0, ans(%rip)
	rep stosq
	movl	$0, i(%rip)
	movl	$0, (%rdi)
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	k(%rip), %rax
	movl	n(%rip), %edx
	addl	$1, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L4
	movq	ans(%rip), %r10
.L3:
	leaq	tim(%rip), %r8
	movq	%r10, %rsi
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	$0, i(%rip)
	xorl	%edi, %edi
	cmpl	$1, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	subl	$1, %edx
	movl	%edx, %eax
	imull	%edi, %eax
	cltq
	addq	%rax, %rsi
	subl	$1, %ecx
	je	.L30
	cmpl	$1, %edx
	jne	.L8
	movl	%ecx, (%r8)
	movl	$1, %r9d
.L7:
	addl	$1, %edi
	addq	$4, %r8
	movl	$1, %eax
	cmpl	$61, %edi
	je	.L31
	movl	%edi, %r12d
	cmpl	$1, %edx
	jg	.L32
.L10:
	testb	%al, %al
	je	.L11
	movl	%r12d, i(%rip)
.L11:
	movq	ans(%rip), %r10
	testb	%r9b, %r9b
	je	.L9
.L27:
	movq	%rsi, ans(%rip)
	movq	%rsi, %r10
	movl	%edx, n(%rip)
.L9:
	movq	%r10, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$0, (%r8)
	movl	$1, %r9d
	jmp	.L7
.L31:
	movl	$61, i(%rip)
	testb	%r9b, %r9b
	jne	.L27
	jmp	.L9
.L29:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	tim
	.align 32
	.type	tim, @object
	.size	tim, 244
tim:
	.zero	244
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	k(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	tim(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$30, %ecx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	$0, ans(%rip)
	rep stosq
	movl	$0, i(%rip)
	movl	$0, (%rdi)
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	k(%rip), %rax
	movl	n(%rip), %edx
	addl	$1, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L4
	movq	ans(%rip), %r10
.L3:
	leaq	tim(%rip), %r8
	movq	%r10, %rsi
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	$0, i(%rip)
	xorl	%edi, %edi
	cmpl	$1, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	subl	$1, %edx
	movl	%edx, %eax
	imull	%edi, %eax
	cltq
	addq	%rax, %rsi
	subl	$1, %ecx
	je	.L30
	cmpl	$1, %edx
	jne	.L8
	movl	%ecx, (%r8)
	movl	$1, %r9d
.L7:
	addl	$1, %edi
	addq	$4, %r8
	movl	$1, %eax
	cmpl	$61, %edi
	je	.L31
	movl	%edi, %r12d
	cmpl	$1, %edx
	jg	.L32
.L10:
	testb	%al, %al
	je	.L11
	movl	%r12d, i(%rip)
.L11:
	movq	ans(%rip), %r10
	testb	%r9b, %r9b
	je	.L9
.L27:
	movq	%rsi, ans(%rip)
	movq	%rsi, %r10
	movl	%edx, n(%rip)
.L9:
	movq	%r10, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$0, (%r8)
	movl	$1, %r9d
	jmp	.L7
.L31:
	movl	$61, i(%rip)
	testb	%r9b, %r9b
	jne	.L27
	jmp	.L9
.L29:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	tim
	.align 32
	.type	tim, @object
	.size	tim, 244
tim:
	.zero	244
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	k(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	tim(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$30, %ecx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	$0, ans(%rip)
	rep stosq
	movl	$0, i(%rip)
	movl	$0, (%rdi)
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	k(%rip), %rax
	movl	n(%rip), %edx
	addl	$1, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L4
	movq	ans(%rip), %r10
.L3:
	leaq	tim(%rip), %r8
	movq	%r10, %rsi
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	$0, i(%rip)
	xorl	%edi, %edi
	cmpl	$1, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	subl	$1, %edx
	movl	%edx, %eax
	imull	%edi, %eax
	cltq
	addq	%rax, %rsi
	subl	$1, %ecx
	je	.L30
	cmpl	$1, %edx
	jne	.L8
	movl	%ecx, (%r8)
	movl	$1, %r9d
.L7:
	addl	$1, %edi
	addq	$4, %r8
	movl	$1, %eax
	cmpl	$61, %edi
	je	.L31
	movl	%edi, %r12d
	cmpl	$1, %edx
	jg	.L32
.L10:
	testb	%al, %al
	je	.L11
	movl	%r12d, i(%rip)
.L11:
	movq	ans(%rip), %r10
	testb	%r9b, %r9b
	je	.L9
.L27:
	movq	%rsi, ans(%rip)
	movq	%rsi, %r10
	movl	%edx, n(%rip)
.L9:
	movq	%r10, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$0, (%r8)
	movl	$1, %r9d
	jmp	.L7
.L31:
	movl	$61, i(%rip)
	testb	%r9b, %r9b
	jne	.L27
	jmp	.L9
.L29:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	tim
	.align 32
	.type	tim, @object
	.size	tim, 244
tim:
	.zero	244
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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>
#include <string.h>
#include <stdlib.h>

int i,j,k;
int n,tim[61];
long long int ans;

int main(){

	while(scanf("%d",&n)*n){
		ans=0;
		for(i=0;i<61;i++)tim[i]=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			tim[k]++;
		}
		for(i=0;i<61 && n>1;i++){
			for(;tim[i]>0 && n>1;tim[i]--){
				n--;
				ans+=i*n;
			}
		}
		printf("%lld\n",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>
#include <string.h>
#include <stdlib.h>

int i,j,k;
int n,tim[61];
long long int ans;

int main(){

	while(scanf("%d",&n)*n){
		ans=0;
		for(i=0;i<61;i++)tim[i]=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			tim[k]++;
		}
		for(i=0;i<61 && n>1;i++){
			for(;tim[i]>0 && n>1;tim[i]--){
				n--;
				ans+=i*n;
			}
		}
		printf("%lld\n",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
2
6
4
6
9
0
 5
2
10
4
6
9
0
 5
2
6
4
7
9
0
 5
2
10
4
7
9
0
 5
2
17
8
7
9
0
 5
4
6
4
7
14
0
 5
2
17
8
7
12
0
 5
4
6
5
7
14
0
 5
1
17
8
7
12
0
 5
0
17
8
7
12
0

38
 41
 39
 43
 54
 47
 57
 50
 53
 49

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>
#include <string.h>
#include <stdlib.h>

int i,j,k;
int n,tim[61];
long long int ans;

int main(){

	while(scanf("%d",&n)*n){
		ans=0;
		for(i=0;i<61;i++)tim[i]=0;
		for(i=0;i<n;i++){
			scanf("%d",&k);
			tim[k]++;
		}
		for(i=0;i<61 && n>1;i++){
			for(;tim[i]>0 && n>1;tim[i]--){
				n--;
				ans+=i*n;
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	k(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	tim(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$30, %ecx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	$0, ans(%rip)
	rep stosq
	movl	$0, i(%rip)
	movl	$0, (%rdi)
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	k(%rip), %rax
	movl	n(%rip), %edx
	addl	$1, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L4
	movq	ans(%rip), %r10
.L3:
	leaq	tim(%rip), %r8
	movq	%r10, %rsi
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	$0, i(%rip)
	xorl	%edi, %edi
	cmpl	$1, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	subl	$1, %edx
	movl	%edx, %eax
	imull	%edi, %eax
	cltq
	addq	%rax, %rsi
	subl	$1, %ecx
	je	.L30
	cmpl	$1, %edx
	jne	.L8
	movl	%ecx, (%r8)
	movl	$1, %r9d
.L7:
	addl	$1, %edi
	addq	$4, %r8
	movl	$1, %eax
	cmpl	$61, %edi
	je	.L31
	movl	%edi, %r12d
	cmpl	$1, %edx
	jg	.L32
.L10:
	testb	%al, %al
	je	.L11
	movl	%r12d, i(%rip)
.L11:
	movq	ans(%rip), %r10
	testb	%r9b, %r9b
	je	.L9
.L27:
	movq	%rsi, ans(%rip)
	movq	%rsi, %r10
	movl	%edx, n(%rip)
.L9:
	movq	%r10, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$0, (%r8)
	movl	$1, %r9d
	jmp	.L7
.L31:
	movl	$61, i(%rip)
	testb	%r9b, %r9b
	jne	.L27
	jmp	.L9
.L29:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	tim
	.align 32
	.type	tim, @object
	.size	tim, 244
tim:
	.zero	244
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	k(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	tim(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$30, %ecx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	$0, ans(%rip)
	rep stosq
	movl	$0, i(%rip)
	movl	$0, (%rdi)
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	k(%rip), %rax
	movl	n(%rip), %edx
	addl	$1, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L4
	movq	ans(%rip), %r10
.L3:
	leaq	tim(%rip), %r8
	movq	%r10, %rsi
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	movl	$0, i(%rip)
	xorl	%edi, %edi
	cmpl	$1, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	subl	$1, %edx
	movl	%edx, %eax
	imull	%edi, %eax
	cltq
	addq	%rax, %rsi
	subl	$1, %ecx
	je	.L30
	cmpl	$1, %edx
	jne	.L8
	movl	%ecx, (%r8)
	movl	$1, %r9d
.L7:
	addl	$1, %edi
	addq	$4, %r8
	movl	$1, %eax
	cmpl	$61, %edi
	je	.L31
	movl	%edi, %r12d
	cmpl	$1, %edx
	jg	.L32
.L10:
	testb	%al, %al
	je	.L11
	movl	%r12d, i(%rip)
.L11:
	movq	ans(%rip), %r10
	testb	%r9b, %r9b
	je	.L9
.L27:
	movq	%rsi, ans(%rip)
	movq	%rsi, %r10
	movl	%edx, n(%rip)
.L9:
	movq	%r10, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$0, (%r8)
	movl	$1, %r9d
	jmp	.L7
.L31:
	movl	$61, i(%rip)
	testb	%r9b, %r9b
	jne	.L27
	jmp	.L9
.L29:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	tim
	.align 32
	.type	tim, @object
	.size	tim, 244
tim:
	.zero	244
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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:
```