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

```c
#include <stdio.h>

int main(void){
	int p[1000], n, m, total, temp, i, j;
	while (1){
		scanf("%d%d", &n, &m);
		if (n == 0) break;
		total = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &p[i]);
			total += p[i];
		}
		for (i = 0; i < n - 1; i++){
			for (j = n - 1; j > i; j--){
				if (p[j] > p[j-1]){
					temp = p[j];
					p[j] = p[j-1];
					p[j-1] = temp;
				}
			}
		}
		for (i = m - 1; i < n; i += m){
			total -= p[i];
		}
		printf("%d\n", total);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-4036(%rbp), %rdx
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%eax, -4032(%rbp)
	addl	$1, -4028(%rbp)
.L4:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L5
	movl	$0, -4028(%rbp)
	jmp	.L6
.L10:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4024(%rbp)
	jmp	.L7
.L9:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4020(%rbp), %edx
	movl	%edx, -4016(%rbp,%rax,4)
.L8:
	subl	$1, -4024(%rbp)
.L7:
	movl	-4024(%rbp), %eax
	cmpl	-4028(%rbp), %eax
	jg	.L9
	addl	$1, -4028(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L10
	movl	-4036(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4028(%rbp)
	jmp	.L11
.L12:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	subl	%eax, -4032(%rbp)
	movl	-4036(%rbp), %eax
	addl	%eax, -4028(%rbp)
.L11:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L12
	movl	-4032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4040, %rsp
	.cfi_def_cfa_offset 4096
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	16(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rdx
	movq	%r13, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L2
	jle	.L17
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r12,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r8d
	addl	(%rbx,%r12,4), %r15d
	addq	$1, %r12
	cmpl	%r12d, %r8d
	jg	.L4
.L3:
	leal	-1(%r8), %r9d
	testl	%r9d, %r9d
	jle	.L5
	movslq	%r8d, %rax
	xorl	%edi, %edi
	leaq	(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r10, %rdx
	movl	%r9d, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	-8(%rdx), %xmm0
	subl	$1, %ecx
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jle	.L6
	movq	%xmm1, -8(%rdx)
.L6:
	subq	$4, %rdx
	cmpl	%edi, %ecx
	jg	.L7
	addl	$1, %edi
	cmpl	%edi, %r9d
	jne	.L8
.L5:
	movslq	12(%rsp), %rdx
	leal	-1(%rdx), %eax
	cmpl	%r8d, %eax
	jge	.L9
	cmpl	$1, %edx
	jne	.L26
	cmpl	$2, %r9d
	jbe	.L18
	movl	%r8d, %edx
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L13
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r15d
	movl	%r8d, %eax
	andl	$-4, %eax
	testb	$3, %r8b
	je	.L9
.L12:
	movslq	%eax, %rdx
	subl	16(%rsp,%rdx,4), %r15d
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jle	.L9
	movslq	%edx, %rdx
	addl	$2, %eax
	subl	16(%rsp,%rdx,4), %r15d
	cmpl	%eax, %r8d
	jle	.L9
	cltq
	subl	16(%rsp,%rax,4), %r15d
.L9:
	movl	%r15d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
.L26:
	cltq
	.p2align 4,,10
	.p2align 3
.L11:
	subl	(%rbx,%rax,4), %r15d
	addq	%rdx, %rax
	cmpl	%eax, %r8d
	jg	.L11
	jmp	.L9
.L2:
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$4040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %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
.L17:
	.cfi_restore_state
	xorl	%r15d, %r15d
	jmp	.L3
.L18:
	xorl	%eax, %eax
	jmp	.L12
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4040, %rsp
	.cfi_def_cfa_offset 4096
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	16(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rdx
	movq	%r13, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L2
	jle	.L17
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r12,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r8d
	addl	(%rbx,%r12,4), %r15d
	addq	$1, %r12
	cmpl	%r12d, %r8d
	jg	.L4
.L3:
	leal	-1(%r8), %r9d
	testl	%r9d, %r9d
	jle	.L5
	movslq	%r8d, %rax
	xorl	%edi, %edi
	leaq	(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r10, %rdx
	movl	%r9d, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	-8(%rdx), %xmm0
	subl	$1, %ecx
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jle	.L6
	movq	%xmm1, -8(%rdx)
.L6:
	subq	$4, %rdx
	cmpl	%edi, %ecx
	jg	.L7
	addl	$1, %edi
	cmpl	%edi, %r9d
	jne	.L8
.L5:
	movslq	12(%rsp), %rdx
	leal	-1(%rdx), %eax
	cmpl	%r8d, %eax
	jge	.L9
	cmpl	$1, %edx
	jne	.L26
	cmpl	$2, %r9d
	jbe	.L18
	movl	%r8d, %edx
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L13
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r15d
	movl	%r8d, %eax
	andl	$-4, %eax
	testb	$3, %r8b
	je	.L9
.L12:
	movslq	%eax, %rdx
	subl	16(%rsp,%rdx,4), %r15d
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jle	.L9
	movslq	%edx, %rdx
	addl	$2, %eax
	subl	16(%rsp,%rdx,4), %r15d
	cmpl	%eax, %r8d
	jle	.L9
	cltq
	subl	16(%rsp,%rax,4), %r15d
.L9:
	movl	%r15d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
.L26:
	cltq
	.p2align 4,,10
	.p2align 3
.L11:
	subl	(%rbx,%rax,4), %r15d
	addq	%rdx, %rax
	cmpl	%eax, %r8d
	jg	.L11
	jmp	.L9
.L2:
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$4040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %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
.L17:
	.cfi_restore_state
	xorl	%r15d, %r15d
	jmp	.L3
.L18:
	xorl	%eax, %eax
	jmp	.L12
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include <stdio.h>

int main(void){
	int p[1000], n, m, total, temp, i, j;
	while (1){
		scanf("%d%d", &n, &m);
		if (n == 0) break;
		total = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &p[i]);
			total += p[i];
		}
		for (i = 0; i < n - 1; i++){
			for (j = n - 1; j > i; j--){
				if (p[j] > p[j-1]){
					temp = p[j];
					p[j] = p[j-1];
					p[j-1] = temp;
				}
			}
		}
		for (i = m - 1; i < n; i += m){
			total -= p[i];
		}
		printf("%d\n", total);
	}
	return 0;
}
4 2
50 40 100 80
7 3
400 300 100 700 200 600 57
0 0
 4 2
50 40 100 80
7 3
400 300 100 700 352 600 57
0 0
 4 3
50 40 100 80
7 3
400 300 100 700 352 600 57
0 0
 4 3
50 40 100 80
7 3
400 290 100 700 352 600 57
0 0
 4 3
50 40 100 80
7 3
400 290 000 700 352 600 57
0 0
 4 3
50 40 100 80
7 3
400 284 000 700 352 600 57
0 0
 4 3
50 40 100 80
7 4
400 284 000 700 352 600 57
0 0
 4 3
50 40 100 80
7 4
400 284 000 700 352 650 57
0 0
 4 2
50 40 100 80
7 4
400 284 000 700 352 650 57
0 0
 4 2
50 40 100 80
7 3
400 139 100 700 200 600 500
0 0

150
1857
 150
2009
 220
2009
 220
1999
 220
1942
 220
1936
 220
2041
 220
2091
 150
2091
 150
2000

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

```c
#include <stdio.h>

int main(void){
	int p[1000], n, m, total, temp, i, j;
	while (1){
		scanf("%d%d", &n, &m);
		if (n == 0) break;
		total = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &p[i]);
			total += p[i];
		}
		for (i = 0; i < n - 1; i++){
			for (j = n - 1; j > i; j--){
				if (p[j] > p[j-1]){
					temp = p[j];
					p[j] = p[j-1];
					p[j-1] = temp;
				}
			}
		}
		for (i = m - 1; i < n; i += m){
			total -= p[i];
		}
		printf("%d\n", total);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-4036(%rbp), %rdx
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%eax, -4032(%rbp)
	addl	$1, -4028(%rbp)
.L4:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L5
	movl	$0, -4028(%rbp)
	jmp	.L6
.L10:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4024(%rbp)
	jmp	.L7
.L9:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4020(%rbp), %edx
	movl	%edx, -4016(%rbp,%rax,4)
.L8:
	subl	$1, -4024(%rbp)
.L7:
	movl	-4024(%rbp), %eax
	cmpl	-4028(%rbp), %eax
	jg	.L9
	addl	$1, -4028(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L10
	movl	-4036(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4028(%rbp)
	jmp	.L11
.L12:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	subl	%eax, -4032(%rbp)
	movl	-4036(%rbp), %eax
	addl	%eax, -4028(%rbp)
.L11:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L12
	movl	-4032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-4036(%rbp), %rdx
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%eax, -4032(%rbp)
	addl	$1, -4028(%rbp)
.L4:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L5
	movl	$0, -4028(%rbp)
	jmp	.L6
.L10:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4024(%rbp)
	jmp	.L7
.L9:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	movl	-4024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4020(%rbp), %edx
	movl	%edx, -4016(%rbp,%rax,4)
.L8:
	subl	$1, -4024(%rbp)
.L7:
	movl	-4024(%rbp), %eax
	cmpl	-4028(%rbp), %eax
	jg	.L9
	addl	$1, -4028(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L10
	movl	-4036(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4028(%rbp)
	jmp	.L11
.L12:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	subl	%eax, -4032(%rbp)
	movl	-4036(%rbp), %eax
	addl	%eax, -4028(%rbp)
.L11:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L12
	movl	-4032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
