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>

char c;
int f;
int nextInt();
int min(int a, int b);

int H, W, N, X, Y, low[200001], p, i, j;
int MAX = 524288;

int main(void){
	H=nextInt();
	W=nextInt();
	N=nextInt();
	for(i=2; i<=H; i++){
		low[i]=MAX;
	}
	for(i=0; i<N; i++){
		X=nextInt();
		Y=nextInt();
		if(Y<low[X]){
			low[X]=Y;
		}
	}
	for(i=2; i<=H; i++){
		if(low[i]==MAX){
		}else if(low[i]+p==i){
			p++;
		}else if(low[i]+p<i){
			printf("%d\n", i-1);
			return 0;
		}
	}
	printf("%d\n", H);
	return 0;
}

int nextInt(){
	f=0;
	c = getchar();
	while((c<'0')||('9'<c)){
		c=getchar();
	}
	while((c>='0')&&(c<='9')){
		f=f*10+(c-'0');
		c=getchar();
	}
	return f;
}

int min(int a, int b){
	return a>b?b:a;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	c
	.bss
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.globl	f
	.align 4
	.type	f, @object
	.size	f, 4
f:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 4
	.type	X, @object
	.size	X, 4
X:
	.zero	4
	.globl	Y
	.align 4
	.type	Y, @object
	.size	Y, 4
Y:
	.zero	4
	.globl	low
	.align 32
	.type	low, @object
	.size	low, 800004
low:
	.zero	800004
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	MAX
	.data
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.long	524288
	.section	.rodata
.LC0:
	.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
	movl	$0, %eax
	call	nextInt
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, W(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %edx
	movl	MAX(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	$0, %eax
	call	nextInt
	movl	%eax, X(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, Y(%rip)
	movl	X(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	Y(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	X(%rip), %edx
	movl	Y(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	$2, i(%rip)
	jmp	.L7
.L11:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	MAX(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L10
.L8:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	H(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
	jmp	.L13
.L14:
	call	getchar@PLT
	movb	%al, c(%rip)
.L13:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L14
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jg	.L14
	jmp	.L15
.L17:
	movl	f(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movzbl	c(%rip), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
.L15:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L16
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jle	.L17
.L16:
	movl	f(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	min
	.type	min, @function
min:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.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
	.p2align 4
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$0, f(%rip)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L4
	movl	f(%rip), %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	nextInt, .-nextInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	nextInt
	movl	%eax, H(%rip)
	xorl	%eax, %eax
	call	nextInt
	movl	%eax, W(%rip)
	xorl	%eax, %eax
	call	nextInt
	movl	H(%rip), %r8d
	movl	%eax, N(%rip)
	movl	%eax, %ecx
	cmpl	$1, %r8d
	jle	.L11
	leal	-2(%r8), %eax
	movl	MAX(%rip), %esi
	leal	-1(%r8), %edi
	cmpl	$2, %eax
	jbe	.L34
	movl	%edi, %edx
	leaq	8+low(%rip), %rax
	movd	%esi, %xmm1
	shrl	$2, %edx
	leaq	16(%rax), %r9
	pshufd	$0, %xmm1, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%edi, %edx
	andl	$-4, %edx
	leal	2(%rdx), %eax
	cmpl	%edi, %edx
	je	.L11
.L12:
	movslq	%eax, %rdx
	leaq	low(%rip), %rbx
	movl	%esi, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L11
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%esi, (%rbx,%rdx,4)
	cmpl	%eax, %r8d
	jl	.L11
	cltq
	movl	%esi, (%rbx,%rax,4)
.L11:
	movl	$0, i(%rip)
	leaq	low(%rip), %rbx
	testl	%ecx, %ecx
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L15:
	movl	$0, f(%rip)
	.p2align 4,,10
	.p2align 3
.L56:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L56
	.p2align 4,,10
	.p2align 3
.L20:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L20
	movl	f(%rip), %eax
	movl	$0, f(%rip)
	movl	%eax, X(%rip)
	.p2align 4,,10
	.p2align 3
.L57:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L57
	.p2align 4,,10
	.p2align 3
.L23:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L23
	movl	f(%rip), %eax
	movslq	X(%rip), %rdx
	movl	%eax, Y(%rip)
	cmpl	%eax, (%rbx,%rdx,4)
	jle	.L24
	movl	%eax, (%rbx,%rdx,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, N(%rip)
	movl	%eax, i(%rip)
	jg	.L15
.L55:
	movl	H(%rip), %r8d
.L26:
	movl	$2, i(%rip)
	cmpl	$1, %r8d
	jle	.L27
	movl	p(%rip), %esi
	xorl	%edi, %edi
	xorl	%r10d, %r10d
	movl	$2, %eax
	movl	MAX(%rip), %r9d
	leaq	8+low(%rip), %rcx
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L29:
	jl	.L58
.L28:
	addl	$1, %eax
	addq	$4, %rcx
	movl	$1, %edi
	cmpl	%r8d, %eax
	jg	.L59
	movl	%eax, %ebp
.L33:
	movl	(%rcx), %edx
	cmpl	%r9d, %edx
	je	.L28
	addl	%esi, %edx
	cmpl	%eax, %edx
	jne	.L29
	addl	$1, %esi
	movl	$1, %r10d
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L24:
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L15
	jmp	.L55
.L59:
	movl	%eax, i(%rip)
	testb	%r10b, %r10b
	je	.L27
	movl	%esi, p(%rip)
.L27:
	movl	%r8d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L53:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L58:
	.cfi_restore_state
	testb	%dil, %dil
	je	.L30
	movl	%ebp, i(%rip)
.L30:
	testb	%r10b, %r10b
	je	.L31
	movl	%esi, p(%rip)
.L31:
	leal	-1(%rax), %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L53
.L34:
	movl	$2, %eax
	jmp	.L12
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	min, .-min
	.globl	MAX
	.data
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.long	524288
	.globl	j
	.bss
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	low
	.align 32
	.type	low, @object
	.size	low, 800004
low:
	.zero	800004
	.globl	Y
	.align 4
	.type	Y, @object
	.size	Y, 4
Y:
	.zero	4
	.globl	X
	.align 4
	.type	X, @object
	.size	X, 4
X:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	f
	.align 4
	.type	f, @object
	.size	f, 4
f:
	.zero	4
	.globl	c
	.type	c, @object
	.size	c, 1
c:
	.zero	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
	.p2align 4
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$0, f(%rip)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L4
	movl	f(%rip), %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	nextInt, .-nextInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	nextInt
	movl	%eax, H(%rip)
	xorl	%eax, %eax
	call	nextInt
	movl	%eax, W(%rip)
	xorl	%eax, %eax
	call	nextInt
	movl	H(%rip), %r8d
	movl	%eax, N(%rip)
	movl	%eax, %ecx
	cmpl	$1, %r8d
	jle	.L11
	leal	-2(%r8), %eax
	movl	MAX(%rip), %esi
	leal	-1(%r8), %edi
	cmpl	$2, %eax
	jbe	.L34
	movl	%edi, %edx
	leaq	8+low(%rip), %rax
	movd	%esi, %xmm1
	shrl	$2, %edx
	leaq	16(%rax), %r9
	pshufd	$0, %xmm1, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%edi, %edx
	andl	$-4, %edx
	leal	2(%rdx), %eax
	cmpl	%edi, %edx
	je	.L11
.L12:
	movslq	%eax, %rdx
	leaq	low(%rip), %rbx
	movl	%esi, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L11
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%esi, (%rbx,%rdx,4)
	cmpl	%eax, %r8d
	jl	.L11
	cltq
	movl	%esi, (%rbx,%rax,4)
.L11:
	movl	$0, i(%rip)
	leaq	low(%rip), %rbx
	testl	%ecx, %ecx
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L15:
	movl	$0, f(%rip)
	.p2align 4,,10
	.p2align 3
.L56:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L56
	.p2align 4,,10
	.p2align 3
.L20:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L20
	movl	f(%rip), %eax
	movl	$0, f(%rip)
	movl	%eax, X(%rip)
	.p2align 4,,10
	.p2align 3
.L57:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L57
	.p2align 4,,10
	.p2align 3
.L23:
	movl	f(%rip), %eax
	subl	$48, %edx
	movq	stdin(%rip), %rdi
	movsbl	%dl, %edx
	leal	(%rax,%rax,4), %eax
	leal	(%rdx,%rax,2), %eax
	movl	%eax, f(%rip)
	call	getc@PLT
	movb	%al, c(%rip)
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L23
	movl	f(%rip), %eax
	movslq	X(%rip), %rdx
	movl	%eax, Y(%rip)
	cmpl	%eax, (%rbx,%rdx,4)
	jle	.L24
	movl	%eax, (%rbx,%rdx,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, N(%rip)
	movl	%eax, i(%rip)
	jg	.L15
.L55:
	movl	H(%rip), %r8d
.L26:
	movl	$2, i(%rip)
	cmpl	$1, %r8d
	jle	.L27
	movl	p(%rip), %esi
	xorl	%edi, %edi
	xorl	%r10d, %r10d
	movl	$2, %eax
	movl	MAX(%rip), %r9d
	leaq	8+low(%rip), %rcx
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L29:
	jl	.L58
.L28:
	addl	$1, %eax
	addq	$4, %rcx
	movl	$1, %edi
	cmpl	%r8d, %eax
	jg	.L59
	movl	%eax, %ebp
.L33:
	movl	(%rcx), %edx
	cmpl	%r9d, %edx
	je	.L28
	addl	%esi, %edx
	cmpl	%eax, %edx
	jne	.L29
	addl	$1, %esi
	movl	$1, %r10d
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L24:
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L15
	jmp	.L55
.L59:
	movl	%eax, i(%rip)
	testb	%r10b, %r10b
	je	.L27
	movl	%esi, p(%rip)
.L27:
	movl	%r8d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L53:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L58:
	.cfi_restore_state
	testb	%dil, %dil
	je	.L30
	movl	%ebp, i(%rip)
.L30:
	testb	%r10b, %r10b
	je	.L31
	movl	%esi, p(%rip)
.L31:
	leal	-1(%rax), %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L53
.L34:
	movl	$2, %eax
	jmp	.L12
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	min, .-min
	.globl	MAX
	.data
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.long	524288
	.globl	j
	.bss
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	low
	.align 32
	.type	low, @object
	.size	low, 800004
low:
	.zero	800004
	.globl	Y
	.align 4
	.type	Y, @object
	.size	Y, 4
Y:
	.zero	4
	.globl	X
	.align 4
	.type	X, @object
	.size	X, 4
X:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	f
	.align 4
	.type	f, @object
	.size	f, 4
f:
	.zero	4
	.globl	c
	.type	c, @object
	.size	c, 1
c:
	.zero	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>

char c;
int f;
int nextInt();
int min(int a, int b);

int H, W, N, X, Y, low[200001], p, i, j;
int MAX = 524288;

int main(void){
	H=nextInt();
	W=nextInt();
	N=nextInt();
	for(i=2; i<=H; i++){
		low[i]=MAX;
	}
	for(i=0; i<N; i++){
		X=nextInt();
		Y=nextInt();
		if(Y<low[X]){
			low[X]=Y;
		}
	}
	for(i=2; i<=H; i++){
		if(low[i]==MAX){
		}else if(low[i]+p==i){
			p++;
		}else if(low[i]+p<i){
			printf("%d\n", i-1);
			return 0;
		}
	}
	printf("%d\n", H);
	return 0;
}

int nextInt(){
	f=0;
	c = getchar();
	while((c<'0')||('9'<c)){
		c=getchar();
	}
	while((c>='0')&&(c<='9')){
		f=f*10+(c-'0');
		c=getchar();
	}
	return f;
}

int min(int a, int b){
	return a>b?b:a;
}

3 6 1
3 2
 100001 100000 0
 10 10 14
4 3
2 2
7 3
9 10
7 9
8 1
10 10
5 4
3 4
2 8
6 4
4 4
5 8
9 2
 100101 100000 0
 10 10 14
4 3
2 1
7 3
9 10
7 9
8 1
10 10
5 4
3 4
2 8
6 4
4 4
5 8
9 2
 110101 100000 0
 110111 100000 0
 010101 111001 0
 110100 100000 0
 100111 100000 0

2
 100001
 6
 100101
 1
 110101
 110111
 10101
 110100
 100111

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>

char c;
int f;
int nextInt();
int min(int a, int b);

int H, W, N, X, Y, low[200001], p, i, j;
int MAX = 524288;

int main(void){
	H=nextInt();
	W=nextInt();
	N=nextInt();
	for(i=2; i<=H; i++){
		low[i]=MAX;
	}
	for(i=0; i<N; i++){
		X=nextInt();
		Y=nextInt();
		if(Y<low[X]){
			low[X]=Y;
		}
	}
	for(i=2; i<=H; i++){
		if(low[i]==MAX){
		}else if(low[i]+p==i){
			p++;
		}else if(low[i]+p<i){
			printf("%d\n", i-1);
			return 0;
		}
	}
	printf("%d\n", H);
	return 0;
}

int nextInt(){
	f=0;
	c = getchar();
	while((c<'0')||('9'<c)){
		c=getchar();
	}
	while((c>='0')&&(c<='9')){
		f=f*10+(c-'0');
		c=getchar();
	}
	return f;
}

int min(int a, int b){
	return a>b?b:a;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	c
	.bss
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.globl	f
	.align 4
	.type	f, @object
	.size	f, 4
f:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 4
	.type	X, @object
	.size	X, 4
X:
	.zero	4
	.globl	Y
	.align 4
	.type	Y, @object
	.size	Y, 4
Y:
	.zero	4
	.globl	low
	.align 32
	.type	low, @object
	.size	low, 800004
low:
	.zero	800004
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	MAX
	.data
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.long	524288
	.section	.rodata
.LC0:
	.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
	movl	$0, %eax
	call	nextInt
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, W(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %edx
	movl	MAX(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	$0, %eax
	call	nextInt
	movl	%eax, X(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, Y(%rip)
	movl	X(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	Y(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	X(%rip), %edx
	movl	Y(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	$2, i(%rip)
	jmp	.L7
.L11:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	MAX(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L10
.L8:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	H(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
	jmp	.L13
.L14:
	call	getchar@PLT
	movb	%al, c(%rip)
.L13:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L14
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jg	.L14
	jmp	.L15
.L17:
	movl	f(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movzbl	c(%rip), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
.L15:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L16
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jle	.L17
.L16:
	movl	f(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	min
	.type	min, @function
min:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.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	c
	.bss
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.globl	f
	.align 4
	.type	f, @object
	.size	f, 4
f:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 4
	.type	X, @object
	.size	X, 4
X:
	.zero	4
	.globl	Y
	.align 4
	.type	Y, @object
	.size	Y, 4
Y:
	.zero	4
	.globl	low
	.align 32
	.type	low, @object
	.size	low, 800004
low:
	.zero	800004
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	MAX
	.data
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.long	524288
	.section	.rodata
.LC0:
	.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
	movl	$0, %eax
	call	nextInt
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, W(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %edx
	movl	MAX(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	$0, %eax
	call	nextInt
	movl	%eax, X(%rip)
	movl	$0, %eax
	call	nextInt
	movl	%eax, Y(%rip)
	movl	X(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	Y(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	X(%rip), %edx
	movl	Y(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	low(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	$2, i(%rip)
	jmp	.L7
.L11:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	MAX(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	low(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	p(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L10
.L8:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	H(%rip), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	H(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
	jmp	.L13
.L14:
	call	getchar@PLT
	movb	%al, c(%rip)
.L13:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L14
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jg	.L14
	jmp	.L15
.L17:
	movl	f(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movzbl	c(%rip), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, f(%rip)
	call	getchar@PLT
	movb	%al, c(%rip)
.L15:
	movzbl	c(%rip), %eax
	cmpb	$47, %al
	jle	.L16
	movzbl	c(%rip), %eax
	cmpb	$57, %al
	jle	.L17
.L16:
	movl	f(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	min
	.type	min, @function
min:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.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:
