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 <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;
}```

Assembly Code:

```assembly
	.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:
```

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 %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
```assembly
	.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:
```
```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;
}```
Given the following C 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;
}```

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:

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 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;
}```

Assembly Code:

```assembly
	.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:
```

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 %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:
```