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 <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define NUM_MAX 2000
#define LEN_MAX 1000
#define NUM2_MAX (NUM_MAX*(NUM_MAX-1)/2)
#define BUF_SIZE (NUM_MAX*5+100)

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}


// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

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

int lower_bound(int *arr, int size, int key) {
    int low = -1;
    int high = size;
    while(low + 1 < high) {
        int middle = (low+high)/2;
        if(arr[middle] > key) {
            high = middle;
        } else {
            low = middle;
        }
    }
    return high;
}

int main(void) {
    int num = get_int();
    int arr[NUM_MAX];

    fget_array(arr, num);
    qsort(arr, num, sizeof(int), asc);
    int i, j;

    int cnt = 0;
    // In this time, len<=1000 is very small, so it's enough to use map
    static int map[LEN_MAX*2+1];
    for(i = 2; i < num; i++) {
        int pivot = arr[i];
        for(j = 0; j < i-1; j++) {
            map[arr[i-1] + arr[j]]++;
        }
        // a < b+c (s.t. a>b>c)
        for(j = pivot+1; j <= LEN_MAX*2; j++) {
            cnt += map[j];
        }
    }
    printf("%d\n", cnt);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1936, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$0, %eax
	jmp	.L4
.L2:
	leaq	-10116(%rbp), %rdx
	leaq	-10112(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-10116(%rbp), %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	" "
	.text
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1968, %rsp
	movq	%rdi, -10152(%rbp)
	movl	%esi, -10156(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10112(%rbp), %rax
	movq	%rax, -10128(%rbp)
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L7
	movl	$-1, %eax
	jmp	.L11
.L7:
	movl	$0, -10132(%rbp)
	jmp	.L9
.L10:
	movq	-10128(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -10120(%rbp)
	movq	-10120(%rbp), %rax
	movl	$10, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	strtol@PLT
	movl	-10132(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-10152(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movq	$0, -10128(%rbp)
	addl	$1, -10132(%rbp)
.L9:
	movl	-10132(%rbp), %eax
	cmpl	-10156(%rbp), %eax
	jl	.L10
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fget_array, .-fget_array
	.globl	asc
	.type	asc, @function
asc:
.LFB8:
	.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
.LFE8:
	.size	asc, .-asc
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.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	$-1, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L18:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%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)
	jge	.L17
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L16:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	call	get_int
	movl	%eax, -8024(%rbp)
	movl	-8024(%rbp), %edx
	leaq	-8016(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	fget_array
	movl	-8024(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-8016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8028(%rbp)
	movl	$2, -8036(%rbp)
	jmp	.L21
.L26:
	movl	-8036(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movl	%eax, -8020(%rbp)
	movl	$0, -8032(%rbp)
	jmp	.L22
.L23:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-8032(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8032(%rbp)
.L22:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8032(%rbp)
	jl	.L23
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8032(%rbp)
	jmp	.L24
.L25:
	movl	-8032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8028(%rbp)
	addl	$1, -8032(%rbp)
.L24:
	cmpl	$2000, -8032(%rbp)
	jle	.L25
	addl	$1, -8036(%rbp)
.L21:
	movl	-8036(%rbp), %eax
	cmpl	-8024(%rbp), %eax
	jl	.L26
	movl	-8028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	main, .-main
	.local	map.0
	.comm	map.0,8004,32
	.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:
.LFB53:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4112
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8208
	orq	$0, (%rsp)
	subq	$1936, %rsp
	.cfi_def_cfa_offset 10144
	movq	stdin(%rip), %rdx
	movl	$10100, %esi
	movq	%fs:40, %rax
	movq	%rax, 10120(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rax, %r8
	xorl	%eax, %eax
	testq	%r8, %r8
	je	.L3
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_sscanf@PLT
	movl	12(%rsp), %eax
.L3:
	movq	10120(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L9
	addq	$10128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	get_int, .-get_int
	.section	.rodata.str1.1
.LC1:
	.string	" "
	.text
	.p2align 4
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4128
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8224
	orq	$0, (%rsp)
	subq	$1920, %rsp
	.cfi_def_cfa_offset 10144
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 10104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rdi, %rbx
	movl	%esi, %r12d
	movq	%rbp, %rdi
	movl	$10100, %esi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L16
	testl	%r12d, %r12d
	jle	.L14
	leal	-1(%r12), %eax
	movq	%rbp, %rdi
	leaq	.LC1(%rip), %rbp
	leaq	4(%rbx,%rax,4), %r12
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	addq	$4, %rbx
	call	strtok@PLT
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	call	strtol@PLT
	xorl	%edi, %edi
	movl	%eax, -4(%rbx)
	cmpq	%r12, %rbx
	jne	.L13
.L14:
	xorl	%eax, %eax
.L10:
	movq	10104(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L19
	addq	$10112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L16:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L10
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fget_array, .-fget_array
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movl	%esi, %eax
	movl	$-1, %r8d
.L21:
	leal	1(%r8), %r9d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L23:
	leal	(%rax,%r8), %ecx
	sarl	%ecx
	movslq	%ecx, %rsi
	cmpl	%edx, (%rdi,%rsi,4)
	jle	.L25
	movl	%ecx, %eax
.L22:
	cmpl	%eax, %r9d
	jl	.L23
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ecx, %r8d
	jmp	.L21
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.section	.rodata.str1.1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3928, %rsp
	.cfi_def_cfa_offset 8064
	movq	%fs:40, %rax
	movq	%rax, 8008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	call	get_int
	movq	%rbx, %rdi
	movl	%eax, %ebp
	movl	%eax, %esi
	call	fget_array
	movslq	%ebp, %rsi
	movl	$4, %edx
	movq	%rbx, %rdi
	leaq	asc(%rip), %rcx
	call	qsort@PLT
	cmpl	$2, %ebp
	jle	.L36
	leal	-3(%rbp), %eax
	leaq	4(%rsp), %rsi
	xorl	%r8d, %r8d
	movl	$2000, %r11d
	leaq	8(%rsp,%rax,4), %r9
	leaq	map.0(%rip), %rcx
	movl	$1999, %r10d
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	4(%rsi), %r13
	movl	(%rsi), %edi
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%rdx), %eax
	addq	$4, %rdx
	addl	%edi, %eax
	cltq
	addl	$1, (%rcx,%rax,4)
	cmpq	%rsi, %rdx
	jne	.L28
	leal	1(%r13), %ebp
	cmpl	$2000, %ebp
	jg	.L29
	movl	%r10d, %eax
	movl	%r11d, %r12d
	subl	%r13d, %eax
	subl	%r13d, %r12d
	cmpl	$2, %eax
	jbe	.L30
	movl	%r12d, %eax
	leaq	4(%rcx,%r13,4), %rdx
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rdx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L48:
	addq	$16, %rax
.L31:
	movdqu	(%rdx), %xmm1
	movq	%rax, %rdx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L48
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r12d, %eax
	andl	$-4, %eax
	addl	%eax, %ebp
	cmpl	%r12d, %eax
	je	.L29
.L30:
	movslq	%ebp, %rax
	addl	(%rcx,%rax,4), %r8d
	leal	1(%rbp), %eax
	cmpl	$2000, %ebp
	je	.L29
	cltq
	addl	(%rcx,%rax,4), %r8d
	leal	2(%rbp), %eax
	cmpl	$1999, %ebp
	je	.L29
	cltq
	addl	(%rcx,%rax,4), %r8d
.L29:
	addq	$4, %rsi
	cmpq	%r9, %rsi
	jne	.L34
.L27:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$8024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L36:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L27
.L49:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.local	map.0
	.comm	map.0,8004,32
	.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:
.LFB53:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4112
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8208
	orq	$0, (%rsp)
	subq	$1936, %rsp
	.cfi_def_cfa_offset 10144
	movq	stdin(%rip), %rdx
	movl	$10100, %esi
	movq	%fs:40, %rax
	movq	%rax, 10120(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rax, %r8
	xorl	%eax, %eax
	testq	%r8, %r8
	je	.L3
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_sscanf@PLT
	movl	12(%rsp), %eax
.L3:
	movq	10120(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L9
	addq	$10128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	get_int, .-get_int
	.section	.rodata.str1.1
.LC1:
	.string	" "
	.text
	.p2align 4
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4128
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8224
	orq	$0, (%rsp)
	subq	$1920, %rsp
	.cfi_def_cfa_offset 10144
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 10104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rdi, %rbx
	movl	%esi, %r12d
	movq	%rbp, %rdi
	movl	$10100, %esi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L16
	testl	%r12d, %r12d
	jle	.L14
	leal	-1(%r12), %eax
	movq	%rbp, %rdi
	leaq	.LC1(%rip), %rbp
	leaq	4(%rbx,%rax,4), %r12
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	addq	$4, %rbx
	call	strtok@PLT
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	call	strtol@PLT
	xorl	%edi, %edi
	movl	%eax, -4(%rbx)
	cmpq	%r12, %rbx
	jne	.L13
.L14:
	xorl	%eax, %eax
.L10:
	movq	10104(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L19
	addq	$10112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L16:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L10
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fget_array, .-fget_array
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movl	%esi, %eax
	movl	$-1, %r8d
.L21:
	leal	1(%r8), %r9d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L23:
	leal	(%rax,%r8), %ecx
	sarl	%ecx
	movslq	%ecx, %rsi
	cmpl	%edx, (%rdi,%rsi,4)
	jle	.L25
	movl	%ecx, %eax
.L22:
	cmpl	%eax, %r9d
	jl	.L23
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ecx, %r8d
	jmp	.L21
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.section	.rodata.str1.1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3928, %rsp
	.cfi_def_cfa_offset 8064
	movq	%fs:40, %rax
	movq	%rax, 8008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	call	get_int
	movq	%rbx, %rdi
	movl	%eax, %ebp
	movl	%eax, %esi
	call	fget_array
	movslq	%ebp, %rsi
	movl	$4, %edx
	movq	%rbx, %rdi
	leaq	asc(%rip), %rcx
	call	qsort@PLT
	cmpl	$2, %ebp
	jle	.L36
	leal	-3(%rbp), %eax
	leaq	4(%rsp), %rsi
	xorl	%r8d, %r8d
	movl	$2000, %r11d
	leaq	8(%rsp,%rax,4), %r9
	leaq	map.0(%rip), %rcx
	movl	$1999, %r10d
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	4(%rsi), %r13
	movl	(%rsi), %edi
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%rdx), %eax
	addq	$4, %rdx
	addl	%edi, %eax
	cltq
	addl	$1, (%rcx,%rax,4)
	cmpq	%rsi, %rdx
	jne	.L28
	leal	1(%r13), %ebp
	cmpl	$2000, %ebp
	jg	.L29
	movl	%r10d, %eax
	movl	%r11d, %r12d
	subl	%r13d, %eax
	subl	%r13d, %r12d
	cmpl	$2, %eax
	jbe	.L30
	movl	%r12d, %eax
	leaq	4(%rcx,%r13,4), %rdx
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rdx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L48:
	addq	$16, %rax
.L31:
	movdqu	(%rdx), %xmm1
	movq	%rax, %rdx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L48
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r12d, %eax
	andl	$-4, %eax
	addl	%eax, %ebp
	cmpl	%r12d, %eax
	je	.L29
.L30:
	movslq	%ebp, %rax
	addl	(%rcx,%rax,4), %r8d
	leal	1(%rbp), %eax
	cmpl	$2000, %ebp
	je	.L29
	cltq
	addl	(%rcx,%rax,4), %r8d
	leal	2(%rbp), %eax
	cmpl	$1999, %ebp
	je	.L29
	cltq
	addl	(%rcx,%rax,4), %r8d
.L29:
	addq	$4, %rsi
	cmpq	%r9, %rsi
	jne	.L34
.L27:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$8024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L36:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L27
.L49:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.local	map.0
	.comm	map.0,8004,32
	.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 <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define NUM_MAX 2000
#define LEN_MAX 1000
#define NUM2_MAX (NUM_MAX*(NUM_MAX-1)/2)
#define BUF_SIZE (NUM_MAX*5+100)

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}


// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

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

int lower_bound(int *arr, int size, int key) {
    int low = -1;
    int high = size;
    while(low + 1 < high) {
        int middle = (low+high)/2;
        if(arr[middle] > key) {
            high = middle;
        } else {
            low = middle;
        }
    }
    return high;
}

int main(void) {
    int num = get_int();
    int arr[NUM_MAX];

    fget_array(arr, num);
    qsort(arr, num, sizeof(int), asc);
    int i, j;

    int cnt = 0;
    // In this time, len<=1000 is very small, so it's enough to use map
    static int map[LEN_MAX*2+1];
    for(i = 2; i < num; i++) {
        int pivot = arr[i];
        for(j = 0; j < i-1; j++) {
            map[arr[i-1] + arr[j]]++;
        }
        // a < b+c (s.t. a>b>c)
        for(j = pivot+1; j <= LEN_MAX*2; j++) {
            cnt += map[j];
        }
    }
    printf("%d\n", cnt);
    return 0;
}
4
5 4 2 1
 7
218 1140 704 233 645 728 389
 3
1 1000 2
 7
218 1140 704 233 645 890 389
 7
218 1140 1051 233 449 890 389
 7
218 1140 1051 16 636 890 389
 7
218 1140 551 40 636 890 487
 7
218 1140 551 40 660 890 487
 7
116 1499 551 40 806 890 487
 7
116 1499 551 40 297 890 487

1
 14
 0
 13
 15
 10
 11
 12
 7
 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 <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define NUM_MAX 2000
#define LEN_MAX 1000
#define NUM2_MAX (NUM_MAX*(NUM_MAX-1)/2)
#define BUF_SIZE (NUM_MAX*5+100)

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}


// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

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

int lower_bound(int *arr, int size, int key) {
    int low = -1;
    int high = size;
    while(low + 1 < high) {
        int middle = (low+high)/2;
        if(arr[middle] > key) {
            high = middle;
        } else {
            low = middle;
        }
    }
    return high;
}

int main(void) {
    int num = get_int();
    int arr[NUM_MAX];

    fget_array(arr, num);
    qsort(arr, num, sizeof(int), asc);
    int i, j;

    int cnt = 0;
    // In this time, len<=1000 is very small, so it's enough to use map
    static int map[LEN_MAX*2+1];
    for(i = 2; i < num; i++) {
        int pivot = arr[i];
        for(j = 0; j < i-1; j++) {
            map[arr[i-1] + arr[j]]++;
        }
        // a < b+c (s.t. a>b>c)
        for(j = pivot+1; j <= LEN_MAX*2; j++) {
            cnt += map[j];
        }
    }
    printf("%d\n", cnt);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1936, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$0, %eax
	jmp	.L4
.L2:
	leaq	-10116(%rbp), %rdx
	leaq	-10112(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-10116(%rbp), %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	" "
	.text
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1968, %rsp
	movq	%rdi, -10152(%rbp)
	movl	%esi, -10156(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10112(%rbp), %rax
	movq	%rax, -10128(%rbp)
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L7
	movl	$-1, %eax
	jmp	.L11
.L7:
	movl	$0, -10132(%rbp)
	jmp	.L9
.L10:
	movq	-10128(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -10120(%rbp)
	movq	-10120(%rbp), %rax
	movl	$10, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	strtol@PLT
	movl	-10132(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-10152(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movq	$0, -10128(%rbp)
	addl	$1, -10132(%rbp)
.L9:
	movl	-10132(%rbp), %eax
	cmpl	-10156(%rbp), %eax
	jl	.L10
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fget_array, .-fget_array
	.globl	asc
	.type	asc, @function
asc:
.LFB8:
	.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
.LFE8:
	.size	asc, .-asc
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.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	$-1, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L18:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%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)
	jge	.L17
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L16:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	call	get_int
	movl	%eax, -8024(%rbp)
	movl	-8024(%rbp), %edx
	leaq	-8016(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	fget_array
	movl	-8024(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-8016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8028(%rbp)
	movl	$2, -8036(%rbp)
	jmp	.L21
.L26:
	movl	-8036(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movl	%eax, -8020(%rbp)
	movl	$0, -8032(%rbp)
	jmp	.L22
.L23:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-8032(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8032(%rbp)
.L22:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8032(%rbp)
	jl	.L23
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8032(%rbp)
	jmp	.L24
.L25:
	movl	-8032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8028(%rbp)
	addl	$1, -8032(%rbp)
.L24:
	cmpl	$2000, -8032(%rbp)
	jle	.L25
	addl	$1, -8036(%rbp)
.L21:
	movl	-8036(%rbp), %eax
	cmpl	-8024(%rbp), %eax
	jl	.L26
	movl	-8028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	main, .-main
	.local	map.0
	.comm	map.0,8004,32
	.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
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1936, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$0, %eax
	jmp	.L4
.L2:
	leaq	-10116(%rbp), %rdx
	leaq	-10112(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-10116(%rbp), %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	" "
	.text
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1968, %rsp
	movq	%rdi, -10152(%rbp)
	movl	%esi, -10156(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10112(%rbp), %rax
	movq	%rax, -10128(%rbp)
	movq	stdin(%rip), %rdx
	leaq	-10112(%rbp), %rax
	movl	$10100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L7
	movl	$-1, %eax
	jmp	.L11
.L7:
	movl	$0, -10132(%rbp)
	jmp	.L9
.L10:
	movq	-10128(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -10120(%rbp)
	movq	-10120(%rbp), %rax
	movl	$10, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	strtol@PLT
	movl	-10132(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-10152(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movq	$0, -10128(%rbp)
	addl	$1, -10132(%rbp)
.L9:
	movl	-10132(%rbp), %eax
	cmpl	-10156(%rbp), %eax
	jl	.L10
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fget_array, .-fget_array
	.globl	asc
	.type	asc, @function
asc:
.LFB8:
	.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
.LFE8:
	.size	asc, .-asc
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.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	$-1, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L18:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%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)
	jge	.L17
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L16:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	call	get_int
	movl	%eax, -8024(%rbp)
	movl	-8024(%rbp), %edx
	leaq	-8016(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	fget_array
	movl	-8024(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-8016(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8028(%rbp)
	movl	$2, -8036(%rbp)
	jmp	.L21
.L26:
	movl	-8036(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movl	%eax, -8020(%rbp)
	movl	$0, -8032(%rbp)
	jmp	.L22
.L23:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-8032(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8032(%rbp)
.L22:
	movl	-8036(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -8032(%rbp)
	jl	.L23
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8032(%rbp)
	jmp	.L24
.L25:
	movl	-8032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	map.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8028(%rbp)
	addl	$1, -8032(%rbp)
.L24:
	cmpl	$2000, -8032(%rbp)
	jle	.L25
	addl	$1, -8036(%rbp)
.L21:
	movl	-8036(%rbp), %eax
	cmpl	-8024(%rbp), %eax
	jl	.L26
	movl	-8028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	main, .-main
	.local	map.0
	.comm	map.0,8004,32
	.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:
