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

Assembly Code:

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

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

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:

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

Assembly Code:

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

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