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

```c
a[1<<18];u[1<<18];i;j;b;r;h;m;main(n){for(;i<=n;i++)scanf("%d",i?a+i:&n);for(qsort(a+1,n,4,"\x8b\6+\7\xc3");~scanf("%d",&b);j++?a[i]-b?r++:u[i]++:0)for(i=0,h=n+1;h-i>1;a[m]<b|a[m]==b&u[m]?h=m:(i=m))m=h+i>>1;puts(r?"NO":"YES");}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1048576
a:
	.zero	1048576
	.globl	u
	.align 32
	.type	u, @object
	.size	u, 1048576
u:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"\213\006+\007\303"
.LC2:
	.string	"NO"
.LC3:
	.string	"YES"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	testl	%eax, %eax
	je	.L3
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	jmp	.L4
.L3:
	leaq	-4(%rbp), %rax
.L4:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	leaq	4+a(%rip), %rdi
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	%eax, %esi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L6
.L13:
	movl	$0, i(%rip)
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L9:
	movl	h(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, m(%rip)
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %ecx
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %esi
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%esi, %eax
	orl	%ecx, %eax
	testl	%eax, %eax
	je	.L8
	movl	m(%rip), %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L8:
	movl	m(%rip), %eax
	movl	%eax, i(%rip)
.L7:
	movl	h(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cmpl	$1, %eax
	jg	.L9
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	je	.L6
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	r(%rip), %eax
	addl	$1, %eax
	movl	%eax, r(%rip)
	jmp	.L6
.L11:
	movl	i(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	u(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	leaq	b(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	r(%rip), %eax
	testl	%eax, %eax
	je	.L14
	leaq	.LC2(%rip), %rax
	jmp	.L15
.L14:
	leaq	.LC3(%rip), %rax
.L15:
	movq	%rax, %rdi
	call	puts@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	"NO"
.LC1:
	.string	"YES"
.LC2:
	.string	"%d"
.LC3:
	.string	"\213\006+\007\303"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edi, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC2(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movl	i(%rip), %eax
	movl	%edi, 12(%rsp)
	cmpl	%edi, %eax
	jg	.L2
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	testl	%eax, %eax
	je	.L3
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	movl	12(%rsp), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%eax, %esi
	jge	.L5
.L2:
	leaq	.LC3(%rip), %rcx
	movl	$4, %edx
	leaq	4+a(%rip), %rdi
	xorl	%eax, %eax
	call	qsort@PLT
	leaq	b(%rip), %rbp
	leaq	a(%rip), %r12
.L6:
	leaq	u(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L35
	movl	$0, i(%rip)
	movl	12(%rsp), %eax
	leal	1(%rax), %edi
	movl	%edi, h(%rip)
	cmpl	$1, %edi
	jle	.L20
	movl	b(%rip), %r9d
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	leal	(%r8,%rdi), %eax
	xorl	%edx, %edx
	sarl	%eax
	movslq	%eax, %rsi
	movl	(%r12,%rsi,4), %ecx
	cmpl	%ecx, %r9d
	sete	%dl
	andl	0(%r13,%rsi,4), %edx
	cmpl	%ecx, %r9d
	setg	%cl
	movzbl	%cl, %ecx
	orl	%ecx, %edx
	jne	.L8
	movl	%edi, %edx
	subl	%eax, %edx
	cmpl	$1, %edx
	jle	.L36
	movl	%eax, %r8d
	movl	$1, %r10d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%eax, %edx
	subl	%r8d, %edx
	cmpl	$1, %edx
	jle	.L11
	movl	%eax, %edi
	movl	$1, %r11d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%eax, m(%rip)
	movl	%eax, i(%rip)
	testb	%r11b, %r11b
	jne	.L37
.L7:
	movl	j(%rip), %edx
	leal	1(%rdx), %ecx
	movl	%ecx, j(%rip)
	testl	%edx, %edx
	je	.L13
	cltq
	movl	b(%rip), %edi
	cmpl	%edi, (%r12,%rax,4)
	je	.L14
	addl	$1, r(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%eax, m(%rip)
	testb	%r10b, %r10b
	jne	.L38
.L18:
	movl	%eax, h(%rip)
	movl	%r8d, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	movl	12(%rsp), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jle	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L38:
	movl	%r8d, i(%rip)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L35:
	movl	r(%rip), %eax
	leaq	.LC0(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC1(%rip), %rax
	cmove	%rax, %rdi
	call	puts@PLT
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	movl	%eax, %r8d
	movl	%edi, %eax
	jmp	.L18
.L14:
	leaq	u(%rip), %rdx
	addl	$1, (%rdx,%rax,4)
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	u
	.align 32
	.type	u, @object
	.size	u, 1048576
u:
	.zero	1048576
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1048576
a:
	.zero	1048576
	.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	"NO"
.LC1:
	.string	"YES"
.LC2:
	.string	"%d"
.LC3:
	.string	"\213\006+\007\303"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edi, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC2(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movl	i(%rip), %eax
	movl	%edi, 12(%rsp)
	cmpl	%edi, %eax
	jg	.L2
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	testl	%eax, %eax
	je	.L3
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	movl	12(%rsp), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%eax, %esi
	jge	.L5
.L2:
	leaq	.LC3(%rip), %rcx
	movl	$4, %edx
	leaq	4+a(%rip), %rdi
	xorl	%eax, %eax
	call	qsort@PLT
	leaq	b(%rip), %rbp
	leaq	a(%rip), %r12
.L6:
	leaq	u(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L35
	movl	$0, i(%rip)
	movl	12(%rsp), %eax
	leal	1(%rax), %edi
	movl	%edi, h(%rip)
	cmpl	$1, %edi
	jle	.L20
	movl	b(%rip), %r9d
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	leal	(%r8,%rdi), %eax
	xorl	%edx, %edx
	sarl	%eax
	movslq	%eax, %rsi
	movl	(%r12,%rsi,4), %ecx
	cmpl	%ecx, %r9d
	sete	%dl
	andl	0(%r13,%rsi,4), %edx
	cmpl	%ecx, %r9d
	setg	%cl
	movzbl	%cl, %ecx
	orl	%ecx, %edx
	jne	.L8
	movl	%edi, %edx
	subl	%eax, %edx
	cmpl	$1, %edx
	jle	.L36
	movl	%eax, %r8d
	movl	$1, %r10d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%eax, %edx
	subl	%r8d, %edx
	cmpl	$1, %edx
	jle	.L11
	movl	%eax, %edi
	movl	$1, %r11d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%eax, m(%rip)
	movl	%eax, i(%rip)
	testb	%r11b, %r11b
	jne	.L37
.L7:
	movl	j(%rip), %edx
	leal	1(%rdx), %ecx
	movl	%ecx, j(%rip)
	testl	%edx, %edx
	je	.L13
	cltq
	movl	b(%rip), %edi
	cmpl	%edi, (%r12,%rax,4)
	je	.L14
	addl	$1, r(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%eax, m(%rip)
	testb	%r10b, %r10b
	jne	.L38
.L18:
	movl	%eax, h(%rip)
	movl	%r8d, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	movl	12(%rsp), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jle	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L38:
	movl	%r8d, i(%rip)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L35:
	movl	r(%rip), %eax
	leaq	.LC0(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC1(%rip), %rax
	cmove	%rax, %rdi
	call	puts@PLT
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	movl	%eax, %r8d
	movl	%edi, %eax
	jmp	.L18
.L14:
	leaq	u(%rip), %rdx
	addl	$1, (%rdx,%rax,4)
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	u
	.align 32
	.type	u, @object
	.size	u, 1048576
u:
	.zero	1048576
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1048576
a:
	.zero	1048576
	.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:

a[1<<18];u[1<<18];i;j;b;r;h;m;main(n){for(;i<=n;i++)scanf("%d",i?a+i:&n);for(qsort(a+1,n,4,"\x8b\6+\7\xc3");~scanf("%d",&b);j++?a[i]-b?r++:u[i]++:0)for(i=0,h=n+1;h-i>1;a[m]<b|a[m]==b&u[m]?h=m:(i=m))m=h+i>>1;puts(r?"NO":"YES");}
1
13
5
100 100 100 100 100

NO

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

```c
a[1<<18];u[1<<18];i;j;b;r;h;m;main(n){for(;i<=n;i++)scanf("%d",i?a+i:&n);for(qsort(a+1,n,4,"\x8b\6+\7\xc3");~scanf("%d",&b);j++?a[i]-b?r++:u[i]++:0)for(i=0,h=n+1;h-i>1;a[m]<b|a[m]==b&u[m]?h=m:(i=m))m=h+i>>1;puts(r?"NO":"YES");}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1048576
a:
	.zero	1048576
	.globl	u
	.align 32
	.type	u, @object
	.size	u, 1048576
u:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"\213\006+\007\303"
.LC2:
	.string	"NO"
.LC3:
	.string	"YES"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	testl	%eax, %eax
	je	.L3
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	jmp	.L4
.L3:
	leaq	-4(%rbp), %rax
.L4:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	leaq	4+a(%rip), %rdi
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	%eax, %esi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L6
.L13:
	movl	$0, i(%rip)
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L9:
	movl	h(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, m(%rip)
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %ecx
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %esi
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%esi, %eax
	orl	%ecx, %eax
	testl	%eax, %eax
	je	.L8
	movl	m(%rip), %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L8:
	movl	m(%rip), %eax
	movl	%eax, i(%rip)
.L7:
	movl	h(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cmpl	$1, %eax
	jg	.L9
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	je	.L6
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	r(%rip), %eax
	addl	$1, %eax
	movl	%eax, r(%rip)
	jmp	.L6
.L11:
	movl	i(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	u(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	leaq	b(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	r(%rip), %eax
	testl	%eax, %eax
	je	.L14
	leaq	.LC2(%rip), %rax
	jmp	.L15
.L14:
	leaq	.LC3(%rip), %rax
.L15:
	movq	%rax, %rdi
	call	puts@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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1048576
a:
	.zero	1048576
	.globl	u
	.align 32
	.type	u, @object
	.size	u, 1048576
u:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"\213\006+\007\303"
.LC2:
	.string	"NO"
.LC3:
	.string	"YES"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	testl	%eax, %eax
	je	.L3
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	jmp	.L4
.L3:
	leaq	-4(%rbp), %rax
.L4:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	leaq	4+a(%rip), %rdi
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	%eax, %esi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L6
.L13:
	movl	$0, i(%rip)
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L9:
	movl	h(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, m(%rip)
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	movzbl	%al, %ecx
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %esi
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%esi, %eax
	orl	%ecx, %eax
	testl	%eax, %eax
	je	.L8
	movl	m(%rip), %eax
	movl	%eax, h(%rip)
	jmp	.L7
.L8:
	movl	m(%rip), %eax
	movl	%eax, i(%rip)
.L7:
	movl	h(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cmpl	$1, %eax
	jg	.L9
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	je	.L6
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	r(%rip), %eax
	addl	$1, %eax
	movl	%eax, r(%rip)
	jmp	.L6
.L11:
	movl	i(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	u(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	u(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	leaq	b(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	r(%rip), %eax
	testl	%eax, %eax
	je	.L14
	leaq	.LC2(%rip), %rax
	jmp	.L15
.L14:
	leaq	.LC3(%rip), %rax
.L15:
	movq	%rax, %rdi
	call	puts@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:
