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 up(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?-1:*(long long*)a>*(long long*)b?1:0;
}
int down(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?1:*(long long*)a>*(long long*)b?-1:0;
}
void upsort(long long*a,int n){
    qsort(a,n,sizeof(long long),up);
}
void downsort(long long*a,int n){
    qsort(a,n,sizeof(long long),down);
}
int judge(long long*a,long long*b,long long n,long long k,long long x){
    long long time=0;
    for(int i=0;i<n;i++){
        time+=(a[i]*b[i]-x>0)?a[i]-x/b[i]:0;
    }
    return time<=k;
}

int main(void){
    long long n,k;
    scanf("%lld%lld",&n,&k);
    long long a[n],f[n];
    for(int i=0;i<n;i++)scanf("%lld",a+i);
    upsort(a,n);
    for(int i=0;i<n;i++)scanf("%lld",f+i);
    downsort(f,n);
    long long high=a[n-1]*f[0],low=0,mid;
    long long sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
    }
    if(sum<=k){
        printf("0\n");
        return 0;
    }
    else{
        while(high>low+1){
            mid=(high+low)/2;
            if(judge(a,f,n,k,mid))high=mid;
            else low=mid;
        }
        printf("%lld\n",high);
        return 0;
    }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	up
	.type	up, @function
up:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	up, .-up
	.globl	down
	.type	down, @function
down:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	down, .-down
	.globl	upsort
	.type	upsort, @function
upsort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	up(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	upsort, .-upsort
	.globl	downsort
	.type	downsort, @function
downsort:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	down(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	downsort, .-downsort
	.globl	judge
	.type	judge, @function
judge:
.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	%rdx, -40(%rbp)
	movq	%rcx, -48(%rbp)
	movq	%r8, -56(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	subq	-56(%rbp), %rax
	testq	%rax, %rax
	jle	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rsi
	movq	-56(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L15:
	movl	$0, %eax
.L16:
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L14:
	movl	-12(%rbp), %eax
	cltq
	cmpq	%rax, -40(%rbp)
	jg	.L17
	movq	-8(%rbp), %rax
	cmpq	-48(%rbp), %rax
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	judge, .-judge
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"0"
.LC3:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-128(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -96(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -80(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L26
.L27:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L27
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-88(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	upsort
	movl	$0, -144(%rbp)
	jmp	.L28
.L29:
	movl	-144(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -144(%rbp)
.L28:
	movl	-144(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L29
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-72(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	downsort
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-88(%rbp), %rax
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	movq	$0, -112(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L30
.L31:
	movq	-88(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	addq	%rax, -104(%rbp)
	addl	$1, -140(%rbp)
.L30:
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L31
	movq	-128(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jg	.L34
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L33
.L36:
	movq	-120(%rbp), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -64(%rbp)
	movq	-128(%rbp), %rcx
	movq	-136(%rbp), %rdx
	movq	-64(%rbp), %rdi
	movq	-72(%rbp), %rsi
	movq	-88(%rbp), %rax
	movq	%rdi, %r8
	movq	%rax, %rdi
	call	judge
	testl	%eax, %eax
	je	.L35
	movq	-64(%rbp), %rax
	movq	%rax, -120(%rbp)
	jmp	.L34
.L35:
	movq	-64(%rbp), %rax
	movq	%rax, -112(%rbp)
.L34:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L36
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L33:
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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	up
	.type	up, @function
up:
.LFB39:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	up, .-up
	.p2align 4
	.globl	down
	.type	down, @function
down:
.LFB40:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE40:
	.size	down, .-down
	.p2align 4
	.globl	upsort
	.type	upsort, @function
upsort:
.LFB41:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	up(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE41:
	.size	upsort, .-upsort
	.p2align 4
	.globl	downsort
	.type	downsort, @function
downsort:
.LFB42:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	down(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE42:
	.size	downsort, .-downsort
	.p2align 4
	.globl	judge
	.type	judge, @function
judge:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rcx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	testq	%rdx, %rdx
	jle	.L14
	movq	%rdi, %r10
	movq	%rsi, %r11
	leaq	0(,%rdx,8), %r9
	xorl	%ecx, %ecx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	(%r10,%rcx), %rsi
	movq	(%r11,%rcx), %rdi
	movq	%rsi, %rax
	imulq	%rdi, %rax
	cmpq	%r8, %rax
	jle	.L12
	movq	%r8, %rax
	cqto
	idivq	%rdi
	subq	%rax, %rsi
	addq	%rsi, %rbx
.L12:
	addq	$8, %rcx
	cmpq	%rcx, %r9
	jne	.L13
	xorl	%eax, %eax
	cmpq	%rbx, %rbp
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	setge	%al
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	cmpq	%rbx, %rbp
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	setge	%al
	ret
	.cfi_endproc
.LFE43:
	.size	judge, .-judge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"0"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB44:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-64(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	movq	%rsp, %rsi
	leaq	15(,%rax,8), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L19
.L56:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L56
.L19:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L57
.L20:
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	movq	%rsp, %rbx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L21:
	cmpq	%rsi, %rsp
	je	.L22
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
.L57:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L20
.L22:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L58
.L23:
	leaq	7(%rsp), %r12
	movq	%r12, %rdx
	andq	$-8, %r12
	shrq	$3, %rdx
	movq	%rdx, -88(%rbp)
	testq	%rax, %rax
	jle	.L24
	movq	%rbx, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L25
.L24:
	movslq	%eax, %rsi
	leaq	up(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %rax
	testq	%rax, %rax
	jle	.L26
	movq	%r12, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L27
.L26:
	movslq	%eax, %rsi
	leaq	down(%rip), %rcx
	movl	$8, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %r13
	movq	-88(%rbp), %rax
	movq	-8(%rbx,%r13,8), %r11
	movq	0(,%rax,8), %rsi
	testq	%r13, %r13
	jle	.L41
	cmpq	$1, %r13
	je	.L42
	movq	%r13, %rdx
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	shrq	%rdx
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L30:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rax, %rdx
	jne	.L30
	movdqa	%xmm0, %xmm1
	movq	%r13, %rcx
	psrldq	$8, %xmm1
	andq	$-2, %rcx
	paddq	%xmm1, %xmm0
	movslq	%ecx, %rdx
	movq	%xmm0, %rax
	cmpq	%r13, %rcx
	je	.L28
.L29:
	addq	(%rbx,%rdx,8), %rax
.L28:
	movq	-64(%rbp), %rdx
	movq	%rdx, -88(%rbp)
	cmpq	%rax, %rdx
	jge	.L32
	imulq	%rsi, %r11
	leaq	0(,%r13,8), %r10
	xorl	%r14d, %r14d
.L33:
	leaq	1(%r14), %r15
	cmpq	%r15, %r11
	jle	.L59
	.p2align 4,,10
	.p2align 3
.L39:
	leaq	(%r14,%r11), %r8
	sarq	%r8
	testq	%r13, %r13
	jle	.L43
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L37:
	movq	(%rbx,%rcx), %rsi
	movq	(%r12,%rcx), %rdi
	movq	%rsi, %rax
	imulq	%rdi, %rax
	cmpq	%r8, %rax
	jle	.L36
	movq	%r8, %rax
	cqto
	idivq	%rdi
	subq	%rax, %rsi
	addq	%rsi, %r9
.L36:
	addq	$8, %rcx
	cmpq	%rcx, %r10
	jne	.L37
	cmpq	%r9, -88(%rbp)
	jl	.L60
.L44:
	movq	%r8, %r11
	cmpq	%r15, %r11
	jg	.L39
.L59:
	movq	%r11, %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L34:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L61
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	.cfi_restore_state
	xorl	%r9d, %r9d
	cmpq	%r9, -88(%rbp)
	jge	.L44
.L60:
	movq	%r8, %r14
	jmp	.L33
.L32:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L34
.L41:
	xorl	%eax, %eax
	jmp	.L28
.L42:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L29
.L58:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L23
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE44:
	.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	up
	.type	up, @function
up:
.LFB39:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	up, .-up
	.p2align 4
	.globl	down
	.type	down, @function
down:
.LFB40:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE40:
	.size	down, .-down
	.p2align 4
	.globl	upsort
	.type	upsort, @function
upsort:
.LFB41:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	up(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE41:
	.size	upsort, .-upsort
	.p2align 4
	.globl	downsort
	.type	downsort, @function
downsort:
.LFB42:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	down(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE42:
	.size	downsort, .-downsort
	.p2align 4
	.globl	judge
	.type	judge, @function
judge:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rcx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	testq	%rdx, %rdx
	jle	.L14
	movq	%rdi, %r10
	movq	%rsi, %r11
	leaq	0(,%rdx,8), %r9
	xorl	%ecx, %ecx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	(%r10,%rcx), %rsi
	movq	(%r11,%rcx), %rdi
	movq	%rsi, %rax
	imulq	%rdi, %rax
	cmpq	%r8, %rax
	jle	.L12
	movq	%r8, %rax
	cqto
	idivq	%rdi
	subq	%rax, %rsi
	addq	%rsi, %rbx
.L12:
	addq	$8, %rcx
	cmpq	%rcx, %r9
	jne	.L13
	xorl	%eax, %eax
	cmpq	%rbx, %rbp
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	setge	%al
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	cmpq	%rbx, %rbp
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	setge	%al
	ret
	.cfi_endproc
.LFE43:
	.size	judge, .-judge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"0"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB44:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-64(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	movq	%rsp, %rsi
	leaq	15(,%rax,8), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L19
.L56:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L56
.L19:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L57
.L20:
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	movq	%rsp, %rbx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L21:
	cmpq	%rsi, %rsp
	je	.L22
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
.L57:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L20
.L22:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L58
.L23:
	leaq	7(%rsp), %r12
	movq	%r12, %rdx
	andq	$-8, %r12
	shrq	$3, %rdx
	movq	%rdx, -88(%rbp)
	testq	%rax, %rax
	jle	.L24
	movq	%rbx, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L25
.L24:
	movslq	%eax, %rsi
	leaq	up(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %rax
	testq	%rax, %rax
	jle	.L26
	movq	%r12, %r14
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	addq	$8, %r14
	cmpq	%r13, %rax
	jg	.L27
.L26:
	movslq	%eax, %rsi
	leaq	down(%rip), %rcx
	movl	$8, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %r13
	movq	-88(%rbp), %rax
	movq	-8(%rbx,%r13,8), %r11
	movq	0(,%rax,8), %rsi
	testq	%r13, %r13
	jle	.L41
	cmpq	$1, %r13
	je	.L42
	movq	%r13, %rdx
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	shrq	%rdx
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L30:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rax, %rdx
	jne	.L30
	movdqa	%xmm0, %xmm1
	movq	%r13, %rcx
	psrldq	$8, %xmm1
	andq	$-2, %rcx
	paddq	%xmm1, %xmm0
	movslq	%ecx, %rdx
	movq	%xmm0, %rax
	cmpq	%r13, %rcx
	je	.L28
.L29:
	addq	(%rbx,%rdx,8), %rax
.L28:
	movq	-64(%rbp), %rdx
	movq	%rdx, -88(%rbp)
	cmpq	%rax, %rdx
	jge	.L32
	imulq	%rsi, %r11
	leaq	0(,%r13,8), %r10
	xorl	%r14d, %r14d
.L33:
	leaq	1(%r14), %r15
	cmpq	%r15, %r11
	jle	.L59
	.p2align 4,,10
	.p2align 3
.L39:
	leaq	(%r14,%r11), %r8
	sarq	%r8
	testq	%r13, %r13
	jle	.L43
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L37:
	movq	(%rbx,%rcx), %rsi
	movq	(%r12,%rcx), %rdi
	movq	%rsi, %rax
	imulq	%rdi, %rax
	cmpq	%r8, %rax
	jle	.L36
	movq	%r8, %rax
	cqto
	idivq	%rdi
	subq	%rax, %rsi
	addq	%rsi, %r9
.L36:
	addq	$8, %rcx
	cmpq	%rcx, %r10
	jne	.L37
	cmpq	%r9, -88(%rbp)
	jl	.L60
.L44:
	movq	%r8, %r11
	cmpq	%r15, %r11
	jg	.L39
.L59:
	movq	%r11, %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L34:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L61
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	.cfi_restore_state
	xorl	%r9d, %r9d
	cmpq	%r9, -88(%rbp)
	jge	.L44
.L60:
	movq	%r8, %r14
	jmp	.L33
.L32:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L34
.L41:
	xorl	%eax, %eax
	jmp	.L28
.L42:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L29
.L58:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L23
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE44:
	.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 up(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?-1:*(long long*)a>*(long long*)b?1:0;
}
int down(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?1:*(long long*)a>*(long long*)b?-1:0;
}
void upsort(long long*a,int n){
    qsort(a,n,sizeof(long long),up);
}
void downsort(long long*a,int n){
    qsort(a,n,sizeof(long long),down);
}
int judge(long long*a,long long*b,long long n,long long k,long long x){
    long long time=0;
    for(int i=0;i<n;i++){
        time+=(a[i]*b[i]-x>0)?a[i]-x/b[i]:0;
    }
    return time<=k;
}

int main(void){
    long long n,k;
    scanf("%lld%lld",&n,&k);
    long long a[n],f[n];
    for(int i=0;i<n;i++)scanf("%lld",a+i);
    upsort(a,n);
    for(int i=0;i<n;i++)scanf("%lld",f+i);
    downsort(f,n);
    long long high=a[n-1]*f[0],low=0,mid;
    long long sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
    }
    if(sum<=k){
        printf("0\n");
        return 0;
    }
    else{
        while(high>low+1){
            mid=(high+low)/2;
            if(judge(a,f,n,k,mid))high=mid;
            else low=mid;
        }
        printf("%lld\n",high);
        return 0;
    }
}


3 1
4 2 1
2 3 1
 3 6
4 2 1
2 3 1
 11 14
3 1 4 1 5 9 2 6 5 3 5
8 9 7 9 3 1 3 8 4 6 2
 3 1
8 2 1
2 3 1
 11 14
3 1 4 1 2 9 2 6 5 3 5
8 9 7 26 3 1 3 8 4 6 2
 11 14
3 1 4 1 2 9 2 11 5 3 10
8 9 7 26 3 1 3 8 4 6 2
 11 14
3 1 4 1 2 9 2 11 5 3 10
8 9 7 26 3 2 3 8 4 6 2
 11 14
3 1 4 1 2 9 2 11 1 3 10
8 9 7 12 3 2 3 8 4 6 2
 3 8
4 1 1
2 3 1
 3 1
2 2 1
2 3 1

4
 1
 12
 7
 10
 15
 16
 14
 0
 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 up(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?-1:*(long long*)a>*(long long*)b?1:0;
}
int down(const void*a,const void*b){
    return*(long long*)a<*(long long*)b?1:*(long long*)a>*(long long*)b?-1:0;
}
void upsort(long long*a,int n){
    qsort(a,n,sizeof(long long),up);
}
void downsort(long long*a,int n){
    qsort(a,n,sizeof(long long),down);
}
int judge(long long*a,long long*b,long long n,long long k,long long x){
    long long time=0;
    for(int i=0;i<n;i++){
        time+=(a[i]*b[i]-x>0)?a[i]-x/b[i]:0;
    }
    return time<=k;
}

int main(void){
    long long n,k;
    scanf("%lld%lld",&n,&k);
    long long a[n],f[n];
    for(int i=0;i<n;i++)scanf("%lld",a+i);
    upsort(a,n);
    for(int i=0;i<n;i++)scanf("%lld",f+i);
    downsort(f,n);
    long long high=a[n-1]*f[0],low=0,mid;
    long long sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
    }
    if(sum<=k){
        printf("0\n");
        return 0;
    }
    else{
        while(high>low+1){
            mid=(high+low)/2;
            if(judge(a,f,n,k,mid))high=mid;
            else low=mid;
        }
        printf("%lld\n",high);
        return 0;
    }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	up
	.type	up, @function
up:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	up, .-up
	.globl	down
	.type	down, @function
down:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	down, .-down
	.globl	upsort
	.type	upsort, @function
upsort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	up(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	upsort, .-upsort
	.globl	downsort
	.type	downsort, @function
downsort:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	down(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	downsort, .-downsort
	.globl	judge
	.type	judge, @function
judge:
.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	%rdx, -40(%rbp)
	movq	%rcx, -48(%rbp)
	movq	%r8, -56(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	subq	-56(%rbp), %rax
	testq	%rax, %rax
	jle	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rsi
	movq	-56(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L15:
	movl	$0, %eax
.L16:
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L14:
	movl	-12(%rbp), %eax
	cltq
	cmpq	%rax, -40(%rbp)
	jg	.L17
	movq	-8(%rbp), %rax
	cmpq	-48(%rbp), %rax
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	judge, .-judge
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"0"
.LC3:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-128(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -96(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -80(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L26
.L27:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L27
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-88(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	upsort
	movl	$0, -144(%rbp)
	jmp	.L28
.L29:
	movl	-144(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -144(%rbp)
.L28:
	movl	-144(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L29
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-72(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	downsort
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-88(%rbp), %rax
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	movq	$0, -112(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L30
.L31:
	movq	-88(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	addq	%rax, -104(%rbp)
	addl	$1, -140(%rbp)
.L30:
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L31
	movq	-128(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jg	.L34
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L33
.L36:
	movq	-120(%rbp), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -64(%rbp)
	movq	-128(%rbp), %rcx
	movq	-136(%rbp), %rdx
	movq	-64(%rbp), %rdi
	movq	-72(%rbp), %rsi
	movq	-88(%rbp), %rax
	movq	%rdi, %r8
	movq	%rax, %rdi
	call	judge
	testl	%eax, %eax
	je	.L35
	movq	-64(%rbp), %rax
	movq	%rax, -120(%rbp)
	jmp	.L34
.L35:
	movq	-64(%rbp), %rax
	movq	%rax, -112(%rbp)
.L34:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L36
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L33:
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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	up
	.type	up, @function
up:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	up, .-up
	.globl	down
	.type	down, @function
down:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	down, .-down
	.globl	upsort
	.type	upsort, @function
upsort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	up(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	upsort, .-upsort
	.globl	downsort
	.type	downsort, @function
downsort:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	down(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	downsort, .-downsort
	.globl	judge
	.type	judge, @function
judge:
.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	%rdx, -40(%rbp)
	movq	%rcx, -48(%rbp)
	movq	%r8, -56(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	subq	-56(%rbp), %rax
	testq	%rax, %rax
	jle	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rsi
	movq	-56(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	jmp	.L16
.L15:
	movl	$0, %eax
.L16:
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L14:
	movl	-12(%rbp), %eax
	cltq
	cmpq	%rax, -40(%rbp)
	jg	.L17
	movq	-8(%rbp), %rax
	cmpq	-48(%rbp), %rax
	setle	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	judge, .-judge
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"0"
.LC3:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-128(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -96(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L20:
	cmpq	%rdx, %rsp
	je	.L21
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L20
.L21:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L22
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L22:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -80(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L23:
	cmpq	%rdx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L25
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L25:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L26
.L27:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L27
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-88(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	upsort
	movl	$0, -144(%rbp)
	jmp	.L28
.L29:
	movl	-144(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -144(%rbp)
.L28:
	movl	-144(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L29
	movq	-136(%rbp), %rax
	movl	%eax, %edx
	movq	-72(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	downsort
	movq	-136(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-88(%rbp), %rax
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	movq	$0, -112(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L30
.L31:
	movq	-88(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	addq	%rax, -104(%rbp)
	addl	$1, -140(%rbp)
.L30:
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L31
	movq	-128(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jg	.L34
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L33
.L36:
	movq	-120(%rbp), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -64(%rbp)
	movq	-128(%rbp), %rcx
	movq	-136(%rbp), %rdx
	movq	-64(%rbp), %rdi
	movq	-72(%rbp), %rsi
	movq	-88(%rbp), %rax
	movq	%rdi, %r8
	movq	%rax, %rdi
	call	judge
	testl	%eax, %eax
	je	.L35
	movq	-64(%rbp), %rax
	movq	%rax, -120(%rbp)
	jmp	.L34
.L35:
	movq	-64(%rbp), %rax
	movq	%rax, -112(%rbp)
.L34:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L36
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L33:
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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:
