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

```c
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define read(n) scanf("%d", &n)
#define readl(n) scanf("%lld", &n)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

lli a[MAX], b[MAX];

int acs(const void *x, const void *y)
{
  if (a[*(int *)x] - a[*(int *)y] > 0)
    return 1;
  if (a[*(int *)x] - a[*(int *)y] < 0)
    return -1;
  return 0;
}

int main(void)
{
  int n, m;
  read(n);
  read(m);

  rep(i, 0, n)
  {
    readl(a[i]);
    readl(b[i]);
  }

  int idx[MAX];
  rep(i, 0, n) idx[i] = i;

  qsort(idx, n, sizeof(int), acs);

  int rem = m;
  lli mny = 0;
  rep(i, 0, n)
  {
    if (rem <= 0)
      break;
    int drink = min(rem, b[idx[i]]);
    mny += a[idx[i]] * drink;
    rem -= drink;
  }

  printf("%lld\n", mny);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.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
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp_char, .-cmp_char
	.globl	cmp_str
	.type	cmp_str, @function
cmp_str:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp_str, .-cmp_str
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.text
	.globl	acs
	.type	acs, @function
acs:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L6
	movl	$1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jns	.L8
	movl	$-1, %eax
	jmp	.L7
.L8:
	movl	$0, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	acs, .-acs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400044(%rbp)
	jmp	.L10
.L11:
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -400044(%rbp)
.L10:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400044(%rbp)
	jl	.L11
	movl	$0, -400040(%rbp)
	jmp	.L12
.L13:
	movl	-400040(%rbp), %eax
	cltq
	movl	-400040(%rbp), %edx
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400040(%rbp)
.L12:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400052(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	acs(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movq	$0, -400024(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L14
.L17:
	cmpl	$0, -400036(%rbp)
	jle	.L20
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400036(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -400028(%rbp)
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400028(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -400024(%rbp)
	movl	-400028(%rbp), %eax
	subl	%eax, -400036(%rbp)
	addl	$1, -400032(%rbp)
.L14:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L17
	jmp	.L16
.L20:
	nop
.L16:
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	acs
	.type	acs, @function
acs:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	(%rdi), %rdx
	movslq	(%rsi), %rcx
	leaq	a(%rip), %rax
	movq	(%rax,%rdx,8), %rdx
	subq	(%rax,%rcx,8), %rdx
	setne	%al
	movzbl	%al, %eax
	negl	%eax
	testq	%rdx, %rdx
	movl	$1, %edx
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	acs, .-acs
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB51:
	.cfi_startproc
	endbr64
	movsbl	(%rdi), %eax
	movsbl	(%rsi), %edx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp_char, .-cmp_char
	.p2align 4
	.globl	cmp_str
	.type	cmp_str, @function
cmp_str:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rsi
	movq	(%rdi), %rdi
	jmp	strcmp@PLT
	.cfi_endproc
.LFE52:
	.size	cmp_str, .-cmp_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC1(%rip), %rbp
	leaq	a(%rip), %r12
	movq	%rbp, %rdi
	leaq	.LC2(%rip), %r13
	leaq	b(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	xorl	%ebp, %ebp
	testl	%esi, %esi
	jle	.L28
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$8, %r12
	call	__isoc99_scanf@PLT
	leaq	(%rbx,%rbp,8), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	addq	$1, %rbp
	cmpl	%ebp, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L28
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%esi, %edx
	leaq	16(%rsp), %rbp
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC3(%rip), %xmm2
	shrl	$2, %edx
	movq	%rbp, %rax
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movaps	%xmm1, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L11
	movl	%esi, %eax
	andl	$-4, %eax
	testb	$3, %sil
	je	.L8
.L10:
	movslq	%eax, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %esi
	jle	.L8
	movslq	%edx, %rcx
	addl	$2, %eax
	movl	%edx, 16(%rsp,%rcx,4)
	cmpl	%eax, %esi
	jle	.L8
	movslq	%eax, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	movl	$4, %edx
	leaq	acs(%rip), %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	movl	8(%rsp), %r9d
	testl	%edx, %edx
	jle	.L18
	testl	%r9d, %r9d
	jle	.L18
	movl	$1, %ecx
	xorl	%r8d, %r8d
	leaq	a(%rip), %r10
	leaq	b(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	-4(%rbp,%rcx,4), %rdi
	movslq	%edx, %rax
	movq	(%rbx,%rdi,8), %rsi
	cmpq	%rsi, %rax
	cmovg	%rsi, %rax
	movslq	%eax, %rsi
	imulq	(%r10,%rdi,8), %rsi
	subl	%eax, %edx
	addq	%rsi, %r8
	cmpl	%ecx, %r9d
	setle	%al
	testl	%edx, %edx
	setle	%sil
	addq	$1, %rcx
	orb	%sil, %al
	je	.L15
.L14:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	leaq	16(%rsp), %rbp
	jmp	.L8
.L18:
	xorl	%r8d, %r8d
	jmp	.L14
.L17:
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	jmp	.L10
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.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	acs
	.type	acs, @function
acs:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	(%rdi), %rdx
	movslq	(%rsi), %rcx
	leaq	a(%rip), %rax
	movq	(%rax,%rdx,8), %rdx
	subq	(%rax,%rcx,8), %rdx
	setne	%al
	movzbl	%al, %eax
	negl	%eax
	testq	%rdx, %rdx
	movl	$1, %edx
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	acs, .-acs
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB51:
	.cfi_startproc
	endbr64
	movsbl	(%rdi), %eax
	movsbl	(%rsi), %edx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp_char, .-cmp_char
	.p2align 4
	.globl	cmp_str
	.type	cmp_str, @function
cmp_str:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rsi
	movq	(%rdi), %rdi
	jmp	strcmp@PLT
	.cfi_endproc
.LFE52:
	.size	cmp_str, .-cmp_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC1(%rip), %rbp
	leaq	a(%rip), %r12
	movq	%rbp, %rdi
	leaq	.LC2(%rip), %r13
	leaq	b(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	xorl	%ebp, %ebp
	testl	%esi, %esi
	jle	.L28
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$8, %r12
	call	__isoc99_scanf@PLT
	leaq	(%rbx,%rbp,8), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	addq	$1, %rbp
	cmpl	%ebp, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L28
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%esi, %edx
	leaq	16(%rsp), %rbp
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC3(%rip), %xmm2
	shrl	$2, %edx
	movq	%rbp, %rax
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movaps	%xmm1, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L11
	movl	%esi, %eax
	andl	$-4, %eax
	testb	$3, %sil
	je	.L8
.L10:
	movslq	%eax, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %esi
	jle	.L8
	movslq	%edx, %rcx
	addl	$2, %eax
	movl	%edx, 16(%rsp,%rcx,4)
	cmpl	%eax, %esi
	jle	.L8
	movslq	%eax, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	movl	$4, %edx
	leaq	acs(%rip), %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	movl	8(%rsp), %r9d
	testl	%edx, %edx
	jle	.L18
	testl	%r9d, %r9d
	jle	.L18
	movl	$1, %ecx
	xorl	%r8d, %r8d
	leaq	a(%rip), %r10
	leaq	b(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	-4(%rbp,%rcx,4), %rdi
	movslq	%edx, %rax
	movq	(%rbx,%rdi,8), %rsi
	cmpq	%rsi, %rax
	cmovg	%rsi, %rax
	movslq	%eax, %rsi
	imulq	(%r10,%rdi,8), %rsi
	subl	%eax, %edx
	addq	%rsi, %r8
	cmpl	%ecx, %r9d
	setle	%al
	testl	%edx, %edx
	setle	%sil
	addq	$1, %rcx
	orb	%sil, %al
	je	.L15
.L14:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	leaq	16(%rsp), %rbp
	jmp	.L8
.L18:
	xorl	%r8d, %r8d
	jmp	.L14
.L17:
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	jmp	.L10
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define read(n) scanf("%d", &n)
#define readl(n) scanf("%lld", &n)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

lli a[MAX], b[MAX];

int acs(const void *x, const void *y)
{
  if (a[*(int *)x] - a[*(int *)y] > 0)
    return 1;
  if (a[*(int *)x] - a[*(int *)y] < 0)
    return -1;
  return 0;
}

int main(void)
{
  int n, m;
  read(n);
  read(m);

  rep(i, 0, n)
  {
    readl(a[i]);
    readl(b[i]);
  }

  int idx[MAX];
  rep(i, 0, n) idx[i] = i;

  qsort(idx, n, sizeof(int), acs);

  int rem = m;
  lli mny = 0;
  rep(i, 0, n)
  {
    if (rem <= 0)
      break;
    int drink = min(rem, b[idx[i]]);
    mny += a[idx[i]] * drink;
    rem -= drink;
  }

  printf("%lld\n", mny);
  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 <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define read(n) scanf("%d", &n)
#define readl(n) scanf("%lld", &n)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

lli a[MAX], b[MAX];

int acs(const void *x, const void *y)
{
  if (a[*(int *)x] - a[*(int *)y] > 0)
    return 1;
  if (a[*(int *)x] - a[*(int *)y] < 0)
    return -1;
  return 0;
}

int main(void)
{
  int n, m;
  read(n);
  read(m);

  rep(i, 0, n)
  {
    readl(a[i]);
    readl(b[i]);
  }

  int idx[MAX];
  rep(i, 0, n) idx[i] = i;

  qsort(idx, n, sizeof(int), acs);

  int rem = m;
  lli mny = 0;
  rep(i, 0, n)
  {
    if (rem <= 0)
      break;
    int drink = min(rem, b[idx[i]]);
    mny += a[idx[i]] * drink;
    rem -= drink;
  }

  printf("%lld\n", mny);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.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
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp_char, .-cmp_char
	.globl	cmp_str
	.type	cmp_str, @function
cmp_str:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp_str, .-cmp_str
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.text
	.globl	acs
	.type	acs, @function
acs:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L6
	movl	$1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jns	.L8
	movl	$-1, %eax
	jmp	.L7
.L8:
	movl	$0, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	acs, .-acs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400044(%rbp)
	jmp	.L10
.L11:
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -400044(%rbp)
.L10:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400044(%rbp)
	jl	.L11
	movl	$0, -400040(%rbp)
	jmp	.L12
.L13:
	movl	-400040(%rbp), %eax
	cltq
	movl	-400040(%rbp), %edx
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400040(%rbp)
.L12:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400052(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	acs(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movq	$0, -400024(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L14
.L17:
	cmpl	$0, -400036(%rbp)
	jle	.L20
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400036(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -400028(%rbp)
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400028(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -400024(%rbp)
	movl	-400028(%rbp), %eax
	subl	%eax, -400036(%rbp)
	addl	$1, -400032(%rbp)
.L14:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L17
	jmp	.L16
.L20:
	nop
.L16:
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	cmp_char
	.type	cmp_char, @function
cmp_char:
.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
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp_char, .-cmp_char
	.globl	cmp_str
	.type	cmp_str, @function
cmp_str:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp_str, .-cmp_str
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.text
	.globl	acs
	.type	acs, @function
acs:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L6
	movl	$1, %eax
	jmp	.L7
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jns	.L8
	movl	$-1, %eax
	jmp	.L7
.L8:
	movl	$0, %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	acs, .-acs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400044(%rbp)
	jmp	.L10
.L11:
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400044(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -400044(%rbp)
.L10:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400044(%rbp)
	jl	.L11
	movl	$0, -400040(%rbp)
	jmp	.L12
.L13:
	movl	-400040(%rbp), %eax
	cltq
	movl	-400040(%rbp), %edx
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400040(%rbp)
.L12:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400052(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	acs(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movq	$0, -400024(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L14
.L17:
	cmpl	$0, -400036(%rbp)
	jle	.L20
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400036(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -400028(%rbp)
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-400028(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -400024(%rbp)
	movl	-400028(%rbp), %eax
	subl	%eax, -400036(%rbp)
	addl	$1, -400032(%rbp)
.L14:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L17
	jmp	.L16
.L20:
	nop
.L16:
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
