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))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}



struct cands {
    int num;
    int cnt;
};

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(struct cands *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        int val;
        scanf("%d", &val);
        arr[i] = (struct cands){val, 1};
    }
    return 0;
}

#define NUM_MAX 100000

int asc(const void *a1, const void *a2) {
    return *(int*)a1 - *(int*)a2;
}

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

#define QUERY_MAX 100000

int desc_by_num(const void *a1, const void *a2) {
    struct cands *ca1 = (struct cands*)a1;
    struct cands *ca2 = (struct cands*)a2;
    return ca2->num - ca1->num;
}


int main(void) {
    int num, queries;
    get_int2(&num, &queries);

    static struct cands arr[NUM_MAX+QUERY_MAX];
    fget_array(arr, num);
    int idx = num;

    int i;
    for(i = 0; i < queries; i++) {
        int cnt, val;
        get_int2(&cnt, &val);
        arr[idx++] = (struct cands){val, cnt};
    }

    qsort(arr, idx, sizeof(struct cands), desc_by_num);

    int64_t ans = 0;
    int rem = num;
    for(i = 0; i < idx; i++) {
        if(rem <= 0) break;
        int64_t picks = min(rem, arr[i].cnt);
        ans += (int64_t)arr[i].num * picks;
        rem -= picks;
    }

    printf("%lld\n", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC1:
	.string	"%d"
	.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	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, 4(%rax)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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	.L11
.L13:
	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)
	jle	.L12
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L11:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L13
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	desc_by_num
	.type	desc_by_num, @function
desc_by_num:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%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
.LFE10:
	.size	desc_by_num, .-desc_by_num
	.section	.rodata
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	fget_array
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L19:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -36(%rbp)
	movl	-40(%rbp), %ecx
	movl	-44(%rbp), %edx
	movslq	%eax, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	arr.0(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+arr.0(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -32(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	cltq
	leaq	desc_by_num(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L20
.L23:
	cmpl	$0, -28(%rbp)
	jle	.L26
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	movq	%rax, -16(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movq	-16(%rbp), %rdx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L20:
	movl	-32(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	jmp	.L22
.L26:
	nop
.L22:
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.local	arr.0
	.comm	arr.0,1600000,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	desc_by_num
	.type	desc_by_num, @function
desc_by_num:
.LFB55:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE55:
	.size	desc_by_num, .-desc_by_num
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rsi, %rdx
	xorl	%eax, %eax
	movq	%rdi, %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_int2, .-get_int2
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
	.text
	.p2align 4
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB52:
	.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	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L6
	leal	-1(%rsi), %eax
	movq	%rdi, %rbx
	leaq	4(%rsp), %r12
	leaq	8(%rdi,%rax,8), %r13
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$8, %rbx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	movl	$1, -4(%rbx)
	movl	%eax, -8(%rbx)
	cmpq	%r13, %rbx
	jne	.L7
.L6:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fget_array, .-fget_array
	.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
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movl	$-1, %r8d
	xorl	%ecx, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	leal	(%r8,%rsi), %eax
	sarl	%eax
	movslq	%eax, %r9
	cmpl	%edx, (%rdi,%r9,4)
	jge	.L18
	movl	%eax, %r8d
	leal	1(%rax), %ecx
.L15:
	cmpl	%esi, %ecx
	jl	.L16
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %esi
	jmp	.L15
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.section	.rodata.str1.1
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %esi
	leaq	arr.0(%rip), %rdi
	call	fget_array
	movl	28(%rsp), %eax
	movl	24(%rsp), %r8d
	testl	%eax, %eax
	jle	.L20
	movslq	%r8d, %rax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	xorl	%r15d, %r15d
	leaq	arr.0(%rip), %rdi
	leal	1(%r8), %ebp
	leaq	(%rdi,%rax,8), %r14
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movd	36(%rsp), %xmm0
	movd	32(%rsp), %xmm1
	leal	0(%rbp,%r15), %r8d
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%r14,%r15,8)
	addq	$1, %r15
	cmpl	%r15d, 28(%rsp)
	jg	.L21
.L20:
	movl	$8, %edx
	movslq	%r8d, %rsi
	leaq	desc_by_num(%rip), %rcx
	movl	%r8d, 12(%rsp)
	leaq	arr.0(%rip), %rdi
	call	qsort@PLT
	movl	24(%rsp), %edx
	testl	%edx, %edx
	jle	.L26
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L26
	leaq	-4+arr.0(%rip), %r11
	movl	$1, %ecx
	xorl	%r9d, %r9d
	leaq	-4(%r11), %r10
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%r11,%rcx,8), %eax
	movslq	(%r10,%rcx,8), %rsi
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movslq	%eax, %rdi
	subl	%eax, %edx
	imulq	%rdi, %rsi
	addq	%rsi, %r9
	testl	%edx, %edx
	setle	%al
	cmpl	%ecx, %r8d
	setle	%sil
	addq	$1, %rcx
	orb	%sil, %al
	je	.L23
.L22:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L26:
	.cfi_restore_state
	xorl	%r9d, %r9d
	jmp	.L22
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.local	arr.0
	.comm	arr.0,1600000,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	desc_by_num
	.type	desc_by_num, @function
desc_by_num:
.LFB55:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE55:
	.size	desc_by_num, .-desc_by_num
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rsi, %rdx
	xorl	%eax, %eax
	movq	%rdi, %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_int2, .-get_int2
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
	.text
	.p2align 4
	.globl	fget_array
	.type	fget_array, @function
fget_array:
.LFB52:
	.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	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L6
	leal	-1(%rsi), %eax
	movq	%rdi, %rbx
	leaq	4(%rsp), %r12
	leaq	8(%rdi,%rax,8), %r13
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$8, %rbx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	movl	$1, -4(%rbx)
	movl	%eax, -8(%rbx)
	cmpq	%r13, %rbx
	jne	.L7
.L6:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fget_array, .-fget_array
	.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
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movl	$-1, %r8d
	xorl	%ecx, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	leal	(%r8,%rsi), %eax
	sarl	%eax
	movslq	%eax, %r9
	cmpl	%edx, (%rdi,%r9,4)
	jge	.L18
	movl	%eax, %r8d
	leal	1(%rax), %ecx
.L15:
	cmpl	%esi, %ecx
	jl	.L16
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %esi
	jmp	.L15
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.section	.rodata.str1.1
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %esi
	leaq	arr.0(%rip), %rdi
	call	fget_array
	movl	28(%rsp), %eax
	movl	24(%rsp), %r8d
	testl	%eax, %eax
	jle	.L20
	movslq	%r8d, %rax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	xorl	%r15d, %r15d
	leaq	arr.0(%rip), %rdi
	leal	1(%r8), %ebp
	leaq	(%rdi,%rax,8), %r14
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movd	36(%rsp), %xmm0
	movd	32(%rsp), %xmm1
	leal	0(%rbp,%r15), %r8d
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%r14,%r15,8)
	addq	$1, %r15
	cmpl	%r15d, 28(%rsp)
	jg	.L21
.L20:
	movl	$8, %edx
	movslq	%r8d, %rsi
	leaq	desc_by_num(%rip), %rcx
	movl	%r8d, 12(%rsp)
	leaq	arr.0(%rip), %rdi
	call	qsort@PLT
	movl	24(%rsp), %edx
	testl	%edx, %edx
	jle	.L26
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L26
	leaq	-4+arr.0(%rip), %r11
	movl	$1, %ecx
	xorl	%r9d, %r9d
	leaq	-4(%r11), %r10
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%r11,%rcx,8), %eax
	movslq	(%r10,%rcx,8), %rsi
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movslq	%eax, %rdi
	subl	%eax, %edx
	imulq	%rdi, %rsi
	addq	%rsi, %r9
	testl	%edx, %edx
	setle	%al
	cmpl	%ecx, %r8d
	setle	%sil
	addq	$1, %rcx
	orb	%sil, %al
	je	.L23
.L22:
	xorl	%eax, %eax
	movq	%r9, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L26:
	.cfi_restore_state
	xorl	%r9d, %r9d
	jmp	.L22
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.local	arr.0
	.comm	arr.0,1600000,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))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}



struct cands {
    int num;
    int cnt;
};

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(struct cands *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        int val;
        scanf("%d", &val);
        arr[i] = (struct cands){val, 1};
    }
    return 0;
}

#define NUM_MAX 100000

int asc(const void *a1, const void *a2) {
    return *(int*)a1 - *(int*)a2;
}

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

#define QUERY_MAX 100000

int desc_by_num(const void *a1, const void *a2) {
    struct cands *ca1 = (struct cands*)a1;
    struct cands *ca2 = (struct cands*)a2;
    return ca2->num - ca1->num;
}


int main(void) {
    int num, queries;
    get_int2(&num, &queries);

    static struct cands arr[NUM_MAX+QUERY_MAX];
    fget_array(arr, num);
    int idx = num;

    int i;
    for(i = 0; i < queries; i++) {
        int cnt, val;
        get_int2(&cnt, &val);
        arr[idx++] = (struct cands){val, cnt};
    }

    qsort(arr, idx, sizeof(struct cands), desc_by_num);

    int64_t ans = 0;
    int rem = num;
    for(i = 0; i < idx; i++) {
        if(rem <= 0) break;
        int64_t picks = min(rem, arr[i].cnt);
        ans += (int64_t)arr[i].num * picks;
        rem -= picks;
    }

    printf("%lld\n", ans);

    return 0;
}
10 3
1 8 5 7 100 4 7 33 13 5
3 10
4 30
1 4
 3 2
5 1 1
2 3
1 5
 3 2
100 100 100
0 99
3 99
 11 3
1 1 1 1 1 1 1 1 1 1 1
3 1000000000
4 1000000000
3 1000000001
 10 2
0 8 5 7 100 4 7 33 24 5
3 10
4 30
1 4
 3 2
5 1 1
2 3
1 7
 10 2
0 8 5 7 100 4 7 33 24 5
3 15
4 30
1 4
 3 2
5 1 1
2 3
1 6
 3 2
5 1 1
2 3
2 6
 10 2
0 4 5 7 100 4 7 33 33 5
3 15
4 30
1 4

296
 13
 300
 10000000004
 307
 15
 322
 14
 17
 331

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))

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}



struct cands {
    int num;
    int cnt;
};

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(struct cands *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        int val;
        scanf("%d", &val);
        arr[i] = (struct cands){val, 1};
    }
    return 0;
}

#define NUM_MAX 100000

int asc(const void *a1, const void *a2) {
    return *(int*)a1 - *(int*)a2;
}

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

#define QUERY_MAX 100000

int desc_by_num(const void *a1, const void *a2) {
    struct cands *ca1 = (struct cands*)a1;
    struct cands *ca2 = (struct cands*)a2;
    return ca2->num - ca1->num;
}


int main(void) {
    int num, queries;
    get_int2(&num, &queries);

    static struct cands arr[NUM_MAX+QUERY_MAX];
    fget_array(arr, num);
    int idx = num;

    int i;
    for(i = 0; i < queries; i++) {
        int cnt, val;
        get_int2(&cnt, &val);
        arr[idx++] = (struct cands){val, cnt};
    }

    qsort(arr, idx, sizeof(struct cands), desc_by_num);

    int64_t ans = 0;
    int rem = num;
    for(i = 0; i < idx; i++) {
        if(rem <= 0) break;
        int64_t picks = min(rem, arr[i].cnt);
        ans += (int64_t)arr[i].num * picks;
        rem -= picks;
    }

    printf("%lld\n", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC1:
	.string	"%d"
	.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	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, 4(%rax)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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	.L11
.L13:
	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)
	jle	.L12
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L11:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L13
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	desc_by_num
	.type	desc_by_num, @function
desc_by_num:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%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
.LFE10:
	.size	desc_by_num, .-desc_by_num
	.section	.rodata
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	fget_array
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L19:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -36(%rbp)
	movl	-40(%rbp), %ecx
	movl	-44(%rbp), %edx
	movslq	%eax, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	arr.0(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+arr.0(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -32(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	cltq
	leaq	desc_by_num(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L20
.L23:
	cmpl	$0, -28(%rbp)
	jle	.L26
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	movq	%rax, -16(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movq	-16(%rbp), %rdx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L20:
	movl	-32(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	jmp	.L22
.L26:
	nop
.L22:
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.local	arr.0
	.comm	arr.0,1600000,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 %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC1:
	.string	"%d"
	.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	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, 4(%rax)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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	.L11
.L13:
	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)
	jle	.L12
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L11:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jg	.L13
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	desc_by_num
	.type	desc_by_num, @function
desc_by_num:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%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
.LFE10:
	.size	desc_by_num, .-desc_by_num
	.section	.rodata
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	fget_array
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L19:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -36(%rbp)
	movl	-40(%rbp), %ecx
	movl	-44(%rbp), %edx
	movslq	%eax, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	arr.0(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+arr.0(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -32(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	cltq
	leaq	desc_by_num(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	arr.0(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L20
.L23:
	cmpl	$0, -28(%rbp)
	jle	.L26
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	movq	%rax, -16(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movq	-16(%rbp), %rdx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -32(%rbp)
.L20:
	movl	-32(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L23
	jmp	.L22
.L26:
	nop
.L22:
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.local	arr.0
	.comm	arr.0,1600000,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:
