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>

typedef struct {
	int w;
	int h;
} mt;

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

int main(void) {
	while(1) {
		int N, M, i, j;
		mt M1[100];
		mt M2[100];
		mt M3[200];
		scanf("%d", &N);
		if (N == 0) break;
		for(i = 0; i < N; i++) {
			scanf("%d %d", &(M1[i].w), &(M1[i].h));
		}
		scanf("%d", &M);
		for(j = 0; j < M; j++) {
			scanf("%d %d", &(M2[j].w), &(M2[j].h));
		}
		
		//merge
		int target = 0;
		int lt = 0, gt = 0;
		while(1) {
			while(lt < N && gt < M && M1[lt].w > M2[gt].w) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w < M2[gt].w) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w == M2[gt].w) {
				if (M1[lt].h < M2[gt].h) {
					M3[target].w = M1[lt].w;
					M3[target].h = M1[lt].h;
					lt++;
					target++;
				} else {
					M3[target].w = M2[lt].w;
					M3[target].h = M2[lt].h;
					gt++;
					target++;
				}
			}
			while(lt == N && gt < M) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(gt == M && lt < N) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			if (lt == N && gt == M) break;
		}
		
		//dp
		int dp[200] = {0};

		for(i = 0; i < N + M - 1; i++) {
			for(j = i + 1; j < N + M; j++) {
				if (M3[i].w < M3[j].w && M3[i].h < M3[j].h) {
					dp[j] = max(dp[j], dp[i] + 1);					
				}
			}
		}
		int ans = 0;
		for(i = 0; i < N + M; i++) {
			if (dp[i] > ans) {
				ans = dp[i];
			}
		}
		printf("%d\n", ans + 1);
	}
	
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L37:
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4048(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	$0, -4040(%rbp)
	jmp	.L6
.L7:
	leaq	-4016(%rbp), %rdx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-4016(%rbp), %rcx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4040(%rbp)
.L6:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L7
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4036(%rbp)
	jmp	.L8
.L9:
	leaq	-3216(%rbp), %rdx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-3216(%rbp), %rcx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4036(%rbp)
.L8:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L9
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	movl	$0, -4024(%rbp)
	jmp	.L10
.L12:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L10:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L13
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L13
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jg	.L12
	jmp	.L13
.L15:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L13:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L16
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L16
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jl	.L15
	jmp	.L16
.L19:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
	jmp	.L16
.L17:
	movl	-4028(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L16:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L20
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L20
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	je	.L19
	jmp	.L20
.L22:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L20:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L23
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L22
	jmp	.L23
.L25:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L23:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jne	.L24
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L25
.L24:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L10
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	je	.L41
	jmp	.L10
.L41:
	nop
	leaq	-2416(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -4040(%rbp)
	jmp	.L29
.L33:
	movl	-4040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4036(%rbp)
	jmp	.L30
.L32:
	movl	-4040(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-4036(%rbp), %edx
	movslq	%edx, %rdx
	movl	%eax, -2416(%rbp,%rdx,4)
.L31:
	addl	$1, -4036(%rbp)
.L30:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L32
	addl	$1, -4040(%rbp)
.L29:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L33
	movl	$0, -4020(%rbp)
	movl	$0, -4040(%rbp)
	jmp	.L34
.L36:
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	cmpl	%eax, -4020(%rbp)
	jge	.L35
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
.L35:
	addl	$1, -4040(%rbp)
.L34:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L36
	movl	-4020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.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:
.LFB24:
	.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
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	2448(%rsp), %r13
	movq	%rax, 16(%rsp)
	leaq	2456(%rsp), %rax
	movq	%rax, 24(%rsp)
.L51:
	movq	16(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	je	.L4
	leaq	48(%rsp), %rbx
	movl	$0, %ebp
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, 40(%rsp)
	jg	.L8
.L9:
	leaq	44(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r9d
	leaq	848(%rsp), %rbx
	testl	%r9d, %r9d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r9d
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %r9d
	jg	.L10
.L7:
	leaq	48(%rsp), %rbx
	movl	40(%rsp), %edi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%rbx, 8(%rsp)
	xorl	%eax, %eax
	leaq	848(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%r9d, %ecx
	jge	.L61
	cmpl	%edx, %edi
	jg	.L87
.L15:
	cmpl	%edx, %edi
	jne	.L26
	movslq	%ecx, %rsi
	cmpl	%ecx, %r9d
	jg	.L30
	jne	.L11
.L52:
	leaq	1648(%rsp), %r11
	movl	$100, %ecx
	xorl	%eax, %eax
	addl	%r9d, %edx
	movq	%r11, %rdi
	rep stosq
	cmpl	$1, %edx
	jle	.L44
	leal	-2(%rdx), %r12d
	movq	24(%rsp), %r10
	movq	%r13, %r9
	leal	-1(%rdx), %r14d
	leaq	1652(%rsp), %rbp
	addq	$2, %r12
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L43:
	cmpl	%ebx, %edx
	jle	.L47
	movl	%r14d, %eax
	movl	(%r9), %r8d
	movq	%rbp, %rcx
	subl	%ebx, %eax
	leaq	-1(%rbx,%rax), %rax
	leaq	(%r10,%rax,8), %rdi
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L46:
	cmpl	8(%rax), %r8d
	jge	.L45
	movl	12(%rax), %esi
	cmpl	%esi, 4(%r9)
	jge	.L45
	movl	-4(%rbp), %esi
	movl	(%rcx), %r15d
	addl	$1, %esi
	cmpl	%r15d, %esi
	cmovl	%r15d, %esi
	movl	%esi, (%rcx)
.L45:
	addq	$8, %rax
	addq	$4, %rcx
	cmpq	%rax, %rdi
	jne	.L46
.L47:
	addq	$1, %rbx
	addq	$8, %r9
	addq	$4, %rbp
	cmpq	%r12, %rbx
	jne	.L43
.L44:
	testl	%edx, %edx
	jle	.L88
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L58
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	1664(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L49:
	movdqa	%xmm0, %xmm1
	addq	$16, %r11
	pcmpgtd	-16(%r11), %xmm1
	pand	%xmm1, %xmm0
	pandn	-16(%r11), %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %r11
	jne	.L49
	movdqa	%xmm0, %xmm2
	movl	%edx, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %eax
	testb	$3, %dl
	je	.L50
.L48:
	movslq	%ecx, %rsi
	movl	1648(%rsp,%rsi,4), %esi
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L50
	movslq	%esi, %rsi
	movl	1648(%rsp,%rsi,4), %esi
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	addl	$2, %ecx
	cmpl	%ecx, %edx
	jle	.L50
	movslq	%ecx, %rcx
	movl	1648(%rsp,%rcx,4), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
.L50:
	leal	1(%rax), %edx
.L41:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L61:
	cmpl	%edx, %edi
	jle	.L15
.L14:
	cmpl	%r9d, %ecx
	jne	.L11
.L37:
	movl	%edi, %ebp
	movl	$1, %r15d
	subl	%edx, %ebp
	cmpl	%edx, %edi
	cmovg	%ebp, %r15d
	jle	.L57
	cmpl	$1, %ebp
	je	.L57
	movq	8(%rsp), %rbx
	movl	%r15d, %r8d
	movslq	%edx, %r14
	movslq	%eax, %r10
	shrl	%r8d
	leaq	0(%r13,%r10,8), %r11
	xorl	%esi, %esi
	leaq	(%rbx,%r14,8), %rbx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L33:
	movdqu	(%rbx,%rsi), %xmm4
	movups	%xmm4, (%r11,%rsi)
	addq	$16, %rsi
	cmpq	%rsi, %r8
	jne	.L33
	movl	%r15d, %esi
	andl	$-2, %esi
	andl	$1, %r15d
	je	.L34
.L32:
	addq	%rsi, %r14
	addq	%r10, %rsi
	movq	48(%rsp,%r14,8), %r8
	movq	%r8, 2448(%rsp,%rsi,8)
.L34:
	subl	$1, %ebp
	xorl	%ebx, %ebx
	cmpl	%edx, %edi
	cmovle	%ebx, %ebp
	leal	1(%rax,%rbp), %eax
	leal	1(%rdx,%rbp), %edx
.L38:
	cmpl	%edx, %edi
	jne	.L11
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L78:
	jne	.L11
.L30:
	movl	%r9d, %r14d
	movl	$1, %r15d
	subl	%ecx, %r14d
	cmpl	%r9d, %ecx
	cmovl	%r14d, %r15d
	cmpl	$1, %r14d
	je	.L56
	cmpl	%r9d, %ecx
	jge	.L56
	movl	%r15d, %r11d
	movslq	%eax, %r10
	leaq	(%r12,%rsi,8), %rbp
	xorl	%r8d, %r8d
	shrl	%r11d
	leaq	0(%r13,%r10,8), %rbx
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	0(%rbp,%r8), %xmm5
	movups	%xmm5, (%rbx,%r8)
	addq	$16, %r8
	cmpq	%r11, %r8
	jne	.L28
	movl	%r15d, %r8d
	andl	$-2, %r8d
	andl	$1, %r15d
	je	.L29
.L27:
	addq	%r8, %rsi
	addq	%r10, %r8
	movq	848(%rsp,%rsi,8), %rsi
	movq	%rsi, 2448(%rsp,%r8,8)
.L29:
	subl	$1, %r14d
	xorl	%ebx, %ebx
	cmpl	%r9d, %ecx
	cmovge	%ebx, %r14d
	leal	1(%rcx,%r14), %ecx
	leal	1(%rax,%r14), %eax
	cmpl	%ecx, %r9d
	jne	.L11
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L87:
	movslq	%ecx, %rsi
	movslq	%edx, %r14
	movl	848(%rsp,%rsi,8), %ebx
	cmpl	%ebx, 48(%rsp,%r14,8)
	jle	.L89
	movq	848(%rsp,%rsi,8), %rsi
	movslq	%eax, %r8
	addl	$1, %ecx
	addl	$1, %eax
	movq	%rsi, 0(%r13,%r8,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L89:
	movq	8(%rsp), %r15
	movslq	%eax, %r10
	leaq	0(%r13,%r10,8), %r10
	leaq	(%r15,%r14,8), %r11
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	movd	4(%r11), %xmm3
	addl	$1, %edx
	addl	$1, %eax
	addq	$8, %r11
	movd	%r8d, %xmm0
	addq	$8, %r10
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, -8(%r10)
	cmpl	%edx, %edi
	jle	.L78
.L18:
	movl	(%r11), %r8d
	cmpl	%r8d, %ebx
	jg	.L20
	cmpl	%edx, %edi
	jle	.L78
	movslq	%eax, %r10
	leaq	0(%r13,%r10,8), %r10
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L90:
	addl	$1, %edx
.L24:
	movq	%r11, (%r10)
	cmpl	%edx, %edi
	jle	.L15
	addq	$8, %r10
	cmpl	%r9d, %ecx
	jge	.L14
	movslq	%ecx, %rsi
.L54:
	movslq	%edx, %r8
	movl	848(%rsp,%rsi,8), %ebx
	cmpl	%ebx, 48(%rsp,%r8,8)
	jne	.L26
	movq	48(%rsp,%r8,8), %r11
	movl	852(%rsp,%rsi,8), %ebx
	addl	$1, %eax
	cmpl	%ebx, 52(%rsp,%r8,8)
	jl	.L90
	movq	(%r12,%r8,8), %r11
	addl	$1, %ecx
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%r9d, %ecx
	jne	.L11
	cmpl	%edx, %edi
	jg	.L37
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%esi, %esi
	movslq	%eax, %r10
	movslq	%edx, %r14
	jmp	.L32
.L56:
	xorl	%r8d, %r8d
	movslq	%eax, %r10
	jmp	.L27
.L4:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L91
	addq	$4072, %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
.L88:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L41
.L58:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L48
.L91:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.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:
.LFB24:
	.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
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	2448(%rsp), %r13
	movq	%rax, 16(%rsp)
	leaq	2456(%rsp), %rax
	movq	%rax, 24(%rsp)
.L51:
	movq	16(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	je	.L4
	leaq	48(%rsp), %rbx
	movl	$0, %ebp
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, 40(%rsp)
	jg	.L8
.L9:
	leaq	44(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r9d
	leaq	848(%rsp), %rbx
	testl	%r9d, %r9d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r9d
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %r9d
	jg	.L10
.L7:
	leaq	48(%rsp), %rbx
	movl	40(%rsp), %edi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%rbx, 8(%rsp)
	xorl	%eax, %eax
	leaq	848(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%r9d, %ecx
	jge	.L61
	cmpl	%edx, %edi
	jg	.L87
.L15:
	cmpl	%edx, %edi
	jne	.L26
	movslq	%ecx, %rsi
	cmpl	%ecx, %r9d
	jg	.L30
	jne	.L11
.L52:
	leaq	1648(%rsp), %r11
	movl	$100, %ecx
	xorl	%eax, %eax
	addl	%r9d, %edx
	movq	%r11, %rdi
	rep stosq
	cmpl	$1, %edx
	jle	.L44
	leal	-2(%rdx), %r12d
	movq	24(%rsp), %r10
	movq	%r13, %r9
	leal	-1(%rdx), %r14d
	leaq	1652(%rsp), %rbp
	addq	$2, %r12
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L43:
	cmpl	%ebx, %edx
	jle	.L47
	movl	%r14d, %eax
	movl	(%r9), %r8d
	movq	%rbp, %rcx
	subl	%ebx, %eax
	leaq	-1(%rbx,%rax), %rax
	leaq	(%r10,%rax,8), %rdi
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L46:
	cmpl	8(%rax), %r8d
	jge	.L45
	movl	12(%rax), %esi
	cmpl	%esi, 4(%r9)
	jge	.L45
	movl	-4(%rbp), %esi
	movl	(%rcx), %r15d
	addl	$1, %esi
	cmpl	%r15d, %esi
	cmovl	%r15d, %esi
	movl	%esi, (%rcx)
.L45:
	addq	$8, %rax
	addq	$4, %rcx
	cmpq	%rax, %rdi
	jne	.L46
.L47:
	addq	$1, %rbx
	addq	$8, %r9
	addq	$4, %rbp
	cmpq	%r12, %rbx
	jne	.L43
.L44:
	testl	%edx, %edx
	jle	.L88
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L58
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	1664(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L49:
	movdqa	%xmm0, %xmm1
	addq	$16, %r11
	pcmpgtd	-16(%r11), %xmm1
	pand	%xmm1, %xmm0
	pandn	-16(%r11), %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %r11
	jne	.L49
	movdqa	%xmm0, %xmm2
	movl	%edx, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %eax
	testb	$3, %dl
	je	.L50
.L48:
	movslq	%ecx, %rsi
	movl	1648(%rsp,%rsi,4), %esi
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L50
	movslq	%esi, %rsi
	movl	1648(%rsp,%rsi,4), %esi
	cmpl	%esi, %eax
	cmovl	%esi, %eax
	addl	$2, %ecx
	cmpl	%ecx, %edx
	jle	.L50
	movslq	%ecx, %rcx
	movl	1648(%rsp,%rcx,4), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
.L50:
	leal	1(%rax), %edx
.L41:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L61:
	cmpl	%edx, %edi
	jle	.L15
.L14:
	cmpl	%r9d, %ecx
	jne	.L11
.L37:
	movl	%edi, %ebp
	movl	$1, %r15d
	subl	%edx, %ebp
	cmpl	%edx, %edi
	cmovg	%ebp, %r15d
	jle	.L57
	cmpl	$1, %ebp
	je	.L57
	movq	8(%rsp), %rbx
	movl	%r15d, %r8d
	movslq	%edx, %r14
	movslq	%eax, %r10
	shrl	%r8d
	leaq	0(%r13,%r10,8), %r11
	xorl	%esi, %esi
	leaq	(%rbx,%r14,8), %rbx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L33:
	movdqu	(%rbx,%rsi), %xmm4
	movups	%xmm4, (%r11,%rsi)
	addq	$16, %rsi
	cmpq	%rsi, %r8
	jne	.L33
	movl	%r15d, %esi
	andl	$-2, %esi
	andl	$1, %r15d
	je	.L34
.L32:
	addq	%rsi, %r14
	addq	%r10, %rsi
	movq	48(%rsp,%r14,8), %r8
	movq	%r8, 2448(%rsp,%rsi,8)
.L34:
	subl	$1, %ebp
	xorl	%ebx, %ebx
	cmpl	%edx, %edi
	cmovle	%ebx, %ebp
	leal	1(%rax,%rbp), %eax
	leal	1(%rdx,%rbp), %edx
.L38:
	cmpl	%edx, %edi
	jne	.L11
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L78:
	jne	.L11
.L30:
	movl	%r9d, %r14d
	movl	$1, %r15d
	subl	%ecx, %r14d
	cmpl	%r9d, %ecx
	cmovl	%r14d, %r15d
	cmpl	$1, %r14d
	je	.L56
	cmpl	%r9d, %ecx
	jge	.L56
	movl	%r15d, %r11d
	movslq	%eax, %r10
	leaq	(%r12,%rsi,8), %rbp
	xorl	%r8d, %r8d
	shrl	%r11d
	leaq	0(%r13,%r10,8), %rbx
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	0(%rbp,%r8), %xmm5
	movups	%xmm5, (%rbx,%r8)
	addq	$16, %r8
	cmpq	%r11, %r8
	jne	.L28
	movl	%r15d, %r8d
	andl	$-2, %r8d
	andl	$1, %r15d
	je	.L29
.L27:
	addq	%r8, %rsi
	addq	%r10, %r8
	movq	848(%rsp,%rsi,8), %rsi
	movq	%rsi, 2448(%rsp,%r8,8)
.L29:
	subl	$1, %r14d
	xorl	%ebx, %ebx
	cmpl	%r9d, %ecx
	cmovge	%ebx, %r14d
	leal	1(%rcx,%r14), %ecx
	leal	1(%rax,%r14), %eax
	cmpl	%ecx, %r9d
	jne	.L11
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L87:
	movslq	%ecx, %rsi
	movslq	%edx, %r14
	movl	848(%rsp,%rsi,8), %ebx
	cmpl	%ebx, 48(%rsp,%r14,8)
	jle	.L89
	movq	848(%rsp,%rsi,8), %rsi
	movslq	%eax, %r8
	addl	$1, %ecx
	addl	$1, %eax
	movq	%rsi, 0(%r13,%r8,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L89:
	movq	8(%rsp), %r15
	movslq	%eax, %r10
	leaq	0(%r13,%r10,8), %r10
	leaq	(%r15,%r14,8), %r11
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	movd	4(%r11), %xmm3
	addl	$1, %edx
	addl	$1, %eax
	addq	$8, %r11
	movd	%r8d, %xmm0
	addq	$8, %r10
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, -8(%r10)
	cmpl	%edx, %edi
	jle	.L78
.L18:
	movl	(%r11), %r8d
	cmpl	%r8d, %ebx
	jg	.L20
	cmpl	%edx, %edi
	jle	.L78
	movslq	%eax, %r10
	leaq	0(%r13,%r10,8), %r10
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L90:
	addl	$1, %edx
.L24:
	movq	%r11, (%r10)
	cmpl	%edx, %edi
	jle	.L15
	addq	$8, %r10
	cmpl	%r9d, %ecx
	jge	.L14
	movslq	%ecx, %rsi
.L54:
	movslq	%edx, %r8
	movl	848(%rsp,%rsi,8), %ebx
	cmpl	%ebx, 48(%rsp,%r8,8)
	jne	.L26
	movq	48(%rsp,%r8,8), %r11
	movl	852(%rsp,%rsi,8), %ebx
	addl	$1, %eax
	cmpl	%ebx, 52(%rsp,%r8,8)
	jl	.L90
	movq	(%r12,%r8,8), %r11
	addl	$1, %ecx
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%r9d, %ecx
	jne	.L11
	cmpl	%edx, %edi
	jg	.L37
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%esi, %esi
	movslq	%eax, %r10
	movslq	%edx, %r14
	jmp	.L32
.L56:
	xorl	%r8d, %r8d
	movslq	%eax, %r10
	jmp	.L27
.L4:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L91
	addq	$4072, %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
.L88:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L41
.L58:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L48
.L91:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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>

typedef struct {
	int w;
	int h;
} mt;

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

int main(void) {
	while(1) {
		int N, M, i, j;
		mt M1[100];
		mt M2[100];
		mt M3[200];
		scanf("%d", &N);
		if (N == 0) break;
		for(i = 0; i < N; i++) {
			scanf("%d %d", &(M1[i].w), &(M1[i].h));
		}
		scanf("%d", &M);
		for(j = 0; j < M; j++) {
			scanf("%d %d", &(M2[j].w), &(M2[j].h));
		}
		
		//merge
		int target = 0;
		int lt = 0, gt = 0;
		while(1) {
			while(lt < N && gt < M && M1[lt].w > M2[gt].w) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w < M2[gt].w) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w == M2[gt].w) {
				if (M1[lt].h < M2[gt].h) {
					M3[target].w = M1[lt].w;
					M3[target].h = M1[lt].h;
					lt++;
					target++;
				} else {
					M3[target].w = M2[lt].w;
					M3[target].h = M2[lt].h;
					gt++;
					target++;
				}
			}
			while(lt == N && gt < M) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(gt == M && lt < N) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			if (lt == N && gt == M) break;
		}
		
		//dp
		int dp[200] = {0};

		for(i = 0; i < N + M - 1; i++) {
			for(j = i + 1; j < N + M; j++) {
				if (M3[i].w < M3[j].w && M3[i].h < M3[j].h) {
					dp[j] = max(dp[j], dp[i] + 1);					
				}
			}
		}
		int ans = 0;
		for(i = 0; i < N + M; i++) {
			if (dp[i] > ans) {
				ans = dp[i];
			}
		}
		printf("%d\n", ans + 1);
	}
	
	
	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>

typedef struct {
	int w;
	int h;
} mt;

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

int main(void) {
	while(1) {
		int N, M, i, j;
		mt M1[100];
		mt M2[100];
		mt M3[200];
		scanf("%d", &N);
		if (N == 0) break;
		for(i = 0; i < N; i++) {
			scanf("%d %d", &(M1[i].w), &(M1[i].h));
		}
		scanf("%d", &M);
		for(j = 0; j < M; j++) {
			scanf("%d %d", &(M2[j].w), &(M2[j].h));
		}
		
		//merge
		int target = 0;
		int lt = 0, gt = 0;
		while(1) {
			while(lt < N && gt < M && M1[lt].w > M2[gt].w) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w < M2[gt].w) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			while(lt < N && gt < M && M1[lt].w == M2[gt].w) {
				if (M1[lt].h < M2[gt].h) {
					M3[target].w = M1[lt].w;
					M3[target].h = M1[lt].h;
					lt++;
					target++;
				} else {
					M3[target].w = M2[lt].w;
					M3[target].h = M2[lt].h;
					gt++;
					target++;
				}
			}
			while(lt == N && gt < M) {
				M3[target].w = M2[gt].w;
				M3[target].h = M2[gt].h;
				gt++;
				target++;
			}
			while(gt == M && lt < N) {
				M3[target].w = M1[lt].w;
				M3[target].h = M1[lt].h;
				lt++;
				target++;
			}
			if (lt == N && gt == M) break;
		}
		
		//dp
		int dp[200] = {0};

		for(i = 0; i < N + M - 1; i++) {
			for(j = i + 1; j < N + M; j++) {
				if (M3[i].w < M3[j].w && M3[i].h < M3[j].h) {
					dp[j] = max(dp[j], dp[i] + 1);					
				}
			}
		}
		int ans = 0;
		for(i = 0; i < N + M; i++) {
			if (dp[i] > ans) {
				ans = dp[i];
			}
		}
		printf("%d\n", ans + 1);
	}
	
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L37:
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4048(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	$0, -4040(%rbp)
	jmp	.L6
.L7:
	leaq	-4016(%rbp), %rdx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-4016(%rbp), %rcx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4040(%rbp)
.L6:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L7
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4036(%rbp)
	jmp	.L8
.L9:
	leaq	-3216(%rbp), %rdx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-3216(%rbp), %rcx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4036(%rbp)
.L8:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L9
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	movl	$0, -4024(%rbp)
	jmp	.L10
.L12:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L10:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L13
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L13
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jg	.L12
	jmp	.L13
.L15:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L13:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L16
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L16
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jl	.L15
	jmp	.L16
.L19:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
	jmp	.L16
.L17:
	movl	-4028(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L16:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L20
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L20
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	je	.L19
	jmp	.L20
.L22:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L20:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L23
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L22
	jmp	.L23
.L25:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L23:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jne	.L24
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L25
.L24:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L10
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	je	.L41
	jmp	.L10
.L41:
	nop
	leaq	-2416(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -4040(%rbp)
	jmp	.L29
.L33:
	movl	-4040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4036(%rbp)
	jmp	.L30
.L32:
	movl	-4040(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-4036(%rbp), %edx
	movslq	%edx, %rdx
	movl	%eax, -2416(%rbp,%rdx,4)
.L31:
	addl	$1, -4036(%rbp)
.L30:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L32
	addl	$1, -4040(%rbp)
.L29:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L33
	movl	$0, -4020(%rbp)
	movl	$0, -4040(%rbp)
	jmp	.L34
.L36:
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	cmpl	%eax, -4020(%rbp)
	jge	.L35
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
.L35:
	addl	$1, -4040(%rbp)
.L34:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L36
	movl	-4020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	max
	.type	max, @function
max:
.LFB0:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L37:
	leaq	-4048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4048(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	$0, -4040(%rbp)
	jmp	.L6
.L7:
	leaq	-4016(%rbp), %rdx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-4016(%rbp), %rcx
	movl	-4040(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4040(%rbp)
.L6:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L7
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4036(%rbp)
	jmp	.L8
.L9:
	leaq	-3216(%rbp), %rdx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	leaq	-3216(%rbp), %rcx
	movl	-4036(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4036(%rbp)
.L8:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L9
	movl	$0, -4032(%rbp)
	movl	$0, -4028(%rbp)
	movl	$0, -4024(%rbp)
	jmp	.L10
.L12:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L10:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L13
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L13
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jg	.L12
	jmp	.L13
.L15:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L13:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L16
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L16
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jl	.L15
	jmp	.L16
.L19:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
	jmp	.L16
.L17:
	movl	-4028(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L16:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jge	.L20
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jge	.L20
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	je	.L19
	jmp	.L20
.L22:
	movl	-4024(%rbp), %eax
	cltq
	movl	-3216(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4024(%rbp), %eax
	cltq
	movl	-3212(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4024(%rbp)
	addl	$1, -4032(%rbp)
.L20:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L23
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L22
	jmp	.L23
.L25:
	movl	-4028(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-4028(%rbp), %eax
	cltq
	movl	-4012(%rbp,%rax,8), %edx
	movl	-4032(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -4028(%rbp)
	addl	$1, -4032(%rbp)
.L23:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jne	.L24
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jl	.L25
.L24:
	movl	-4048(%rbp), %eax
	cmpl	%eax, -4028(%rbp)
	jne	.L10
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	je	.L41
	jmp	.L10
.L41:
	nop
	leaq	-2416(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -4040(%rbp)
	jmp	.L29
.L33:
	movl	-4040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4036(%rbp)
	jmp	.L30
.L32:
	movl	-4040(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L31
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-4036(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-4036(%rbp), %edx
	movslq	%edx, %rdx
	movl	%eax, -2416(%rbp,%rdx,4)
.L31:
	addl	$1, -4036(%rbp)
.L30:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4036(%rbp)
	jl	.L32
	addl	$1, -4040(%rbp)
.L29:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L33
	movl	$0, -4020(%rbp)
	movl	$0, -4040(%rbp)
	jmp	.L34
.L36:
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	cmpl	%eax, -4020(%rbp)
	jge	.L35
	movl	-4040(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,4), %eax
	movl	%eax, -4020(%rbp)
.L35:
	addl	$1, -4040(%rbp)
.L34:
	movl	-4048(%rbp), %edx
	movl	-4044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4040(%rbp)
	jl	.L36
	movl	-4020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
