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() {
	int h,w,n,a,t = 0,y = 0;
	scanf("%d %d",&h,&w);
	scanf("%d",&n);
	int c[h][w];
	for(int i = 1; i <= n; i++) {
		scanf("%d",&a);
		for(int j = 0; j < a; j++) {
			c[t][y] = i;
			if(t%2 == 0) {
				if(y == w - 1) t++;
				else y++;
			} else {
				if(y == 0) t++;
				else y--;
			}
		}
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) printf("%d ",c[i][j]);
		printf("\n");
	}
	return 0;
}
			```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -184(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movl	-120(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	movq	%r9, %rdx
	movq	-160(%rbp), %r10
	movq	-152(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L5
.L12:
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -92(%rbp)
	jmp	.L6
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	leaq	(%rsi,%rdx), %rcx
	movl	-96(%rbp), %edx
	movl	%edx, (%rax,%rcx,4)
	movl	-104(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-116(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jne	.L8
	addl	$1, -104(%rbp)
	jmp	.L9
.L8:
	addl	$1, -100(%rbp)
	jmp	.L9
.L7:
	cmpl	$0, -100(%rbp)
	jne	.L10
	addl	$1, -104(%rbp)
	jmp	.L9
.L10:
	subl	$1, -100(%rbp)
.L9:
	addl	$1, -92(%rbp)
.L6:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L11
	addl	$1, -96(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L12
	movl	$0, -88(%rbp)
	jmp	.L13
.L16:
	movl	$0, -84(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rsi
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -84(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L15
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -88(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-184(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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 "
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-64(%rbp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rdx
	movq	%rsp, %rcx
	leaq	0(,%rdx,4), %rax
	movq	%rax, -88(%rbp)
	movslq	-72(%rbp), %rax
	imulq	%rdx, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L29:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L29
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L30
.L4:
	cmpl	$0, -64(%rbp)
	movq	%rsp, %r12
	jle	.L5
	leaq	-60(%rbp), %rax
	movq	-88(%rbp), %rbx
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, -96(%rbp)
	movl	$1, %r13d
	shrq	$2, %rbx
	.p2align 4,,10
	.p2align 3
.L12:
	movq	-96(%rbp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edi
	testl	%edi, %edi
	jle	.L6
	movl	-68(%rbp), %eax
	xorl	%esi, %esi
	leal	-1(%rax), %r9d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	cmpl	%r14d, %r9d
	je	.L27
	addl	$1, %r14d
.L9:
	addl	$1, %esi
	cmpl	%esi, %edi
	je	.L6
.L11:
	movslq	%r15d, %r10
	movslq	%r14d, %rax
	imulq	%rbx, %r10
	addq	%r10, %rax
	movl	%r13d, (%r12,%rax,4)
	testb	$1, %r15b
	je	.L31
	testl	%r14d, %r14d
	je	.L27
	addl	$1, %esi
	subl	$1, %r14d
	cmpl	%esi, %edi
	jne	.L11
.L6:
	addl	$1, %r13d
	cmpl	%r13d, -64(%rbp)
	jge	.L12
.L5:
	movl	-72(%rbp), %edx
	testl	%edx, %edx
	jle	.L13
	movq	%r12, %r13
	xorl	%r15d, %r15d
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L14:
	movl	-68(%rbp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%r13,%rbx,4), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -68(%rbp)
	jg	.L15
.L16:
	movl	$10, %edi
	addl	$1, %r15d
	call	putchar@PLT
	addq	-88(%rbp), %r13
	cmpl	%r15d, -72(%rbp)
	jg	.L14
.L13:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	addl	$1, %r15d
	jmp	.L9
.L30:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L32:
	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 "
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-64(%rbp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rdx
	movq	%rsp, %rcx
	leaq	0(,%rdx,4), %rax
	movq	%rax, -88(%rbp)
	movslq	-72(%rbp), %rax
	imulq	%rdx, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L29:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L29
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L30
.L4:
	cmpl	$0, -64(%rbp)
	movq	%rsp, %r12
	jle	.L5
	leaq	-60(%rbp), %rax
	movq	-88(%rbp), %rbx
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, -96(%rbp)
	movl	$1, %r13d
	shrq	$2, %rbx
	.p2align 4,,10
	.p2align 3
.L12:
	movq	-96(%rbp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edi
	testl	%edi, %edi
	jle	.L6
	movl	-68(%rbp), %eax
	xorl	%esi, %esi
	leal	-1(%rax), %r9d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	cmpl	%r14d, %r9d
	je	.L27
	addl	$1, %r14d
.L9:
	addl	$1, %esi
	cmpl	%esi, %edi
	je	.L6
.L11:
	movslq	%r15d, %r10
	movslq	%r14d, %rax
	imulq	%rbx, %r10
	addq	%r10, %rax
	movl	%r13d, (%r12,%rax,4)
	testb	$1, %r15b
	je	.L31
	testl	%r14d, %r14d
	je	.L27
	addl	$1, %esi
	subl	$1, %r14d
	cmpl	%esi, %edi
	jne	.L11
.L6:
	addl	$1, %r13d
	cmpl	%r13d, -64(%rbp)
	jge	.L12
.L5:
	movl	-72(%rbp), %edx
	testl	%edx, %edx
	jle	.L13
	movq	%r12, %r13
	xorl	%r15d, %r15d
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L14:
	movl	-68(%rbp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%r13,%rbx,4), %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -68(%rbp)
	jg	.L15
.L16:
	movl	$10, %edi
	addl	$1, %r15d
	call	putchar@PLT
	addq	-88(%rbp), %r13
	cmpl	%r15d, -72(%rbp)
	jg	.L14
.L13:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	addl	$1, %r15d
	jmp	.L9
.L30:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L32:
	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() {
	int h,w,n,a,t = 0,y = 0;
	scanf("%d %d",&h,&w);
	scanf("%d",&n);
	int c[h][w];
	for(int i = 1; i <= n; i++) {
		scanf("%d",&a);
		for(int j = 0; j < a; j++) {
			c[t][y] = i;
			if(t%2 == 0) {
				if(y == w - 1) t++;
				else y++;
			} else {
				if(y == 0) t++;
				else y--;
			}
		}
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) printf("%d ",c[i][j]);
		printf("\n");
	}
	return 0;
}
			
2 2
3
2 1 1

1 1 
3 2 

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() {
	int h,w,n,a,t = 0,y = 0;
	scanf("%d %d",&h,&w);
	scanf("%d",&n);
	int c[h][w];
	for(int i = 1; i <= n; i++) {
		scanf("%d",&a);
		for(int j = 0; j < a; j++) {
			c[t][y] = i;
			if(t%2 == 0) {
				if(y == w - 1) t++;
				else y++;
			} else {
				if(y == 0) t++;
				else y--;
			}
		}
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) printf("%d ",c[i][j]);
		printf("\n");
	}
	return 0;
}
			```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -184(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movl	-120(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	movq	%r9, %rdx
	movq	-160(%rbp), %r10
	movq	-152(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L5
.L12:
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -92(%rbp)
	jmp	.L6
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	leaq	(%rsi,%rdx), %rcx
	movl	-96(%rbp), %edx
	movl	%edx, (%rax,%rcx,4)
	movl	-104(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-116(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jne	.L8
	addl	$1, -104(%rbp)
	jmp	.L9
.L8:
	addl	$1, -100(%rbp)
	jmp	.L9
.L7:
	cmpl	$0, -100(%rbp)
	jne	.L10
	addl	$1, -104(%rbp)
	jmp	.L9
.L10:
	subl	$1, -100(%rbp)
.L9:
	addl	$1, -92(%rbp)
.L6:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L11
	addl	$1, -96(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L12
	movl	$0, -88(%rbp)
	jmp	.L13
.L16:
	movl	$0, -84(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rsi
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -84(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L15
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -88(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-184(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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 "
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -184(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movl	-120(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	movq	%r9, %rdx
	movq	-160(%rbp), %r10
	movq	-152(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L5
.L12:
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -92(%rbp)
	jmp	.L6
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	leaq	(%rsi,%rdx), %rcx
	movl	-96(%rbp), %edx
	movl	%edx, (%rax,%rcx,4)
	movl	-104(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-116(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jne	.L8
	addl	$1, -104(%rbp)
	jmp	.L9
.L8:
	addl	$1, -100(%rbp)
	jmp	.L9
.L7:
	cmpl	$0, -100(%rbp)
	jne	.L10
	addl	$1, -104(%rbp)
	jmp	.L9
.L10:
	subl	$1, -100(%rbp)
.L9:
	addl	$1, -92(%rbp)
.L6:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L11
	addl	$1, -96(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L12
	movl	$0, -88(%rbp)
	jmp	.L13
.L16:
	movl	$0, -84(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rsi
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -84(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L15
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -88(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-184(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
