Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <math.h>

int main(void) {
	int w, h, n;
	int x, y, a;
	int S[100][100] = {  };
	scanf("%d %d %d", &w, &h, &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d %d", &x, &y, &a);
		switch (a)
		{
		case 1:
			for (int j = 0; j < x; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 2:
			for (int j = x; j < w; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 3:
			for (int j = 0; j < y; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		case 4:
			for (int j = y; j < h; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		default:
			break;
		}

	}
	int ans = 0;
	for (int i = 0; i < h; ++i) {
		for (int k = 0; k < w; ++k) {
			ans += 1-S[i][k];
		}
	}
	printf("%d", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40016(%rbp), %rax
	movl	$40000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40080(%rbp), %rcx
	leaq	-40084(%rbp), %rdx
	leaq	-40088(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40064(%rbp)
	jmp	.L2
.L25:
	leaq	-40068(%rbp), %rcx
	leaq	-40072(%rbp), %rdx
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	cmpl	$4, %eax
	je	.L3
	cmpl	$4, %eax
	jg	.L32
	cmpl	$3, %eax
	je	.L5
	cmpl	$3, %eax
	jg	.L32
	cmpl	$1, %eax
	je	.L6
	cmpl	$2, %eax
	je	.L7
	jmp	.L32
.L6:
	movl	$0, -40060(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40056(%rbp)
	jmp	.L9
.L10:
	movl	-40060(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40056(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40056(%rbp)
.L9:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L10
	addl	$1, -40060(%rbp)
.L8:
	movl	-40076(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L11
	jmp	.L12
.L7:
	movl	-40076(%rbp), %eax
	movl	%eax, -40052(%rbp)
	jmp	.L13
.L16:
	movl	$0, -40048(%rbp)
	jmp	.L14
.L15:
	movl	-40052(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40048(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40048(%rbp)
.L14:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40048(%rbp)
	jl	.L15
	addl	$1, -40052(%rbp)
.L13:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40052(%rbp)
	jl	.L16
	jmp	.L12
.L5:
	movl	$0, -40044(%rbp)
	jmp	.L17
.L20:
	movl	$0, -40040(%rbp)
	jmp	.L18
.L19:
	movl	-40040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40044(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40040(%rbp)
.L18:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40040(%rbp)
	jl	.L19
	addl	$1, -40044(%rbp)
.L17:
	movl	-40072(%rbp), %eax
	cmpl	%eax, -40044(%rbp)
	jl	.L20
	jmp	.L12
.L3:
	movl	-40072(%rbp), %eax
	movl	%eax, -40036(%rbp)
	jmp	.L21
.L24:
	movl	$0, -40032(%rbp)
	jmp	.L22
.L23:
	movl	-40032(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40036(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40032(%rbp)
.L22:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40032(%rbp)
	jl	.L23
	addl	$1, -40036(%rbp)
.L21:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40036(%rbp)
	jl	.L24
	jmp	.L12
.L32:
	nop
.L12:
	addl	$1, -40064(%rbp)
.L2:
	movl	-40080(%rbp), %eax
	cmpl	%eax, -40064(%rbp)
	jl	.L25
	movl	$0, -40028(%rbp)
	movl	$0, -40024(%rbp)
	jmp	.L26
.L29:
	movl	$0, -40020(%rbp)
	jmp	.L27
.L28:
	movl	-40020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40024(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-40016(%rbp,%rax,4), %edx
	movl	$1, %eax
	subl	%edx, %eax
	addl	%eax, -40028(%rbp)
	addl	$1, -40020(%rbp)
.L27:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L28
	addl	$1, -40024(%rbp)
.L26:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jl	.L29
	movl	-40028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	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"
.LC2:
	.string	"%d"
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3208, %rsp
	.cfi_def_cfa_offset 40128
	movl	$40000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 40056(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
	leaq	32(%rsp), %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%r14d, %r14d
	leaq	44(%rsp), %r13
	leaq	40(%rsp), %r12
	leaq	36(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	movdqa	.LC1(%rip), %xmm0
	cmpl	$3, %eax
	je	.L3
	jg	.L4
	cmpl	$1, %eax
	je	.L5
	cmpl	$2, %eax
	jne	.L7
	movl	36(%rsp), %ecx
	movl	24(%rsp), %edi
	cmpl	%edi, %ecx
	jge	.L7
	movl	28(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L7
	leal	-1(%rdi), %eax
	movl	%edi, %r10d
	subl	%ecx, %eax
	subl	%ecx, %r10d
	cmpl	$2, %eax
	jbe	.L74
	movq	8(%rsp), %rsi
	movslq	%ecx, %rax
	movl	%r10d, %r8d
	movdqa	%xmm0, %xmm1
	shrl	$2, %r8d
	leaq	(%rsi,%rax,4), %rsi
	leal	-1(%r9), %eax
	salq	$4, %r8
	movq	%rax, %r9
	leaq	(%rax,%rax,4), %rax
	addq	%rsi, %r8
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	leaq	400(%rsi,%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	movups	%xmm1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L22
	addq	$16, %rsi
	leaq	16(%rax), %rdx
	cmpq	%r8, %rsi
	jne	.L21
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %ecx
	cmpl	%eax, %r10d
	je	.L7
.L20:
	movq	8(%rsp), %rsi
	leaq	(%r9,%r9,4), %rdx
	movslq	%ecx, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rsi,%rax,4), %rsi
	leaq	(%rax,%rdx,4), %rax
	leaq	448(%rsp,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L25:
	movl	$1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L25
	addl	$1, %ecx
	addq	$4, %rsi
	addq	$4, %rdx
	cmpl	%ecx, %edi
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r14d
	cmpl	%r14d, 32(%rsp)
	jg	.L37
.L2:
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L49
	movl	24(%rsp), %edi
	movq	8(%rsp), %rsi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movdqa	.LC1(%rip), %xmm2
	movl	$1, %r9d
	movl	%edi, %eax
	movl	%edi, %r10d
	leal	-1(%rdi), %ebp
	shrl	$2, %eax
	andl	$-4, %r10d
	leal	-1(%rax), %r11d
	addq	$1, %r11
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edi, %edi
	jle	.L44
	cmpl	$2, %ebp
	jbe	.L50
	leaq	(%r11,%rsi), %rdx
	movq	%rsi, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L41:
	movdqa	%xmm2, %xmm1
	psubd	(%rax), %xmm1
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L41
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r10d, %eax
	cmpl	%edi, %r10d
	je	.L44
.L40:
	movslq	%ecx, %rdx
	movslq	%eax, %r12
	movl	%r9d, %r15d
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %r12
	subl	48(%rsp,%r12,4), %r15d
	leal	1(%rax), %r12d
	addl	%r15d, %r8d
	cmpl	%edi, %r12d
	jge	.L44
	movslq	%r12d, %r12
	movl	%r9d, %r14d
	addl	$2, %eax
	addq	%rdx, %r12
	subl	48(%rsp,%r12,4), %r14d
	addl	%r14d, %r8d
	cmpl	%eax, %edi
	jle	.L44
	cltq
	addq	%rax, %rdx
	movl	%r9d, %eax
	subl	48(%rsp,%rdx,4), %eax
	addl	%eax, %r8d
.L44:
	addl	$1, %ecx
	addq	$400, %rsi
	cmpl	%ebx, %ecx
	jne	.L39
.L38:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	addq	$40072, %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
.L4:
	.cfi_restore_state
	cmpl	$4, %eax
	jne	.L7
	movl	40(%rsp), %edi
	movl	28(%rsp), %r11d
	cmpl	%r11d, %edi
	jge	.L7
	movl	24(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	movslq	%edi, %rax
	movl	%r8d, %r9d
	leal	-1(%r8), %r15d
	leaq	(%rax,%rax,4), %rax
	andl	$-4, %r9d
	leaq	(%rax,%rax,4), %rsi
	movl	%r8d, %eax
	shrl	$2, %eax
	salq	$4, %rsi
	addq	8(%rsp), %rsi
	leal	-1(%rax), %r10d
	movq	%rsi, %rax
	addq	$1, %r10
	salq	$4, %r10
	leaq	(%r10,%rsi), %rdx
	cmpl	$2, %r15d
	jbe	.L76
	.p2align 4,,10
	.p2align 3
.L33:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L33
	movl	%r9d, %eax
	cmpl	%r9d, %r8d
	je	.L34
.L35:
	movslq	%edi, %rdx
	movslq	%eax, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r8d
	jle	.L34
	movslq	%ecx, %rcx
	addl	$2, %eax
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	cmpl	%r8d, %eax
	jge	.L34
	cltq
	addq	%rax, %rdx
	movl	$1, 48(%rsp,%rdx,4)
.L34:
	addl	$1, %edi
	addq	$400, %rsi
	cmpl	%r11d, %edi
	je	.L7
	leaq	(%r10,%rsi), %rdx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	ja	.L33
.L76:
	xorl	%eax, %eax
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L3:
	movl	40(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L7
	movl	24(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	movl	%r8d, %eax
	movq	8(%rsp), %rsi
	movl	%r8d, %r9d
	leal	-1(%r8), %r15d
	shrl	$2, %eax
	andl	$-4, %r9d
	xorl	%edi, %edi
	leal	-1(%rax), %r10d
	movq	%rsi, %rax
	addq	$1, %r10
	salq	$4, %r10
	leaq	(%r10,%rsi), %rdx
	cmpl	$2, %r15d
	jbe	.L77
	.p2align 4,,10
	.p2align 3
.L28:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L28
	movl	%r9d, %eax
	cmpl	%r9d, %r8d
	je	.L29
.L30:
	movslq	%edi, %rdx
	movslq	%eax, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%r8d, %ecx
	jge	.L29
	movslq	%ecx, %rcx
	addl	$2, %eax
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	cmpl	%eax, %r8d
	jle	.L29
	cltq
	addq	%rax, %rdx
	movl	$1, 48(%rsp,%rdx,4)
.L29:
	addl	$1, %edi
	addq	$400, %rsi
	cmpl	%r11d, %edi
	je	.L7
	leaq	(%r10,%rsi), %rdx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	ja	.L28
.L77:
	xorl	%eax, %eax
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L5:
	movl	36(%rsp), %edi
	testl	%edi, %edi
	jle	.L7
	movl	28(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	leal	-1(%rdi), %eax
	cmpl	$2, %eax
	jbe	.L46
	leal	-1(%r8), %eax
	movl	%edi, %esi
	movq	8(%rsp), %rcx
	leaq	448(%rsp), %r9
	movq	%rax, %r8
	leaq	(%rax,%rax,4), %rax
	shrl	$2, %esi
	leaq	(%rax,%rax,4), %rdx
	salq	$4, %rsi
	salq	$4, %rdx
	addq	%rcx, %rsi
	addq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	movaps	%xmm0, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L14
	addq	$16, %rcx
	leaq	16(%rax), %rdx
	cmpq	%rsi, %rcx
	jne	.L13
	movl	%edi, %ecx
	andl	$-4, %ecx
	testb	$3, %dil
	je	.L7
.L12:
	movq	8(%rsp), %rsi
	leaq	(%r8,%r8,4), %rdx
	movslq	%ecx, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rsi,%rax,4), %rsi
	leaq	(%rax,%rdx,4), %rax
	leaq	(%r9,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L17:
	movl	$1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L17
	addl	$1, %ecx
	addq	$4, %rsi
	addq	$4, %rdx
	cmpl	%ecx, %edi
	jg	.L18
	addl	$1, %r14d
	cmpl	%r14d, 32(%rsp)
	jg	.L37
	jmp	.L2
.L50:
	xorl	%eax, %eax
	jmp	.L40
.L74:
	subl	$1, %r9d
	jmp	.L20
.L46:
	xorl	%ecx, %ecx
	subl	$1, %r8d
	leaq	448(%rsp), %r9
	jmp	.L12
.L49:
	xorl	%r8d, %r8d
	jmp	.L38
.L75:
	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"
.LC2:
	.string	"%d"
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3208, %rsp
	.cfi_def_cfa_offset 40128
	movl	$40000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 40056(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
	leaq	32(%rsp), %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%r14d, %r14d
	leaq	44(%rsp), %r13
	leaq	40(%rsp), %r12
	leaq	36(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	movdqa	.LC1(%rip), %xmm0
	cmpl	$3, %eax
	je	.L3
	jg	.L4
	cmpl	$1, %eax
	je	.L5
	cmpl	$2, %eax
	jne	.L7
	movl	36(%rsp), %ecx
	movl	24(%rsp), %edi
	cmpl	%edi, %ecx
	jge	.L7
	movl	28(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L7
	leal	-1(%rdi), %eax
	movl	%edi, %r10d
	subl	%ecx, %eax
	subl	%ecx, %r10d
	cmpl	$2, %eax
	jbe	.L74
	movq	8(%rsp), %rsi
	movslq	%ecx, %rax
	movl	%r10d, %r8d
	movdqa	%xmm0, %xmm1
	shrl	$2, %r8d
	leaq	(%rsi,%rax,4), %rsi
	leal	-1(%r9), %eax
	salq	$4, %r8
	movq	%rax, %r9
	leaq	(%rax,%rax,4), %rax
	addq	%rsi, %r8
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	leaq	400(%rsi,%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	movups	%xmm1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L22
	addq	$16, %rsi
	leaq	16(%rax), %rdx
	cmpq	%r8, %rsi
	jne	.L21
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %ecx
	cmpl	%eax, %r10d
	je	.L7
.L20:
	movq	8(%rsp), %rsi
	leaq	(%r9,%r9,4), %rdx
	movslq	%ecx, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rsi,%rax,4), %rsi
	leaq	(%rax,%rdx,4), %rax
	leaq	448(%rsp,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L25:
	movl	$1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L25
	addl	$1, %ecx
	addq	$4, %rsi
	addq	$4, %rdx
	cmpl	%ecx, %edi
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r14d
	cmpl	%r14d, 32(%rsp)
	jg	.L37
.L2:
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L49
	movl	24(%rsp), %edi
	movq	8(%rsp), %rsi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movdqa	.LC1(%rip), %xmm2
	movl	$1, %r9d
	movl	%edi, %eax
	movl	%edi, %r10d
	leal	-1(%rdi), %ebp
	shrl	$2, %eax
	andl	$-4, %r10d
	leal	-1(%rax), %r11d
	addq	$1, %r11
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edi, %edi
	jle	.L44
	cmpl	$2, %ebp
	jbe	.L50
	leaq	(%r11,%rsi), %rdx
	movq	%rsi, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L41:
	movdqa	%xmm2, %xmm1
	psubd	(%rax), %xmm1
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L41
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r10d, %eax
	cmpl	%edi, %r10d
	je	.L44
.L40:
	movslq	%ecx, %rdx
	movslq	%eax, %r12
	movl	%r9d, %r15d
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %r12
	subl	48(%rsp,%r12,4), %r15d
	leal	1(%rax), %r12d
	addl	%r15d, %r8d
	cmpl	%edi, %r12d
	jge	.L44
	movslq	%r12d, %r12
	movl	%r9d, %r14d
	addl	$2, %eax
	addq	%rdx, %r12
	subl	48(%rsp,%r12,4), %r14d
	addl	%r14d, %r8d
	cmpl	%eax, %edi
	jle	.L44
	cltq
	addq	%rax, %rdx
	movl	%r9d, %eax
	subl	48(%rsp,%rdx,4), %eax
	addl	%eax, %r8d
.L44:
	addl	$1, %ecx
	addq	$400, %rsi
	cmpl	%ebx, %ecx
	jne	.L39
.L38:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	addq	$40072, %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
.L4:
	.cfi_restore_state
	cmpl	$4, %eax
	jne	.L7
	movl	40(%rsp), %edi
	movl	28(%rsp), %r11d
	cmpl	%r11d, %edi
	jge	.L7
	movl	24(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	movslq	%edi, %rax
	movl	%r8d, %r9d
	leal	-1(%r8), %r15d
	leaq	(%rax,%rax,4), %rax
	andl	$-4, %r9d
	leaq	(%rax,%rax,4), %rsi
	movl	%r8d, %eax
	shrl	$2, %eax
	salq	$4, %rsi
	addq	8(%rsp), %rsi
	leal	-1(%rax), %r10d
	movq	%rsi, %rax
	addq	$1, %r10
	salq	$4, %r10
	leaq	(%r10,%rsi), %rdx
	cmpl	$2, %r15d
	jbe	.L76
	.p2align 4,,10
	.p2align 3
.L33:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L33
	movl	%r9d, %eax
	cmpl	%r9d, %r8d
	je	.L34
.L35:
	movslq	%edi, %rdx
	movslq	%eax, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r8d
	jle	.L34
	movslq	%ecx, %rcx
	addl	$2, %eax
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	cmpl	%r8d, %eax
	jge	.L34
	cltq
	addq	%rax, %rdx
	movl	$1, 48(%rsp,%rdx,4)
.L34:
	addl	$1, %edi
	addq	$400, %rsi
	cmpl	%r11d, %edi
	je	.L7
	leaq	(%r10,%rsi), %rdx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	ja	.L33
.L76:
	xorl	%eax, %eax
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L3:
	movl	40(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L7
	movl	24(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	movl	%r8d, %eax
	movq	8(%rsp), %rsi
	movl	%r8d, %r9d
	leal	-1(%r8), %r15d
	shrl	$2, %eax
	andl	$-4, %r9d
	xorl	%edi, %edi
	leal	-1(%rax), %r10d
	movq	%rsi, %rax
	addq	$1, %r10
	salq	$4, %r10
	leaq	(%r10,%rsi), %rdx
	cmpl	$2, %r15d
	jbe	.L77
	.p2align 4,,10
	.p2align 3
.L28:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L28
	movl	%r9d, %eax
	cmpl	%r9d, %r8d
	je	.L29
.L30:
	movslq	%edi, %rdx
	movslq	%eax, %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$2, %rdx
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%r8d, %ecx
	jge	.L29
	movslq	%ecx, %rcx
	addl	$2, %eax
	addq	%rdx, %rcx
	movl	$1, 48(%rsp,%rcx,4)
	cmpl	%eax, %r8d
	jle	.L29
	cltq
	addq	%rax, %rdx
	movl	$1, 48(%rsp,%rdx,4)
.L29:
	addl	$1, %edi
	addq	$400, %rsi
	cmpl	%r11d, %edi
	je	.L7
	leaq	(%r10,%rsi), %rdx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	ja	.L28
.L77:
	xorl	%eax, %eax
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L5:
	movl	36(%rsp), %edi
	testl	%edi, %edi
	jle	.L7
	movl	28(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L7
	leal	-1(%rdi), %eax
	cmpl	$2, %eax
	jbe	.L46
	leal	-1(%r8), %eax
	movl	%edi, %esi
	movq	8(%rsp), %rcx
	leaq	448(%rsp), %r9
	movq	%rax, %r8
	leaq	(%rax,%rax,4), %rax
	shrl	$2, %esi
	leaq	(%rax,%rax,4), %rdx
	salq	$4, %rsi
	salq	$4, %rdx
	addq	%rcx, %rsi
	addq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	movaps	%xmm0, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L14
	addq	$16, %rcx
	leaq	16(%rax), %rdx
	cmpq	%rsi, %rcx
	jne	.L13
	movl	%edi, %ecx
	andl	$-4, %ecx
	testb	$3, %dil
	je	.L7
.L12:
	movq	8(%rsp), %rsi
	leaq	(%r8,%r8,4), %rdx
	movslq	%ecx, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rsi,%rax,4), %rsi
	leaq	(%rax,%rdx,4), %rax
	leaq	(%r9,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L17:
	movl	$1, (%rax)
	addq	$400, %rax
	cmpq	%rdx, %rax
	jne	.L17
	addl	$1, %ecx
	addq	$4, %rsi
	addq	$4, %rdx
	cmpl	%ecx, %edi
	jg	.L18
	addl	$1, %r14d
	cmpl	%r14d, 32(%rsp)
	jg	.L37
	jmp	.L2
.L50:
	xorl	%eax, %eax
	jmp	.L40
.L74:
	subl	$1, %r9d
	jmp	.L20
.L46:
	xorl	%ecx, %ecx
	subl	$1, %r8d
	leaq	448(%rsp), %r9
	jmp	.L12
.L49:
	xorl	%r8d, %r8d
	jmp	.L38
.L75:
	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>
#include <math.h>

int main(void) {
	int w, h, n;
	int x, y, a;
	int S[100][100] = {  };
	scanf("%d %d %d", &w, &h, &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d %d", &x, &y, &a);
		switch (a)
		{
		case 1:
			for (int j = 0; j < x; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 2:
			for (int j = x; j < w; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 3:
			for (int j = 0; j < y; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		case 4:
			for (int j = y; j < h; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		default:
			break;
		}

	}
	int ans = 0;
	for (int i = 0; i < h; ++i) {
		for (int k = 0; k < w; ++k) {
			ans += 1-S[i][k];
		}
	}
	printf("%d", ans);
	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>
#include <math.h>

int main(void) {
	int w, h, n;
	int x, y, a;
	int S[100][100] = {  };
	scanf("%d %d %d", &w, &h, &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d %d", &x, &y, &a);
		switch (a)
		{
		case 1:
			for (int j = 0; j < x; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 2:
			for (int j = x; j < w; ++j) {
				for (int k = 0; k < h; ++k) {
					S[k][j] = 1;
				}
			}break;
		case 3:
			for (int j = 0; j < y; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		case 4:
			for (int j = y; j < h; ++j) {
				for (int k = 0; k < w; ++k) {
					S[j][k] = 1;
				}
			}break;
		default:
			break;
		}

	}
	int ans = 0;
	for (int i = 0; i < h; ++i) {
		for (int k = 0; k < w; ++k) {
			ans += 1-S[i][k];
		}
	}
	printf("%d", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40016(%rbp), %rax
	movl	$40000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40080(%rbp), %rcx
	leaq	-40084(%rbp), %rdx
	leaq	-40088(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40064(%rbp)
	jmp	.L2
.L25:
	leaq	-40068(%rbp), %rcx
	leaq	-40072(%rbp), %rdx
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	cmpl	$4, %eax
	je	.L3
	cmpl	$4, %eax
	jg	.L32
	cmpl	$3, %eax
	je	.L5
	cmpl	$3, %eax
	jg	.L32
	cmpl	$1, %eax
	je	.L6
	cmpl	$2, %eax
	je	.L7
	jmp	.L32
.L6:
	movl	$0, -40060(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40056(%rbp)
	jmp	.L9
.L10:
	movl	-40060(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40056(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40056(%rbp)
.L9:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L10
	addl	$1, -40060(%rbp)
.L8:
	movl	-40076(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L11
	jmp	.L12
.L7:
	movl	-40076(%rbp), %eax
	movl	%eax, -40052(%rbp)
	jmp	.L13
.L16:
	movl	$0, -40048(%rbp)
	jmp	.L14
.L15:
	movl	-40052(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40048(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40048(%rbp)
.L14:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40048(%rbp)
	jl	.L15
	addl	$1, -40052(%rbp)
.L13:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40052(%rbp)
	jl	.L16
	jmp	.L12
.L5:
	movl	$0, -40044(%rbp)
	jmp	.L17
.L20:
	movl	$0, -40040(%rbp)
	jmp	.L18
.L19:
	movl	-40040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40044(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40040(%rbp)
.L18:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40040(%rbp)
	jl	.L19
	addl	$1, -40044(%rbp)
.L17:
	movl	-40072(%rbp), %eax
	cmpl	%eax, -40044(%rbp)
	jl	.L20
	jmp	.L12
.L3:
	movl	-40072(%rbp), %eax
	movl	%eax, -40036(%rbp)
	jmp	.L21
.L24:
	movl	$0, -40032(%rbp)
	jmp	.L22
.L23:
	movl	-40032(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40036(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40032(%rbp)
.L22:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40032(%rbp)
	jl	.L23
	addl	$1, -40036(%rbp)
.L21:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40036(%rbp)
	jl	.L24
	jmp	.L12
.L32:
	nop
.L12:
	addl	$1, -40064(%rbp)
.L2:
	movl	-40080(%rbp), %eax
	cmpl	%eax, -40064(%rbp)
	jl	.L25
	movl	$0, -40028(%rbp)
	movl	$0, -40024(%rbp)
	jmp	.L26
.L29:
	movl	$0, -40020(%rbp)
	jmp	.L27
.L28:
	movl	-40020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40024(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-40016(%rbp,%rax,4), %edx
	movl	$1, %eax
	subl	%edx, %eax
	addl	%eax, -40028(%rbp)
	addl	$1, -40020(%rbp)
.L27:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L28
	addl	$1, -40024(%rbp)
.L26:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jl	.L29
	movl	-40028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	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"
.LC1:
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40016(%rbp), %rax
	movl	$40000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40080(%rbp), %rcx
	leaq	-40084(%rbp), %rdx
	leaq	-40088(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40064(%rbp)
	jmp	.L2
.L25:
	leaq	-40068(%rbp), %rcx
	leaq	-40072(%rbp), %rdx
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	cmpl	$4, %eax
	je	.L3
	cmpl	$4, %eax
	jg	.L32
	cmpl	$3, %eax
	je	.L5
	cmpl	$3, %eax
	jg	.L32
	cmpl	$1, %eax
	je	.L6
	cmpl	$2, %eax
	je	.L7
	jmp	.L32
.L6:
	movl	$0, -40060(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40056(%rbp)
	jmp	.L9
.L10:
	movl	-40060(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40056(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40056(%rbp)
.L9:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L10
	addl	$1, -40060(%rbp)
.L8:
	movl	-40076(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L11
	jmp	.L12
.L7:
	movl	-40076(%rbp), %eax
	movl	%eax, -40052(%rbp)
	jmp	.L13
.L16:
	movl	$0, -40048(%rbp)
	jmp	.L14
.L15:
	movl	-40052(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40048(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40048(%rbp)
.L14:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40048(%rbp)
	jl	.L15
	addl	$1, -40052(%rbp)
.L13:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40052(%rbp)
	jl	.L16
	jmp	.L12
.L5:
	movl	$0, -40044(%rbp)
	jmp	.L17
.L20:
	movl	$0, -40040(%rbp)
	jmp	.L18
.L19:
	movl	-40040(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40044(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40040(%rbp)
.L18:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40040(%rbp)
	jl	.L19
	addl	$1, -40044(%rbp)
.L17:
	movl	-40072(%rbp), %eax
	cmpl	%eax, -40044(%rbp)
	jl	.L20
	jmp	.L12
.L3:
	movl	-40072(%rbp), %eax
	movl	%eax, -40036(%rbp)
	jmp	.L21
.L24:
	movl	$0, -40032(%rbp)
	jmp	.L22
.L23:
	movl	-40032(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40036(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$1, -40016(%rbp,%rax,4)
	addl	$1, -40032(%rbp)
.L22:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40032(%rbp)
	jl	.L23
	addl	$1, -40036(%rbp)
.L21:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40036(%rbp)
	jl	.L24
	jmp	.L12
.L32:
	nop
.L12:
	addl	$1, -40064(%rbp)
.L2:
	movl	-40080(%rbp), %eax
	cmpl	%eax, -40064(%rbp)
	jl	.L25
	movl	$0, -40028(%rbp)
	movl	$0, -40024(%rbp)
	jmp	.L26
.L29:
	movl	$0, -40020(%rbp)
	jmp	.L27
.L28:
	movl	-40020(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40024(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	-40016(%rbp,%rax,4), %edx
	movl	$1, %eax
	subl	%edx, %eax
	addl	%eax, -40028(%rbp)
	addl	$1, -40020(%rbp)
.L27:
	movl	-40088(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L28
	addl	$1, -40024(%rbp)
.L26:
	movl	-40084(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jl	.L29
	movl	-40028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	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:
