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 a[300000],b[300000];
int main(){
	long long n;
	int q,h,w,t;
	scanf("%lld %d",&n,&q);
	h=n;w=n;
	long long ans=(n-2)*(n-2);
	for (int i=1;i<=n;i++){
		a[i]=n;b[i]=n;
	}
	for (int i=1;i<=q;i++){
		int k;
		scanf("%d",&k);
		if (k==1){
			scanf("%d",&t);
			if (t<w){
				for (int j=t;j<w;j++){
				  b[j]=h;
			}
				w=t;
			}
			ans=ans-(b[t]-2);
		}else{
			scanf("%d",&t);
			if (t<h){
				for (int j=t;j<h;j++){
				  a[j]=w;
			}
			    h=t;
			}
			ans=ans-(a[t]-2);	
		}
	}
	printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1200000
a:
	.zero	1200000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1200000
b:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%lld %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	movl	%eax, -48(%rbp)
	movq	-24(%rbp), %rax
	movl	%eax, -44(%rbp)
	movq	-24(%rbp), %rax
	leaq	-2(%rax), %rdx
	movq	-24(%rbp), %rax
	subq	$2, %rax
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L13:
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L6
	movl	-56(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L7
.L8:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-48(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L8
	movl	-56(%rbp), %eax
	movl	%eax, -44(%rbp)
.L6:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L9
.L5:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L10
	movl	-56(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-44(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L12
	movl	-56(%rbp), %eax
	movl	%eax, -48(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
.L9:
	addl	$1, -36(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L13
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	"%lld %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.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
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rdx
	leaq	-2(%rdx), %r12
	movl	%edx, %r13d
	imulq	%r12, %r12
	testq	%rdx, %rdx
	jle	.L2
	leaq	-1(%rdx), %rax
	cmpq	$2, %rax
	jbe	.L19
	movq	%rdx, %rcx
	movd	%edx, %xmm2
	movl	$4, %eax
	shrq	$2, %rcx
	pshufd	$0, %xmm2, %xmm0
	leaq	a(%rip), %rdi
	salq	$4, %rcx
	leaq	b(%rip), %rsi
	addq	$4, %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rdi,%rax)
	movups	%xmm0, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L4
	movq	%rdx, %rcx
	andq	$-4, %rcx
	leal	1(%rcx), %eax
	cmpq	%rcx, %rdx
	je	.L2
.L3:
	movslq	%eax, %rcx
	movl	%edx, (%rdi,%rcx,4)
	movl	%edx, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %rdx
	jl	.L2
	addl	$2, %eax
	movl	%edx, (%rdi,%rcx,4)
	cltq
	movl	%edx, (%rsi,%rcx,4)
	cmpq	%rax, %rdx
	jl	.L2
	movl	%edx, (%rdi,%rax,4)
	movl	%edx, (%rsi,%rax,4)
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movl	%edx, 12(%rsp)
	movl	$1, %ebx
	leaq	28(%rsp), %r14
	leaq	.LC1(%rip), %rbp
	leaq	24(%rsp), %r15
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L7:
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdi
	movq	%rdi, %rdx
	cmpl	%r13d, %edi
	jl	.L32
.L13:
	leaq	a(%rip), %rax
	addl	$1, %ebx
	movl	(%rax,%rdi,4), %eax
	subl	$2, %eax
	cltq
	subq	%rax, %r12
	cmpl	%ebx, 20(%rsp)
	jl	.L6
.L17:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	cmpl	$1, 28(%rsp)
	movq	%r15, %rsi
	movq	%rbp, %rdi
	jne	.L7
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdi
	movq	%rdi, %rdx
	cmpl	12(%rsp), %edi
	jl	.L33
.L8:
	leaq	b(%rip), %rax
	addl	$1, %ebx
	movl	(%rax,%rdi,4), %eax
	subl	$2, %eax
	cltq
	subq	%rax, %r12
	cmpl	%ebx, 20(%rsp)
	jge	.L17
.L6:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$56, %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
.L32:
	.cfi_restore_state
	movl	%r13d, %r8d
	subl	%edi, %r8d
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L21
	leaq	a(%rip), %rax
	movd	12(%rsp), %xmm1
	leaq	(%rax,%rdi,4), %rcx
	movl	%r8d, %eax
	shrl	$2, %eax
	pshufd	$0, %xmm1, %xmm0
	leal	-1(%rax), %esi
	leaq	16(%rcx), %rax
	salq	$4, %rsi
	addq	%rax, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L15:
	movups	%xmm0, (%rcx)
	movq	%rax, %rcx
	cmpq	%rax, %rsi
	jne	.L35
	movl	%r8d, %ecx
	andl	$-4, %ecx
	leal	(%rcx,%rdx), %eax
	cmpl	%ecx, %r8d
	je	.L16
.L14:
	movl	12(%rsp), %r9d
	movslq	%eax, %rcx
	leaq	a(%rip), %rsi
	movl	%r9d, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r13d
	jle	.L16
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%r9d, (%rsi,%rcx,4)
	cmpl	%r13d, %eax
	jge	.L16
	cltq
	movl	%r9d, (%rsi,%rax,4)
.L16:
	movl	%edx, %r13d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L33:
	movl	12(%rsp), %r8d
	subl	%edi, %r8d
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L20
	leaq	b(%rip), %rax
	movd	%r13d, %xmm3
	leaq	(%rax,%rdi,4), %rcx
	movl	%r8d, %eax
	pshufd	$0, %xmm3, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %esi
	leaq	16(%rcx), %rax
	salq	$4, %rsi
	addq	%rax, %rsi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L36:
	addq	$16, %rax
.L10:
	movups	%xmm0, (%rcx)
	movq	%rax, %rcx
	cmpq	%rax, %rsi
	jne	.L36
	movl	%r8d, %ecx
	andl	$-4, %ecx
	leal	(%rcx,%rdx), %eax
	cmpl	%ecx, %r8d
	je	.L11
.L9:
	movslq	%eax, %rcx
	leaq	b(%rip), %rsi
	movl	12(%rsp), %r10d
	movl	%r13d, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r10d
	jle	.L11
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%r13d, (%rsi,%rcx,4)
	cmpl	%r10d, %eax
	jge	.L11
	cltq
	movl	%r13d, (%rsi,%rax,4)
.L11:
	movl	%edx, 12(%rsp)
	jmp	.L8
.L21:
	movl	%edi, %eax
	jmp	.L14
.L19:
	movl	$1, %eax
	leaq	a(%rip), %rdi
	leaq	b(%rip), %rsi
	jmp	.L3
.L20:
	movl	%edi, %eax
	jmp	.L9
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 1200000
b:
	.zero	1200000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1200000
a:
	.zero	1200000
	.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	"%lld %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.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
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rdx
	leaq	-2(%rdx), %r12
	movl	%edx, %r13d
	imulq	%r12, %r12
	testq	%rdx, %rdx
	jle	.L2
	leaq	-1(%rdx), %rax
	cmpq	$2, %rax
	jbe	.L19
	movq	%rdx, %rcx
	movd	%edx, %xmm2
	movl	$4, %eax
	shrq	$2, %rcx
	pshufd	$0, %xmm2, %xmm0
	leaq	a(%rip), %rdi
	salq	$4, %rcx
	leaq	b(%rip), %rsi
	addq	$4, %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rdi,%rax)
	movups	%xmm0, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L4
	movq	%rdx, %rcx
	andq	$-4, %rcx
	leal	1(%rcx), %eax
	cmpq	%rcx, %rdx
	je	.L2
.L3:
	movslq	%eax, %rcx
	movl	%edx, (%rdi,%rcx,4)
	movl	%edx, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %rdx
	jl	.L2
	addl	$2, %eax
	movl	%edx, (%rdi,%rcx,4)
	cltq
	movl	%edx, (%rsi,%rcx,4)
	cmpq	%rax, %rdx
	jl	.L2
	movl	%edx, (%rdi,%rax,4)
	movl	%edx, (%rsi,%rax,4)
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movl	%edx, 12(%rsp)
	movl	$1, %ebx
	leaq	28(%rsp), %r14
	leaq	.LC1(%rip), %rbp
	leaq	24(%rsp), %r15
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L7:
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdi
	movq	%rdi, %rdx
	cmpl	%r13d, %edi
	jl	.L32
.L13:
	leaq	a(%rip), %rax
	addl	$1, %ebx
	movl	(%rax,%rdi,4), %eax
	subl	$2, %eax
	cltq
	subq	%rax, %r12
	cmpl	%ebx, 20(%rsp)
	jl	.L6
.L17:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	cmpl	$1, 28(%rsp)
	movq	%r15, %rsi
	movq	%rbp, %rdi
	jne	.L7
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdi
	movq	%rdi, %rdx
	cmpl	12(%rsp), %edi
	jl	.L33
.L8:
	leaq	b(%rip), %rax
	addl	$1, %ebx
	movl	(%rax,%rdi,4), %eax
	subl	$2, %eax
	cltq
	subq	%rax, %r12
	cmpl	%ebx, 20(%rsp)
	jge	.L17
.L6:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$56, %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
.L32:
	.cfi_restore_state
	movl	%r13d, %r8d
	subl	%edi, %r8d
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L21
	leaq	a(%rip), %rax
	movd	12(%rsp), %xmm1
	leaq	(%rax,%rdi,4), %rcx
	movl	%r8d, %eax
	shrl	$2, %eax
	pshufd	$0, %xmm1, %xmm0
	leal	-1(%rax), %esi
	leaq	16(%rcx), %rax
	salq	$4, %rsi
	addq	%rax, %rsi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L15:
	movups	%xmm0, (%rcx)
	movq	%rax, %rcx
	cmpq	%rax, %rsi
	jne	.L35
	movl	%r8d, %ecx
	andl	$-4, %ecx
	leal	(%rcx,%rdx), %eax
	cmpl	%ecx, %r8d
	je	.L16
.L14:
	movl	12(%rsp), %r9d
	movslq	%eax, %rcx
	leaq	a(%rip), %rsi
	movl	%r9d, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r13d
	jle	.L16
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%r9d, (%rsi,%rcx,4)
	cmpl	%r13d, %eax
	jge	.L16
	cltq
	movl	%r9d, (%rsi,%rax,4)
.L16:
	movl	%edx, %r13d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L33:
	movl	12(%rsp), %r8d
	subl	%edi, %r8d
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L20
	leaq	b(%rip), %rax
	movd	%r13d, %xmm3
	leaq	(%rax,%rdi,4), %rcx
	movl	%r8d, %eax
	pshufd	$0, %xmm3, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %esi
	leaq	16(%rcx), %rax
	salq	$4, %rsi
	addq	%rax, %rsi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L36:
	addq	$16, %rax
.L10:
	movups	%xmm0, (%rcx)
	movq	%rax, %rcx
	cmpq	%rax, %rsi
	jne	.L36
	movl	%r8d, %ecx
	andl	$-4, %ecx
	leal	(%rcx,%rdx), %eax
	cmpl	%ecx, %r8d
	je	.L11
.L9:
	movslq	%eax, %rcx
	leaq	b(%rip), %rsi
	movl	12(%rsp), %r10d
	movl	%r13d, (%rsi,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %r10d
	jle	.L11
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%r13d, (%rsi,%rcx,4)
	cmpl	%r10d, %eax
	jge	.L11
	cltq
	movl	%r13d, (%rsi,%rax,4)
.L11:
	movl	%edx, 12(%rsp)
	jmp	.L8
.L21:
	movl	%edi, %eax
	jmp	.L14
.L19:
	movl	$1, %eax
	leaq	a(%rip), %rdi
	leaq	b(%rip), %rsi
	jmp	.L3
.L20:
	movl	%edi, %eax
	jmp	.L9
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 1200000
b:
	.zero	1200000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1200000
a:
	.zero	1200000
	.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 a[300000],b[300000];
int main(){
	long long n;
	int q,h,w,t;
	scanf("%lld %d",&n,&q);
	h=n;w=n;
	long long ans=(n-2)*(n-2);
	for (int i=1;i<=n;i++){
		a[i]=n;b[i]=n;
	}
	for (int i=1;i<=q;i++){
		int k;
		scanf("%d",&k);
		if (k==1){
			scanf("%d",&t);
			if (t<w){
				for (int j=t;j<w;j++){
				  b[j]=h;
			}
				w=t;
			}
			ans=ans-(b[t]-2);
		}else{
			scanf("%d",&t);
			if (t<h){
				for (int j=t;j<h;j++){
				  a[j]=w;
			}
			    h=t;
			}
			ans=ans-(a[t]-2);	
		}
	}
	printf("%lld",ans);
}
2463 0
 176527 15
1 81279
2 22308
2 168987
1 80744
2 44603
1 170938
2 139754
2 15220
1 172794
1 159290
2 156968
1 56426
2 77429
1 97459
2 71282
 1874 0
 176527 15
1 81279
2 22308
2 168987
1 80744
2 44603
1 170938
2 139754
2 15220
1 172794
1 78642
2 156968
1 56426
2 77429
1 97459
2 71282
 297869 0
 176527 15
2 81279
2 22308
2 168987
1 80744
2 44603
1 170938
2 139754
2 15220
1 172794
1 159290
2 156968
1 56426
2 77429
1 97459
2 71282
 176527 15
2 81279
2 22308
2 168987
1 93587
2 44603
1 170938
2 139754
2 15220
1 172794
1 159290
2 156968
1 56426
2 77429
1 97459
2 71282
 5 5
1 3
2 3
1 4
2 0
1 2
 176527 15
1 53690
2 22308
2 133061
1 80744
2 44603
1 170938
2 139754
2 15220
1 172794
1 159290
2 156968
1 56426
2 77429
1 97459
2 71282
 3570 0

6056521 31159505795 3504384 31159667102 88724749689 31159455935 31159443092 3 31159410446 12730624
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 a[300000],b[300000];
int main(){
	long long n;
	int q,h,w,t;
	scanf("%lld %d",&n,&q);
	h=n;w=n;
	long long ans=(n-2)*(n-2);
	for (int i=1;i<=n;i++){
		a[i]=n;b[i]=n;
	}
	for (int i=1;i<=q;i++){
		int k;
		scanf("%d",&k);
		if (k==1){
			scanf("%d",&t);
			if (t<w){
				for (int j=t;j<w;j++){
				  b[j]=h;
			}
				w=t;
			}
			ans=ans-(b[t]-2);
		}else{
			scanf("%d",&t);
			if (t<h){
				for (int j=t;j<h;j++){
				  a[j]=w;
			}
			    h=t;
			}
			ans=ans-(a[t]-2);	
		}
	}
	printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1200000
a:
	.zero	1200000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1200000
b:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%lld %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	movl	%eax, -48(%rbp)
	movq	-24(%rbp), %rax
	movl	%eax, -44(%rbp)
	movq	-24(%rbp), %rax
	leaq	-2(%rax), %rdx
	movq	-24(%rbp), %rax
	subq	$2, %rax
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L13:
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L6
	movl	-56(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L7
.L8:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-48(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L8
	movl	-56(%rbp), %eax
	movl	%eax, -44(%rbp)
.L6:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L9
.L5:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L10
	movl	-56(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-44(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L12
	movl	-56(%rbp), %eax
	movl	%eax, -48(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
.L9:
	addl	$1, -36(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L13
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1200000
a:
	.zero	1200000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1200000
b:
	.zero	1200000
	.section	.rodata
.LC0:
	.string	"%lld %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	movl	%eax, -48(%rbp)
	movq	-24(%rbp), %rax
	movl	%eax, -44(%rbp)
	movq	-24(%rbp), %rax
	leaq	-2(%rax), %rdx
	movq	-24(%rbp), %rax
	subq	$2, %rax
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L13:
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L6
	movl	-56(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L7
.L8:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-48(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L8
	movl	-56(%rbp), %eax
	movl	%eax, -44(%rbp)
.L6:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L9
.L5:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jle	.L10
	movl	-56(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-44(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L12
	movl	-56(%rbp), %eax
	movl	%eax, -48(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$2, %eax
	cltq
	subq	%rax, -16(%rbp)
.L9:
	addl	$1, -36(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L13
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
