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

```c
h[201],w[201],d[201];main(n,i,j,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
for(i=0;i<n;i++)scanf("%d%d",h+i,w+i);
for(scanf("%d",&r),n+=r;i<n;i++)scanf("%d%d",h+i,w+i);
for(i=0;i<n-1;i++)for(j=0;j<n-i-1;j++)if(h[j]>h[j+1])r=h[j],h[j]=h[j+1],h[j+1]=r,r=w[j],w[j]=w[j+1],w[j+1]=r;
for(memset(d,0,sizeof(d)),r=i=0;i<n;r=r>d[i]?r:d[i],i++)for(d[i]=1,j=0;j<i;j++)if(h[j]<h[i]&&w[j]<w[i])d[i]=d[j]>=d[i]?d[j]+1:d[i];
}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	h
	.bss
	.align 32
	.type	h, @object
	.size	h, 804
h:
	.zero	804
	.globl	w
	.align 32
	.type	w, @object
	.size	w, 804
w:
	.zero	804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 804
d:
	.zero	804
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	jmp	.L2
.L19:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	$0, -8(%rbp)
	jmp	.L7
.L11:
	movl	$0, -12(%rbp)
	jmp	.L8
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L9:
	addl	$1, -12(%rbp)
.L8:
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L10
	addl	$1, -8(%rbp)
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L11
	movl	$804, %edx
	movl	$0, %esi
	leaq	d(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L18:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	w(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
.L16:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	addl	$1, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
.L12:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L18
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %edi
	call	exit@PLT
	.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	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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
	leaq	w(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	h(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	leaq	12(%rsp), %rax
	movl	%edi, 12(%rsp)
	movl	%ecx, 8(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, %ebp
	movl	$0, %r15d
	leaq	.LC0(%rip), %r14
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, 12(%rsp)
	jg	.L3
.L19:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	8(%rsp), %r8d
	addl	12(%rsp), %r8d
	movl	%r8d, 12(%rsp)
	cmpl	%r15d, %r8d
	jle	.L4
	movslq	%r15d, %rcx
	leaq	.LC0(%rip), %r14
	leaq	0(,%rcx,4), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %r8d
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, %r8d
	jg	.L5
.L4:
	leal	-1(%r8), %eax
	leaq	4+h(%rip), %r10
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	leaq	h(%rip), %rdx
	leaq	w(%rip), %rcx
	movq	%rax, %r9
	leaq	(%r10,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jge	.L8
	movq	%xmm1, (%rdx)
	rolq	$32, (%rcx)
.L8:
	addq	$4, %rdx
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	jne	.L9
	movl	%r9d, %eax
	testl	%r9d, %r9d
	jne	.L7
.L6:
	leaq	d(%rip), %r9
	movl	$100, %ecx
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	movq	%r9, %rdi
	movl	$0, 8(%rsp)
	rep stosq
	movl	$0, (%rdi)
	testl	%r8d, %r8d
	jle	.L11
	movl	$1, d(%rip)
	movl	$1, %r14d
	cmpl	$1, %r8d
	je	.L14
	leaq	4+d(%rip), %r10
	movl	$4, %edx
	movl	$1, %r15d
	movl	$1, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$1, (%r10)
	movl	(%r12,%rdx), %ecx
	xorl	%eax, %eax
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%ecx, (%r12,%rax)
	jge	.L15
	movl	0(%r13,%rdx), %edi
	cmpl	%edi, 0(%r13,%rax)
	jge	.L15
	movl	(%r9,%rax), %edi
	leal	1(%rdi), %r11d
	cmpl	%esi, %edi
	cmovge	%r11d, %esi
	movl	%esi, (%r10)
.L15:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L12
	movl	(%r10), %eax
	cmpl	%eax, %r14d
	cmovl	%eax, %r14d
	addl	$1, %r15d
	addq	$4, %r10
	addq	$4, %rdx
	cmpl	%r8d, %r15d
	jne	.L13
.L14:
	movl	%r14d, 8(%rsp)
.L11:
	movl	%r14d, %esi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L18:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 804
d:
	.zero	804
	.globl	w
	.align 32
	.type	w, @object
	.size	w, 804
w:
	.zero	804
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 804
h:
	.zero	804
	.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	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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
	leaq	w(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	h(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	leaq	12(%rsp), %rax
	movl	%edi, 12(%rsp)
	movl	%ecx, 8(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, %ebp
	movl	$0, %r15d
	leaq	.LC0(%rip), %r14
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, 12(%rsp)
	jg	.L3
.L19:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	8(%rsp), %r8d
	addl	12(%rsp), %r8d
	movl	%r8d, 12(%rsp)
	cmpl	%r15d, %r8d
	jle	.L4
	movslq	%r15d, %rcx
	leaq	.LC0(%rip), %r14
	leaq	0(,%rcx,4), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %r8d
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, %r8d
	jg	.L5
.L4:
	leal	-1(%r8), %eax
	leaq	4+h(%rip), %r10
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	leaq	h(%rip), %rdx
	leaq	w(%rip), %rcx
	movq	%rax, %r9
	leaq	(%r10,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jge	.L8
	movq	%xmm1, (%rdx)
	rolq	$32, (%rcx)
.L8:
	addq	$4, %rdx
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	jne	.L9
	movl	%r9d, %eax
	testl	%r9d, %r9d
	jne	.L7
.L6:
	leaq	d(%rip), %r9
	movl	$100, %ecx
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	movq	%r9, %rdi
	movl	$0, 8(%rsp)
	rep stosq
	movl	$0, (%rdi)
	testl	%r8d, %r8d
	jle	.L11
	movl	$1, d(%rip)
	movl	$1, %r14d
	cmpl	$1, %r8d
	je	.L14
	leaq	4+d(%rip), %r10
	movl	$4, %edx
	movl	$1, %r15d
	movl	$1, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$1, (%r10)
	movl	(%r12,%rdx), %ecx
	xorl	%eax, %eax
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%ecx, (%r12,%rax)
	jge	.L15
	movl	0(%r13,%rdx), %edi
	cmpl	%edi, 0(%r13,%rax)
	jge	.L15
	movl	(%r9,%rax), %edi
	leal	1(%rdi), %r11d
	cmpl	%esi, %edi
	cmovge	%r11d, %esi
	movl	%esi, (%r10)
.L15:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L12
	movl	(%r10), %eax
	cmpl	%eax, %r14d
	cmovl	%eax, %r14d
	addl	$1, %r15d
	addq	$4, %r10
	addq	$4, %rdx
	cmpl	%r8d, %r15d
	jne	.L13
.L14:
	movl	%r14d, 8(%rsp)
.L11:
	movl	%r14d, %esi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L18:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 804
d:
	.zero	804
	.globl	w
	.align 32
	.type	w, @object
	.size	w, 804
w:
	.zero	804
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 804
h:
	.zero	804
	.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:

h[201],w[201],d[201];main(n,i,j,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
for(i=0;i<n;i++)scanf("%d%d",h+i,w+i);
for(scanf("%d",&r),n+=r;i<n;i++)scanf("%d%d",h+i,w+i);
for(i=0;i<n-1;i++)for(j=0;j<n-i-1;j++)if(h[j]>h[j+1])r=h[j],h[j]=h[j+1],h[j+1]=r,r=w[j],w[j]=w[j+1],w[j+1]=r;
for(memset(d,0,sizeof(d)),r=i=0;i<n;r=r>d[i]?r:d[i],i++)for(d[i]=1,j=0;j<i;j++)if(h[j]<h[i]&&w[j]<w[i])d[i]=d[j]>=d[i]?d[j]+1:d[i];
}exit(0);}
6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 1
5 4
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
2 2
5 4
6 6
4
1 1
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 2
5 4
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
2 2
5 4
6 6
4
1 2
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 2
5 4
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
4 2
5 4
6 6
4
1 1
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 0
8 6
10 10
14 14
5
2 2
5 4
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
2 2
9 4
6 6
4
1 2
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 0
8 6
10 10
14 14
5
2 2
5 4
6 6
9 10
15 10
4
1 1
4 3
6 5
12 6
3
2 2
9 4
9 6
4
1 2
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 0
8 6
10 10
14 14
5
2 2
5 4
6 6
9 8
15 10
4
2 1
4 3
6 5
8 6
3
2 2
9 4
6 6
4
1 2
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 0
8 6
10 10
14 14
5
2 2
5 4
6 6
9 10
15 10
4
1 1
4 3
6 5
12 6
3
1 2
9 4
9 6
4
1 2
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 2
5 4
6 6
9 15
15 20
4
1 1
4 3
6 3
8 6
3
4 2
5 4
6 6
4
1 1
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
0 1
4 3
6 5
8 6
10 10
14 14
5
2 1
5 5
6 6
9 8
15 10
4
1 1
4 3
6 5
8 6
3
2 2
5 4
6 6
4
1 1
4 3
6 5
8 6
4
10 10
12 11
18 15
24 20
0
 6
1 1
4 3
6 5
8 6
10 10
14 14
5
2 2
5 4
6 6
9 15
15 10
4
1 1
4 3
6 5
8 11
3
4 2
5 4
6 7
4
1 1
4 3
6 5
8 6
4
10 2
12 11
18 15
24 20
0

8
6
8
 9
6
8
 9
5
8
 8
5
8
 7
5
8
 8
4
8
 7
4
8
 9
4
8
 7
6
8
 8
5
7

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

```c
h[201],w[201],d[201];main(n,i,j,r){for(;scanf("%d",&n),n;printf("%d\n",r)){
for(i=0;i<n;i++)scanf("%d%d",h+i,w+i);
for(scanf("%d",&r),n+=r;i<n;i++)scanf("%d%d",h+i,w+i);
for(i=0;i<n-1;i++)for(j=0;j<n-i-1;j++)if(h[j]>h[j+1])r=h[j],h[j]=h[j+1],h[j+1]=r,r=w[j],w[j]=w[j+1],w[j+1]=r;
for(memset(d,0,sizeof(d)),r=i=0;i<n;r=r>d[i]?r:d[i],i++)for(d[i]=1,j=0;j<i;j++)if(h[j]<h[i]&&w[j]<w[i])d[i]=d[j]>=d[i]?d[j]+1:d[i];
}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	h
	.bss
	.align 32
	.type	h, @object
	.size	h, 804
h:
	.zero	804
	.globl	w
	.align 32
	.type	w, @object
	.size	w, 804
w:
	.zero	804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 804
d:
	.zero	804
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	jmp	.L2
.L19:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	$0, -8(%rbp)
	jmp	.L7
.L11:
	movl	$0, -12(%rbp)
	jmp	.L8
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L9:
	addl	$1, -12(%rbp)
.L8:
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L10
	addl	$1, -8(%rbp)
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L11
	movl	$804, %edx
	movl	$0, %esi
	leaq	d(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L18:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	w(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
.L16:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	addl	$1, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
.L12:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L18
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %edi
	call	exit@PLT
	.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	h
	.bss
	.align 32
	.type	h, @object
	.size	h, 804
h:
	.zero	804
	.globl	w
	.align 32
	.type	w, @object
	.size	w, 804
w:
	.zero	804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 804
d:
	.zero	804
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	jmp	.L2
.L19:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -8(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	$0, -8(%rbp)
	jmp	.L7
.L11:
	movl	$0, -12(%rbp)
	jmp	.L8
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	w(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L9:
	addl	$1, -12(%rbp)
.L8:
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L10
	addl	$1, -8(%rbp)
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L11
	movl	$804, %edx
	movl	$0, %esi
	leaq	d(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -8(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L18:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	h(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	w(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	w(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
.L16:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	addl	$1, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
.L12:
	movl	-4(%rbp), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L18
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %edi
	call	exit@PLT
	.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:
