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 <stdbool.h>
typedef long long ll;
struct point {
    ll x, y;
};

ll n;
struct point red[105];
struct point blue[105];
bool is_pair_red[105];
bool is_pair_blue[105];

ll ans = 0;

int main()
{
    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &red[i].x, &red[i].y);
    }
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &blue[i].x, &blue[i].y);
    }
    
    blue[n].x = blue[n].y = 1000;
    red[n].x = red[n].y = -1;

    // 1.x座標の一番大きい赤い点を選ぶ
    // 2.1.の点とペアになれる点のなかで1番yの小さいものを選ぶ
    // 3. 1.にもどる！

    for (int i = 0; i < n; i++) {
        int red_pos = n;
        int blue_pos = n;
        
        for (int j = 0; j < n; j++) {
            if (red[j].x > red[red_pos].x && !is_pair_red[j]) {
                red_pos = j;
            }
        }

        for (int j = 0; j < n; j++) {
            if (red[red_pos].x < blue[j].x &&
                red[red_pos].y < blue[j].y &&
                !is_pair_blue[j] &&
                blue[blue_pos].y > blue[j].y) {
                
                blue_pos = j;
            }
        }

        if (blue_pos < n) {
            ans++;
            is_pair_blue[blue_pos] = true;
        }
        
        is_pair_red[red_pos] = true;
    }

    printf("%lld\n", ans);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	red
	.align 32
	.type	red, @object
	.size	red, 1680
red:
	.zero	1680
	.globl	blue
	.align 32
	.type	blue, @object
	.size	blue, 1680
blue:
	.zero	1680
	.globl	is_pair_red
	.align 32
	.type	is_pair_red, @object
	.size	is_pair_red, 105
is_pair_red:
	.zero	105
	.globl	is_pair_blue
	.align 32
	.type	is_pair_blue, @object
	.size	is_pair_blue, 105
is_pair_blue:
	.zero	105
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L3
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	blue(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+blue(%rip), %rdx
	movq	$1000, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	blue(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+red(%rip), %rdx
	movq	$-1, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+red(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	red(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	$0, -20(%rbp)
	jmp	.L6
.L14:
	movq	n(%rip), %rax
	movl	%eax, -16(%rbp)
	movq	n(%rip), %rax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movl	-8(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L8
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movl	$0, -4(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-4(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L11
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+blue(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L11:
	addl	$1, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L13
	movq	ans(%rip), %rax
	addq	$1, %rax
	movq	%rax, ans(%rip)
	movl	-12(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L13:
	movl	-16(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -20(%rbp)
.L6:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L14
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld %lld"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	red(%rip), %rbx
	movq	%rbx, %rbp
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	testq	%rax, %rax
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	8(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	addq	$1, %r12
	addq	$16, %rbp
	cmpq	%r12, %rax
	jg	.L3
	testq	%rax, %rax
	jle	.L2
	leaq	blue(%rip), %rbp
	xorl	%r14d, %r14d
	movq	%rbp, %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	leaq	8(%r12), %rdx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rsi
	addq	$1, %r14
	addq	$16, %r12
	cmpq	%r14, %rsi
	jg	.L4
	movdqa	.LC2(%rip), %xmm0
	movq	%rsi, %rax
	salq	$4, %rax
	movaps	%xmm0, 0(%rbp,%rax)
	pcmpeqd	%xmm0, %xmm0
	movaps	%xmm0, (%rbx,%rax)
	movq	ans(%rip), %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 24(%rsp)
	testq	%rsi, %rsi
	jle	.L6
	movslq	%esi, %rax
	movb	$0, 39(%rsp)
	movl	%esi, %r14d
	xorl	%r12d, %r12d
	salq	$4, %rax
	leaq	is_pair_red(%rip), %r10
	leaq	is_pair_blue(%rip), %r13
	movq	(%rbx,%rax), %rax
	movq	%rax, 8(%rsp)
	movslq	%esi, %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	8(%rsp), %rcx
	leaq	red(%rip), %rdx
	movl	%r14d, %r8d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	movq	(%rdx), %rdi
	cmpq	%rcx, %rdi
	jle	.L7
	cmpb	$0, (%r10,%rax)
	cmove	%rdi, %rcx
	cmove	%eax, %r8d
.L7:
	addq	$1, %rax
	addq	$16, %rdx
	cmpq	%rsi, %rax
	jne	.L8
	movslq	%r8d, %r8
	movq	16(%rsp), %r11
	movq	%rbp, %rax
	xorl	%edx, %edx
	movq	%r8, %r9
	salq	$4, %r9
	addq	%rbx, %r9
	.p2align 4,,10
	.p2align 3
.L10:
	cmpq	%rcx, (%rax)
	jle	.L9
	movq	8(%rax), %rdi
	cmpq	%rdi, 8(%r9)
	jge	.L9
	cmpb	$0, 0(%r13,%rdx)
	jne	.L9
	movq	%r11, %r15
	salq	$4, %r15
	cmpq	8(%rbp,%r15), %rdi
	jge	.L9
	movslq	%edx, %r11
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rdx
	addq	$16, %rax
	cmpq	%rsi, %rdx
	jne	.L10
	cmpq	%r11, %rsi
	jle	.L11
	addl	$1, %r12d
	addq	$1, 24(%rsp)
	movb	$1, 0(%r13,%r11)
	movb	$1, (%r10,%r8)
	cmpl	%r14d, %r12d
	je	.L13
	movb	$1, 39(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L11:
	addl	$1, %r12d
	movb	$1, (%r10,%r8)
	cmpl	%r14d, %r12d
	jne	.L15
	cmpb	$0, 39(%rsp)
	jne	.L13
.L6:
	movq	40(%rsp), %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$56, %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
.L13:
	.cfi_restore_state
	movq	24(%rsp), %rax
	movq	%rax, ans(%rip)
	movq	%rax, 40(%rsp)
	jmp	.L6
.L2:
	movdqa	.LC2(%rip), %xmm0
	salq	$4, %rax
	leaq	blue(%rip), %rdx
	movaps	%xmm0, (%rdx,%rax)
	pcmpeqd	%xmm0, %xmm0
	movaps	%xmm0, (%rbx,%rax)
	movq	ans(%rip), %rax
	movq	%rax, 40(%rsp)
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	is_pair_blue
	.align 32
	.type	is_pair_blue, @object
	.size	is_pair_blue, 105
is_pair_blue:
	.zero	105
	.globl	is_pair_red
	.align 32
	.type	is_pair_red, @object
	.size	is_pair_red, 105
is_pair_red:
	.zero	105
	.globl	blue
	.align 32
	.type	blue, @object
	.size	blue, 1680
blue:
	.zero	1680
	.globl	red
	.align 32
	.type	red, @object
	.size	red, 1680
red:
	.zero	1680
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	1000
	.quad	1000
	.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	"%lld"
.LC1:
	.string	"%lld %lld"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	red(%rip), %rbx
	movq	%rbx, %rbp
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	testq	%rax, %rax
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	8(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	addq	$1, %r12
	addq	$16, %rbp
	cmpq	%r12, %rax
	jg	.L3
	testq	%rax, %rax
	jle	.L2
	leaq	blue(%rip), %rbp
	xorl	%r14d, %r14d
	movq	%rbp, %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	leaq	8(%r12), %rdx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rsi
	addq	$1, %r14
	addq	$16, %r12
	cmpq	%r14, %rsi
	jg	.L4
	movdqa	.LC2(%rip), %xmm0
	movq	%rsi, %rax
	salq	$4, %rax
	movaps	%xmm0, 0(%rbp,%rax)
	pcmpeqd	%xmm0, %xmm0
	movaps	%xmm0, (%rbx,%rax)
	movq	ans(%rip), %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 24(%rsp)
	testq	%rsi, %rsi
	jle	.L6
	movslq	%esi, %rax
	movb	$0, 39(%rsp)
	movl	%esi, %r14d
	xorl	%r12d, %r12d
	salq	$4, %rax
	leaq	is_pair_red(%rip), %r10
	leaq	is_pair_blue(%rip), %r13
	movq	(%rbx,%rax), %rax
	movq	%rax, 8(%rsp)
	movslq	%esi, %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	8(%rsp), %rcx
	leaq	red(%rip), %rdx
	movl	%r14d, %r8d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	movq	(%rdx), %rdi
	cmpq	%rcx, %rdi
	jle	.L7
	cmpb	$0, (%r10,%rax)
	cmove	%rdi, %rcx
	cmove	%eax, %r8d
.L7:
	addq	$1, %rax
	addq	$16, %rdx
	cmpq	%rsi, %rax
	jne	.L8
	movslq	%r8d, %r8
	movq	16(%rsp), %r11
	movq	%rbp, %rax
	xorl	%edx, %edx
	movq	%r8, %r9
	salq	$4, %r9
	addq	%rbx, %r9
	.p2align 4,,10
	.p2align 3
.L10:
	cmpq	%rcx, (%rax)
	jle	.L9
	movq	8(%rax), %rdi
	cmpq	%rdi, 8(%r9)
	jge	.L9
	cmpb	$0, 0(%r13,%rdx)
	jne	.L9
	movq	%r11, %r15
	salq	$4, %r15
	cmpq	8(%rbp,%r15), %rdi
	jge	.L9
	movslq	%edx, %r11
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rdx
	addq	$16, %rax
	cmpq	%rsi, %rdx
	jne	.L10
	cmpq	%r11, %rsi
	jle	.L11
	addl	$1, %r12d
	addq	$1, 24(%rsp)
	movb	$1, 0(%r13,%r11)
	movb	$1, (%r10,%r8)
	cmpl	%r14d, %r12d
	je	.L13
	movb	$1, 39(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L11:
	addl	$1, %r12d
	movb	$1, (%r10,%r8)
	cmpl	%r14d, %r12d
	jne	.L15
	cmpb	$0, 39(%rsp)
	jne	.L13
.L6:
	movq	40(%rsp), %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$56, %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
.L13:
	.cfi_restore_state
	movq	24(%rsp), %rax
	movq	%rax, ans(%rip)
	movq	%rax, 40(%rsp)
	jmp	.L6
.L2:
	movdqa	.LC2(%rip), %xmm0
	salq	$4, %rax
	leaq	blue(%rip), %rdx
	movaps	%xmm0, (%rdx,%rax)
	pcmpeqd	%xmm0, %xmm0
	movaps	%xmm0, (%rbx,%rax)
	movq	ans(%rip), %rax
	movq	%rax, 40(%rsp)
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	is_pair_blue
	.align 32
	.type	is_pair_blue, @object
	.size	is_pair_blue, 105
is_pair_blue:
	.zero	105
	.globl	is_pair_red
	.align 32
	.type	is_pair_red, @object
	.size	is_pair_red, 105
is_pair_red:
	.zero	105
	.globl	blue
	.align 32
	.type	blue, @object
	.size	blue, 1680
blue:
	.zero	1680
	.globl	red
	.align 32
	.type	red, @object
	.size	red, 1680
red:
	.zero	1680
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	1000
	.quad	1000
	.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 <stdbool.h>
typedef long long ll;
struct point {
    ll x, y;
};

ll n;
struct point red[105];
struct point blue[105];
bool is_pair_red[105];
bool is_pair_blue[105];

ll ans = 0;

int main()
{
    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &red[i].x, &red[i].y);
    }
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &blue[i].x, &blue[i].y);
    }
    
    blue[n].x = blue[n].y = 1000;
    red[n].x = red[n].y = -1;

    // 1.x座標の一番大きい赤い点を選ぶ
    // 2.1.の点とペアになれる点のなかで1番yの小さいものを選ぶ
    // 3. 1.にもどる！

    for (int i = 0; i < n; i++) {
        int red_pos = n;
        int blue_pos = n;
        
        for (int j = 0; j < n; j++) {
            if (red[j].x > red[red_pos].x && !is_pair_red[j]) {
                red_pos = j;
            }
        }

        for (int j = 0; j < n; j++) {
            if (red[red_pos].x < blue[j].x &&
                red[red_pos].y < blue[j].y &&
                !is_pair_blue[j] &&
                blue[blue_pos].y > blue[j].y) {
                
                blue_pos = j;
            }
        }

        if (blue_pos < n) {
            ans++;
            is_pair_blue[blue_pos] = true;
        }
        
        is_pair_red[red_pos] = true;
    }

    printf("%lld\n", ans);

    return 0;
}

3
2 0
3 1
1 3
4 2
0 4
5 5

2

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 <stdbool.h>
typedef long long ll;
struct point {
    ll x, y;
};

ll n;
struct point red[105];
struct point blue[105];
bool is_pair_red[105];
bool is_pair_blue[105];

ll ans = 0;

int main()
{
    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &red[i].x, &red[i].y);
    }
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &blue[i].x, &blue[i].y);
    }
    
    blue[n].x = blue[n].y = 1000;
    red[n].x = red[n].y = -1;

    // 1.x座標の一番大きい赤い点を選ぶ
    // 2.1.の点とペアになれる点のなかで1番yの小さいものを選ぶ
    // 3. 1.にもどる！

    for (int i = 0; i < n; i++) {
        int red_pos = n;
        int blue_pos = n;
        
        for (int j = 0; j < n; j++) {
            if (red[j].x > red[red_pos].x && !is_pair_red[j]) {
                red_pos = j;
            }
        }

        for (int j = 0; j < n; j++) {
            if (red[red_pos].x < blue[j].x &&
                red[red_pos].y < blue[j].y &&
                !is_pair_blue[j] &&
                blue[blue_pos].y > blue[j].y) {
                
                blue_pos = j;
            }
        }

        if (blue_pos < n) {
            ans++;
            is_pair_blue[blue_pos] = true;
        }
        
        is_pair_red[red_pos] = true;
    }

    printf("%lld\n", ans);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	red
	.align 32
	.type	red, @object
	.size	red, 1680
red:
	.zero	1680
	.globl	blue
	.align 32
	.type	blue, @object
	.size	blue, 1680
blue:
	.zero	1680
	.globl	is_pair_red
	.align 32
	.type	is_pair_red, @object
	.size	is_pair_red, 105
is_pair_red:
	.zero	105
	.globl	is_pair_blue
	.align 32
	.type	is_pair_blue, @object
	.size	is_pair_blue, 105
is_pair_blue:
	.zero	105
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L3
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	blue(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+blue(%rip), %rdx
	movq	$1000, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	blue(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+red(%rip), %rdx
	movq	$-1, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+red(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	red(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	$0, -20(%rbp)
	jmp	.L6
.L14:
	movq	n(%rip), %rax
	movl	%eax, -16(%rbp)
	movq	n(%rip), %rax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movl	-8(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L8
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movl	$0, -4(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-4(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L11
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+blue(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L11:
	addl	$1, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L13
	movq	ans(%rip), %rax
	addq	$1, %rax
	movq	%rax, ans(%rip)
	movl	-12(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L13:
	movl	-16(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -20(%rbp)
.L6:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L14
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	red
	.align 32
	.type	red, @object
	.size	red, 1680
red:
	.zero	1680
	.globl	blue
	.align 32
	.type	blue, @object
	.size	blue, 1680
blue:
	.zero	1680
	.globl	is_pair_red
	.align 32
	.type	is_pair_red, @object
	.size	is_pair_red, 105
is_pair_red:
	.zero	105
	.globl	is_pair_blue
	.align 32
	.type	is_pair_blue, @object
	.size	is_pair_blue, 105
is_pair_blue:
	.zero	105
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L3
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	blue(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+blue(%rip), %rdx
	movq	$1000, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	blue(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	n(%rip), %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	leaq	8+red(%rip), %rdx
	movq	$-1, (%rcx,%rdx)
	movq	n(%rip), %rdx
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+red(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	red(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	$0, -20(%rbp)
	jmp	.L6
.L14:
	movq	n(%rip), %rax
	movl	%eax, -16(%rbp)
	movq	n(%rip), %rax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	red(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L8
	movl	-8(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L8
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movl	$0, -4(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+red(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L11
	movl	-4(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	xorl	$1, %eax
	testb	%al, %al
	je	.L11
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+blue(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+blue(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L11:
	addl	$1, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L13
	movq	ans(%rip), %rax
	addq	$1, %rax
	movq	%rax, ans(%rip)
	movl	-12(%rbp), %eax
	cltq
	leaq	is_pair_blue(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L13:
	movl	-16(%rbp), %eax
	cltq
	leaq	is_pair_red(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -20(%rbp)
.L6:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L14
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
