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>

int asc(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);
  int a[100000], b[100000], c[100000];
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  for(int i = 0; i < n; i++) scanf("%d", &b[i]);
  for(int i = 0; i < n; i++) scanf("%d", &c[i]);

  qsort(a, n, sizeof(int), asc);
  qsort(b, n, sizeof(int), asc);
  qsort(c, n, sizeof(int), asc);

  int k = 0; long long ia[100000], xb[100000];
  xb[n] = 0;
  for(int i = 0; i < n; i++){
    while(a[i] >= b[k] && k < n) k++;
    ia[i] = k;
  }
  
  k = 0;
  for(int i = 0; i < n; i++){
    while(b[i] >= c[k] && k < n) k++;
    xb[i] = n - k;
  }

  k = n - 1;
  long long sb[100000] = {};
  sb[n - 1] = xb[n - 1];
  while(k > 0){
    k--;
    sb[k] = sb[k + 1] + xb[k];
  }

  long long ans = 0;
  for(int i = 0; i < n; i++){
    ans += sb[ia[i]];
  }
  
  printf("%lld\n", ans);

  return 0;
}
				  
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	asc
	.type	asc, @function
asc:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3596288(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3792, %rsp
	movl	%edi, -3600068(%rbp)
	movq	%rsi, -3600080(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3600052(%rbp)
	jmp	.L4
.L5:
	leaq	-3600016(%rbp), %rdx
	movl	-3600052(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600052(%rbp)
.L4:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600052(%rbp)
	jl	.L5
	movl	$0, -3600048(%rbp)
	jmp	.L6
.L7:
	leaq	-3200016(%rbp), %rdx
	movl	-3600048(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600048(%rbp)
.L6:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600048(%rbp)
	jl	.L7
	movl	$0, -3600044(%rbp)
	jmp	.L8
.L9:
	leaq	-2800016(%rbp), %rdx
	movl	-3600044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600044(%rbp)
.L8:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600044(%rbp)
	jl	.L9
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3600016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3200016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-2800016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -3600040(%rbp)
	movl	-3600056(%rbp), %eax
	cltq
	movq	$0, -1600016(%rbp,%rax,8)
	movl	$0, -3600036(%rbp)
	jmp	.L10
.L13:
	addl	$1, -3600040(%rbp)
.L11:
	movl	-3600036(%rbp), %eax
	cltq
	movl	-3600016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L13
.L12:
	movl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600036(%rbp), %eax
	cltq
	movq	%rdx, -2400016(%rbp,%rax,8)
	addl	$1, -3600036(%rbp)
.L10:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600036(%rbp)
	jl	.L11
	movl	$0, -3600040(%rbp)
	movl	$0, -3600032(%rbp)
	jmp	.L15
.L18:
	addl	$1, -3600040(%rbp)
.L16:
	movl	-3600032(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L18
.L17:
	movl	-3600056(%rbp), %eax
	subl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600032(%rbp), %eax
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	addl	$1, -3600032(%rbp)
.L15:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600032(%rbp)
	jl	.L16
	movl	-3600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -3600040(%rbp)
	leaq	-800016(%rbp), %rax
	movl	$800000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %ecx
	movslq	%edx, %rax
	movq	-1600016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
	jmp	.L20
.L21:
	subl	$1, -3600040(%rbp)
	movl	-3600040(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
.L20:
	cmpl	$0, -3600040(%rbp)
	jg	.L21
	movq	$0, -3600024(%rbp)
	movl	$0, -3600028(%rbp)
	jmp	.L22
.L23:
	movl	-3600028(%rbp), %eax
	cltq
	movq	-2400016(%rbp,%rax,8), %rax
	movq	-800016(%rbp,%rax,8), %rax
	addq	%rax, -3600024(%rbp)
	addl	$1, -3600028(%rbp)
.L22:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600028(%rbp)
	jl	.L23
	movq	-3600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	asc
	.type	asc, @function
asc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-3596288(%rsp), %r11
	.cfi_def_cfa 11, 3596344
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3752, %rsp
	.cfi_def_cfa_offset 3600096
	leaq	.LC0(%rip), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 3600024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %r12
	movq	%r12, %r13
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L50
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L4
	leaq	400016(%rsp), %rbp
	xorl	%r13d, %r13d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L6
	leaq	800016(%rsp), %r13
	testl	%eax, %eax
	jle	.L7
	movq	%r13, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r15
	cmpl	%r14d, %eax
	jg	.L8
.L7:
	leaq	asc(%rip), %r14
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%r12, %rdi
	movq	%r14, %rcx
	call	qsort@PLT
	movslq	12(%rsp), %rsi
	movq	%r14, %rcx
	movq	%rbp, %rdi
	movl	$4, %edx
	call	qsort@PLT
	movslq	12(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r14, %rcx
	movl	$4, %edx
	call	qsort@PLT
	movslq	12(%rsp), %rdi
	xorl	%edx, %edx
	movq	$0, 2000016(%rsp,%rdi,8)
	movq	%rdi, %rbx
	testl	%edi, %edi
	jle	.L10
	movl	400016(%rsp), %edx
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	leaq	1200016(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r12,%r10,4), %r9d
	cmpl	%r8d, %ebx
	jle	.L16
	cmpl	%edx, %r9d
	leal	1(%r8), %eax
	setge	%cl
	cltq
	testb	%cl, %cl
	je	.L16
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rax,4), %edx
	movl	%eax, %r8d
	cmpl	%r9d, %edx
	setle	%sil
	cmpl	%eax, %ebx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L11
.L16:
	movslq	%r8d, %rax
	movq	%rax, (%r14,%r10,8)
	addq	$1, %r10
	cmpq	%r10, %rdi
	jne	.L12
	movl	800016(%rsp), %edx
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	leaq	2000016(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	0(%rbp,%r10,4), %r9d
	cmpl	%edx, %r9d
	jl	.L21
	cmpl	%r8d, %ebx
	leal	1(%r8), %eax
	setg	%cl
	cltq
	testb	%cl, %cl
	je	.L21
	.p2align 4,,10
	.p2align 3
.L17:
	movl	0(%r13,%rax,4), %edx
	cmpl	%eax, %ebx
	movl	%eax, %r8d
	setg	%sil
	cmpl	%r9d, %edx
	setle	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L17
.L21:
	movl	%ebx, %eax
	subl	%r8d, %eax
	cltq
	movq	%rax, (%r12,%r10,8)
	addq	$1, %r10
	cmpq	%r10, %rdi
	jne	.L13
	leaq	2800016(%rsp), %rcx
	movl	$800000, %edx
	leal	-1(%rbx), %ebp
	xorl	%esi, %esi
	movq	%rcx, %rdi
	call	memset@PLT
	movq	%rax, %rcx
	movslq	%ebp, %rax
	movq	2000016(%rsp,%rax,8), %rdx
	movq	%rdx, 2800016(%rsp,%rax,8)
	testl	%ebp, %ebp
	je	.L25
	.p2align 4,,10
	.p2align 3
.L22:
	addq	-8(%r12,%rax,8), %rdx
	movq	%rdx, -8(%rcx,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jg	.L22
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	(%r14,%rax,8), %rcx
	addq	$1, %rax
	addq	2800016(%rsp,%rcx,8), %rdx
	cmpl	%eax, %ebx
	jg	.L23
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	3600024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$3600040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movl	12(%rsp), %eax
.L4:
	leaq	400016(%rsp), %rbp
	leaq	800016(%rsp), %r13
	jmp	.L7
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	asc
	.type	asc, @function
asc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-3596288(%rsp), %r11
	.cfi_def_cfa 11, 3596344
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3752, %rsp
	.cfi_def_cfa_offset 3600096
	leaq	.LC0(%rip), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 3600024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %r12
	movq	%r12, %r13
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L50
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L4
	leaq	400016(%rsp), %rbp
	xorl	%r13d, %r13d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L6
	leaq	800016(%rsp), %r13
	testl	%eax, %eax
	jle	.L7
	movq	%r13, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r15
	cmpl	%r14d, %eax
	jg	.L8
.L7:
	leaq	asc(%rip), %r14
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%r12, %rdi
	movq	%r14, %rcx
	call	qsort@PLT
	movslq	12(%rsp), %rsi
	movq	%r14, %rcx
	movq	%rbp, %rdi
	movl	$4, %edx
	call	qsort@PLT
	movslq	12(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r14, %rcx
	movl	$4, %edx
	call	qsort@PLT
	movslq	12(%rsp), %rdi
	xorl	%edx, %edx
	movq	$0, 2000016(%rsp,%rdi,8)
	movq	%rdi, %rbx
	testl	%edi, %edi
	jle	.L10
	movl	400016(%rsp), %edx
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	leaq	1200016(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r12,%r10,4), %r9d
	cmpl	%r8d, %ebx
	jle	.L16
	cmpl	%edx, %r9d
	leal	1(%r8), %eax
	setge	%cl
	cltq
	testb	%cl, %cl
	je	.L16
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rax,4), %edx
	movl	%eax, %r8d
	cmpl	%r9d, %edx
	setle	%sil
	cmpl	%eax, %ebx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L11
.L16:
	movslq	%r8d, %rax
	movq	%rax, (%r14,%r10,8)
	addq	$1, %r10
	cmpq	%r10, %rdi
	jne	.L12
	movl	800016(%rsp), %edx
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	leaq	2000016(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	0(%rbp,%r10,4), %r9d
	cmpl	%edx, %r9d
	jl	.L21
	cmpl	%r8d, %ebx
	leal	1(%r8), %eax
	setg	%cl
	cltq
	testb	%cl, %cl
	je	.L21
	.p2align 4,,10
	.p2align 3
.L17:
	movl	0(%r13,%rax,4), %edx
	cmpl	%eax, %ebx
	movl	%eax, %r8d
	setg	%sil
	cmpl	%r9d, %edx
	setle	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L17
.L21:
	movl	%ebx, %eax
	subl	%r8d, %eax
	cltq
	movq	%rax, (%r12,%r10,8)
	addq	$1, %r10
	cmpq	%r10, %rdi
	jne	.L13
	leaq	2800016(%rsp), %rcx
	movl	$800000, %edx
	leal	-1(%rbx), %ebp
	xorl	%esi, %esi
	movq	%rcx, %rdi
	call	memset@PLT
	movq	%rax, %rcx
	movslq	%ebp, %rax
	movq	2000016(%rsp,%rax,8), %rdx
	movq	%rdx, 2800016(%rsp,%rax,8)
	testl	%ebp, %ebp
	je	.L25
	.p2align 4,,10
	.p2align 3
.L22:
	addq	-8(%r12,%rax,8), %rdx
	movq	%rdx, -8(%rcx,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jg	.L22
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	(%r14,%rax,8), %rcx
	addq	$1, %rax
	addq	2800016(%rsp,%rcx,8), %rdx
	cmpl	%eax, %ebx
	jg	.L23
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	3600024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$3600040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movl	12(%rsp), %eax
.L4:
	leaq	400016(%rsp), %rbp
	leaq	800016(%rsp), %r13
	jmp	.L7
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:

#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);
  int a[100000], b[100000], c[100000];
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  for(int i = 0; i < n; i++) scanf("%d", &b[i]);
  for(int i = 0; i < n; i++) scanf("%d", &c[i]);

  qsort(a, n, sizeof(int), asc);
  qsort(b, n, sizeof(int), asc);
  qsort(c, n, sizeof(int), asc);

  int k = 0; long long ia[100000], xb[100000];
  xb[n] = 0;
  for(int i = 0; i < n; i++){
    while(a[i] >= b[k] && k < n) k++;
    ia[i] = k;
  }
  
  k = 0;
  for(int i = 0; i < n; i++){
    while(b[i] >= c[k] && k < n) k++;
    xb[i] = n - k;
  }

  k = n - 1;
  long long sb[100000] = {};
  sb[n - 1] = xb[n - 1];
  while(k > 0){
    k--;
    sb[k] = sb[k + 1] + xb[k];
  }

  long long ans = 0;
  for(int i = 0; i < n; i++){
    ans += sb[ia[i]];
  }
  
  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 <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);
  int a[100000], b[100000], c[100000];
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  for(int i = 0; i < n; i++) scanf("%d", &b[i]);
  for(int i = 0; i < n; i++) scanf("%d", &c[i]);

  qsort(a, n, sizeof(int), asc);
  qsort(b, n, sizeof(int), asc);
  qsort(c, n, sizeof(int), asc);

  int k = 0; long long ia[100000], xb[100000];
  xb[n] = 0;
  for(int i = 0; i < n; i++){
    while(a[i] >= b[k] && k < n) k++;
    ia[i] = k;
  }
  
  k = 0;
  for(int i = 0; i < n; i++){
    while(b[i] >= c[k] && k < n) k++;
    xb[i] = n - k;
  }

  k = n - 1;
  long long sb[100000] = {};
  sb[n - 1] = xb[n - 1];
  while(k > 0){
    k--;
    sb[k] = sb[k + 1] + xb[k];
  }

  long long ans = 0;
  for(int i = 0; i < n; i++){
    ans += sb[ia[i]];
  }
  
  printf("%lld\n", ans);

  return 0;
}
				  
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	asc
	.type	asc, @function
asc:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3596288(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3792, %rsp
	movl	%edi, -3600068(%rbp)
	movq	%rsi, -3600080(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3600052(%rbp)
	jmp	.L4
.L5:
	leaq	-3600016(%rbp), %rdx
	movl	-3600052(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600052(%rbp)
.L4:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600052(%rbp)
	jl	.L5
	movl	$0, -3600048(%rbp)
	jmp	.L6
.L7:
	leaq	-3200016(%rbp), %rdx
	movl	-3600048(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600048(%rbp)
.L6:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600048(%rbp)
	jl	.L7
	movl	$0, -3600044(%rbp)
	jmp	.L8
.L9:
	leaq	-2800016(%rbp), %rdx
	movl	-3600044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600044(%rbp)
.L8:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600044(%rbp)
	jl	.L9
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3600016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3200016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-2800016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -3600040(%rbp)
	movl	-3600056(%rbp), %eax
	cltq
	movq	$0, -1600016(%rbp,%rax,8)
	movl	$0, -3600036(%rbp)
	jmp	.L10
.L13:
	addl	$1, -3600040(%rbp)
.L11:
	movl	-3600036(%rbp), %eax
	cltq
	movl	-3600016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L13
.L12:
	movl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600036(%rbp), %eax
	cltq
	movq	%rdx, -2400016(%rbp,%rax,8)
	addl	$1, -3600036(%rbp)
.L10:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600036(%rbp)
	jl	.L11
	movl	$0, -3600040(%rbp)
	movl	$0, -3600032(%rbp)
	jmp	.L15
.L18:
	addl	$1, -3600040(%rbp)
.L16:
	movl	-3600032(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L18
.L17:
	movl	-3600056(%rbp), %eax
	subl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600032(%rbp), %eax
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	addl	$1, -3600032(%rbp)
.L15:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600032(%rbp)
	jl	.L16
	movl	-3600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -3600040(%rbp)
	leaq	-800016(%rbp), %rax
	movl	$800000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %ecx
	movslq	%edx, %rax
	movq	-1600016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
	jmp	.L20
.L21:
	subl	$1, -3600040(%rbp)
	movl	-3600040(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
.L20:
	cmpl	$0, -3600040(%rbp)
	jg	.L21
	movq	$0, -3600024(%rbp)
	movl	$0, -3600028(%rbp)
	jmp	.L22
.L23:
	movl	-3600028(%rbp), %eax
	cltq
	movq	-2400016(%rbp,%rax,8), %rax
	movq	-800016(%rbp,%rax,8), %rax
	addq	%rax, -3600024(%rbp)
	addl	$1, -3600028(%rbp)
.L22:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600028(%rbp)
	jl	.L23
	movq	-3600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	asc
	.type	asc, @function
asc:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3596288(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3792, %rsp
	movl	%edi, -3600068(%rbp)
	movq	%rsi, -3600080(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3600056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3600052(%rbp)
	jmp	.L4
.L5:
	leaq	-3600016(%rbp), %rdx
	movl	-3600052(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600052(%rbp)
.L4:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600052(%rbp)
	jl	.L5
	movl	$0, -3600048(%rbp)
	jmp	.L6
.L7:
	leaq	-3200016(%rbp), %rdx
	movl	-3600048(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600048(%rbp)
.L6:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600048(%rbp)
	jl	.L7
	movl	$0, -3600044(%rbp)
	jmp	.L8
.L9:
	leaq	-2800016(%rbp), %rdx
	movl	-3600044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3600044(%rbp)
.L8:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600044(%rbp)
	jl	.L9
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3600016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-3200016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-3600056(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-2800016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -3600040(%rbp)
	movl	-3600056(%rbp), %eax
	cltq
	movq	$0, -1600016(%rbp,%rax,8)
	movl	$0, -3600036(%rbp)
	jmp	.L10
.L13:
	addl	$1, -3600040(%rbp)
.L11:
	movl	-3600036(%rbp), %eax
	cltq
	movl	-3600016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L13
.L12:
	movl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600036(%rbp), %eax
	cltq
	movq	%rdx, -2400016(%rbp,%rax,8)
	addl	$1, -3600036(%rbp)
.L10:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600036(%rbp)
	jl	.L11
	movl	$0, -3600040(%rbp)
	movl	$0, -3600032(%rbp)
	jmp	.L15
.L18:
	addl	$1, -3600040(%rbp)
.L16:
	movl	-3600032(%rbp), %eax
	cltq
	movl	-3200016(%rbp,%rax,4), %edx
	movl	-3600040(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600040(%rbp)
	jl	.L18
.L17:
	movl	-3600056(%rbp), %eax
	subl	-3600040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3600032(%rbp), %eax
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	addl	$1, -3600032(%rbp)
.L15:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600032(%rbp)
	jl	.L16
	movl	-3600056(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -3600040(%rbp)
	leaq	-800016(%rbp), %rax
	movl	$800000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3600056(%rbp), %eax
	leal	-1(%rax), %ecx
	movslq	%edx, %rax
	movq	-1600016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
	jmp	.L20
.L21:
	subl	$1, -3600040(%rbp)
	movl	-3600040(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-3600040(%rbp), %eax
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
.L20:
	cmpl	$0, -3600040(%rbp)
	jg	.L21
	movq	$0, -3600024(%rbp)
	movl	$0, -3600028(%rbp)
	jmp	.L22
.L23:
	movl	-3600028(%rbp), %eax
	cltq
	movq	-2400016(%rbp,%rax,8), %rax
	movq	-800016(%rbp,%rax,8), %rax
	addq	%rax, -3600024(%rbp)
	addl	$1, -3600028(%rbp)
.L22:
	movl	-3600056(%rbp), %eax
	cmpl	%eax, -3600028(%rbp)
	jl	.L23
	movq	-3600024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
