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 <stdlib.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    int *A;
    A = malloc(sizeof(int) * n * 500000);
    int I[1000] = {0};

    int q;
    scanf("%d", &q);
    int op, t, x, i, j;

    while (q--) {
        scanf("%d", &op);
        scanf("%d", &t);
        if (op == 0) {
            scanf("%d", &x);
            A[500000 * t + I[t]] = x;
            I[t] += 1;
        }
        else if (op == 1) {
            if (I[t] == 0) printf("\n");
            else {
                j = 500000 * t;
                printf("%d", A[j]);
                for (i = 1; i < I[t]; i++) printf(" %d", A[j + i]);
                printf("\n");
            }
        }
        else I[t] = 0;
    }

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4052(%rbp), %eax
	cltq
	imulq	$2000000, %rax, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -4024(%rbp)
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L8:
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4044(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %edx
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rax, %rdx
	movl	-4036(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4040(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	jmp	.L2
.L3:
	movl	-4044(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L5:
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %eax
	movl	%eax, -4028(%rbp)
	movl	-4028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -4032(%rbp)
	jmp	.L6
.L7:
	movl	-4028(%rbp), %edx
	movl	-4032(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4032(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, -4032(%rbp)
	jl	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L4:
	movl	-4040(%rbp), %eax
	cltq
	movl	$0, -4016(%rbp,%rax,4)
.L2:
	movl	-4048(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4048(%rbp)
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC1:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %r14
	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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	leaq	36(%rsp), %r12
	leaq	40(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rdi
	imulq	$2000000, %rdi, %rdi
	call	malloc@PLT
	leaq	48(%rsp), %rdi
	movl	$500, %ecx
	leaq	32(%rsp), %rsi
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	rep stosq
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	40(%rsp), %rdx
	cmpl	$1, %eax
	je	.L22
	movl	$0, 48(%rsp,%rdx,4)
.L4:
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	je	.L10
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jne	.L3
	leaq	44(%rsp), %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %rcx
	movl	44(%rsp), %esi
	movq	8(%rsp), %rdi
	imull	$500000, %ecx, %eax
	movl	48(%rsp,%rcx,4), %edx
	addl	%edx, %eax
	addl	$1, %edx
	cltq
	movl	%edx, 48(%rsp,%rcx,4)
	movl	%esi, (%rdi,%rax,4)
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jne	.L2
.L10:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4072, %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
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	movslq	%edx, %rax
	movl	48(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L6
.L8:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L4
.L6:
	imull	$500000, %edx, %edx
	movq	8(%rsp), %rax
	movq	%rbx, %rsi
	movl	$1, %edi
	movl	$1, %r15d
	movslq	%edx, %rdx
	leaq	(%rax,%rdx,4), %r13
	xorl	%eax, %eax
	movl	0(%r13), %edx
	call	__printf_chk@PLT
	movslq	40(%rsp), %rax
	cmpl	$1, 48(%rsp,%rax,4)
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	0(%r13,%r15,4), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r15
	call	__printf_chk@PLT
	movslq	40(%rsp), %rax
	cmpl	%r15d, 48(%rsp,%rax,4)
	jg	.L7
	jmp	.L8
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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"
.LC1:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %r14
	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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	leaq	36(%rsp), %r12
	leaq	40(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rdi
	imulq	$2000000, %rdi, %rdi
	call	malloc@PLT
	leaq	48(%rsp), %rdi
	movl	$500, %ecx
	leaq	32(%rsp), %rsi
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	rep stosq
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	40(%rsp), %rdx
	cmpl	$1, %eax
	je	.L22
	movl	$0, 48(%rsp,%rdx,4)
.L4:
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	je	.L10
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jne	.L3
	leaq	44(%rsp), %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %rcx
	movl	44(%rsp), %esi
	movq	8(%rsp), %rdi
	imull	$500000, %ecx, %eax
	movl	48(%rsp,%rcx,4), %edx
	addl	%edx, %eax
	addl	$1, %edx
	cltq
	movl	%edx, 48(%rsp,%rcx,4)
	movl	%esi, (%rdi,%rax,4)
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jne	.L2
.L10:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4072, %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
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	movslq	%edx, %rax
	movl	48(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L6
.L8:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L4
.L6:
	imull	$500000, %edx, %edx
	movq	8(%rsp), %rax
	movq	%rbx, %rsi
	movl	$1, %edi
	movl	$1, %r15d
	movslq	%edx, %rdx
	leaq	(%rax,%rdx,4), %r13
	xorl	%eax, %eax
	movl	0(%r13), %edx
	call	__printf_chk@PLT
	movslq	40(%rsp), %rax
	cmpl	$1, 48(%rsp,%rax,4)
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	movl	0(%r13,%r15,4), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r15
	call	__printf_chk@PLT
	movslq	40(%rsp), %rax
	cmpl	%r15d, 48(%rsp,%rax,4)
	jg	.L7
	jmp	.L8
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 <stdlib.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    int *A;
    A = malloc(sizeof(int) * n * 500000);
    int I[1000] = {0};

    int q;
    scanf("%d", &q);
    int op, t, x, i, j;

    while (q--) {
        scanf("%d", &op);
        scanf("%d", &t);
        if (op == 0) {
            scanf("%d", &x);
            A[500000 * t + I[t]] = x;
            I[t] += 1;
        }
        else if (op == 1) {
            if (I[t] == 0) printf("\n");
            else {
                j = 500000 * t;
                printf("%d", A[j]);
                for (i = 1; i < I[t]; i++) printf(" %d", A[j + i]);
                printf("\n");
            }
        }
        else I[t] = 0;
    }

    return 0;
}

3 13
0 0 1
0 0 3
0 0 3
0 1 -1
0 2 4
0 2 5
1 0
1 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 2
0 0 3
0 1 0
0 2 4
0 2 5
1 0
1 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 3
0 0 3
0 1 -1
0 2 4
0 2 5
1 1
1 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 2
0 0 3
0 1 0
0 0 4
0 2 5
1 0
1 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 1 2
0 0 3
0 1 -1
0 2 4
0 2 5
1 0
1 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 3
0 0 3
0 1 -1
0 2 4
0 2 5
1 0
2 1
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 3
0 0 3
0 1 -1
0 2 4
0 2 5
1 1
1 0
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 2
0 0 3
0 1 0
0 0 4
0 2 5
1 0
1 1
1 2
2 1
1 0
0 1
1 2
 3 13
0 0 1
0 0 3
0 0 3
0 1 -1
0 2 4
0 2 5
1 0
2 0
1 2
2 1
1 0
1 1
1 2
 3 13
0 0 1
0 0 2
0 0 4
0 1 0
0 0 4
0 2 5
1 0
1 1
1 2
2 1
1 0
0 1
1 2

1 3 3
-1
4 5
1 3 3

4 5
 1 2 3
0
4 5
1 2 3

4 5
 -1
-1
4 5
1 3 3

4 5
 1 2 3 4
0
5
1 2 3 4

5
 1 3
2 -1
4 5
1 3

4 5
 1 3 3
4 5
1 3 3

4 5
 -1
1 3 3
4 5
1 3 3

4 5
 1 2 3 4
0
5
1 2 3 4
 1 3 3
4 5


4 5
 1 2 4 4
0
5
1 2 4 4

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 <stdlib.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    int *A;
    A = malloc(sizeof(int) * n * 500000);
    int I[1000] = {0};

    int q;
    scanf("%d", &q);
    int op, t, x, i, j;

    while (q--) {
        scanf("%d", &op);
        scanf("%d", &t);
        if (op == 0) {
            scanf("%d", &x);
            A[500000 * t + I[t]] = x;
            I[t] += 1;
        }
        else if (op == 1) {
            if (I[t] == 0) printf("\n");
            else {
                j = 500000 * t;
                printf("%d", A[j]);
                for (i = 1; i < I[t]; i++) printf(" %d", A[j + i]);
                printf("\n");
            }
        }
        else I[t] = 0;
    }

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4052(%rbp), %eax
	cltq
	imulq	$2000000, %rax, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -4024(%rbp)
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L8:
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4044(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %edx
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rax, %rdx
	movl	-4036(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4040(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	jmp	.L2
.L3:
	movl	-4044(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L5:
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %eax
	movl	%eax, -4028(%rbp)
	movl	-4028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -4032(%rbp)
	jmp	.L6
.L7:
	movl	-4028(%rbp), %edx
	movl	-4032(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4032(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, -4032(%rbp)
	jl	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L4:
	movl	-4040(%rbp), %eax
	cltq
	movl	$0, -4016(%rbp,%rax,4)
.L2:
	movl	-4048(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4048(%rbp)
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC1:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4052(%rbp), %eax
	cltq
	imulq	$2000000, %rax, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -4024(%rbp)
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L8:
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4044(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %edx
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rax, %rdx
	movl	-4036(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4040(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	jmp	.L2
.L3:
	movl	-4044(%rbp), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L5:
	movl	-4040(%rbp), %eax
	imull	$500000, %eax, %eax
	movl	%eax, -4028(%rbp)
	movl	-4028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -4032(%rbp)
	jmp	.L6
.L7:
	movl	-4028(%rbp), %edx
	movl	-4032(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-4024(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4032(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cmpl	%eax, -4032(%rbp)
	jl	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L4:
	movl	-4040(%rbp), %eax
	cltq
	movl	$0, -4016(%rbp,%rax,4)
.L2:
	movl	-4048(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4048(%rbp)
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
