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>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    long price;
    int num;
}shop;

//昇順
int asc(const void* a, const void* b){
    shop p = *(shop*)a;
    shop q = *(shop*)b;

    if(p.price<q.price) return -1;
    else if(p.price>q.price) return 1;
    return 0;
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //S[0]~S[N-1]に格納する
    shop* S;
    NEW(S,N);
    for(int i=0;i<N;i++){
        scanf("%ld%d",&S[i].price, &S[i].num);
    }
    qsort(S,N,sizeof(shop),asc);

    long ans=0;
    int i=0;
    while(M>0){
        if(M>=S[i].num){
            ans+=S[i].price*S[i].num;
            M-=S[i].num;
        }
        else{
            ans+=S[i].price*M;
            M=0;
        }
        i++;
    }
    printf("%ld\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	asc
	.type	asc, @function
asc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jge	.L2
	movl	$-1, %eax
	jmp	.L5
.L2:
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L4
	movl	$1, %eax
	jmp	.L5
.L4:
	movl	$0, %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%ld%d"
.LC3:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L10
.L13:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L11
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	8(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	8(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -36(%rbp)
	jmp	.L12
.L11:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	$0, -36(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L10:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	asc
	.type	asc, @function
asc:
.LFB39:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%ld%d"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %r15
	movq	%r15, %rdi
	salq	$4, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rax, %rbp
	movq	%rax, %rbx
	leaq	.LC2(%rip), %r14
	xorl	%r12d, %r12d
	testl	%r15d, %r15d
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	8(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %r13d
	addl	$1, %r12d
	addq	$16, %rbx
	cmpl	%r12d, %r13d
	jg	.L9
	movslq	%r13d, %r15
.L8:
	leaq	asc(%rip), %rcx
	movl	$16, %edx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
	movq	%rbp, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	movl	8(%rdx), %ecx
	movq	(%rdx), %rsi
	cmpl	%eax, %ecx
	jg	.L11
	movslq	%ecx, %rdi
	addq	$16, %rdx
	imulq	%rdi, %rsi
	addq	%rsi, %r8
	subl	%ecx, %eax
	jne	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$0, 4(%rsp)
.L10:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$24, %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
.L11:
	.cfi_restore_state
	cltq
	imulq	%rsi, %rax
	addq	%rax, %r8
	jmp	.L13
.L15:
	xorl	%r8d, %r8d
	jmp	.L10
.L20:
	call	__stack_chk_fail@PLT
.L6:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	asc
	.type	asc, @function
asc:
.LFB39:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	asc, .-asc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%ld%d"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %r15
	movq	%r15, %rdi
	salq	$4, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rax, %rbp
	movq	%rax, %rbx
	leaq	.LC2(%rip), %r14
	xorl	%r12d, %r12d
	testl	%r15d, %r15d
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	8(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %r13d
	addl	$1, %r12d
	addq	$16, %rbx
	cmpl	%r12d, %r13d
	jg	.L9
	movslq	%r13d, %r15
.L8:
	leaq	asc(%rip), %rcx
	movl	$16, %edx
	movq	%r15, %rsi
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
	movq	%rbp, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	movl	8(%rdx), %ecx
	movq	(%rdx), %rsi
	cmpl	%eax, %ecx
	jg	.L11
	movslq	%ecx, %rdi
	addq	$16, %rdx
	imulq	%rdi, %rsi
	addq	%rsi, %r8
	subl	%ecx, %eax
	jne	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$0, 4(%rsp)
.L10:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$24, %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
.L11:
	.cfi_restore_state
	cltq
	imulq	%rsi, %rax
	addq	%rax, %r8
	jmp	.L13
.L15:
	xorl	%r8d, %r8d
	jmp	.L10
.L20:
	call	__stack_chk_fail@PLT
.L6:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    long price;
    int num;
}shop;

//昇順
int asc(const void* a, const void* b){
    shop p = *(shop*)a;
    shop q = *(shop*)b;

    if(p.price<q.price) return -1;
    else if(p.price>q.price) return 1;
    return 0;
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //S[0]~S[N-1]に格納する
    shop* S;
    NEW(S,N);
    for(int i=0;i<N;i++){
        scanf("%ld%d",&S[i].price, &S[i].num);
    }
    qsort(S,N,sizeof(shop),asc);

    long ans=0;
    int i=0;
    while(M>0){
        if(M>=S[i].num){
            ans+=S[i].price*S[i].num;
            M-=S[i].num;
        }
        else{
            ans+=S[i].price*M;
            M=0;
        }
        i++;
    }
    printf("%ld\n",ans);

    return 0;
}
4 30
6 18
2 6
3 10
7 9
 2 3
4 9
2 4
 4 30
6 18
2 1
3 10
7 9
 2 3
4 9
4 4
 2 6
4 9
4 4
 2 6
3 9
4 4
 2 6
3 9
2 4
 2 6
3 9
1 4
 2 3
3 4
1 6
 2 5
3 4
1 6

126
 6
 147
 12
 24
 18
 14
 10
 3
 5

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>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    long price;
    int num;
}shop;

//昇順
int asc(const void* a, const void* b){
    shop p = *(shop*)a;
    shop q = *(shop*)b;

    if(p.price<q.price) return -1;
    else if(p.price>q.price) return 1;
    return 0;
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //S[0]~S[N-1]に格納する
    shop* S;
    NEW(S,N);
    for(int i=0;i<N;i++){
        scanf("%ld%d",&S[i].price, &S[i].num);
    }
    qsort(S,N,sizeof(shop),asc);

    long ans=0;
    int i=0;
    while(M>0){
        if(M>=S[i].num){
            ans+=S[i].price*S[i].num;
            M-=S[i].num;
        }
        else{
            ans+=S[i].price*M;
            M=0;
        }
        i++;
    }
    printf("%ld\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	asc
	.type	asc, @function
asc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jge	.L2
	movl	$-1, %eax
	jmp	.L5
.L2:
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L4
	movl	$1, %eax
	jmp	.L5
.L4:
	movl	$0, %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%ld%d"
.LC3:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L10
.L13:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L11
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	8(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	8(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -36(%rbp)
	jmp	.L12
.L11:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	$0, -36(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L10:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	asc
	.type	asc, @function
asc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jge	.L2
	movl	$-1, %eax
	jmp	.L5
.L2:
	movq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L4
	movl	$1, %eax
	jmp	.L5
.L4:
	movl	$0, %eax
.L5:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	asc, .-asc
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%ld%d"
.LC3:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L10
.L13:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L11
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	8(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	8(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -36(%rbp)
	jmp	.L12
.L11:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -24(%rbp)
	movl	$0, -36(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L10:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
