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

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct d{int r,h;}d;
d ds[200];
int n,m,i,j,t,dp[201];
int c(const void *a,const void *b)
{
	d x=*(d*)a,y=*(d*)b;
	if(x.r==y.r)
		return x.h-y.h;
	else
		return x.r-y.r;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(dp,0,sizeof(dp));
		for(i=0;i<n;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		for(scanf("%d",&m);i-n<m;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		qsort(ds,n+m,sizeof(d),c);
		for(i=t=0;i<n+m;i++)
		{
			for(j=0,dp[i]=1;j<i;j++)
				if(ds[j].r<ds[i].r&&ds[j].h<ds[i].h)
					dp[i]=dp[i]<dp[j]+1?dp[j]+1:dp[i];
			t=t<dp[i]?dp[i]:t;
		}
		printf("%d\n",t);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ds
	.bss
	.align 32
	.type	ds, @object
	.size	ds, 1600
ds:
	.zero	1600
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 804
dp:
	.zero	804
	.text
	.globl	c
	.type	c, @function
c:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-12(%rbp), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	jmp	.L4
.L2:
	movl	-16(%rbp), %eax
	movl	-8(%rbp), %edx
	subl	%edx, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L6
.L18:
	movl	$804, %edx
	movl	$0, %esi
	leaq	dp(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L9
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %eax
	movl	n(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	ds(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, t(%rip)
	movl	t(%rip), %eax
	movl	%eax, i(%rip)
	jmp	.L11
.L17:
	movl	$0, j(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$1, (%rdx,%rax)
	jmp	.L12
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
.L15:
	movl	i(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, t(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L17
	movl	t(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %ecx
	movl	(%rsi), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	cmpl	%edx, %ecx
	je	.L5
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	4+ds(%rip), %r15
	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
	leaq	dp(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L36
	movl	$100, %ecx
	movl	$0, %eax
	movq	%rbp, %rdi
	movl	$0, i(%rip)
	rep stosq
	leaq	ds(%rip), %rbx
	leaq	.LC1(%rip), %r12
	movl	$0, (%rdi)
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L8:
	cltq
	movq	%r12, %rdi
	salq	$3, %rax
	leaq	(%rbx,%rax), %rdx
	leaq	4(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L8
.L11:
	leaq	m(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	n(%rip), %edx
	leaq	.LC1(%rip), %r12
	movl	m(%rip), %ecx
	movl	%eax, %esi
	subl	%edx, %esi
	cmpl	%ecx, %esi
	jge	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	cltq
	movq	%r12, %rdi
	salq	$3, %rax
	leaq	(%rbx,%rax), %rdx
	leaq	4(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	n(%rip), %edx
	movl	m(%rip), %ecx
	addl	$1, %eax
	movl	%eax, %esi
	movl	%eax, i(%rip)
	subl	%edx, %esi
	cmpl	%ecx, %esi
	jl	.L9
.L10:
	addl	%ecx, %edx
	movq	%rbx, %rdi
	leaq	c(%rip), %rcx
	xorl	%r12d, %r12d
	movslq	%edx, %rsi
	movl	$8, %edx
	call	qsort@PLT
	movl	m(%rip), %eax
	addl	n(%rip), %eax
	movl	$0, t(%rip)
	movl	$0, i(%rip)
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jle	.L13
	movl	$0, j(%rip)
	cmpl	$1, 12(%rsp)
	movl	$1, dp(%rip)
	je	.L37
	movslq	12(%rsp), %r14
	leaq	4+dp(%rip), %r9
	movl	$1, %r11d
	xorl	%edx, %edx
	leaq	8+ds(%rip), %rdi
	movl	$1, %r12d
	.p2align 4,,10
	.p2align 3
.L17:
	movl	$1, (%r9)
	movl	(%rdi), %esi
	movl	%r11d, %r13d
	xorl	%eax, %eax
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%esi, (%rbx,%rax,8)
	jge	.L14
	movl	4(%rdi), %ecx
	cmpl	%ecx, (%r15,%rax,8)
	jge	.L14
	movl	0(%rbp,%rax,4), %ecx
	leal	1(%rcx), %r10d
	cmpl	%r8d, %ecx
	cmovge	%r10d, %r8d
	movl	%r8d, (%r9)
.L14:
	addq	$1, %rax
	leal	-1(%rax), %ecx
	cmpl	%edx, %ecx
	jl	.L16
	movl	(%r9), %eax
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
	addq	$1, %r11
	addl	$1, %edx
	addq	$4, %r9
	addq	$8, %rdi
	cmpq	%r11, %r14
	jne	.L17
	movl	12(%rsp), %eax
	movl	%r12d, t(%rip)
	movl	%r13d, j(%rip)
	movl	%eax, i(%rip)
.L13:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L36:
	addq	$24, %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
.L37:
	.cfi_restore_state
	movl	$1, t(%rip)
	movl	$1, %r12d
	movl	$1, i(%rip)
	jmp	.L13
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 804
dp:
	.zero	804
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	j
	.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	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	ds
	.align 32
	.type	ds, @object
	.size	ds, 1600
ds:
	.zero	1600
	.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	c
	.type	c, @function
c:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %ecx
	movl	(%rsi), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	cmpl	%edx, %ecx
	je	.L5
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	4+ds(%rip), %r15
	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
	leaq	dp(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L36
	movl	$100, %ecx
	movl	$0, %eax
	movq	%rbp, %rdi
	movl	$0, i(%rip)
	rep stosq
	leaq	ds(%rip), %rbx
	leaq	.LC1(%rip), %r12
	movl	$0, (%rdi)
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L8:
	cltq
	movq	%r12, %rdi
	salq	$3, %rax
	leaq	(%rbx,%rax), %rdx
	leaq	4(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L8
.L11:
	leaq	m(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	n(%rip), %edx
	leaq	.LC1(%rip), %r12
	movl	m(%rip), %ecx
	movl	%eax, %esi
	subl	%edx, %esi
	cmpl	%ecx, %esi
	jge	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	cltq
	movq	%r12, %rdi
	salq	$3, %rax
	leaq	(%rbx,%rax), %rdx
	leaq	4(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	n(%rip), %edx
	movl	m(%rip), %ecx
	addl	$1, %eax
	movl	%eax, %esi
	movl	%eax, i(%rip)
	subl	%edx, %esi
	cmpl	%ecx, %esi
	jl	.L9
.L10:
	addl	%ecx, %edx
	movq	%rbx, %rdi
	leaq	c(%rip), %rcx
	xorl	%r12d, %r12d
	movslq	%edx, %rsi
	movl	$8, %edx
	call	qsort@PLT
	movl	m(%rip), %eax
	addl	n(%rip), %eax
	movl	$0, t(%rip)
	movl	$0, i(%rip)
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jle	.L13
	movl	$0, j(%rip)
	cmpl	$1, 12(%rsp)
	movl	$1, dp(%rip)
	je	.L37
	movslq	12(%rsp), %r14
	leaq	4+dp(%rip), %r9
	movl	$1, %r11d
	xorl	%edx, %edx
	leaq	8+ds(%rip), %rdi
	movl	$1, %r12d
	.p2align 4,,10
	.p2align 3
.L17:
	movl	$1, (%r9)
	movl	(%rdi), %esi
	movl	%r11d, %r13d
	xorl	%eax, %eax
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%esi, (%rbx,%rax,8)
	jge	.L14
	movl	4(%rdi), %ecx
	cmpl	%ecx, (%r15,%rax,8)
	jge	.L14
	movl	0(%rbp,%rax,4), %ecx
	leal	1(%rcx), %r10d
	cmpl	%r8d, %ecx
	cmovge	%r10d, %r8d
	movl	%r8d, (%r9)
.L14:
	addq	$1, %rax
	leal	-1(%rax), %ecx
	cmpl	%edx, %ecx
	jl	.L16
	movl	(%r9), %eax
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
	addq	$1, %r11
	addl	$1, %edx
	addq	$4, %r9
	addq	$8, %rdi
	cmpq	%r11, %r14
	jne	.L17
	movl	12(%rsp), %eax
	movl	%r12d, t(%rip)
	movl	%r13d, j(%rip)
	movl	%eax, i(%rip)
.L13:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L36:
	addq	$24, %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
.L37:
	.cfi_restore_state
	movl	$1, t(%rip)
	movl	$1, %r12d
	movl	$1, i(%rip)
	jmp	.L13
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 804
dp:
	.zero	804
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	j
	.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	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	ds
	.align 32
	.type	ds, @object
	.size	ds, 1600
ds:
	.zero	1600
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct d{int r,h;}d;
d ds[200];
int n,m,i,j,t,dp[201];
int c(const void *a,const void *b)
{
	d x=*(d*)a,y=*(d*)b;
	if(x.r==y.r)
		return x.h-y.h;
	else
		return x.r-y.r;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(dp,0,sizeof(dp));
		for(i=0;i<n;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		for(scanf("%d",&m);i-n<m;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		qsort(ds,n+m,sizeof(d),c);
		for(i=t=0;i<n+m;i++)
		{
			for(j=0,dp[i]=1;j<i;j++)
				if(ds[j].r<ds[i].r&&ds[j].h<ds[i].h)
					dp[i]=dp[i]<dp[j]+1?dp[j]+1:dp[i];
			t=t<dp[i]?dp[i]:t;
		}
		printf("%d\n",t);
	}
	return 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
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct d{int r,h;}d;
d ds[200];
int n,m,i,j,t,dp[201];
int c(const void *a,const void *b)
{
	d x=*(d*)a,y=*(d*)b;
	if(x.r==y.r)
		return x.h-y.h;
	else
		return x.r-y.r;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(dp,0,sizeof(dp));
		for(i=0;i<n;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		for(scanf("%d",&m);i-n<m;i++)
			scanf("%d%d",&ds[i].h,&ds[i].r);
		qsort(ds,n+m,sizeof(d),c);
		for(i=t=0;i<n+m;i++)
		{
			for(j=0,dp[i]=1;j<i;j++)
				if(ds[j].r<ds[i].r&&ds[j].h<ds[i].h)
					dp[i]=dp[i]<dp[j]+1?dp[j]+1:dp[i];
			t=t<dp[i]?dp[i]:t;
		}
		printf("%d\n",t);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ds
	.bss
	.align 32
	.type	ds, @object
	.size	ds, 1600
ds:
	.zero	1600
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 804
dp:
	.zero	804
	.text
	.globl	c
	.type	c, @function
c:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-12(%rbp), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	jmp	.L4
.L2:
	movl	-16(%rbp), %eax
	movl	-8(%rbp), %edx
	subl	%edx, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L6
.L18:
	movl	$804, %edx
	movl	$0, %esi
	leaq	dp(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L9
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %eax
	movl	n(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	ds(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, t(%rip)
	movl	t(%rip), %eax
	movl	%eax, i(%rip)
	jmp	.L11
.L17:
	movl	$0, j(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$1, (%rdx,%rax)
	jmp	.L12
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
.L15:
	movl	i(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, t(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L17
	movl	t(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	ds
	.bss
	.align 32
	.type	ds, @object
	.size	ds, 1600
ds:
	.zero	1600
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 804
dp:
	.zero	804
	.text
	.globl	c
	.type	c, @function
c:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-12(%rbp), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	jmp	.L4
.L2:
	movl	-16(%rbp), %eax
	movl	-8(%rbp), %edx
	subl	%edx, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L6
.L18:
	movl	$804, %edx
	movl	$0, %esi
	leaq	dp(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L9
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %eax
	movl	n(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	ds(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, t(%rip)
	movl	t(%rip), %eax
	movl	%eax, i(%rip)
	jmp	.L11
.L17:
	movl	$0, j(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$1, (%rdx,%rax)
	jmp	.L12
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ds(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ds(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$1, %eax
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
.L15:
	movl	i(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, t(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	n(%rip), %edx
	movl	m(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L17
	movl	t(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
