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>
#include <memory.h>
int main(void){
	int n,m,a,h,p,q,amida[1000][100],i,j,maxh,ans;
	while(1){
		scanf("%d %d %d",&n,&m,&a);
		if(!n){
			break;
		}
		ans=a-1;
		memset(amida,0,sizeof(amida));
		maxh=0;
		for(i=0;i<m;i++){
			scanf("%d %d %d",&h,&p,&q);
			if(maxh<h){
				maxh=h;
			}
			amida[h-1][p-1]=q;
			amida[h-1][q-1]=p;
		}
		for(i=maxh-1;i>=0;i--){
			if(amida[i][ans]){
				ans=amida[i][ans]-1;
			}
		}
		printf("%d\n",ans+1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L10:
	leaq	-400044(%rbp), %rcx
	leaq	-400048(%rbp), %rdx
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400052(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400024(%rbp)
	movl	$0, -400028(%rbp)
	jmp	.L4
.L6:
	leaq	-400032(%rbp), %rcx
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400024(%rbp)
	jge	.L5
	movl	-400040(%rbp), %eax
	movl	%eax, -400024(%rbp)
.L5:
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400036(%rbp), %eax
	subl	$1, %eax
	movl	-400032(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400032(%rbp), %eax
	subl	$1, %eax
	movl	-400036(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400028(%rbp)
.L4:
	movl	-400048(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	-400024(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400028(%rbp)
	jmp	.L7
.L9:
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L8
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
.L8:
	subl	$1, -400028(%rbp)
.L7:
	cmpl	$0, -400028(%rbp)
	jns	.L9
	movl	-400020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2776, %rsp
	.cfi_def_cfa_offset 400144
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400072(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movl	48(%rsp), %eax
	leaq	64(%rsp), %rdi
	movl	$400000, %edx
	xorl	%esi, %esi
	movl	%eax, (%rsp)
	leal	-1(%rax), %r15d
	call	memset@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	xorl	%r14d, %r14d
	leaq	52(%rsp), %rax
	movl	%r15d, 4(%rsp)
	leaq	60(%rsp), %r13
	leaq	56(%rsp), %r12
	movl	%r14d, %r15d
	movq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	movl	56(%rsp), %ecx
	movl	60(%rsp), %edx
	cmpl	%eax, %r15d
	leal	-1(%rcx), %esi
	cmovl	%eax, %r15d
	subl	$1, %eax
	movslq	%esi, %rsi
	addl	$1, %r14d
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	salq	$2, %rax
	addq	%rax, %rsi
	movl	%edx, 64(%rsp,%rsi,4)
	subl	$1, %edx
	movslq	%edx, %rdx
	addq	%rdx, %rax
	movl	%ecx, 64(%rsp,%rax,4)
	cmpl	%r14d, 44(%rsp)
	jg	.L4
	movl	%r15d, %r14d
	movl	4(%rsp), %r15d
	leal	-1(%r14), %eax
	testl	%r14d, %r14d
	je	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%eax, %rdx
	movslq	%r15d, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rcx,%rdx,4), %rdx
	movl	64(%rsp,%rdx,4), %edx
	leal	-1(%rdx), %ecx
	testl	%edx, %edx
	cmovne	%ecx, %r15d
	subl	$1, %eax
	jnb	.L6
	leal	1(%r15), %eax
	movl	%eax, (%rsp)
.L3:
	movl	(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	400072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400088, %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
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2776, %rsp
	.cfi_def_cfa_offset 400144
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400072(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movl	48(%rsp), %eax
	leaq	64(%rsp), %rdi
	movl	$400000, %edx
	xorl	%esi, %esi
	movl	%eax, (%rsp)
	leal	-1(%rax), %r15d
	call	memset@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	xorl	%r14d, %r14d
	leaq	52(%rsp), %rax
	movl	%r15d, 4(%rsp)
	leaq	60(%rsp), %r13
	leaq	56(%rsp), %r12
	movl	%r14d, %r15d
	movq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	movl	56(%rsp), %ecx
	movl	60(%rsp), %edx
	cmpl	%eax, %r15d
	leal	-1(%rcx), %esi
	cmovl	%eax, %r15d
	subl	$1, %eax
	movslq	%esi, %rsi
	addl	$1, %r14d
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	salq	$2, %rax
	addq	%rax, %rsi
	movl	%edx, 64(%rsp,%rsi,4)
	subl	$1, %edx
	movslq	%edx, %rdx
	addq	%rdx, %rax
	movl	%ecx, 64(%rsp,%rax,4)
	cmpl	%r14d, 44(%rsp)
	jg	.L4
	movl	%r15d, %r14d
	movl	4(%rsp), %r15d
	leal	-1(%r14), %eax
	testl	%r14d, %r14d
	je	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%eax, %rdx
	movslq	%r15d, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rcx,%rdx,4), %rdx
	movl	64(%rsp,%rdx,4), %edx
	leal	-1(%rdx), %ecx
	testl	%edx, %edx
	cmovne	%ecx, %r15d
	subl	$1, %eax
	jnb	.L6
	leal	1(%r15), %eax
	movl	%eax, (%rsp)
.L3:
	movl	(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	400072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400088, %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
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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>
#include <memory.h>
int main(void){
	int n,m,a,h,p,q,amida[1000][100],i,j,maxh,ans;
	while(1){
		scanf("%d %d %d",&n,&m,&a);
		if(!n){
			break;
		}
		ans=a-1;
		memset(amida,0,sizeof(amida));
		maxh=0;
		for(i=0;i<m;i++){
			scanf("%d %d %d",&h,&p,&q);
			if(maxh<h){
				maxh=h;
			}
			amida[h-1][p-1]=q;
			amida[h-1][q-1]=p;
		}
		for(i=maxh-1;i>=0;i--){
			if(amida[i][ans]){
				ans=amida[i][ans]-1;
			}
		}
		printf("%d\n",ans+1);
	}
	return 0;
}
4 4 1
3 1 2
2 2 4
3 3 4
1 3 4
0 0 0
 4 4 1
3 1 2
2 2 3
4 3 4
1 3 4
0 0 0
 4 4 1
3 1 2
2 2 4
3 3 4
1 1 4
0 0 0
 4 4 1
0 1 2
2 2 3
3 3 4
0 3 4
0 0 0
 4 3 1
3 1 2
0 1 3
4 3 4
1 0 1
0 0 0
 4 3 1
3 1 1
0 1 3
4 3 4
1 0 1
0 0 0
 7 4 1
3 1 4
0 1 3
8 3 4
1 4 6
0 0 0
 6 4 1
3 0 2
2 2 3
0 5 1
0 2 0
0 0 0
 4 4 1
3 1 2
2 2 3
3 3 4
0 3 4
0 0 0
 4 4 1
3 1 2
2 2 3
4 3 4
1 0 4
0 0 0

3
 4
 1
 1
 2
1
 1
1
 6
 1
 3
 5

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>
#include <memory.h>
int main(void){
	int n,m,a,h,p,q,amida[1000][100],i,j,maxh,ans;
	while(1){
		scanf("%d %d %d",&n,&m,&a);
		if(!n){
			break;
		}
		ans=a-1;
		memset(amida,0,sizeof(amida));
		maxh=0;
		for(i=0;i<m;i++){
			scanf("%d %d %d",&h,&p,&q);
			if(maxh<h){
				maxh=h;
			}
			amida[h-1][p-1]=q;
			amida[h-1][q-1]=p;
		}
		for(i=maxh-1;i>=0;i--){
			if(amida[i][ans]){
				ans=amida[i][ans]-1;
			}
		}
		printf("%d\n",ans+1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L10:
	leaq	-400044(%rbp), %rcx
	leaq	-400048(%rbp), %rdx
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400052(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400024(%rbp)
	movl	$0, -400028(%rbp)
	jmp	.L4
.L6:
	leaq	-400032(%rbp), %rcx
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400024(%rbp)
	jge	.L5
	movl	-400040(%rbp), %eax
	movl	%eax, -400024(%rbp)
.L5:
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400036(%rbp), %eax
	subl	$1, %eax
	movl	-400032(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400032(%rbp), %eax
	subl	$1, %eax
	movl	-400036(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400028(%rbp)
.L4:
	movl	-400048(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	-400024(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400028(%rbp)
	jmp	.L7
.L9:
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L8
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
.L8:
	subl	$1, -400028(%rbp)
.L7:
	cmpl	$0, -400028(%rbp)
	jns	.L9
	movl	-400020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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 %d"
.LC1:
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L10:
	leaq	-400044(%rbp), %rcx
	leaq	-400048(%rbp), %rdx
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400052(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400024(%rbp)
	movl	$0, -400028(%rbp)
	jmp	.L4
.L6:
	leaq	-400032(%rbp), %rcx
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400024(%rbp)
	jge	.L5
	movl	-400040(%rbp), %eax
	movl	%eax, -400024(%rbp)
.L5:
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400036(%rbp), %eax
	subl	$1, %eax
	movl	-400032(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-400040(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-400032(%rbp), %eax
	subl	$1, %eax
	movl	-400036(%rbp), %edx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400028(%rbp)
.L4:
	movl	-400048(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	-400024(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -400028(%rbp)
	jmp	.L7
.L9:
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L8
	movl	-400020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-400028(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-400016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, -400020(%rbp)
.L8:
	subl	$1, -400028(%rbp)
.L7:
	cmpl	$0, -400028(%rbp)
	jns	.L9
	movl	-400020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
