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>

#define MAX 500 //配列の大きさは500*500で十分です。

int main(void){
	while(1){
		//入力
		//問題ではn, m, t, pとして与えられますが、
		//nはw、mはhとして変数を用意します。
		int w, h, t, p; 
		scanf(" %d %d %d %d", &w, &h, &t, &p);
		if(!w && !h && !t && !p) break;

		//2次元配列は行列のように、i行j列(kami[i][j])として考えます。
		//そのため、座標(x, y)は kami[y][x] となります。
		int kami[MAX][MAX] = {0};
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				kami[i][j] = 1;//折り紙が存在する部分を1で初期化
			}
		}

		//処理
		int origin_x = 0, origin_y =0; //折り紙左上の角の座標を原点として記憶(kami[origin_y][origin_x])
		for(int k=0; k<t; k++){
			int d, c;
			scanf(" %d %d", &d, &c);

			if(d == 1){
				//もし d が 1 なら，左端から c だけ右側を通る垂直の折り線の左側を右側に折り重ねる．
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int j=origin_x+c; j<origin_x+(2*c); j++){	//折られる先のx座標
					for(int i=0; i<MAX; i++){	//垂直方向に折るループ
						kami[i][j] += kami[i][j-dist];
					}
					dist += 2;
				}
				origin_x += c;
			} else{
				//このプログラムの場合は、上下を入れ替えています。
				//	→もし d が 2 なら，上端から c だけ下側を通る水平の折り線の上側を下側に折り重ねる。
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int i=origin_y+c; i<origin_y+(2*c); i++){	//折られる先のy座標
					for(int j=0; j<MAX; j++){	//水平方向に折るループ
						kami[i][j] += kami[i-dist][j];
					}
					dist += 2;
				}
				origin_y += c;
			}
		}

		//入力・出力
		for(int k=0; k<p; k++){
			int x, y;
			scanf(" %d %d", &x, &y);
			printf("%d\n", kami[origin_y+y][origin_x+x]);
		}
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %d %d %d %d"
.LC1:
	.string	" %d %d"
.LC2:
	.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-1000076(%rbp), %rsi
	leaq	-1000080(%rbp), %rcx
	leaq	-1000084(%rbp), %rdx
	leaq	-1000088(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000088(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000084(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000080(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	jmp	.L24
.L2:
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000064(%rbp)
	jmp	.L4
.L7:
	movl	$0, -1000060(%rbp)
	jmp	.L5
.L6:
	movl	-1000060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000064(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1000016(%rbp,%rax,4)
	addl	$1, -1000060(%rbp)
.L5:
	movl	-1000088(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jl	.L6
	addl	$1, -1000064(%rbp)
.L4:
	movl	-1000084(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	movl	$0, -1000056(%rbp)
	movl	$0, -1000052(%rbp)
	movl	$0, -1000048(%rbp)
	jmp	.L8
.L19:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000072(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, -1000044(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000040(%rbp)
	jmp	.L10
.L13:
	movl	$0, -1000036(%rbp)
	jmp	.L11
.L12:
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %edx
	movl	-1000040(%rbp), %eax
	subl	-1000044(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000036(%rbp)
.L11:
	cmpl	$499, -1000036(%rbp)
	jle	.L12
	addl	$2, -1000044(%rbp)
	addl	$1, -1000040(%rbp)
.L10:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000040(%rbp)
	jl	.L13
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000056(%rbp)
	jmp	.L14
.L9:
	movl	$1, -1000032(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000028(%rbp)
	jmp	.L15
.L18:
	movl	$0, -1000024(%rbp)
	jmp	.L16
.L17:
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %ecx
	movl	-1000028(%rbp), %eax
	subl	-1000032(%rbp), %eax
	movl	-1000024(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000024(%rbp)
.L16:
	cmpl	$499, -1000024(%rbp)
	jle	.L17
	addl	$2, -1000032(%rbp)
	addl	$1, -1000028(%rbp)
.L15:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000028(%rbp)
	jl	.L18
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000052(%rbp)
.L14:
	addl	$1, -1000048(%rbp)
.L8:
	movl	-1000080(%rbp), %eax
	cmpl	%eax, -1000048(%rbp)
	jl	.L19
	movl	$0, -1000020(%rbp)
	jmp	.L20
.L21:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	-1000072(%rbp), %ecx
	movl	-1000056(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000020(%rbp)
.L20:
	movl	-1000076(%rbp), %eax
	cmpl	%eax, -1000020(%rbp)
	jl	.L21
	jmp	.L22
.L24:
	call	__stack_chk_fail@PLT
.L23:
	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 %d"
.LC2:
	.string	" %d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$680, %rsp
	.cfi_def_cfa_offset 1000160
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 1000088(%rsp)
	xorl	%eax, %eax
	leaq	68(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	60(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, (%rsp)
	leaq	1000080(%rsp), %rax
	movq	%rax, 32(%rsp)
.L21:
	movq	24(%rsp), %r8
	movq	16(%rsp), %rcx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %r12d
	movl	60(%rsp), %r14d
	movl	%r12d, %eax
	orl	%r14d, %eax
	jne	.L2
	movl	64(%rsp), %r13d
	movl	%r13d, %eax
	orl	68(%rsp), %eax
	je	.L41
	leaq	80(%rsp), %rbx
	movl	$1000000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
.L5:
	testl	%r13d, %r13d
	jle	.L25
	leaq	76(%rsp), %r15
	xorl	%r8d, %r8d
	leaq	72(%rsp), %r14
	xorl	%r13d, %r13d
	movq	%r15, %rax
	xorl	%r12d, %r12d
	movq	%r14, %r15
	movl	%r8d, %r14d
	movq	%rax, %r8
.L19:
	movq	%r8, %rdx
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%rbp, %rdi
	movq	%r8, 40(%rsp)
	call	__isoc99_scanf@PLT
	cmpl	$1, 72(%rsp)
	movl	76(%rsp), %eax
	movq	40(%rsp), %r8
	je	.L42
	addl	%eax, %r13d
	leal	(%rax,%rax), %edx
	leal	(%rax,%r13), %r9d
	cmpl	%edx, %eax
	jge	.L14
	movslq	%r13d, %rsi
	movl	%r13d, %edi
	imulq	$2000, %rsi, %rsi
	leaq	(%rbx,%rsi), %rdx
	subq	$2000, %rsi
.L18:
	leaq	(%rbx,%rsi), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L17:
	movdqa	(%rdx,%rax), %xmm0
	paddd	(%rcx,%rax), %xmm0
	movaps	%xmm0, (%rdx,%rax)
	addq	$16, %rax
	cmpq	$2000, %rax
	jne	.L17
	addl	$1, %edi
	addq	$2000, %rdx
	subq	$2000, %rsi
	cmpl	%r9d, %edi
	jl	.L18
.L14:
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L19
.L12:
	movl	68(%rsp), %eax
	testl	%eax, %eax
	jle	.L21
	leaq	76(%rsp), %r15
	xorl	%ecx, %ecx
	leaq	72(%rsp), %r14
	movq	%r15, %rax
	leaq	.LC3(%rip), %rbx
	movq	%r14, %r15
	movl	%ecx, %r14d
	movq	%rax, %rcx
.L20:
	movq	%rcx, %rdx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%rcx, 40(%rsp)
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %eax
	movl	72(%rsp), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	addl	%r13d, %eax
	addl	%r12d, %edx
	cltq
	movslq	%edx, %rdx
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	80(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r14d, 68(%rsp)
	movq	40(%rsp), %rcx
	jg	.L20
	jmp	.L21
.L42:
	addl	%eax, %r12d
	leal	(%rax,%rax), %edx
	leal	(%rax,%r12), %r9d
	cmpl	%edx, %eax
	jge	.L14
	movq	32(%rsp), %rdi
	movslq	%r12d, %rax
	movq	$-1, %rsi
	leaq	(%rdi,%rax,4), %rcx
	movl	%r12d, %edi
.L16:
	leaq	-1000000(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movl	(%rax,%rsi,4), %edx
	addl	%edx, (%rax)
	addq	$2000, %rax
	cmpq	%rcx, %rax
	jne	.L15
	addl	$1, %edi
	subq	$2, %rsi
	addq	$4, %rcx
	cmpl	%r9d, %edi
	jl	.L16
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L19
	jmp	.L12
.L2:
	leaq	80(%rsp), %rbx
	xorl	%esi, %esi
	movl	$1000000, %edx
	movq	%rbx, %rdi
	call	memset@PLT
	testl	%r14d, %r14d
	movl	64(%rsp), %r13d
	movdqa	.LC1(%rip), %xmm1
	jle	.L5
	testl	%r12d, %r12d
	jle	.L5
	movl	%r12d, %eax
	movq	%rbx, %rdi
	movl	%r12d, %r8d
	xorl	%esi, %esi
	shrl	$2, %eax
	leal	-1(%r12), %r9d
	andl	$-4, %r8d
	leal	-1(%rax), %ecx
	movq	%rdi, %rax
	addq	$1, %rcx
	salq	$4, %rcx
	leaq	(%rcx,%rdi), %rdx
	cmpl	$2, %r9d
	jbe	.L43
.L8:
	movaps	%xmm1, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %eax
	cmpl	%r8d, %r12d
	je	.L9
.L10:
	movslq	%esi, %rdx
	movslq	%eax, %r10
	imulq	$500, %rdx, %rdx
	addq	%rdx, %r10
	movl	$1, 80(%rsp,%r10,4)
	leal	1(%rax), %r10d
	cmpl	%r10d, %r12d
	jle	.L9
	movslq	%r10d, %r10
	addl	$2, %eax
	addq	%rdx, %r10
	movl	$1, 80(%rsp,%r10,4)
	cmpl	%eax, %r12d
	jle	.L9
	cltq
	addq	%rax, %rdx
	movl	$1, 80(%rsp,%rdx,4)
.L9:
	addl	$1, %esi
	addq	$2000, %rdi
	cmpl	%esi, %r14d
	je	.L5
	leaq	(%rcx,%rdi), %rdx
	movq	%rdi, %rax
	cmpl	$2, %r9d
	ja	.L8
.L43:
	xorl	%eax, %eax
	jmp	.L10
.L25:
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	jmp	.L12
.L41:
	movq	1000088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$1000104, %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
.L44:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 %d"
.LC2:
	.string	" %d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$680, %rsp
	.cfi_def_cfa_offset 1000160
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 1000088(%rsp)
	xorl	%eax, %eax
	leaq	68(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	60(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, (%rsp)
	leaq	1000080(%rsp), %rax
	movq	%rax, 32(%rsp)
.L21:
	movq	24(%rsp), %r8
	movq	16(%rsp), %rcx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %r12d
	movl	60(%rsp), %r14d
	movl	%r12d, %eax
	orl	%r14d, %eax
	jne	.L2
	movl	64(%rsp), %r13d
	movl	%r13d, %eax
	orl	68(%rsp), %eax
	je	.L41
	leaq	80(%rsp), %rbx
	movl	$1000000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
.L5:
	testl	%r13d, %r13d
	jle	.L25
	leaq	76(%rsp), %r15
	xorl	%r8d, %r8d
	leaq	72(%rsp), %r14
	xorl	%r13d, %r13d
	movq	%r15, %rax
	xorl	%r12d, %r12d
	movq	%r14, %r15
	movl	%r8d, %r14d
	movq	%rax, %r8
.L19:
	movq	%r8, %rdx
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%rbp, %rdi
	movq	%r8, 40(%rsp)
	call	__isoc99_scanf@PLT
	cmpl	$1, 72(%rsp)
	movl	76(%rsp), %eax
	movq	40(%rsp), %r8
	je	.L42
	addl	%eax, %r13d
	leal	(%rax,%rax), %edx
	leal	(%rax,%r13), %r9d
	cmpl	%edx, %eax
	jge	.L14
	movslq	%r13d, %rsi
	movl	%r13d, %edi
	imulq	$2000, %rsi, %rsi
	leaq	(%rbx,%rsi), %rdx
	subq	$2000, %rsi
.L18:
	leaq	(%rbx,%rsi), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L17:
	movdqa	(%rdx,%rax), %xmm0
	paddd	(%rcx,%rax), %xmm0
	movaps	%xmm0, (%rdx,%rax)
	addq	$16, %rax
	cmpq	$2000, %rax
	jne	.L17
	addl	$1, %edi
	addq	$2000, %rdx
	subq	$2000, %rsi
	cmpl	%r9d, %edi
	jl	.L18
.L14:
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L19
.L12:
	movl	68(%rsp), %eax
	testl	%eax, %eax
	jle	.L21
	leaq	76(%rsp), %r15
	xorl	%ecx, %ecx
	leaq	72(%rsp), %r14
	movq	%r15, %rax
	leaq	.LC3(%rip), %rbx
	movq	%r14, %r15
	movl	%ecx, %r14d
	movq	%rax, %rcx
.L20:
	movq	%rcx, %rdx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%rcx, 40(%rsp)
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %eax
	movl	72(%rsp), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	addl	%r13d, %eax
	addl	%r12d, %edx
	cltq
	movslq	%edx, %rdx
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	80(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r14d, 68(%rsp)
	movq	40(%rsp), %rcx
	jg	.L20
	jmp	.L21
.L42:
	addl	%eax, %r12d
	leal	(%rax,%rax), %edx
	leal	(%rax,%r12), %r9d
	cmpl	%edx, %eax
	jge	.L14
	movq	32(%rsp), %rdi
	movslq	%r12d, %rax
	movq	$-1, %rsi
	leaq	(%rdi,%rax,4), %rcx
	movl	%r12d, %edi
.L16:
	leaq	-1000000(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movl	(%rax,%rsi,4), %edx
	addl	%edx, (%rax)
	addq	$2000, %rax
	cmpq	%rcx, %rax
	jne	.L15
	addl	$1, %edi
	subq	$2, %rsi
	addq	$4, %rcx
	cmpl	%r9d, %edi
	jl	.L16
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L19
	jmp	.L12
.L2:
	leaq	80(%rsp), %rbx
	xorl	%esi, %esi
	movl	$1000000, %edx
	movq	%rbx, %rdi
	call	memset@PLT
	testl	%r14d, %r14d
	movl	64(%rsp), %r13d
	movdqa	.LC1(%rip), %xmm1
	jle	.L5
	testl	%r12d, %r12d
	jle	.L5
	movl	%r12d, %eax
	movq	%rbx, %rdi
	movl	%r12d, %r8d
	xorl	%esi, %esi
	shrl	$2, %eax
	leal	-1(%r12), %r9d
	andl	$-4, %r8d
	leal	-1(%rax), %ecx
	movq	%rdi, %rax
	addq	$1, %rcx
	salq	$4, %rcx
	leaq	(%rcx,%rdi), %rdx
	cmpl	$2, %r9d
	jbe	.L43
.L8:
	movaps	%xmm1, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %eax
	cmpl	%r8d, %r12d
	je	.L9
.L10:
	movslq	%esi, %rdx
	movslq	%eax, %r10
	imulq	$500, %rdx, %rdx
	addq	%rdx, %r10
	movl	$1, 80(%rsp,%r10,4)
	leal	1(%rax), %r10d
	cmpl	%r10d, %r12d
	jle	.L9
	movslq	%r10d, %r10
	addl	$2, %eax
	addq	%rdx, %r10
	movl	$1, 80(%rsp,%r10,4)
	cmpl	%eax, %r12d
	jle	.L9
	cltq
	addq	%rax, %rdx
	movl	$1, 80(%rsp,%rdx,4)
.L9:
	addl	$1, %esi
	addq	$2000, %rdi
	cmpl	%esi, %r14d
	je	.L5
	leaq	(%rcx,%rdi), %rdx
	movq	%rdi, %rax
	cmpl	$2, %r9d
	ja	.L8
.L43:
	xorl	%eax, %eax
	jmp	.L10
.L25:
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	jmp	.L12
.L41:
	movq	1000088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L44
	addq	$1000104, %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
.L44:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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>

#define MAX 500 //配列の大きさは500*500で十分です。

int main(void){
	while(1){
		//入力
		//問題ではn, m, t, pとして与えられますが、
		//nはw、mはhとして変数を用意します。
		int w, h, t, p; 
		scanf(" %d %d %d %d", &w, &h, &t, &p);
		if(!w && !h && !t && !p) break;

		//2次元配列は行列のように、i行j列(kami[i][j])として考えます。
		//そのため、座標(x, y)は kami[y][x] となります。
		int kami[MAX][MAX] = {0};
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				kami[i][j] = 1;//折り紙が存在する部分を1で初期化
			}
		}

		//処理
		int origin_x = 0, origin_y =0; //折り紙左上の角の座標を原点として記憶(kami[origin_y][origin_x])
		for(int k=0; k<t; k++){
			int d, c;
			scanf(" %d %d", &d, &c);

			if(d == 1){
				//もし d が 1 なら，左端から c だけ右側を通る垂直の折り線の左側を右側に折り重ねる．
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int j=origin_x+c; j<origin_x+(2*c); j++){	//折られる先のx座標
					for(int i=0; i<MAX; i++){	//垂直方向に折るループ
						kami[i][j] += kami[i][j-dist];
					}
					dist += 2;
				}
				origin_x += c;
			} else{
				//このプログラムの場合は、上下を入れ替えています。
				//	→もし d が 2 なら，上端から c だけ下側を通る水平の折り線の上側を下側に折り重ねる。
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int i=origin_y+c; i<origin_y+(2*c); i++){	//折られる先のy座標
					for(int j=0; j<MAX; j++){	//水平方向に折るループ
						kami[i][j] += kami[i-dist][j];
					}
					dist += 2;
				}
				origin_y += c;
			}
		}

		//入力・出力
		for(int k=0; k<p; k++){
			int x, y;
			scanf(" %d %d", &x, &y);
			printf("%d\n", kami[origin_y+y][origin_x+x]);
		}
	}

	return 0;
}

2 1 1 1
1 1
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
3 4
3 3 3 2
1 2
2 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
2 2
1 3
1 1
0 1
3 4
3 3 3 2
1 2
1 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 0
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
3 4
3 3 3 2
1 2
2 2
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 0
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
2 4
3 3 3 2
1 2
2 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 0
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
2 4
3 3 3 2
1 3
2 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 0
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
2 4
3 3 3 2
1 3
2 1
1 0
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
2 2
1 3
1 0
0 1
6 4
3 3 3 2
1 2
1 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
1 2
1 2
1 1
0 1
2 4
3 3 3 2
1 2
2 1
1 1
0 1
0 0
0 0 0 0
 3 1 1 1
1 1
0 0
1 3 2 1
2 2
2 1
0 0
10 8 3 2
2 2
1 0
1 1
0 1
6 4
3 3 3 2
1 2
2 1
1 1
0 1
0 0
0 0 0 0
 2 1 1 1
1 1
0 0
1 3 2 1
2 1
2 1
0 0
10 8 3 2
2 2
1 2
1 1
0 1
3 4
4 3 3 2
1 2
2 2
1 1
0 1
0 0
0 0 0 0

2
3
8
1
3
6
 2
3
8
1
3
3
 1
3
8
1
3
6
 2
2
8
1
3
6
 2
2
8
1
2
4
 2
2
8
1
1
2
 2
3
4
1
3
3
 2
3
6
1
3
6
 2
3
4
1
3
6
 2
3
8
1
4
8

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>

#define MAX 500 //配列の大きさは500*500で十分です。

int main(void){
	while(1){
		//入力
		//問題ではn, m, t, pとして与えられますが、
		//nはw、mはhとして変数を用意します。
		int w, h, t, p; 
		scanf(" %d %d %d %d", &w, &h, &t, &p);
		if(!w && !h && !t && !p) break;

		//2次元配列は行列のように、i行j列(kami[i][j])として考えます。
		//そのため、座標(x, y)は kami[y][x] となります。
		int kami[MAX][MAX] = {0};
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				kami[i][j] = 1;//折り紙が存在する部分を1で初期化
			}
		}

		//処理
		int origin_x = 0, origin_y =0; //折り紙左上の角の座標を原点として記憶(kami[origin_y][origin_x])
		for(int k=0; k<t; k++){
			int d, c;
			scanf(" %d %d", &d, &c);

			if(d == 1){
				//もし d が 1 なら，左端から c だけ右側を通る垂直の折り線の左側を右側に折り重ねる．
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int j=origin_x+c; j<origin_x+(2*c); j++){	//折られる先のx座標
					for(int i=0; i<MAX; i++){	//垂直方向に折るループ
						kami[i][j] += kami[i][j-dist];
					}
					dist += 2;
				}
				origin_x += c;
			} else{
				//このプログラムの場合は、上下を入れ替えています。
				//	→もし d が 2 なら，上端から c だけ下側を通る水平の折り線の上側を下側に折り重ねる。
				int dist = 1; //distは折られる前の座標と、折る先の座標の差の絶対値。
				for(int i=origin_y+c; i<origin_y+(2*c); i++){	//折られる先のy座標
					for(int j=0; j<MAX; j++){	//水平方向に折るループ
						kami[i][j] += kami[i-dist][j];
					}
					dist += 2;
				}
				origin_y += c;
			}
		}

		//入力・出力
		for(int k=0; k<p; k++){
			int x, y;
			scanf(" %d %d", &x, &y);
			printf("%d\n", kami[origin_y+y][origin_x+x]);
		}
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %d %d %d %d"
.LC1:
	.string	" %d %d"
.LC2:
	.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-1000076(%rbp), %rsi
	leaq	-1000080(%rbp), %rcx
	leaq	-1000084(%rbp), %rdx
	leaq	-1000088(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000088(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000084(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000080(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	jmp	.L24
.L2:
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000064(%rbp)
	jmp	.L4
.L7:
	movl	$0, -1000060(%rbp)
	jmp	.L5
.L6:
	movl	-1000060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000064(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1000016(%rbp,%rax,4)
	addl	$1, -1000060(%rbp)
.L5:
	movl	-1000088(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jl	.L6
	addl	$1, -1000064(%rbp)
.L4:
	movl	-1000084(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	movl	$0, -1000056(%rbp)
	movl	$0, -1000052(%rbp)
	movl	$0, -1000048(%rbp)
	jmp	.L8
.L19:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000072(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, -1000044(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000040(%rbp)
	jmp	.L10
.L13:
	movl	$0, -1000036(%rbp)
	jmp	.L11
.L12:
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %edx
	movl	-1000040(%rbp), %eax
	subl	-1000044(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000036(%rbp)
.L11:
	cmpl	$499, -1000036(%rbp)
	jle	.L12
	addl	$2, -1000044(%rbp)
	addl	$1, -1000040(%rbp)
.L10:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000040(%rbp)
	jl	.L13
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000056(%rbp)
	jmp	.L14
.L9:
	movl	$1, -1000032(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000028(%rbp)
	jmp	.L15
.L18:
	movl	$0, -1000024(%rbp)
	jmp	.L16
.L17:
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %ecx
	movl	-1000028(%rbp), %eax
	subl	-1000032(%rbp), %eax
	movl	-1000024(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000024(%rbp)
.L16:
	cmpl	$499, -1000024(%rbp)
	jle	.L17
	addl	$2, -1000032(%rbp)
	addl	$1, -1000028(%rbp)
.L15:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000028(%rbp)
	jl	.L18
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000052(%rbp)
.L14:
	addl	$1, -1000048(%rbp)
.L8:
	movl	-1000080(%rbp), %eax
	cmpl	%eax, -1000048(%rbp)
	jl	.L19
	movl	$0, -1000020(%rbp)
	jmp	.L20
.L21:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	-1000072(%rbp), %ecx
	movl	-1000056(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000020(%rbp)
.L20:
	movl	-1000076(%rbp), %eax
	cmpl	%eax, -1000020(%rbp)
	jl	.L21
	jmp	.L22
.L24:
	call	__stack_chk_fail@PLT
.L23:
	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 %d"
.LC1:
	.string	" %d %d"
.LC2:
	.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-1000076(%rbp), %rsi
	leaq	-1000080(%rbp), %rcx
	leaq	-1000084(%rbp), %rdx
	leaq	-1000088(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000088(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000084(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000080(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-1000076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	jmp	.L24
.L2:
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000064(%rbp)
	jmp	.L4
.L7:
	movl	$0, -1000060(%rbp)
	jmp	.L5
.L6:
	movl	-1000060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000064(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1000016(%rbp,%rax,4)
	addl	$1, -1000060(%rbp)
.L5:
	movl	-1000088(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jl	.L6
	addl	$1, -1000064(%rbp)
.L4:
	movl	-1000084(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	movl	$0, -1000056(%rbp)
	movl	$0, -1000052(%rbp)
	movl	$0, -1000048(%rbp)
	jmp	.L8
.L19:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000072(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, -1000044(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000040(%rbp)
	jmp	.L10
.L13:
	movl	$0, -1000036(%rbp)
	jmp	.L11
.L12:
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %edx
	movl	-1000040(%rbp), %eax
	subl	-1000044(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1000040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000036(%rbp)
.L11:
	cmpl	$499, -1000036(%rbp)
	jle	.L12
	addl	$2, -1000044(%rbp)
	addl	$1, -1000040(%rbp)
.L10:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000056(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000040(%rbp)
	jl	.L13
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000056(%rbp)
	jmp	.L14
.L9:
	movl	$1, -1000032(%rbp)
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -1000028(%rbp)
	jmp	.L15
.L18:
	movl	$0, -1000024(%rbp)
	jmp	.L16
.L17:
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %ecx
	movl	-1000028(%rbp), %eax
	subl	-1000032(%rbp), %eax
	movl	-1000024(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-1000024(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1000028(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1000016(%rbp,%rax,4)
	addl	$1, -1000024(%rbp)
.L16:
	cmpl	$499, -1000024(%rbp)
	jle	.L17
	addl	$2, -1000032(%rbp)
	addl	$1, -1000028(%rbp)
.L15:
	movl	-1000068(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -1000028(%rbp)
	jl	.L18
	movl	-1000068(%rbp), %eax
	addl	%eax, -1000052(%rbp)
.L14:
	addl	$1, -1000048(%rbp)
.L8:
	movl	-1000080(%rbp), %eax
	cmpl	%eax, -1000048(%rbp)
	jl	.L19
	movl	$0, -1000020(%rbp)
	jmp	.L20
.L21:
	leaq	-1000068(%rbp), %rdx
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000068(%rbp), %edx
	movl	-1000052(%rbp), %eax
	addl	%edx, %eax
	movl	-1000072(%rbp), %ecx
	movl	-1000056(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000020(%rbp)
.L20:
	movl	-1000076(%rbp), %eax
	cmpl	%eax, -1000020(%rbp)
	jl	.L21
	jmp	.L22
.L24:
	call	__stack_chk_fail@PLT
.L23:
	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:
