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 <math.h>

int n;
int a[100], b[100], c[100], d[100];
int cflag[200];	//r=0, b=1;
int flag[100];	//rで使用済みは1,othersは0　なおx座標に準拠
int rnum=0, bnum=0;	//rの回数
int rmax=0;
int maxnum=-1;
int ans=0;

void change(int *x, int *y);

int main(void){
	for(int i=0;i<100;i++)	flag[i]=0;

	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d %d", &a[i], &b[i]);
		cflag[a[i]] = 0;
	}
	for(int i=0;i<n;i++){
		scanf("%d %d", &c[i], &d[i]);
		cflag[c[i]] = 1;
	}

	for(int i=0;i<100;i++){
		for(int j=0;j<n-1;j++){
			if(a[j]>a[j+1]){
				change(&a[j], &a[j+1]);
				change(&b[j], &b[j+1]);
			}
			if(c[j]>c[j+1]){
				change(&c[j], &c[j+1]);
				change(&d[j], &d[j+1]);
			}
		}
	}

	for(int i=0;i<2*n;i++){
		if(cflag[i] == 0)	rnum++;
		else if(cflag[i] == 1){
			bnum++;
			for(int j=0;j<rnum;j++){
				if(b[j]>rmax && b[j]<d[bnum-1] && flag[j]==0){
					rmax = b[j];
					maxnum=j;
				}
			}
			if(maxnum!=-1){
				flag[maxnum] = 1;
				ans++;
			}
		}
		maxnum=-1;rmax=-1;
	}

	printf("%d", ans);

	return 0;
}

void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400
b:
	.zero	400
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 400
c:
	.zero	400
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	cflag
	.align 32
	.type	cflag, @object
	.size	cflag, 800
cflag:
	.zero	800
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400
flag:
	.zero	400
	.globl	rnum
	.align 4
	.type	rnum, @object
	.size	rnum, 4
rnum:
	.zero	4
	.globl	bnum
	.align 4
	.type	bnum, @object
	.size	bnum, 4
bnum:
	.zero	4
	.globl	rmax
	.align 4
	.type	rmax, @object
	.size	rmax, 4
rmax:
	.zero	4
	.globl	maxnum
	.data
	.align 4
	.type	maxnum, @object
	.size	maxnum, 4
maxnum:
	.long	-1
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	cmpl	$99, -28(%rbp)
	jle	.L3
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	$0, -20(%rbp)
	jmp	.L6
.L7:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L7
	movl	$0, -16(%rbp)
	jmp	.L8
.L13:
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	n(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L8:
	cmpl	$99, -16(%rbp)
	jle	.L13
	movl	$0, -8(%rbp)
	jmp	.L14
.L20:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	rnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, rnum(%rip)
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	bnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, bnum(%rip)
	movl	$0, -4(%rbp)
	jmp	.L17
.L19:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	rmax(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	bnum(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, rmax(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, maxnum(%rip)
.L18:
	addl	$1, -4(%rbp)
.L17:
	movl	rnum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L19
	movl	maxnum(%rip), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	maxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	ans(%rip), %eax
	addl	$1, %eax
	movl	%eax, ans(%rip)
.L16:
	movl	$-1, maxnum(%rip)
	movl	$-1, rmax(%rip)
	addl	$1, -8(%rbp)
.L14:
	movl	n(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L20
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	change
	.type	change, @function
change:
.LFB7:
	.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
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	change, .-change
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	movl	$50, %ecx
	leaq	flag(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	n(%rip), %rsi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r9d
	testl	%r9d, %r9d
	jle	.L12
	leaq	a(%rip), %rbx
	xorl	%r15d, %r15d
	leaq	b(%rip), %r14
	movq	%rbx, %rbp
	leaq	.LC1(%rip), %r12
	leaq	cflag(%rip), %r13
.L3:
	leaq	(%r14,%r15,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	0(%rbp), %rax
	movl	n(%rip), %r9d
	addq	$1, %r15
	addq	$4, %rbp
	movl	$0, 0(%r13,%rax,4)
	cmpl	%r15d, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L12
	leaq	c(%rip), %rbp
	xorl	%r15d, %r15d
	leaq	d(%rip), %r14
.L4:
	leaq	(%r14,%r15,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	0(%rbp), %rax
	movl	n(%rip), %r9d
	addq	$1, %r15
	addq	$4, %rbp
	movl	$1, 0(%r13,%rax,4)
	cmpl	%r15d, %r9d
	jg	.L4
	cmpl	$1, %r9d
	jle	.L12
	leal	-2(%r9), %eax
	leaq	4+a(%rip), %rdx
	movl	$100, %r11d
	leaq	(%rdx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	c(%rip), %rcx
	leaq	d(%rip), %rdi
	movq	%rbx, %rdx
	leaq	b(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %r8d
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %r8d
	jge	.L6
	movq	%xmm1, (%rdx)
	rolq	$32, (%rsi)
.L6:
	movq	(%rcx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm3
	movd	%xmm0, %r8d
	movd	%xmm3, %eax
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %r8d
	jle	.L7
	movq	%xmm1, (%rcx)
	rolq	$32, (%rdi)
.L7:
	addq	$4, %rdx
	addq	$4, %rcx
	addq	$4, %rdi
	addq	$4, %rsi
	cmpq	%r10, %rdx
	jne	.L8
	subl	$1, %r11d
	jne	.L9
.L12:
	movl	ans(%rip), %r14d
	addl	%r9d, %r9d
	movl	%r14d, %r13d
	testl	%r9d, %r9d
	jle	.L11
	leal	-1(%r9), %edi
	movl	rmax(%rip), %ecx
	xorl	%r15d, %r15d
	xorl	%r11d, %r11d
	leaq	cflag(%rip), %rax
	movslq	bnum(%rip), %r10
	movl	maxnum(%rip), %esi
	leaq	b(%rip), %rbx
	leaq	4(%rax), %rdx
	movl	rnum(%rip), %r8d
	leaq	(%rdx,%rdi,4), %r9
	xorl	%edi, %edi
	jmp	.L18
.L43:
	addl	$1, %r8d
	movl	$1, %r11d
.L14:
	addq	$4, %rax
	movl	$-1, %ecx
	movl	$-1, %esi
	cmpq	%r9, %rax
	je	.L42
.L18:
	movl	(%rax), %edx
	testl	%edx, %edx
	je	.L43
	cmpl	$1, %edx
	jne	.L14
	leal	1(%r10), %r12d
	testl	%r8d, %r8d
	jle	.L15
	movq	%rax, 8(%rsp)
	movslq	%r8d, %rbp
	xorl	%edx, %edx
.L17:
	movl	(%rbx,%rdx,4), %edi
	cmpl	%ecx, %edi
	jle	.L16
	leaq	d(%rip), %rax
	cmpl	(%rax,%r10,4), %edi
	jge	.L16
	leaq	flag(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	cmove	%edx, %esi
	cmove	%edi, %ecx
.L16:
	addq	$1, %rdx
	cmpq	%rbp, %rdx
	jne	.L17
	movq	8(%rsp), %rax
.L15:
	cmpl	$-1, %esi
	je	.L23
	movslq	%esi, %rsi
	addl	$1, %r13d
	movslq	%r12d, %r10
	movl	$1, %r15d
	leaq	flag(%rip), %rdi
	movl	$1, (%rdi,%rsi,4)
	movl	$1, %edi
	jmp	.L14
.L42:
	movl	$-1, maxnum(%rip)
	movl	$-1, rmax(%rip)
	testb	%r15b, %r15b
	je	.L19
	movl	%r13d, ans(%rip)
	movl	%r13d, %r14d
.L19:
	testb	%dil, %dil
	je	.L20
	movl	%r10d, bnum(%rip)
.L20:
	testb	%r11b, %r11b
	je	.L11
	movl	%r8d, rnum(%rip)
.L11:
	movl	%r14d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
.L23:
	.cfi_restore_state
	movslq	%r12d, %r10
	movl	$1, %edi
	jmp	.L14
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	change
	.type	change, @function
change:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE40:
	.size	change, .-change
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	maxnum
	.data
	.align 4
	.type	maxnum, @object
	.size	maxnum, 4
maxnum:
	.long	-1
	.globl	rmax
	.bss
	.align 4
	.type	rmax, @object
	.size	rmax, 4
rmax:
	.zero	4
	.globl	bnum
	.align 4
	.type	bnum, @object
	.size	bnum, 4
bnum:
	.zero	4
	.globl	rnum
	.align 4
	.type	rnum, @object
	.size	rnum, 4
rnum:
	.zero	4
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400
flag:
	.zero	400
	.globl	cflag
	.align 32
	.type	cflag, @object
	.size	cflag, 800
cflag:
	.zero	800
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 400
c:
	.zero	400
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400
b:
	.zero	400
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	movl	$50, %ecx
	leaq	flag(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	n(%rip), %rsi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r9d
	testl	%r9d, %r9d
	jle	.L12
	leaq	a(%rip), %rbx
	xorl	%r15d, %r15d
	leaq	b(%rip), %r14
	movq	%rbx, %rbp
	leaq	.LC1(%rip), %r12
	leaq	cflag(%rip), %r13
.L3:
	leaq	(%r14,%r15,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	0(%rbp), %rax
	movl	n(%rip), %r9d
	addq	$1, %r15
	addq	$4, %rbp
	movl	$0, 0(%r13,%rax,4)
	cmpl	%r15d, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L12
	leaq	c(%rip), %rbp
	xorl	%r15d, %r15d
	leaq	d(%rip), %r14
.L4:
	leaq	(%r14,%r15,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	0(%rbp), %rax
	movl	n(%rip), %r9d
	addq	$1, %r15
	addq	$4, %rbp
	movl	$1, 0(%r13,%rax,4)
	cmpl	%r15d, %r9d
	jg	.L4
	cmpl	$1, %r9d
	jle	.L12
	leal	-2(%r9), %eax
	leaq	4+a(%rip), %rdx
	movl	$100, %r11d
	leaq	(%rdx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	c(%rip), %rcx
	leaq	d(%rip), %rdi
	movq	%rbx, %rdx
	leaq	b(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %r8d
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %r8d
	jge	.L6
	movq	%xmm1, (%rdx)
	rolq	$32, (%rsi)
.L6:
	movq	(%rcx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm3
	movd	%xmm0, %r8d
	movd	%xmm3, %eax
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %r8d
	jle	.L7
	movq	%xmm1, (%rcx)
	rolq	$32, (%rdi)
.L7:
	addq	$4, %rdx
	addq	$4, %rcx
	addq	$4, %rdi
	addq	$4, %rsi
	cmpq	%r10, %rdx
	jne	.L8
	subl	$1, %r11d
	jne	.L9
.L12:
	movl	ans(%rip), %r14d
	addl	%r9d, %r9d
	movl	%r14d, %r13d
	testl	%r9d, %r9d
	jle	.L11
	leal	-1(%r9), %edi
	movl	rmax(%rip), %ecx
	xorl	%r15d, %r15d
	xorl	%r11d, %r11d
	leaq	cflag(%rip), %rax
	movslq	bnum(%rip), %r10
	movl	maxnum(%rip), %esi
	leaq	b(%rip), %rbx
	leaq	4(%rax), %rdx
	movl	rnum(%rip), %r8d
	leaq	(%rdx,%rdi,4), %r9
	xorl	%edi, %edi
	jmp	.L18
.L43:
	addl	$1, %r8d
	movl	$1, %r11d
.L14:
	addq	$4, %rax
	movl	$-1, %ecx
	movl	$-1, %esi
	cmpq	%r9, %rax
	je	.L42
.L18:
	movl	(%rax), %edx
	testl	%edx, %edx
	je	.L43
	cmpl	$1, %edx
	jne	.L14
	leal	1(%r10), %r12d
	testl	%r8d, %r8d
	jle	.L15
	movq	%rax, 8(%rsp)
	movslq	%r8d, %rbp
	xorl	%edx, %edx
.L17:
	movl	(%rbx,%rdx,4), %edi
	cmpl	%ecx, %edi
	jle	.L16
	leaq	d(%rip), %rax
	cmpl	(%rax,%r10,4), %edi
	jge	.L16
	leaq	flag(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	cmove	%edx, %esi
	cmove	%edi, %ecx
.L16:
	addq	$1, %rdx
	cmpq	%rbp, %rdx
	jne	.L17
	movq	8(%rsp), %rax
.L15:
	cmpl	$-1, %esi
	je	.L23
	movslq	%esi, %rsi
	addl	$1, %r13d
	movslq	%r12d, %r10
	movl	$1, %r15d
	leaq	flag(%rip), %rdi
	movl	$1, (%rdi,%rsi,4)
	movl	$1, %edi
	jmp	.L14
.L42:
	movl	$-1, maxnum(%rip)
	movl	$-1, rmax(%rip)
	testb	%r15b, %r15b
	je	.L19
	movl	%r13d, ans(%rip)
	movl	%r13d, %r14d
.L19:
	testb	%dil, %dil
	je	.L20
	movl	%r10d, bnum(%rip)
.L20:
	testb	%r11b, %r11b
	je	.L11
	movl	%r8d, rnum(%rip)
.L11:
	movl	%r14d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
.L23:
	.cfi_restore_state
	movslq	%r12d, %r10
	movl	$1, %edi
	jmp	.L14
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	change
	.type	change, @function
change:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE40:
	.size	change, .-change
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	maxnum
	.data
	.align 4
	.type	maxnum, @object
	.size	maxnum, 4
maxnum:
	.long	-1
	.globl	rmax
	.bss
	.align 4
	.type	rmax, @object
	.size	rmax, 4
rmax:
	.zero	4
	.globl	bnum
	.align 4
	.type	bnum, @object
	.size	bnum, 4
bnum:
	.zero	4
	.globl	rnum
	.align 4
	.type	rnum, @object
	.size	rnum, 4
rnum:
	.zero	4
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400
flag:
	.zero	400
	.globl	cflag
	.align 32
	.type	cflag, @object
	.size	cflag, 800
cflag:
	.zero	800
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 400
c:
	.zero	400
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400
b:
	.zero	400
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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 <math.h>

int n;
int a[100], b[100], c[100], d[100];
int cflag[200];	//r=0, b=1;
int flag[100];	//rで使用済みは1,othersは0　なおx座標に準拠
int rnum=0, bnum=0;	//rの回数
int rmax=0;
int maxnum=-1;
int ans=0;

void change(int *x, int *y);

int main(void){
	for(int i=0;i<100;i++)	flag[i]=0;

	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d %d", &a[i], &b[i]);
		cflag[a[i]] = 0;
	}
	for(int i=0;i<n;i++){
		scanf("%d %d", &c[i], &d[i]);
		cflag[c[i]] = 1;
	}

	for(int i=0;i<100;i++){
		for(int j=0;j<n-1;j++){
			if(a[j]>a[j+1]){
				change(&a[j], &a[j+1]);
				change(&b[j], &b[j+1]);
			}
			if(c[j]>c[j+1]){
				change(&c[j], &c[j+1]);
				change(&d[j], &d[j+1]);
			}
		}
	}

	for(int i=0;i<2*n;i++){
		if(cflag[i] == 0)	rnum++;
		else if(cflag[i] == 1){
			bnum++;
			for(int j=0;j<rnum;j++){
				if(b[j]>rmax && b[j]<d[bnum-1] && flag[j]==0){
					rmax = b[j];
					maxnum=j;
				}
			}
			if(maxnum!=-1){
				flag[maxnum] = 1;
				ans++;
			}
		}
		maxnum=-1;rmax=-1;
	}

	printf("%d", ans);

	return 0;
}

void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
2
2 2
3 5
0 0
1 1
 5
0 0
7 3
2 2
4 8
1 6
8 5
6 9
5 4
9 1
2 7
 5
0 0
1 1
5 5
6 6
7 11
2 2
3 3
4 4
8 8
9 9
 3
0 0
1 1
10 2
2 3
3 4
4 5
 5
0 0
4 1
5 5
6 6
13 11
2 2
3 3
2 4
8 8
9 16
 2
0 0
6 -1
0 0
1 1
 2
2 2
3 0
0 0
1 1
 5
-1 0
7 3
2 2
4 8
1 6
8 5
6 9
5 4
9 1
2 7
 5
0 0
1 1
5 5
6 6
7 11
2 2
3 3
2 4
8 8
9 9
 3
0 0
1 1
10 2
2 0
3 4
4 5

0 5 4 2 4 0 0 5 4 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 <stdlib.h>
#include <math.h>

int n;
int a[100], b[100], c[100], d[100];
int cflag[200];	//r=0, b=1;
int flag[100];	//rで使用済みは1,othersは0　なおx座標に準拠
int rnum=0, bnum=0;	//rの回数
int rmax=0;
int maxnum=-1;
int ans=0;

void change(int *x, int *y);

int main(void){
	for(int i=0;i<100;i++)	flag[i]=0;

	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d %d", &a[i], &b[i]);
		cflag[a[i]] = 0;
	}
	for(int i=0;i<n;i++){
		scanf("%d %d", &c[i], &d[i]);
		cflag[c[i]] = 1;
	}

	for(int i=0;i<100;i++){
		for(int j=0;j<n-1;j++){
			if(a[j]>a[j+1]){
				change(&a[j], &a[j+1]);
				change(&b[j], &b[j+1]);
			}
			if(c[j]>c[j+1]){
				change(&c[j], &c[j+1]);
				change(&d[j], &d[j+1]);
			}
		}
	}

	for(int i=0;i<2*n;i++){
		if(cflag[i] == 0)	rnum++;
		else if(cflag[i] == 1){
			bnum++;
			for(int j=0;j<rnum;j++){
				if(b[j]>rmax && b[j]<d[bnum-1] && flag[j]==0){
					rmax = b[j];
					maxnum=j;
				}
			}
			if(maxnum!=-1){
				flag[maxnum] = 1;
				ans++;
			}
		}
		maxnum=-1;rmax=-1;
	}

	printf("%d", ans);

	return 0;
}

void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400
b:
	.zero	400
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 400
c:
	.zero	400
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	cflag
	.align 32
	.type	cflag, @object
	.size	cflag, 800
cflag:
	.zero	800
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400
flag:
	.zero	400
	.globl	rnum
	.align 4
	.type	rnum, @object
	.size	rnum, 4
rnum:
	.zero	4
	.globl	bnum
	.align 4
	.type	bnum, @object
	.size	bnum, 4
bnum:
	.zero	4
	.globl	rmax
	.align 4
	.type	rmax, @object
	.size	rmax, 4
rmax:
	.zero	4
	.globl	maxnum
	.data
	.align 4
	.type	maxnum, @object
	.size	maxnum, 4
maxnum:
	.long	-1
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	cmpl	$99, -28(%rbp)
	jle	.L3
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	$0, -20(%rbp)
	jmp	.L6
.L7:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L7
	movl	$0, -16(%rbp)
	jmp	.L8
.L13:
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	n(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L8:
	cmpl	$99, -16(%rbp)
	jle	.L13
	movl	$0, -8(%rbp)
	jmp	.L14
.L20:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	rnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, rnum(%rip)
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	bnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, bnum(%rip)
	movl	$0, -4(%rbp)
	jmp	.L17
.L19:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	rmax(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	bnum(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, rmax(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, maxnum(%rip)
.L18:
	addl	$1, -4(%rbp)
.L17:
	movl	rnum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L19
	movl	maxnum(%rip), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	maxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	ans(%rip), %eax
	addl	$1, %eax
	movl	%eax, ans(%rip)
.L16:
	movl	$-1, maxnum(%rip)
	movl	$-1, rmax(%rip)
	addl	$1, -8(%rbp)
.L14:
	movl	n(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L20
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	change
	.type	change, @function
change:
.LFB7:
	.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
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	change, .-change
	.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 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400
b:
	.zero	400
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 400
c:
	.zero	400
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	cflag
	.align 32
	.type	cflag, @object
	.size	cflag, 800
cflag:
	.zero	800
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400
flag:
	.zero	400
	.globl	rnum
	.align 4
	.type	rnum, @object
	.size	rnum, 4
rnum:
	.zero	4
	.globl	bnum
	.align 4
	.type	bnum, @object
	.size	bnum, 4
bnum:
	.zero	4
	.globl	rmax
	.align 4
	.type	rmax, @object
	.size	rmax, 4
rmax:
	.zero	4
	.globl	maxnum
	.data
	.align 4
	.type	maxnum, @object
	.size	maxnum, 4
maxnum:
	.long	-1
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	cmpl	$99, -28(%rbp)
	jle	.L3
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	$0, -20(%rbp)
	jmp	.L6
.L7:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L7
	movl	$0, -16(%rbp)
	jmp	.L8
.L13:
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	c(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	change
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	n(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L8:
	cmpl	$99, -16(%rbp)
	jle	.L13
	movl	$0, -8(%rbp)
	jmp	.L14
.L20:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	rnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, rnum(%rip)
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cflag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	bnum(%rip), %eax
	addl	$1, %eax
	movl	%eax, bnum(%rip)
	movl	$0, -4(%rbp)
	jmp	.L17
.L19:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	rmax(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	bnum(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L18
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, rmax(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, maxnum(%rip)
.L18:
	addl	$1, -4(%rbp)
.L17:
	movl	rnum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L19
	movl	maxnum(%rip), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	maxnum(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	ans(%rip), %eax
	addl	$1, %eax
	movl	%eax, ans(%rip)
.L16:
	movl	$-1, maxnum(%rip)
	movl	$-1, rmax(%rip)
	addl	$1, -8(%rbp)
.L14:
	movl	n(%rip), %eax
	addl	%eax, %eax
	cmpl	%eax, -8(%rbp)
	jl	.L20
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	change
	.type	change, @function
change:
.LFB7:
	.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
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	change, .-change
	.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:
