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 i, N, Q, t, x;
	scanf("%d %d", &N, &Q);
	
	int j, num[2][200001] = {}, l = N - 1, u = N - 1;
	long long ans = (long long)(N - 2) * (N - 2);
	for (i = 2; i <= N - 1; i++) {
		num[0][i] = -1;
		num[1][i] = -1;
	}
	for (i = 1; i <= Q; i++) {
		scanf("%d %d", &t, &x);
		if (t == 1) {
			if (num[0][x] == -1) {
				ans -= u - 1;
				for (j = x + 1; j <= l; j++) num[0][j] = u - 1;
				l = x - 1;
			} else ans -= num[0][x];
		} else {
			if (num[1][x] == -1) {
				ans -= l - 1;
				for (j = x + 1; j <= u; j++) num[1][j] = l - 1;
				u = x - 1;
			} else ans -= num[1][x];
		}
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%lld\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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600052(%rbp), %rdx
	leaq	-1600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1600016(%rbp), %rax
	movl	$1600008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	movslq	%eax, %rdx
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -1600024(%rbp)
	movl	$2, -1600040(%rbp)
	jmp	.L2
.L3:
	movl	-1600040(%rbp), %eax
	cltq
	movl	$-1, -1600016(%rbp,%rax,4)
	movl	-1600040(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	$-1, -1600016(%rbp,%rax,4)
	addl	$1, -1600040(%rbp)
.L2:
	movl	-1600056(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jl	.L3
	movl	$1, -1600040(%rbp)
	jmp	.L4
.L13:
	leaq	-1600044(%rbp), %rdx
	leaq	-1600048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1600048(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L6
	movl	-1600028(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L7
.L8:
	movl	-1600028(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L7:
	movl	-1600036(%rbp), %eax
	cmpl	-1600032(%rbp), %eax
	jle	.L8
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	jmp	.L9
.L6:
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
	jmp	.L9
.L5:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L10
	movl	-1600032(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L11
.L12:
	movl	-1600032(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L11:
	movl	-1600036(%rbp), %eax
	cmpl	-1600028(%rbp), %eax
	jle	.L12
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	jmp	.L9
.L10:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
.L9:
	addl	$1, -1600040(%rbp)
.L4:
	movl	-1600052(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jle	.L13
	movq	-1600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@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	"%d %d"
.LC1:
	.string	"%lld\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	-1597440(%rsp), %r11
	.cfi_def_cfa 11, 1597496
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2616, %rsp
	.cfi_def_cfa_offset 1600112
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1600040(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	32(%rsp), %rax
	movl	$1600008, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
	movl	16(%rsp), %eax
	leal	-2(%rax), %edx
	leal	-1(%rax), %ecx
	movslq	%edx, %r12
	movl	%ecx, 4(%rsp)
	imulq	%r12, %r12
	cmpl	$2, %eax
	jle	.L2
	movl	%edx, %edx
	leaq	40(%rsp), %rdi
	movl	$255, %esi
	leaq	0(,%rdx,4), %r13
	movq	%r13, %rdx
	call	memset@PLT
	leaq	800044(%rsp), %rdi
	movq	%r13, %rdx
	movl	$255, %esi
	call	memset@PLT
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	4(%rsp), %r14d
	movl	$1, %r15d
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %rbp
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	800036(%rsp,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L25
.L11:
	subq	%rax, %r12
.L10:
	addl	$1, %r15d
	cmpl	%r15d, 20(%rsp)
	jl	.L3
.L16:
	movq	%r13, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	cmpl	$1, 24(%rsp)
	movq	%rsi, %rdx
	jne	.L4
	movslq	32(%rsp,%rsi,4), %rax
	cmpl	$-1, %eax
	jne	.L11
	leal	-1(%r14), %r9d
	leal	1(%rsi), %r8d
	movslq	%r9d, %rax
	subq	%rax, %r12
	movl	4(%rsp), %eax
	cmpl	%eax, %r8d
	jg	.L6
	movl	%eax, %r10d
	subl	%esi, %r10d
	leal	-1(%r10), %eax
	cmpl	$2, %eax
	jbe	.L7
	movq	8(%rsp), %rax
	movd	%r9d, %xmm2
	pshufd	$0, %xmm2, %xmm0
	leaq	4(%rax,%rsi,4), %rsi
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rsi), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$16, %rax
.L8:
	movups	%xmm0, (%rsi)
	movq	%rax, %rsi
	cmpq	%rdi, %rax
	jne	.L26
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %r8d
	cmpl	%eax, %r10d
	je	.L6
.L7:
	movslq	%r8d, %rax
	movl	4(%rsp), %ecx
	movl	%r9d, 32(%rsp,%rax,4)
	leal	1(%r8), %eax
	cmpl	%ecx, %eax
	jg	.L6
	cltq
	addl	$2, %r8d
	movl	%r9d, 32(%rsp,%rax,4)
	cmpl	%r8d, %ecx
	jl	.L6
	movslq	%r8d, %r8
	movl	%r9d, 32(%rsp,%r8,4)
.L6:
	leal	-1(%rdx), %eax
	movl	%eax, 4(%rsp)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r12, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	1600040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$1600056, %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
.L25:
	.cfi_restore_state
	movl	4(%rsp), %eax
	leal	1(%rsi), %r8d
	leal	-1(%rax), %r9d
	movslq	%r9d, %rax
	subq	%rax, %r12
	cmpl	%r14d, %r8d
	jg	.L12
	movl	%r14d, %r10d
	subl	%esi, %r10d
	leal	-1(%r10), %eax
	cmpl	$2, %eax
	jbe	.L13
	movq	8(%rsp), %rax
	movd	%r9d, %xmm1
	pshufd	$0, %xmm1, %xmm0
	leaq	800008(%rax,%rsi,4), %rsi
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rsi), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L28:
	addq	$16, %rax
.L14:
	movups	%xmm0, (%rsi)
	movq	%rax, %rsi
	cmpq	%rdi, %rax
	jne	.L28
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %r8d
	cmpl	%eax, %r10d
	je	.L12
.L13:
	movslq	%r8d, %rax
	movl	%r9d, 800036(%rsp,%rax,4)
	leal	1(%r8), %eax
	cmpl	%eax, %r14d
	jl	.L12
	cltq
	addl	$2, %r8d
	movl	%r9d, 800036(%rsp,%rax,4)
	cmpl	%r8d, %r14d
	jl	.L12
	movslq	%r8d, %r8
	movl	%r9d, 800036(%rsp,%r8,4)
.L12:
	leal	-1(%rdx), %r14d
	jmp	.L10
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%lld\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	-1597440(%rsp), %r11
	.cfi_def_cfa 11, 1597496
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2616, %rsp
	.cfi_def_cfa_offset 1600112
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1600040(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	32(%rsp), %rax
	movl	$1600008, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
	movl	16(%rsp), %eax
	leal	-2(%rax), %edx
	leal	-1(%rax), %ecx
	movslq	%edx, %r12
	movl	%ecx, 4(%rsp)
	imulq	%r12, %r12
	cmpl	$2, %eax
	jle	.L2
	movl	%edx, %edx
	leaq	40(%rsp), %rdi
	movl	$255, %esi
	leaq	0(,%rdx,4), %r13
	movq	%r13, %rdx
	call	memset@PLT
	leaq	800044(%rsp), %rdi
	movq	%r13, %rdx
	movl	$255, %esi
	call	memset@PLT
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	4(%rsp), %r14d
	movl	$1, %r15d
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %rbp
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	800036(%rsp,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L25
.L11:
	subq	%rax, %r12
.L10:
	addl	$1, %r15d
	cmpl	%r15d, 20(%rsp)
	jl	.L3
.L16:
	movq	%r13, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	cmpl	$1, 24(%rsp)
	movq	%rsi, %rdx
	jne	.L4
	movslq	32(%rsp,%rsi,4), %rax
	cmpl	$-1, %eax
	jne	.L11
	leal	-1(%r14), %r9d
	leal	1(%rsi), %r8d
	movslq	%r9d, %rax
	subq	%rax, %r12
	movl	4(%rsp), %eax
	cmpl	%eax, %r8d
	jg	.L6
	movl	%eax, %r10d
	subl	%esi, %r10d
	leal	-1(%r10), %eax
	cmpl	$2, %eax
	jbe	.L7
	movq	8(%rsp), %rax
	movd	%r9d, %xmm2
	pshufd	$0, %xmm2, %xmm0
	leaq	4(%rax,%rsi,4), %rsi
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rsi), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$16, %rax
.L8:
	movups	%xmm0, (%rsi)
	movq	%rax, %rsi
	cmpq	%rdi, %rax
	jne	.L26
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %r8d
	cmpl	%eax, %r10d
	je	.L6
.L7:
	movslq	%r8d, %rax
	movl	4(%rsp), %ecx
	movl	%r9d, 32(%rsp,%rax,4)
	leal	1(%r8), %eax
	cmpl	%ecx, %eax
	jg	.L6
	cltq
	addl	$2, %r8d
	movl	%r9d, 32(%rsp,%rax,4)
	cmpl	%r8d, %ecx
	jl	.L6
	movslq	%r8d, %r8
	movl	%r9d, 32(%rsp,%r8,4)
.L6:
	leal	-1(%rdx), %eax
	movl	%eax, 4(%rsp)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r12, %rdx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	1600040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$1600056, %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
.L25:
	.cfi_restore_state
	movl	4(%rsp), %eax
	leal	1(%rsi), %r8d
	leal	-1(%rax), %r9d
	movslq	%r9d, %rax
	subq	%rax, %r12
	cmpl	%r14d, %r8d
	jg	.L12
	movl	%r14d, %r10d
	subl	%esi, %r10d
	leal	-1(%r10), %eax
	cmpl	$2, %eax
	jbe	.L13
	movq	8(%rsp), %rax
	movd	%r9d, %xmm1
	pshufd	$0, %xmm1, %xmm0
	leaq	800008(%rax,%rsi,4), %rsi
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rsi), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L28:
	addq	$16, %rax
.L14:
	movups	%xmm0, (%rsi)
	movq	%rax, %rsi
	cmpq	%rdi, %rax
	jne	.L28
	movl	%r10d, %eax
	andl	$-4, %eax
	addl	%eax, %r8d
	cmpl	%eax, %r10d
	je	.L12
.L13:
	movslq	%r8d, %rax
	movl	%r9d, 800036(%rsp,%rax,4)
	leal	1(%r8), %eax
	cmpl	%eax, %r14d
	jl	.L12
	cltq
	addl	$2, %r8d
	movl	%r9d, 800036(%rsp,%rax,4)
	cmpl	%r8d, %r14d
	jl	.L12
	movslq	%r8d, %r8
	movl	%r9d, 800036(%rsp,%r8,4)
.L12:
	leal	-1(%rdx), %r14d
	jmp	.L10
.L27:
	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 i, N, Q, t, x;
	scanf("%d %d", &N, &Q);
	
	int j, num[2][200001] = {}, l = N - 1, u = N - 1;
	long long ans = (long long)(N - 2) * (N - 2);
	for (i = 2; i <= N - 1; i++) {
		num[0][i] = -1;
		num[1][i] = -1;
	}
	for (i = 1; i <= Q; i++) {
		scanf("%d %d", &t, &x);
		if (t == 1) {
			if (num[0][x] == -1) {
				ans -= u - 1;
				for (j = x + 1; j <= l; j++) num[0][j] = u - 1;
				l = x - 1;
			} else ans -= num[0][x];
		} else {
			if (num[1][x] == -1) {
				ans -= l - 1;
				for (j = x + 1; j <= u; j++) num[1][j] = l - 1;
				u = x - 1;
			} else ans -= num[1][x];
		}
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}
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

6056521
 31159505795
 3504384
 31159667102

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 i, N, Q, t, x;
	scanf("%d %d", &N, &Q);
	
	int j, num[2][200001] = {}, l = N - 1, u = N - 1;
	long long ans = (long long)(N - 2) * (N - 2);
	for (i = 2; i <= N - 1; i++) {
		num[0][i] = -1;
		num[1][i] = -1;
	}
	for (i = 1; i <= Q; i++) {
		scanf("%d %d", &t, &x);
		if (t == 1) {
			if (num[0][x] == -1) {
				ans -= u - 1;
				for (j = x + 1; j <= l; j++) num[0][j] = u - 1;
				l = x - 1;
			} else ans -= num[0][x];
		} else {
			if (num[1][x] == -1) {
				ans -= l - 1;
				for (j = x + 1; j <= u; j++) num[1][j] = l - 1;
				u = x - 1;
			} else ans -= num[1][x];
		}
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%lld\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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600052(%rbp), %rdx
	leaq	-1600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1600016(%rbp), %rax
	movl	$1600008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	movslq	%eax, %rdx
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -1600024(%rbp)
	movl	$2, -1600040(%rbp)
	jmp	.L2
.L3:
	movl	-1600040(%rbp), %eax
	cltq
	movl	$-1, -1600016(%rbp,%rax,4)
	movl	-1600040(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	$-1, -1600016(%rbp,%rax,4)
	addl	$1, -1600040(%rbp)
.L2:
	movl	-1600056(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jl	.L3
	movl	$1, -1600040(%rbp)
	jmp	.L4
.L13:
	leaq	-1600044(%rbp), %rdx
	leaq	-1600048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1600048(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L6
	movl	-1600028(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L7
.L8:
	movl	-1600028(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L7:
	movl	-1600036(%rbp), %eax
	cmpl	-1600032(%rbp), %eax
	jle	.L8
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	jmp	.L9
.L6:
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
	jmp	.L9
.L5:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L10
	movl	-1600032(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L11
.L12:
	movl	-1600032(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L11:
	movl	-1600036(%rbp), %eax
	cmpl	-1600028(%rbp), %eax
	jle	.L12
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	jmp	.L9
.L10:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
.L9:
	addl	$1, -1600040(%rbp)
.L4:
	movl	-1600052(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jle	.L13
	movq	-1600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@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
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%lld\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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600052(%rbp), %rdx
	leaq	-1600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1600016(%rbp), %rax
	movl	$1600008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	movslq	%eax, %rdx
	movl	-1600056(%rbp), %eax
	subl	$2, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -1600024(%rbp)
	movl	$2, -1600040(%rbp)
	jmp	.L2
.L3:
	movl	-1600040(%rbp), %eax
	cltq
	movl	$-1, -1600016(%rbp,%rax,4)
	movl	-1600040(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	$-1, -1600016(%rbp,%rax,4)
	addl	$1, -1600040(%rbp)
.L2:
	movl	-1600056(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jl	.L3
	movl	$1, -1600040(%rbp)
	jmp	.L4
.L13:
	leaq	-1600044(%rbp), %rdx
	leaq	-1600048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1600048(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L6
	movl	-1600028(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L7
.L8:
	movl	-1600028(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L7:
	movl	-1600036(%rbp), %eax
	cmpl	-1600032(%rbp), %eax
	jle	.L8
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600032(%rbp)
	jmp	.L9
.L6:
	movl	-1600044(%rbp), %eax
	cltq
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
	jmp	.L9
.L5:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L10
	movl	-1600032(%rbp), %eax
	subl	$1, %eax
	cltq
	subq	%rax, -1600024(%rbp)
	movl	-1600044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1600036(%rbp)
	jmp	.L11
.L12:
	movl	-1600032(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-1600036(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	%edx, -1600016(%rbp,%rax,4)
	addl	$1, -1600036(%rbp)
.L11:
	movl	-1600036(%rbp), %eax
	cmpl	-1600028(%rbp), %eax
	jle	.L12
	movl	-1600044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1600028(%rbp)
	jmp	.L9
.L10:
	movl	-1600044(%rbp), %eax
	cltq
	addq	$200001, %rax
	movl	-1600016(%rbp,%rax,4), %eax
	cltq
	subq	%rax, -1600024(%rbp)
.L9:
	addl	$1, -1600040(%rbp)
.L4:
	movl	-1600052(%rbp), %eax
	cmpl	%eax, -1600040(%rbp)
	jle	.L13
	movq	-1600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@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:
