Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>



int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




int main(void){
    int price[4];
    long long n;
    unsigned long long min = 10000000000000000;
    int mini;
    unsigned long long ans = 0;
    for (int i = 0; i < 4; i++){
        scanf("%d", &price[i]);
    }
    scanf("%lld", &n);
    n *= 4;
    for (int i = 0; i < 3; i++){
        if (min > price[i]*(int)pow(2, 3-i)){
            min = price[i]*(int)pow(2, 3-i);
            mini = i;
        }
    }
    if (min > price[3]){
        ans = (unsigned long long)n/8*price[3]+(n%8)/(int)pow(2, mini)*price[mini];
    }else{
        ans = (unsigned long long)n/(int)pow(2, mini)*price[mini];
    }

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

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	descending_compare
	.type	descending_compare, @function
descending_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	descending_compare, .-descending_compare
	.globl	ascending_compare
	.type	ascending_compare, @function
ascending_compare:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	$0, %eax
	jmp	.L7
.L8:
	movl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ascending_compare, .-ascending_compare
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	jmp	.L10
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L11
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L12
.L11:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L12:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
.L10:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jne	.L13
	movl	-8(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
.L13:
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L15
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L16
	movl	-12(%rbp), %eax
	jmp	.L17
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	jmp	.L17
.L18:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	jmp	.L17
.L19:
	movl	-28(%rbp), %eax
.L17:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	lower_bound, .-lower_bound
	.globl	gcd
	.type	gcd, @function
gcd:
.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)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	jmp	.L22
.L21:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	gcd, .-gcd
	.globl	factorial
	.type	factorial, @function
factorial:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movl	-12(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	subl	$1, -12(%rbp)
.L24:
	cmpl	$1, -12(%rbp)
	jg	.L25
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC3:
	.string	"%llu\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	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$10000000000000000, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -56(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L28
.L29:
	leaq	-48(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L28:
	cmpl	$3, -80(%rbp)
	jle	.L29
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L30
.L32:
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L31
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	movq	%rax, -64(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -84(%rbp)
.L31:
	addl	$1, -76(%rbp)
.L30:
	cmpl	$2, -76(%rbp)
	jle	.L32
	movl	-36(%rbp), %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L33
	movq	-72(%rbp), %rax
	shrq	$3, %rax
	movq	%rax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rbx
	imulq	%rax, %rbx
	movq	-72(%rbp), %rax
	cqto
	shrq	$61, %rdx
	addq	%rdx, %rax
	andl	$7, %eax
	subq	%rdx, %rax
	movq	%rax, %r12
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%r12, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rbx, %rax
	movq	%rax, -56(%rbp)
	jmp	.L34
.L33:
	movq	-72(%rbp), %rax
	movq	%rax, %rbx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%rbx, %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -56(%rbp)
.L34:
	movq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$80, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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	descending_compare
	.type	descending_compare, @function
descending_compare:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$-1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	descending_compare, .-descending_compare
	.p2align 4
	.globl	ascending_compare
	.type	ascending_compare, @function
ascending_compare:
.LFB52:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$-1, %eax
	cmpl	%edx, (%rdi)
	jl	.L5
	setne	%al
	movzbl	%al, %eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	ascending_compare, .-ascending_compare
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB53:
	.cfi_startproc
	endbr64
	movl	%esi, %eax
	movq	%rdi, %r9
	movl	%esi, %r10d
	movl	%esi, %ecx
	shrl	$31, %eax
	movl	%edx, %edi
	xorl	%r8d, %r8d
	addl	%esi, %eax
	movl	$1, %esi
	sarl	%eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
.L10:
	leal	(%r8,%rcx), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
.L9:
	cmpl	%eax, %esi
	je	.L18
.L11:
	cmpl	%eax, %r8d
	je	.L12
	movslq	%eax, %rdx
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L19
	movl	%eax, %r8d
	leal	1(%rax), %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L18:
	leal	2(%r8), %edx
	cmpl	%ecx, %edx
	jne	.L11
.L12:
	movslq	%r8d, %rdx
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L8
	movslq	%eax, %rdx
	movl	%eax, %r8d
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L8
	movslq	%ecx, %rax
	cmpl	%edi, (%r9,%rax,4)
	cmovl	%r10d, %ecx
	movl	%ecx, %r8d
.L8:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	lower_bound, .-lower_bound
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB54:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L21
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%rdx, %r8
.L21:
	xorl	%edx, %edx
	divq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L29
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE54:
	.size	gcd, .-gcd
	.p2align 4
	.globl	factorial
	.type	factorial, @function
factorial:
.LFB55:
	.cfi_startproc
	endbr64
	cmpl	$1, %edi
	jle	.L33
	movslq	%edi, %rdx
	leal	-2(%rdi), %esi
	movl	$1, %r8d
	leaq	-1(%rdx), %rax
	movq	%rax, %rcx
	subq	%rsi, %rcx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	subq	$1, %rax
.L32:
	imulq	%rdx, %r8
	movq	%rax, %rdx
	cmpq	%rcx, %rax
	jne	.L35
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %r8d
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	factorial, .-factorial
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC3:
	.string	"%llu\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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r13
	leaq	48(%rsp), %r12
	movq	%r13, %rbx
.L37:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%r12, %rbx
	jne	.L37
	leaq	24(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	movl	$3, %r15d
	leaq	.LC1(%rip), %rdi
	movabsq	$10000000000000000, %rbp
	call	__isoc99_scanf@PLT
	movq	24(%rsp), %rax
	movsd	.LC2(%rip), %xmm2
	leaq	0(,%rax,4), %rbx
	movq	%rbx, 24(%rsp)
.L39:
	movl	%r15d, %eax
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	movl	0(%r13,%r14,4), %r12d
	subl	%r14d, %eax
	cvtsi2sdl	%eax, %xmm1
	movsd	%xmm1, (%rsp)
	call	pow@PLT
	movsd	(%rsp), %xmm1
	cvttsd2sil	%xmm0, %eax
	imull	%r12d, %eax
	cltq
	cmpq	%rbp, %rax
	movq	.LC2(%rip), %rax
	movq	%rax, %xmm2
	jb	.L46
.L38:
	addq	$1, %r14
	cmpq	$3, %r14
	jne	.L39
	movl	12(%rsp), %r15d
	movslq	44(%rsp), %r12
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	cvtsi2sdl	%r15d, %xmm1
	cmpq	%rbp, %r12
	jnb	.L40
	call	pow@PLT
	movq	%rbx, %rax
	movl	$8, %ecx
	movslq	%r15d, %r14
	cqto
	shrq	$3, %rbx
	idivq	%rcx
	cvttsd2sil	%xmm0, %ecx
	imulq	%r12, %rbx
	movslq	%ecx, %rcx
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	movslq	32(%rsp,%r14,4), %rdx
	imulq	%rdx, %rax
	leaq	(%rax,%rbx), %rdx
.L41:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$72, %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
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore_state
	movq	%rax, %xmm0
	call	pow@PLT
	movq	.LC2(%rip), %rax
	movl	%r14d, 12(%rsp)
	cvttsd2sil	%xmm0, %ebp
	movq	%rax, %xmm2
	imull	%r12d, %ebp
	movslq	%ebp, %rbp
	jmp	.L38
.L40:
	call	pow@PLT
	movq	%rbx, %rax
	xorl	%edx, %edx
	movslq	12(%rsp), %r14
	cvttsd2sil	%xmm0, %ecx
	movslq	%ecx, %rcx
	divq	%rcx
	movslq	32(%rsp,%r14,4), %rdx
	imulq	%rax, %rdx
	jmp	.L41
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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	descending_compare
	.type	descending_compare, @function
descending_compare:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$-1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	descending_compare, .-descending_compare
	.p2align 4
	.globl	ascending_compare
	.type	ascending_compare, @function
ascending_compare:
.LFB52:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$-1, %eax
	cmpl	%edx, (%rdi)
	jl	.L5
	setne	%al
	movzbl	%al, %eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	ascending_compare, .-ascending_compare
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB53:
	.cfi_startproc
	endbr64
	movl	%esi, %eax
	movq	%rdi, %r9
	movl	%esi, %r10d
	movl	%esi, %ecx
	shrl	$31, %eax
	movl	%edx, %edi
	xorl	%r8d, %r8d
	addl	%esi, %eax
	movl	$1, %esi
	sarl	%eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
.L10:
	leal	(%r8,%rcx), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
.L9:
	cmpl	%eax, %esi
	je	.L18
.L11:
	cmpl	%eax, %r8d
	je	.L12
	movslq	%eax, %rdx
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L19
	movl	%eax, %r8d
	leal	1(%rax), %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L18:
	leal	2(%r8), %edx
	cmpl	%ecx, %edx
	jne	.L11
.L12:
	movslq	%r8d, %rdx
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L8
	movslq	%eax, %rdx
	movl	%eax, %r8d
	cmpl	%edi, (%r9,%rdx,4)
	jge	.L8
	movslq	%ecx, %rax
	cmpl	%edi, (%r9,%rax,4)
	cmovl	%r10d, %ecx
	movl	%ecx, %r8d
.L8:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	lower_bound, .-lower_bound
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB54:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L21
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%rdx, %r8
.L21:
	xorl	%edx, %edx
	divq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L29
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE54:
	.size	gcd, .-gcd
	.p2align 4
	.globl	factorial
	.type	factorial, @function
factorial:
.LFB55:
	.cfi_startproc
	endbr64
	cmpl	$1, %edi
	jle	.L33
	movslq	%edi, %rdx
	leal	-2(%rdi), %esi
	movl	$1, %r8d
	leaq	-1(%rdx), %rax
	movq	%rax, %rcx
	subq	%rsi, %rcx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	subq	$1, %rax
.L32:
	imulq	%rdx, %r8
	movq	%rax, %rdx
	cmpq	%rcx, %rax
	jne	.L35
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %r8d
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	factorial, .-factorial
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC3:
	.string	"%llu\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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r13
	leaq	48(%rsp), %r12
	movq	%r13, %rbx
.L37:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%r12, %rbx
	jne	.L37
	leaq	24(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	movl	$3, %r15d
	leaq	.LC1(%rip), %rdi
	movabsq	$10000000000000000, %rbp
	call	__isoc99_scanf@PLT
	movq	24(%rsp), %rax
	movsd	.LC2(%rip), %xmm2
	leaq	0(,%rax,4), %rbx
	movq	%rbx, 24(%rsp)
.L39:
	movl	%r15d, %eax
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	movl	0(%r13,%r14,4), %r12d
	subl	%r14d, %eax
	cvtsi2sdl	%eax, %xmm1
	movsd	%xmm1, (%rsp)
	call	pow@PLT
	movsd	(%rsp), %xmm1
	cvttsd2sil	%xmm0, %eax
	imull	%r12d, %eax
	cltq
	cmpq	%rbp, %rax
	movq	.LC2(%rip), %rax
	movq	%rax, %xmm2
	jb	.L46
.L38:
	addq	$1, %r14
	cmpq	$3, %r14
	jne	.L39
	movl	12(%rsp), %r15d
	movslq	44(%rsp), %r12
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	cvtsi2sdl	%r15d, %xmm1
	cmpq	%rbp, %r12
	jnb	.L40
	call	pow@PLT
	movq	%rbx, %rax
	movl	$8, %ecx
	movslq	%r15d, %r14
	cqto
	shrq	$3, %rbx
	idivq	%rcx
	cvttsd2sil	%xmm0, %ecx
	imulq	%r12, %rbx
	movslq	%ecx, %rcx
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	movslq	32(%rsp,%r14,4), %rdx
	imulq	%rdx, %rax
	leaq	(%rax,%rbx), %rdx
.L41:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$72, %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
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore_state
	movq	%rax, %xmm0
	call	pow@PLT
	movq	.LC2(%rip), %rax
	movl	%r14d, 12(%rsp)
	cvttsd2sil	%xmm0, %ebp
	movq	%rax, %xmm2
	imull	%r12d, %ebp
	movslq	%ebp, %rbp
	jmp	.L38
.L40:
	call	pow@PLT
	movq	%rbx, %rax
	xorl	%edx, %edx
	movslq	12(%rsp), %r14
	cvttsd2sil	%xmm0, %ecx
	movslq	%ecx, %rcx
	divq	%rcx
	movslq	32(%rsp,%r14,4), %rdx
	imulq	%rax, %rdx
	jmp	.L41
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

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



int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




int main(void){
    int price[4];
    long long n;
    unsigned long long min = 10000000000000000;
    int mini;
    unsigned long long ans = 0;
    for (int i = 0; i < 4; i++){
        scanf("%d", &price[i]);
    }
    scanf("%lld", &n);
    n *= 4;
    for (int i = 0; i < 3; i++){
        if (min > price[i]*(int)pow(2, 3-i)){
            min = price[i]*(int)pow(2, 3-i);
            mini = i;
        }
    }
    if (min > price[3]){
        ans = (unsigned long long)n/8*price[3]+(n%8)/(int)pow(2, mini)*price[mini];
    }else{
        ans = (unsigned long long)n/(int)pow(2, mini)*price[mini];
    }

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

    return 0;
}

10 100 1010 10000
1
 20 30 70 129
3
 10000 1001 100 10
1
 12345678 87654321 12345678 87654321
226515686
 20 30 70 83
3
 10000 1001 100 10
0
 12345678 87654321 12873114 87654321
226515686
 20 30 70 63
3
 10000 1001 100 10
-1
 1103255 87654321 12873114 87654321
226515686

40
 180
 100
 2796489721305108
 143
 0
 2915962248666204
 123
 4611686018427387794
 999618252631720

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>



int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




int main(void){
    int price[4];
    long long n;
    unsigned long long min = 10000000000000000;
    int mini;
    unsigned long long ans = 0;
    for (int i = 0; i < 4; i++){
        scanf("%d", &price[i]);
    }
    scanf("%lld", &n);
    n *= 4;
    for (int i = 0; i < 3; i++){
        if (min > price[i]*(int)pow(2, 3-i)){
            min = price[i]*(int)pow(2, 3-i);
            mini = i;
        }
    }
    if (min > price[3]){
        ans = (unsigned long long)n/8*price[3]+(n%8)/(int)pow(2, mini)*price[mini];
    }else{
        ans = (unsigned long long)n/(int)pow(2, mini)*price[mini];
    }

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

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	descending_compare
	.type	descending_compare, @function
descending_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	descending_compare, .-descending_compare
	.globl	ascending_compare
	.type	ascending_compare, @function
ascending_compare:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	$0, %eax
	jmp	.L7
.L8:
	movl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ascending_compare, .-ascending_compare
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	jmp	.L10
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L11
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L12
.L11:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L12:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
.L10:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jne	.L13
	movl	-8(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
.L13:
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L15
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L16
	movl	-12(%rbp), %eax
	jmp	.L17
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	jmp	.L17
.L18:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	jmp	.L17
.L19:
	movl	-28(%rbp), %eax
.L17:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	lower_bound, .-lower_bound
	.globl	gcd
	.type	gcd, @function
gcd:
.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)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	jmp	.L22
.L21:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	gcd, .-gcd
	.globl	factorial
	.type	factorial, @function
factorial:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movl	-12(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	subl	$1, -12(%rbp)
.L24:
	cmpl	$1, -12(%rbp)
	jg	.L25
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC3:
	.string	"%llu\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	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$10000000000000000, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -56(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L28
.L29:
	leaq	-48(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L28:
	cmpl	$3, -80(%rbp)
	jle	.L29
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L30
.L32:
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L31
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	movq	%rax, -64(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -84(%rbp)
.L31:
	addl	$1, -76(%rbp)
.L30:
	cmpl	$2, -76(%rbp)
	jle	.L32
	movl	-36(%rbp), %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L33
	movq	-72(%rbp), %rax
	shrq	$3, %rax
	movq	%rax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rbx
	imulq	%rax, %rbx
	movq	-72(%rbp), %rax
	cqto
	shrq	$61, %rdx
	addq	%rdx, %rax
	andl	$7, %eax
	subq	%rdx, %rax
	movq	%rax, %r12
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%r12, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rbx, %rax
	movq	%rax, -56(%rbp)
	jmp	.L34
.L33:
	movq	-72(%rbp), %rax
	movq	%rax, %rbx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%rbx, %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -56(%rbp)
.L34:
	movq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$80, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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	descending_compare
	.type	descending_compare, @function
descending_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	descending_compare, .-descending_compare
	.globl	ascending_compare
	.type	ascending_compare, @function
ascending_compare:
.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
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	$0, %eax
	jmp	.L7
.L8:
	movl	$1, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ascending_compare, .-ascending_compare
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	jmp	.L10
.L15:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L11
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L12
.L11:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L12:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
.L10:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -8(%rbp)
	jne	.L13
	movl	-8(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
.L13:
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L15
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L16
	movl	-12(%rbp), %eax
	jmp	.L17
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L18
	movl	-8(%rbp), %eax
	jmp	.L17
.L18:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	jmp	.L17
.L19:
	movl	-28(%rbp), %eax
.L17:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	lower_bound, .-lower_bound
	.globl	gcd
	.type	gcd, @function
gcd:
.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)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L21
	movq	-8(%rbp), %rax
	jmp	.L22
.L21:
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	gcd, .-gcd
	.globl	factorial
	.type	factorial, @function
factorial:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movl	-12(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	subl	$1, -12(%rbp)
.L24:
	cmpl	$1, -12(%rbp)
	jg	.L25
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC3:
	.string	"%llu\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	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$10000000000000000, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -56(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L28
.L29:
	leaq	-48(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L28:
	cmpl	$3, -80(%rbp)
	jle	.L29
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L30
.L32:
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L31
	movl	-76(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %ebx
	movl	$3, %eax
	subl	-76(%rbp), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	imull	%ebx, %eax
	cltq
	movq	%rax, -64(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -84(%rbp)
.L31:
	addl	$1, -76(%rbp)
.L30:
	cmpl	$2, -76(%rbp)
	jle	.L32
	movl	-36(%rbp), %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jbe	.L33
	movq	-72(%rbp), %rax
	shrq	$3, %rax
	movq	%rax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rbx
	imulq	%rax, %rbx
	movq	-72(%rbp), %rax
	cqto
	shrq	$61, %rdx
	addq	%rdx, %rax
	andl	$7, %eax
	subq	%rdx, %rax
	movq	%rax, %r12
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%r12, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rbx, %rax
	movq	%rax, -56(%rbp)
	jmp	.L34
.L33:
	movq	-72(%rbp), %rax
	movq	%rax, %rbx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-84(%rbp), %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movslq	%eax, %rcx
	movq	%rbx, %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rdx
	movl	-84(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -56(%rbp)
.L34:
	movq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$80, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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:
