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 w, h, n;
        scanf("%d %d %d", &w, &h, &n);

        int mp[w][h];
        for(int i=0; i<w*h; i++) mp[i/h][i%h]=1;

        for(int i=0; i<n; i++){
                int x, y, a;
                scanf("%d %d %d", &x, &y, &a);
                switch(a){
                        case 1:
                                for(int j=0; j<x*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 2:
                                for(int j=x*h; j<w*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 3:
                                for(int j=0; j<w*y; j++) mp[j%w][j/w]=0;
                                break;
                        case 4:
                                for(int j=w*y; j<w*h; j++) mp[j%w][j/w]=0;
                                break;
                }
        }

        //for(int i=0; i<w; i++){for(int j=0; j<h; j++)printf("%d ", mp[i][j]);puts("");}

        int sm = 0;
        for(int i=0; i<w*h; i++) sm += mp[i/h][i%h];
        printf("%d\n", sm);
        return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %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, -200(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %ecx
	movl	-136(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	movq	%r9, %rdx
	movq	-176(%rbp), %r10
	movq	-168(%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, %edi
	movl	$0, %edx
	divq	%rdi
	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	$0, -112(%rbp)
	jmp	.L5
.L6:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-112(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-112(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -112(%rbp)
.L5:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L6
	movl	$0, -108(%rbp)
	jmp	.L7
.L21:
	leaq	-116(%rbp), %rcx
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	cmpl	$4, %eax
	je	.L8
	cmpl	$4, %eax
	jg	.L9
	cmpl	$3, %eax
	je	.L10
	cmpl	$3, %eax
	jg	.L9
	cmpl	$1, %eax
	je	.L11
	cmpl	$2, %eax
	je	.L12
	jmp	.L9
.L11:
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-104(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-104(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	jmp	.L9
.L12:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -100(%rbp)
	jmp	.L15
.L16:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-100(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-100(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L16
	jmp	.L9
.L10:
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -96(%rbp)
	jl	.L18
	jmp	.L9
.L8:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -92(%rbp)
	jmp	.L19
.L20:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L19:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L20
	nop
.L9:
	addl	$1, -108(%rbp)
.L7:
	movl	-128(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L21
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L22
.L23:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-84(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-84(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -88(%rbp)
	addl	$1, -84(%rbp)
.L22:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L23
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-200(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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 %d"
.LC1:
	.string	"%d\n"
	.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
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-72(%rbp), %rcx
	leaq	-76(%rbp), %rdx
	pushq	%r13
	leaq	-80(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-76(%rbp), %rdx
	movslq	-80(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %rsi
	imulq	%rdx, %rax
	movq	%rdx, %rcx
	leaq	0(,%rdx,4), %r15
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rdx
	cmpq	%rdi, %rsp
	je	.L3
.L42:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L42
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L43
.L4:
	imull	%ecx, %esi
	movq	%rsp, %r12
	testl	%esi, %esi
	jle	.L5
	shrq	$2, %r15
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%edi, %eax
	addl	$1, %edi
	cltd
	idivl	%ecx
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$1, (%r12,%rdx,4)
	cmpl	%esi, %edi
	jne	.L6
	movl	-72(%rbp), %eax
	testl	%eax, %eax
	jle	.L20
.L23:
	leaq	-64(%rbp), %rax
	xorl	%r13d, %r13d
	leaq	-60(%rbp), %r14
	movq	%rax, -96(%rbp)
	leaq	-68(%rbp), %rax
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-96(%rbp), %rdx
	movq	-88(%rbp), %rsi
	movq	%r14, %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cmpl	$3, %eax
	je	.L8
	jg	.L9
	cmpl	$1, %eax
	je	.L10
	cmpl	$2, %eax
	jne	.L12
	movl	-76(%rbp), %esi
	movl	-68(%rbp), %ecx
	movl	-80(%rbp), %edi
	imull	%esi, %ecx
	imull	%esi, %edi
	cmpl	%edi, %ecx
	jge	.L12
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$0, (%r12,%rdx,4)
	cmpl	%edi, %ecx
	jne	.L17
.L12:
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
.L45:
	movl	-76(%rbp), %ecx
	movl	-80(%rbp), %esi
	imull	%ecx, %esi
	testl	%esi, %esi
	jle	.L24
.L20:
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edi, %eax
	addl	$1, %edi
	cltd
	idivl	%ecx
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	addl	(%r12,%rdx,4), %r9d
	cmpl	%edi, %esi
	jg	.L22
.L21:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L44
	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
.L9:
	.cfi_restore_state
	cmpl	$4, %eax
	jne	.L12
	movl	-80(%rbp), %esi
	movl	-64(%rbp), %ecx
	movl	-76(%rbp), %edi
	imull	%esi, %ecx
	imull	%esi, %edi
	cmpl	%edi, %ecx
	jge	.L12
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	cltq
	imulq	%r15, %rdx
	addq	%rdx, %rax
	movl	$0, (%r12,%rax,4)
	cmpl	%edi, %ecx
	jne	.L18
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-80(%rbp), %esi
	movl	-64(%rbp), %edi
	xorl	%ecx, %ecx
	imull	%esi, %edi
	testl	%edi, %edi
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	cltq
	imulq	%r15, %rdx
	addq	%rdx, %rax
	movl	$0, (%r12,%rax,4)
	cmpl	%edi, %ecx
	jne	.L14
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L10:
	movl	-76(%rbp), %esi
	movl	-68(%rbp), %edi
	imull	%esi, %edi
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$0, (%r12,%rdx,4)
	cmpl	%edi, %ecx
	jne	.L16
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
.L43:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L24:
	xorl	%r9d, %r9d
	jmp	.L21
.L5:
	cmpl	$0, -72(%rbp)
	jle	.L24
	shrq	$2, %r15
	jmp	.L23
.L44:
	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 %d"
.LC1:
	.string	"%d\n"
	.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
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-72(%rbp), %rcx
	leaq	-76(%rbp), %rdx
	pushq	%r13
	leaq	-80(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-76(%rbp), %rdx
	movslq	-80(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %rsi
	imulq	%rdx, %rax
	movq	%rdx, %rcx
	leaq	0(,%rdx,4), %r15
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rdx
	cmpq	%rdi, %rsp
	je	.L3
.L42:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L42
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L43
.L4:
	imull	%ecx, %esi
	movq	%rsp, %r12
	testl	%esi, %esi
	jle	.L5
	shrq	$2, %r15
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%edi, %eax
	addl	$1, %edi
	cltd
	idivl	%ecx
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$1, (%r12,%rdx,4)
	cmpl	%esi, %edi
	jne	.L6
	movl	-72(%rbp), %eax
	testl	%eax, %eax
	jle	.L20
.L23:
	leaq	-64(%rbp), %rax
	xorl	%r13d, %r13d
	leaq	-60(%rbp), %r14
	movq	%rax, -96(%rbp)
	leaq	-68(%rbp), %rax
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-96(%rbp), %rdx
	movq	-88(%rbp), %rsi
	movq	%r14, %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cmpl	$3, %eax
	je	.L8
	jg	.L9
	cmpl	$1, %eax
	je	.L10
	cmpl	$2, %eax
	jne	.L12
	movl	-76(%rbp), %esi
	movl	-68(%rbp), %ecx
	movl	-80(%rbp), %edi
	imull	%esi, %ecx
	imull	%esi, %edi
	cmpl	%edi, %ecx
	jge	.L12
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$0, (%r12,%rdx,4)
	cmpl	%edi, %ecx
	jne	.L17
.L12:
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
.L45:
	movl	-76(%rbp), %ecx
	movl	-80(%rbp), %esi
	imull	%ecx, %esi
	testl	%esi, %esi
	jle	.L24
.L20:
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edi, %eax
	addl	$1, %edi
	cltd
	idivl	%ecx
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	addl	(%r12,%rdx,4), %r9d
	cmpl	%edi, %esi
	jg	.L22
.L21:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L44
	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
.L9:
	.cfi_restore_state
	cmpl	$4, %eax
	jne	.L12
	movl	-80(%rbp), %esi
	movl	-64(%rbp), %ecx
	movl	-76(%rbp), %edi
	imull	%esi, %ecx
	imull	%esi, %edi
	cmpl	%edi, %ecx
	jge	.L12
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	cltq
	imulq	%r15, %rdx
	addq	%rdx, %rax
	movl	$0, (%r12,%rax,4)
	cmpl	%edi, %ecx
	jne	.L18
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-80(%rbp), %esi
	movl	-64(%rbp), %edi
	xorl	%ecx, %ecx
	imull	%esi, %edi
	testl	%edi, %edi
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	cltq
	imulq	%r15, %rdx
	addq	%rdx, %rax
	movl	$0, (%r12,%rax,4)
	cmpl	%edi, %ecx
	jne	.L14
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L10:
	movl	-76(%rbp), %esi
	movl	-68(%rbp), %edi
	imull	%esi, %edi
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%esi
	cltq
	movslq	%edx, %rdx
	imulq	%r15, %rax
	addq	%rax, %rdx
	movl	$0, (%r12,%rdx,4)
	cmpl	%edi, %ecx
	jne	.L16
	addl	$1, %r13d
	cmpl	%r13d, -72(%rbp)
	jg	.L19
	jmp	.L45
.L43:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L24:
	xorl	%r9d, %r9d
	jmp	.L21
.L5:
	cmpl	$0, -72(%rbp)
	jle	.L24
	shrq	$2, %r15
	jmp	.L23
.L44:
	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 w, h, n;
        scanf("%d %d %d", &w, &h, &n);

        int mp[w][h];
        for(int i=0; i<w*h; i++) mp[i/h][i%h]=1;

        for(int i=0; i<n; i++){
                int x, y, a;
                scanf("%d %d %d", &x, &y, &a);
                switch(a){
                        case 1:
                                for(int j=0; j<x*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 2:
                                for(int j=x*h; j<w*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 3:
                                for(int j=0; j<w*y; j++) mp[j%w][j/w]=0;
                                break;
                        case 4:
                                for(int j=w*y; j<w*h; j++) mp[j%w][j/w]=0;
                                break;
                }
        }

        //for(int i=0; i<w; i++){for(int j=0; j<h; j++)printf("%d ", mp[i][j]);puts("");}

        int sm = 0;
        for(int i=0; i<w*h; i++) sm += mp[i/h][i%h];
        printf("%d\n", sm);
        return 0;
}
5 4 3
2 1 1
3 6 4
1 4 2
 5 4 2
2 1 1
6 3 4
 5 4 2
2 1 2
6 3 4
 10 10 5
1 6 1
4 1 1
6 9 4
9 4 2
3 1 4
 5 4 1
2 1 2
6 3 4
 5 4 3
2 0 2
2 6 2
1 4 2
 10 10 5
1 14 1
4 1 1
6 4 4
9 0 2
3 2 4
 10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 0 3
 5 1 3
2 0 2
2 11 2
2 4 2
 5 6 3
2 0 2
3 11 2
2 4 2

0
 9
 6
 5
 8
 4
 10
 64
 2
 12

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 w, h, n;
        scanf("%d %d %d", &w, &h, &n);

        int mp[w][h];
        for(int i=0; i<w*h; i++) mp[i/h][i%h]=1;

        for(int i=0; i<n; i++){
                int x, y, a;
                scanf("%d %d %d", &x, &y, &a);
                switch(a){
                        case 1:
                                for(int j=0; j<x*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 2:
                                for(int j=x*h; j<w*h; j++) mp[j/h][j%h]=0;
                                break;
                        case 3:
                                for(int j=0; j<w*y; j++) mp[j%w][j/w]=0;
                                break;
                        case 4:
                                for(int j=w*y; j<w*h; j++) mp[j%w][j/w]=0;
                                break;
                }
        }

        //for(int i=0; i<w; i++){for(int j=0; j<h; j++)printf("%d ", mp[i][j]);puts("");}

        int sm = 0;
        for(int i=0; i<w*h; i++) sm += mp[i/h][i%h];
        printf("%d\n", sm);
        return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %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, -200(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %ecx
	movl	-136(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	movq	%r9, %rdx
	movq	-176(%rbp), %r10
	movq	-168(%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, %edi
	movl	$0, %edx
	divq	%rdi
	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	$0, -112(%rbp)
	jmp	.L5
.L6:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-112(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-112(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -112(%rbp)
.L5:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L6
	movl	$0, -108(%rbp)
	jmp	.L7
.L21:
	leaq	-116(%rbp), %rcx
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	cmpl	$4, %eax
	je	.L8
	cmpl	$4, %eax
	jg	.L9
	cmpl	$3, %eax
	je	.L10
	cmpl	$3, %eax
	jg	.L9
	cmpl	$1, %eax
	je	.L11
	cmpl	$2, %eax
	je	.L12
	jmp	.L9
.L11:
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-104(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-104(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	jmp	.L9
.L12:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -100(%rbp)
	jmp	.L15
.L16:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-100(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-100(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L16
	jmp	.L9
.L10:
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -96(%rbp)
	jl	.L18
	jmp	.L9
.L8:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -92(%rbp)
	jmp	.L19
.L20:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L19:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L20
	nop
.L9:
	addl	$1, -108(%rbp)
.L7:
	movl	-128(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L21
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L22
.L23:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-84(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-84(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -88(%rbp)
	addl	$1, -84(%rbp)
.L22:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L23
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-200(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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 %d"
.LC1:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %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, -200(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %ecx
	movl	-136(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	movq	%r9, %rdx
	movq	-176(%rbp), %r10
	movq	-168(%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, %edi
	movl	$0, %edx
	divq	%rdi
	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	$0, -112(%rbp)
	jmp	.L5
.L6:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-112(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-112(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -112(%rbp)
.L5:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L6
	movl	$0, -108(%rbp)
	jmp	.L7
.L21:
	leaq	-116(%rbp), %rcx
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	cmpl	$4, %eax
	je	.L8
	cmpl	$4, %eax
	jg	.L9
	cmpl	$3, %eax
	je	.L10
	cmpl	$3, %eax
	jg	.L9
	cmpl	$1, %eax
	je	.L11
	cmpl	$2, %eax
	je	.L12
	jmp	.L9
.L11:
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-104(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-104(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	jmp	.L9
.L12:
	movl	-124(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -100(%rbp)
	jmp	.L15
.L16:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-100(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-100(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L16
	jmp	.L9
.L10:
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-96(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -96(%rbp)
	jl	.L18
	jmp	.L9
.L8:
	movl	-136(%rbp), %edx
	movl	-120(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -92(%rbp)
	jmp	.L19
.L20:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, %edi
	movl	-136(%rbp), %ecx
	movl	-92(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L19:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L20
	nop
.L9:
	addl	$1, -108(%rbp)
.L7:
	movl	-128(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L21
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L22
.L23:
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-132(%rbp), %edi
	movl	-84(%rbp), %eax
	cltd
	idivl	%edi
	movl	%eax, %edi
	movl	-132(%rbp), %ecx
	movl	-84(%rbp), %eax
	cltd
	idivl	%ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rcx
	movslq	%edi, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -88(%rbp)
	addl	$1, -84(%rbp)
.L22:
	movl	-136(%rbp), %edx
	movl	-132(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L23
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-200(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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:
