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

int kugyu(const void* tomatuharuka, const void* igutiyuka) {
	int hayamisaori = *(const int*)tomatuharuka, hanazawakana = *(const int*)igutiyuka;
	return hayamisaori < hanazawakana ? -1 : hayamisaori > hanazawakana;
}

int N;
int A[114514];
int B[114514];
int C[114514];

/* target以下の要素数を求める */
int mizuhasu(const int data[], int N, int target) {
	int le = 0, greater = N - 1;
	if (data[0] > target) return 0;
	if (data[N - 1] <= target) return N;
	while (le + 1 < greater) {
		int mid = le + (greater - le) / 2;
		if (data[mid] <= target) le = mid; else greater = mid;
	}
	return le + 1;
}

int64_t asumisu[114514];

int main(void) {
	int i;
	int64_t mareitaso = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &B[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &C[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), kugyu);
	qsort(B, N, sizeof(*B), kugyu);
	qsort(C, N, sizeof(*C), kugyu);

	for (i = 0; i < N; i++) {
		int mikakosi = mizuhasu(C, N, B[i]);
		asumisu[i] = N - mikakosi;
	}
	asumisu[N] = 0; /* 使えるパーツBがそもそも無い */

	/* k個目のパーツBが使えるなら、k+1個目以降も使える */
	for (i = N - 1; i > 0; i--) {
		asumisu[i - 1] += asumisu[i];
	}

	for (i = 0; i < N; i++) {
		int satorina = mizuhasu(B, N, A[i]);
		/* Bの最初satorina個がA[i]以下 → satorina個目(0-origin)以降が使える */
		mareitaso += asumisu[satorina];
	}

	printf("%" PRId64 "\n", mareitaso);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	kugyu
	.type	kugyu, @function
kugyu:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L2
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	kugyu, .-kugyu
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 458056
C:
	.zero	458056
	.text
	.globl	mizuhasu
	.type	mizuhasu, @function
mizuhasu:
.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L6
	movl	$0, %eax
	jmp	.L7
.L6:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L9:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mizuhasu, .-mizuhasu
	.globl	asumisu
	.bss
	.align 32
	.type	asumisu, @object
	.size	asumisu, 916112
asumisu:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	movq	$0, -8(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$0, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L17
	movl	$0, -20(%rbp)
	jmp	.L18
.L20:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L14
.L19:
	addl	$1, -20(%rbp)
.L18:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L20
	movl	$0, -20(%rbp)
	jmp	.L21
.L23:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L22
	movl	$1, %eax
	jmp	.L14
.L22:
	addl	$1, -20(%rbp)
.L21:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L23
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -20(%rbp)
	jmp	.L24
.L25:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -12(%rbp)
	movl	N(%rip), %eax
	subl	-12(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	asumisu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L24:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L26
.L27:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -20(%rbp)
.L26:
	cmpl	$0, -20(%rbp)
	jg	.L27
	movl	$0, -20(%rbp)
	jmp	.L28
.L29:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -8(%rbp)
	addl	$1, -20(%rbp)
.L28:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L29
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	kugyu
	.type	kugyu, @function
kugyu:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	kugyu, .-kugyu
	.p2align 4
	.globl	mizuhasu
	.type	mizuhasu, @function
mizuhasu:
.LFB40:
	.cfi_startproc
	endbr64
	movq	%rdi, %r9
	xorl	%eax, %eax
	cmpl	%edx, (%rdi)
	jg	.L5
	movslq	%esi, %rcx
	movl	%esi, %eax
	cmpl	%edx, -4(%rdi,%rcx,4)
	jle	.L5
	leal	-1(%rsi), %r8d
	xorl	%ecx, %ecx
	movl	$1, %esi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%r8d, %edi
	subl	%ecx, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%ecx, %eax
	movslq	%eax, %rdi
	cmpl	%edx, (%r9,%rdi,4)
	jg	.L13
	movl	%eax, %ecx
	leal	1(%rax), %esi
.L8:
	movl	%esi, %eax
	cmpl	%r8d, %esi
	jl	.L9
.L5:
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r8d
	jmp	.L8
	.cfi_endproc
.LFE40:
	.size	mizuhasu, .-mizuhasu
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L18
	cmpl	$0, N(%rip)
	movl	N(%rip), %eax
	leaq	A(%rip), %r12
	jle	.L17
	movq	%r12, %rbx
	xorl	%ebp, %ebp
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L38:
	movl	N(%rip), %eax
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, %eax
	jle	.L37
.L19:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L38
.L18:
	movl	$1, %eax
.L14:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L37:
	.cfi_restore_state
	testl	%eax, %eax
	jle	.L17
	leaq	B(%rip), %rbp
	xorl	%r14d, %r14d
	movq	%rbp, %rbx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L40:
	movl	N(%rip), %eax
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, %eax
	jle	.L39
.L20:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L40
	jmp	.L18
.L39:
	leaq	C(%rip), %rbx
	xorl	%r15d, %r15d
	movq	%rbx, %r14
	testl	%eax, %eax
	jg	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L41:
	movl	N(%rip), %eax
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, %eax
	jle	.L21
.L22:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L41
	jmp	.L18
.L17:
	leaq	B(%rip), %rbp
	leaq	C(%rip), %rbx
.L21:
	leaq	kugyu(%rip), %r13
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%r12, %rdi
	movq	%r13, %rcx
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbp, %rdi
	movslq	N(%rip), %rsi
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbx, %rdi
	movslq	N(%rip), %rsi
	leaq	asumisu(%rip), %r13
	call	qsort@PLT
	movl	N(%rip), %r10d
	xorl	%r11d, %r11d
	jmp	.L23
.L24:
	movl	0(%rbp,%r11,4), %edx
	movl	%r10d, %esi
	movq	%rbx, %rdi
	call	mizuhasu
	movl	%eax, %r8d
	movl	%r10d, %eax
	subl	%r8d, %eax
	cltq
	movq	%rax, 0(%r13,%r11,8)
	addq	$1, %r11
.L23:
	cmpl	%r11d, %r10d
	jg	.L24
	movslq	%r10d, %rax
	leaq	-8+asumisu(%rip), %rdx
	movq	$0, 0(%r13,%rax,8)
	leal	-1(%r10), %eax
	cltq
	jmp	.L25
.L26:
	movq	0(%r13,%rax,8), %rcx
	addq	%rcx, (%rdx,%rax,8)
	subq	$1, %rax
.L25:
	testl	%eax, %eax
	jg	.L26
	xorl	%r11d, %r11d
	xorl	%r14d, %r14d
	jmp	.L27
.L28:
	movl	(%r12,%r11,4), %edx
	movl	%r10d, %esi
	movq	%rbp, %rdi
	addq	$1, %r11
	call	mizuhasu
	cltq
	addq	0(%r13,%rax,8), %r14
.L27:
	cmpl	%r11d, %r10d
	jg	.L28
	movq	%r14, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L14
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	asumisu
	.bss
	.align 32
	.type	asumisu, @object
	.size	asumisu, 916112
asumisu:
	.zero	916112
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 458056
C:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.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
	.p2align 4
	.globl	kugyu
	.type	kugyu, @function
kugyu:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	kugyu, .-kugyu
	.p2align 4
	.globl	mizuhasu
	.type	mizuhasu, @function
mizuhasu:
.LFB40:
	.cfi_startproc
	endbr64
	movq	%rdi, %r9
	xorl	%eax, %eax
	cmpl	%edx, (%rdi)
	jg	.L5
	movslq	%esi, %rcx
	movl	%esi, %eax
	cmpl	%edx, -4(%rdi,%rcx,4)
	jle	.L5
	leal	-1(%rsi), %r8d
	xorl	%ecx, %ecx
	movl	$1, %esi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%r8d, %edi
	subl	%ecx, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%ecx, %eax
	movslq	%eax, %rdi
	cmpl	%edx, (%r9,%rdi,4)
	jg	.L13
	movl	%eax, %ecx
	leal	1(%rax), %esi
.L8:
	movl	%esi, %eax
	cmpl	%r8d, %esi
	jl	.L9
.L5:
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r8d
	jmp	.L8
	.cfi_endproc
.LFE40:
	.size	mizuhasu, .-mizuhasu
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L18
	cmpl	$0, N(%rip)
	movl	N(%rip), %eax
	leaq	A(%rip), %r12
	jle	.L17
	movq	%r12, %rbx
	xorl	%ebp, %ebp
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L38:
	movl	N(%rip), %eax
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, %eax
	jle	.L37
.L19:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L38
.L18:
	movl	$1, %eax
.L14:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L37:
	.cfi_restore_state
	testl	%eax, %eax
	jle	.L17
	leaq	B(%rip), %rbp
	xorl	%r14d, %r14d
	movq	%rbp, %rbx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L40:
	movl	N(%rip), %eax
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, %eax
	jle	.L39
.L20:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L40
	jmp	.L18
.L39:
	leaq	C(%rip), %rbx
	xorl	%r15d, %r15d
	movq	%rbx, %r14
	testl	%eax, %eax
	jg	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L41:
	movl	N(%rip), %eax
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, %eax
	jle	.L21
.L22:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L41
	jmp	.L18
.L17:
	leaq	B(%rip), %rbp
	leaq	C(%rip), %rbx
.L21:
	leaq	kugyu(%rip), %r13
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%r12, %rdi
	movq	%r13, %rcx
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbp, %rdi
	movslq	N(%rip), %rsi
	call	qsort@PLT
	movq	%r13, %rcx
	movl	$4, %edx
	movq	%rbx, %rdi
	movslq	N(%rip), %rsi
	leaq	asumisu(%rip), %r13
	call	qsort@PLT
	movl	N(%rip), %r10d
	xorl	%r11d, %r11d
	jmp	.L23
.L24:
	movl	0(%rbp,%r11,4), %edx
	movl	%r10d, %esi
	movq	%rbx, %rdi
	call	mizuhasu
	movl	%eax, %r8d
	movl	%r10d, %eax
	subl	%r8d, %eax
	cltq
	movq	%rax, 0(%r13,%r11,8)
	addq	$1, %r11
.L23:
	cmpl	%r11d, %r10d
	jg	.L24
	movslq	%r10d, %rax
	leaq	-8+asumisu(%rip), %rdx
	movq	$0, 0(%r13,%rax,8)
	leal	-1(%r10), %eax
	cltq
	jmp	.L25
.L26:
	movq	0(%r13,%rax,8), %rcx
	addq	%rcx, (%rdx,%rax,8)
	subq	$1, %rax
.L25:
	testl	%eax, %eax
	jg	.L26
	xorl	%r11d, %r11d
	xorl	%r14d, %r14d
	jmp	.L27
.L28:
	movl	(%r12,%r11,4), %edx
	movl	%r10d, %esi
	movq	%rbp, %rdi
	addq	$1, %r11
	call	mizuhasu
	cltq
	addq	0(%r13,%rax,8), %r14
.L27:
	cmpl	%r11d, %r10d
	jg	.L28
	movq	%r14, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L14
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	asumisu
	.bss
	.align 32
	.type	asumisu, @object
	.size	asumisu, 916112
asumisu:
	.zero	916112
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 458056
C:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.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 <inttypes.h>

int kugyu(const void* tomatuharuka, const void* igutiyuka) {
	int hayamisaori = *(const int*)tomatuharuka, hanazawakana = *(const int*)igutiyuka;
	return hayamisaori < hanazawakana ? -1 : hayamisaori > hanazawakana;
}

int N;
int A[114514];
int B[114514];
int C[114514];

/* target以下の要素数を求める */
int mizuhasu(const int data[], int N, int target) {
	int le = 0, greater = N - 1;
	if (data[0] > target) return 0;
	if (data[N - 1] <= target) return N;
	while (le + 1 < greater) {
		int mid = le + (greater - le) / 2;
		if (data[mid] <= target) le = mid; else greater = mid;
	}
	return le + 1;
}

int64_t asumisu[114514];

int main(void) {
	int i;
	int64_t mareitaso = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &B[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &C[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), kugyu);
	qsort(B, N, sizeof(*B), kugyu);
	qsort(C, N, sizeof(*C), kugyu);

	for (i = 0; i < N; i++) {
		int mikakosi = mizuhasu(C, N, B[i]);
		asumisu[i] = N - mikakosi;
	}
	asumisu[N] = 0; /* 使えるパーツBがそもそも無い */

	/* k個目のパーツBが使えるなら、k+1個目以降も使える */
	for (i = N - 1; i > 0; i--) {
		asumisu[i - 1] += asumisu[i];
	}

	for (i = 0; i < N; i++) {
		int satorina = mizuhasu(B, N, A[i]);
		/* Bの最初satorina個がA[i]以下 → satorina個目(0-origin)以降が使える */
		mareitaso += asumisu[satorina];
	}

	printf("%" PRId64 "\n", mareitaso);
	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 <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int kugyu(const void* tomatuharuka, const void* igutiyuka) {
	int hayamisaori = *(const int*)tomatuharuka, hanazawakana = *(const int*)igutiyuka;
	return hayamisaori < hanazawakana ? -1 : hayamisaori > hanazawakana;
}

int N;
int A[114514];
int B[114514];
int C[114514];

/* target以下の要素数を求める */
int mizuhasu(const int data[], int N, int target) {
	int le = 0, greater = N - 1;
	if (data[0] > target) return 0;
	if (data[N - 1] <= target) return N;
	while (le + 1 < greater) {
		int mid = le + (greater - le) / 2;
		if (data[mid] <= target) le = mid; else greater = mid;
	}
	return le + 1;
}

int64_t asumisu[114514];

int main(void) {
	int i;
	int64_t mareitaso = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &B[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		if (scanf("%d", &C[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), kugyu);
	qsort(B, N, sizeof(*B), kugyu);
	qsort(C, N, sizeof(*C), kugyu);

	for (i = 0; i < N; i++) {
		int mikakosi = mizuhasu(C, N, B[i]);
		asumisu[i] = N - mikakosi;
	}
	asumisu[N] = 0; /* 使えるパーツBがそもそも無い */

	/* k個目のパーツBが使えるなら、k+1個目以降も使える */
	for (i = N - 1; i > 0; i--) {
		asumisu[i - 1] += asumisu[i];
	}

	for (i = 0; i < N; i++) {
		int satorina = mizuhasu(B, N, A[i]);
		/* Bの最初satorina個がA[i]以下 → satorina個目(0-origin)以降が使える */
		mareitaso += asumisu[satorina];
	}

	printf("%" PRId64 "\n", mareitaso);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	kugyu
	.type	kugyu, @function
kugyu:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L2
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	kugyu, .-kugyu
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 458056
C:
	.zero	458056
	.text
	.globl	mizuhasu
	.type	mizuhasu, @function
mizuhasu:
.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L6
	movl	$0, %eax
	jmp	.L7
.L6:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L9:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mizuhasu, .-mizuhasu
	.globl	asumisu
	.bss
	.align 32
	.type	asumisu, @object
	.size	asumisu, 916112
asumisu:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	movq	$0, -8(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$0, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L17
	movl	$0, -20(%rbp)
	jmp	.L18
.L20:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L14
.L19:
	addl	$1, -20(%rbp)
.L18:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L20
	movl	$0, -20(%rbp)
	jmp	.L21
.L23:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L22
	movl	$1, %eax
	jmp	.L14
.L22:
	addl	$1, -20(%rbp)
.L21:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L23
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -20(%rbp)
	jmp	.L24
.L25:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -12(%rbp)
	movl	N(%rip), %eax
	subl	-12(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	asumisu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L24:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L26
.L27:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -20(%rbp)
.L26:
	cmpl	$0, -20(%rbp)
	jg	.L27
	movl	$0, -20(%rbp)
	jmp	.L28
.L29:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -8(%rbp)
	addl	$1, -20(%rbp)
.L28:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L29
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	kugyu
	.type	kugyu, @function
kugyu:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L2
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	kugyu, .-kugyu
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 458056
C:
	.zero	458056
	.text
	.globl	mizuhasu
	.type	mizuhasu, @function
mizuhasu:
.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L6
	movl	$0, %eax
	jmp	.L7
.L6:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L9:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L11
	movl	-12(%rbp), %eax
	addl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mizuhasu, .-mizuhasu
	.globl	asumisu
	.bss
	.align 32
	.type	asumisu, @object
	.size	asumisu, 916112
asumisu:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	movq	$0, -8(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$0, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L17
	movl	$0, -20(%rbp)
	jmp	.L18
.L20:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L14
.L19:
	addl	$1, -20(%rbp)
.L18:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L20
	movl	$0, -20(%rbp)
	jmp	.L21
.L23:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %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
	cmpl	$1, %eax
	je	.L22
	movl	$1, %eax
	jmp	.L14
.L22:
	addl	$1, -20(%rbp)
.L21:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L23
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	N(%rip), %eax
	cltq
	leaq	kugyu(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -20(%rbp)
	jmp	.L24
.L25:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -12(%rbp)
	movl	N(%rip), %eax
	subl	-12(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	asumisu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L24:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L26
.L27:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	subl	$1, -20(%rbp)
.L26:
	cmpl	$0, -20(%rbp)
	jg	.L27
	movl	$0, -20(%rbp)
	jmp	.L28
.L29:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	B(%rip), %rax
	movq	%rax, %rdi
	call	mizuhasu
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	asumisu(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -8(%rbp)
	addl	$1, -20(%rbp)
.L28:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L29
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
