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

```c
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

ll a[100005], b[100005], c[100005];

int isOK_a(ll key, ll mid) { return a[mid] >= key ? 1 : 0; }
int isOK_c(ll key, ll mid) { return c[mid] <= key ? 1 : 0; }

ll binary_search(ll key, ll n, ll aORc) // a -> aORC=1, c -> aORC=0,
{
  ll ok = n, ng = -1;
  while (llabs(ok - ng) > 1)
  {
    ll mid = (ok + ng) / 2;
    if (aORc)
      isOK_a(key, mid) ? (ok = mid) : (ng = mid);
    else
      isOK_c(key, mid) ? (ok = mid) : (ng = mid);
  }
  return ok;
}

int main()
{
  ll n, ans = 0;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
    scanf("%lld", a + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", b + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", c + i);
  sortup(a, n);
  sortdown(c, n);
  for (int i = 0; i < n; i++)
    ans += binary_search(b[i], n, 1) * binary_search(b[i], n, 0);
  printf("%lld\n", ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800040
b:
	.zero	800040
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800040
c:
	.zero	800040
	.text
	.globl	isOK_a
	.type	isOK_a, @function
isOK_a:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	isOK_a, .-isOK_a
	.globl	isOK_c
	.type	isOK_c, @function
isOK_c:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setge	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	isOK_c, .-isOK_c
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$56, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%rdx, -56(%rbp)
	movq	-48(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	$-1, -16(%rbp)
	jmp	.L18
.L22:
	movq	-24(%rbp), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	cmpq	$0, -56(%rbp)
	je	.L19
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_a
	testl	%eax, %eax
	je	.L20
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_c
	testl	%eax, %eax
	je	.L21
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L18:
	movq	-24(%rbp), %rax
	subq	-16(%rbp), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovns	%rdx, %rax
	cmpq	$1, %rax
	jg	.L22
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	binary_search, .-binary_search
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L25
.L26:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L25:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L26
	movl	$0, -52(%rbp)
	jmp	.L27
.L28:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -52(%rbp)
.L27:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L28
	movl	$0, -48(%rbp)
	jmp	.L29
.L30:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L30
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	sortup
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	c(%rip), %rax
	movq	%rax, %rdi
	call	sortdown
	movl	$0, -44(%rbp)
	jmp	.L31
.L32:
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$1, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	movq	%rax, %rbx
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$0, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	imulq	%rbx, %rax
	addq	%rax, -32(%rbp)
	addl	$1, -44(%rbp)
.L31:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L32
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.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	upll
	.type	upll, @function
upll:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	upll, .-upll
	.p2align 4
	.globl	downll
	.type	downll, @function
downll:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	downll, .-downll
	.p2align 4
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE53:
	.size	sortup, .-sortup
	.p2align 4
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE54:
	.size	sortdown, .-sortdown
	.p2align 4
	.globl	isOK_a
	.type	isOK_a, @function
isOK_a:
.LFB55:
	.cfi_startproc
	endbr64
	leaq	a(%rip), %rax
	cmpq	%rdi, (%rax,%rsi,8)
	setge	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	isOK_a, .-isOK_a
	.p2align 4
	.globl	isOK_c
	.type	isOK_c, @function
isOK_c:
.LFB56:
	.cfi_startproc
	endbr64
	leaq	c(%rip), %rax
	cmpq	%rdi, (%rax,%rsi,8)
	setle	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	isOK_c, .-isOK_c
	.p2align 4
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB57:
	.cfi_startproc
	endbr64
	movq	%rsi, %rcx
	leaq	1(%rsi), %rsi
	movq	%rsi, %rax
	negq	%rax
	cmovs	%rsi, %rax
	cmpq	$1, %rax
	jle	.L21
	movq	$-1, %rsi
	testq	%rdx, %rdx
	jne	.L22
	leaq	c(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %r8
	cmpq	(%r9,%rax,8), %rdi
	jge	.L15
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rsi, %rdx
	negq	%rdx
	cmovs	%rsi, %rdx
	cmpq	$1, %rdx
	jle	.L21
	movq	%rax, %rsi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rcx, %r8
.L12:
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	a(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %r8
	cmpq	(%r9,%rax,8), %rdi
	jg	.L19
	movq	%rax, %rcx
	subq	%rsi, %rcx
	movq	%rcx, %rdx
	negq	%rdx
	cmovs	%rcx, %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rax, %rcx
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rsi, %rdx
	negq	%rdx
	cmovs	%rsi, %rdx
	cmpq	$1, %rdx
	jle	.L21
	movq	%rax, %rsi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, %rcx
	subq	%rsi, %rcx
	movq	%rcx, %rdx
	negq	%rdx
	cmovs	%rcx, %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rax, %rcx
	jmp	.L18
	.cfi_endproc
.LFE57:
	.size	binary_search, .-binary_search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB58:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, (%rsp)
	movq	(%rsp), %rax
	jle	.L27
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r13
	cmpq	%rbx, %rax
	jg	.L28
	testq	%rax, %rax
	jle	.L27
	leaq	b(%rip), %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r13
	cmpq	%rbx, %rax
	jg	.L29
	leaq	c(%rip), %rbx
	testq	%rax, %rax
	jle	.L30
	movq	%rbx, %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L31
.L30:
	movslq	%eax, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	movq	%rbp, %rdi
	call	qsort@PLT
	movslq	(%rsp), %rsi
	movq	%rbx, %rdi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	call	qsort@PLT
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	jle	.L41
	leaq	b(%rip), %rsi
	xorl	%r8d, %r8d
	leaq	(%rsi,%rdi,8), %r9
	.p2align 4,,10
	.p2align 3
.L39:
	movq	(%rsi), %rdx
	movq	%rdi, %r10
	movq	$-1, %r11
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	(%r11,%r10), %rcx
	movq	%rcx, %rax
	shrq	$63, %rax
	addq	%rcx, %rax
	sarq	%rax
	cmpq	0(%rbp,%rax,8), %rdx
	cmovg	%rax, %r11
	cmovle	%rax, %r10
.L34:
	movq	%r10, %rcx
	subq	%r11, %rcx
	movq	%rcx, %rax
	negq	%rax
	cmovs	%rcx, %rax
	cmpq	$1, %rax
	jg	.L35
	movq	%rdi, %rcx
	movq	$-1, %r11
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L38:
	leaq	(%rcx,%r11), %r12
	movq	%r12, %rax
	shrq	$63, %rax
	addq	%r12, %rax
	sarq	%rax
	cmpq	(%rbx,%rax,8), %rdx
	cmovl	%rax, %r11
	cmovge	%rax, %rcx
.L37:
	movq	%rcx, %r12
	subq	%r11, %r12
	movq	%r12, %rax
	negq	%rax
	cmovs	%r12, %rax
	cmpq	$1, %rax
	jg	.L38
	imulq	%r10, %rcx
	addq	$8, %rsi
	addq	%rcx, %r8
	cmpq	%rsi, %r9
	jne	.L39
.L32:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L27:
	.cfi_restore_state
	leaq	c(%rip), %rbx
	jmp	.L30
.L41:
	xorl	%r8d, %r8d
	jmp	.L32
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE58:
	.size	main, .-main
	.globl	c
	.bss
	.align 32
	.type	c, @object
	.size	c, 800040
c:
	.zero	800040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800040
b:
	.zero	800040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.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	upll
	.type	upll, @function
upll:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	upll, .-upll
	.p2align 4
	.globl	downll
	.type	downll, @function
downll:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	downll, .-downll
	.p2align 4
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE53:
	.size	sortup, .-sortup
	.p2align 4
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE54:
	.size	sortdown, .-sortdown
	.p2align 4
	.globl	isOK_a
	.type	isOK_a, @function
isOK_a:
.LFB55:
	.cfi_startproc
	endbr64
	leaq	a(%rip), %rax
	cmpq	%rdi, (%rax,%rsi,8)
	setge	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	isOK_a, .-isOK_a
	.p2align 4
	.globl	isOK_c
	.type	isOK_c, @function
isOK_c:
.LFB56:
	.cfi_startproc
	endbr64
	leaq	c(%rip), %rax
	cmpq	%rdi, (%rax,%rsi,8)
	setle	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	isOK_c, .-isOK_c
	.p2align 4
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB57:
	.cfi_startproc
	endbr64
	movq	%rsi, %rcx
	leaq	1(%rsi), %rsi
	movq	%rsi, %rax
	negq	%rax
	cmovs	%rsi, %rax
	cmpq	$1, %rax
	jle	.L21
	movq	$-1, %rsi
	testq	%rdx, %rdx
	jne	.L22
	leaq	c(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %r8
	cmpq	(%r9,%rax,8), %rdi
	jge	.L15
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rsi, %rdx
	negq	%rdx
	cmovs	%rsi, %rdx
	cmpq	$1, %rdx
	jle	.L21
	movq	%rax, %rsi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rcx, %r8
.L12:
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	a(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %r8
	cmpq	(%r9,%rax,8), %rdi
	jg	.L19
	movq	%rax, %rcx
	subq	%rsi, %rcx
	movq	%rcx, %rdx
	negq	%rdx
	cmovs	%rcx, %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rax, %rcx
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movq	%rsi, %rdx
	negq	%rdx
	cmovs	%rsi, %rdx
	cmpq	$1, %rdx
	jle	.L21
	movq	%rax, %rsi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, %rcx
	subq	%rsi, %rcx
	movq	%rcx, %rdx
	negq	%rdx
	cmovs	%rcx, %rdx
	cmpq	$1, %rdx
	jle	.L12
	movq	%rax, %rcx
	jmp	.L18
	.cfi_endproc
.LFE57:
	.size	binary_search, .-binary_search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB58:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, (%rsp)
	movq	(%rsp), %rax
	jle	.L27
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r13
	cmpq	%rbx, %rax
	jg	.L28
	testq	%rax, %rax
	jle	.L27
	leaq	b(%rip), %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r13
	cmpq	%rbx, %rax
	jg	.L29
	leaq	c(%rip), %rbx
	testq	%rax, %rax
	jle	.L30
	movq	%rbx, %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L31
.L30:
	movslq	%eax, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	movq	%rbp, %rdi
	call	qsort@PLT
	movslq	(%rsp), %rsi
	movq	%rbx, %rdi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	call	qsort@PLT
	movq	(%rsp), %rdi
	testq	%rdi, %rdi
	jle	.L41
	leaq	b(%rip), %rsi
	xorl	%r8d, %r8d
	leaq	(%rsi,%rdi,8), %r9
	.p2align 4,,10
	.p2align 3
.L39:
	movq	(%rsi), %rdx
	movq	%rdi, %r10
	movq	$-1, %r11
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	(%r11,%r10), %rcx
	movq	%rcx, %rax
	shrq	$63, %rax
	addq	%rcx, %rax
	sarq	%rax
	cmpq	0(%rbp,%rax,8), %rdx
	cmovg	%rax, %r11
	cmovle	%rax, %r10
.L34:
	movq	%r10, %rcx
	subq	%r11, %rcx
	movq	%rcx, %rax
	negq	%rax
	cmovs	%rcx, %rax
	cmpq	$1, %rax
	jg	.L35
	movq	%rdi, %rcx
	movq	$-1, %r11
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L38:
	leaq	(%rcx,%r11), %r12
	movq	%r12, %rax
	shrq	$63, %rax
	addq	%r12, %rax
	sarq	%rax
	cmpq	(%rbx,%rax,8), %rdx
	cmovl	%rax, %r11
	cmovge	%rax, %rcx
.L37:
	movq	%rcx, %r12
	subq	%r11, %r12
	movq	%r12, %rax
	negq	%rax
	cmovs	%r12, %rax
	cmpq	$1, %rax
	jg	.L38
	imulq	%r10, %rcx
	addq	$8, %rsi
	addq	%rcx, %r8
	cmpq	%rsi, %r9
	jne	.L39
.L32:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L27:
	.cfi_restore_state
	leaq	c(%rip), %rbx
	jmp	.L30
.L41:
	xorl	%r8d, %r8d
	jmp	.L32
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE58:
	.size	main, .-main
	.globl	c
	.bss
	.align 32
	.type	c, @object
	.size	c, 800040
c:
	.zero	800040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800040
b:
	.zero	800040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.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 <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

ll a[100005], b[100005], c[100005];

int isOK_a(ll key, ll mid) { return a[mid] >= key ? 1 : 0; }
int isOK_c(ll key, ll mid) { return c[mid] <= key ? 1 : 0; }

ll binary_search(ll key, ll n, ll aORc) // a -> aORC=1, c -> aORC=0,
{
  ll ok = n, ng = -1;
  while (llabs(ok - ng) > 1)
  {
    ll mid = (ok + ng) / 2;
    if (aORc)
      isOK_a(key, mid) ? (ok = mid) : (ng = mid);
    else
      isOK_c(key, mid) ? (ok = mid) : (ng = mid);
  }
  return ok;
}

int main()
{
  ll n, ans = 0;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
    scanf("%lld", a + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", b + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", c + i);
  sortup(a, n);
  sortdown(c, n);
  for (int i = 0; i < n; i++)
    ans += binary_search(b[i], n, 1) * binary_search(b[i], n, 0);
  printf("%lld\n", ans);
  return 0;
}

2
1 5
2 4
3 6

3

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

```c
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

ll a[100005], b[100005], c[100005];

int isOK_a(ll key, ll mid) { return a[mid] >= key ? 1 : 0; }
int isOK_c(ll key, ll mid) { return c[mid] <= key ? 1 : 0; }

ll binary_search(ll key, ll n, ll aORc) // a -> aORC=1, c -> aORC=0,
{
  ll ok = n, ng = -1;
  while (llabs(ok - ng) > 1)
  {
    ll mid = (ok + ng) / 2;
    if (aORc)
      isOK_a(key, mid) ? (ok = mid) : (ng = mid);
    else
      isOK_c(key, mid) ? (ok = mid) : (ng = mid);
  }
  return ok;
}

int main()
{
  ll n, ans = 0;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++)
    scanf("%lld", a + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", b + i);
  for (int i = 0; i < n; i++)
    scanf("%lld", c + i);
  sortup(a, n);
  sortdown(c, n);
  for (int i = 0; i < n; i++)
    ans += binary_search(b[i], n, 1) * binary_search(b[i], n, 0);
  printf("%lld\n", ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800040
b:
	.zero	800040
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800040
c:
	.zero	800040
	.text
	.globl	isOK_a
	.type	isOK_a, @function
isOK_a:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	isOK_a, .-isOK_a
	.globl	isOK_c
	.type	isOK_c, @function
isOK_c:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setge	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	isOK_c, .-isOK_c
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$56, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%rdx, -56(%rbp)
	movq	-48(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	$-1, -16(%rbp)
	jmp	.L18
.L22:
	movq	-24(%rbp), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	cmpq	$0, -56(%rbp)
	je	.L19
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_a
	testl	%eax, %eax
	je	.L20
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_c
	testl	%eax, %eax
	je	.L21
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L18:
	movq	-24(%rbp), %rax
	subq	-16(%rbp), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovns	%rdx, %rax
	cmpq	$1, %rax
	jg	.L22
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	binary_search, .-binary_search
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L25
.L26:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L25:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L26
	movl	$0, -52(%rbp)
	jmp	.L27
.L28:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -52(%rbp)
.L27:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L28
	movl	$0, -48(%rbp)
	jmp	.L29
.L30:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L30
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	sortup
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	c(%rip), %rax
	movq	%rax, %rdi
	call	sortdown
	movl	$0, -44(%rbp)
	jmp	.L31
.L32:
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$1, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	movq	%rax, %rbx
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$0, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	imulq	%rbx, %rax
	addq	%rax, -32(%rbp)
	addl	$1, -44(%rbp)
.L31:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L32
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.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	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800040
b:
	.zero	800040
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800040
c:
	.zero	800040
	.text
	.globl	isOK_a
	.type	isOK_a, @function
isOK_a:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	isOK_a, .-isOK_a
	.globl	isOK_c
	.type	isOK_c, @function
isOK_c:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -8(%rbp)
	setge	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	isOK_c, .-isOK_c
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$56, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%rdx, -56(%rbp)
	movq	-48(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	$-1, -16(%rbp)
	jmp	.L18
.L22:
	movq	-24(%rbp), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -8(%rbp)
	cmpq	$0, -56(%rbp)
	je	.L19
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_a
	testl	%eax, %eax
	je	.L20
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L20:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	isOK_c
	testl	%eax, %eax
	je	.L21
	movq	-8(%rbp), %rax
	movq	%rax, -24(%rbp)
	jmp	.L18
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
.L18:
	movq	-24(%rbp), %rax
	subq	-16(%rbp), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovns	%rdx, %rax
	cmpq	$1, %rax
	jg	.L22
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	binary_search, .-binary_search
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L25
.L26:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L25:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L26
	movl	$0, -52(%rbp)
	jmp	.L27
.L28:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -52(%rbp)
.L27:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L28
	movl	$0, -48(%rbp)
	jmp	.L29
.L30:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L30
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	sortup
	movq	-40(%rbp), %rax
	movl	%eax, %esi
	leaq	c(%rip), %rax
	movq	%rax, %rdi
	call	sortdown
	movl	$0, -44(%rbp)
	jmp	.L31
.L32:
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$1, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	movq	%rax, %rbx
	movq	-40(%rbp), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	$0, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	binary_search
	imulq	%rbx, %rax
	addq	%rax, -32(%rbp)
	addl	$1, -44(%rbp)
.L31:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L32
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.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:
