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>

int main(void){
    int m;
    scanf("%d", &m);
    long long int ans = 0;
    long long int i, d, c;
    long long int sum = 0;
    for(i = 0; i < m; i++){
        scanf("%lld%lld", &d, &c);
        sum += c * d;
        ans += c;
    }
    ans--;
    
    ans += sum / 9;
    if(sum % 9 == 0){
        ans--;
    }
    printf("%lld\n", ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -16(%rbp)
	movq	-40(%rbp), %rax
	addq	%rax, -32(%rbp)
	addq	$1, -24(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jl	.L3
	subq	$1, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	sarq	$63, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	addq	%rax, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rcx, %rsi
	sarq	$63, %rsi
	movq	%rdx, %rax
	subq	%rsi, %rax
	movq	%rax, %rdx
	salq	$3, %rdx
	addq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	testq	%rax, %rax
	jne	.L4
	subq	$1, -32(%rbp)
.L4:
	movq	-32(%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	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	xorl	%ebp, %ebp
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	movq	8(%rsp), %rdx
	addq	$1, %rbx
	imulq	%rax, %rdx
	addq	%rax, %rbp
	movslq	4(%rsp), %rax
	addq	%rdx, %r15
	cmpq	%rbx, %rax
	jg	.L3
	movabsq	$2049638230412172402, %rdx
	movq	%r15, %rax
	imulq	%rdx
	movq	%r15, %rax
	sarq	$63, %rax
	subq	%rax, %rdx
	leaq	(%rdx,%rdx,8), %rax
	leaq	-1(%rbp,%rdx), %r8
	cmpq	%rax, %r15
	je	.L2
.L4:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$40, %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
.L6:
	.cfi_restore_state
	orq	$-1, %r8
.L2:
	subq	$1, %r8
	jmp	.L4
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	xorl	%ebp, %ebp
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	movq	8(%rsp), %rdx
	addq	$1, %rbx
	imulq	%rax, %rdx
	addq	%rax, %rbp
	movslq	4(%rsp), %rax
	addq	%rdx, %r15
	cmpq	%rbx, %rax
	jg	.L3
	movabsq	$2049638230412172402, %rdx
	movq	%r15, %rax
	imulq	%rdx
	movq	%r15, %rax
	sarq	$63, %rax
	subq	%rax, %rdx
	leaq	(%rdx,%rdx,8), %rax
	leaq	-1(%rbp,%rdx), %r8
	cmpq	%rax, %r15
	je	.L2
.L4:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$40, %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
.L6:
	.cfi_restore_state
	orq	$-1, %r8
.L2:
	subq	$1, %r8
	jmp	.L4
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void){
    int m;
    scanf("%d", &m);
    long long int ans = 0;
    long long int i, d, c;
    long long int sum = 0;
    for(i = 0; i < m; i++){
        scanf("%lld%lld", &d, &c);
        sum += c * d;
        ans += c;
    }
    ans--;
    
    ans += sum / 9;
    if(sum % 9 == 0){
        ans--;
    }
    printf("%lld\n", ans);
}
3
1 0
0 8
7 1
 3
1 0
0 8
7 2
 3
1 0
0 10
7 2
 3
1 0
0 17
7 2
 3
1 1
0 17
7 2
 3
1 1
0 4
7 2
 3
1 0
0 4
7 2
 3
1 0
0 4
7 1
 3
1 0
0 3
7 1
 3
1 1
0 8
7 2

8
 10
 12
 19
 20
 7
 6
 4
 3
 11

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>

int main(void){
    int m;
    scanf("%d", &m);
    long long int ans = 0;
    long long int i, d, c;
    long long int sum = 0;
    for(i = 0; i < m; i++){
        scanf("%lld%lld", &d, &c);
        sum += c * d;
        ans += c;
    }
    ans--;
    
    ans += sum / 9;
    if(sum % 9 == 0){
        ans--;
    }
    printf("%lld\n", ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -16(%rbp)
	movq	-40(%rbp), %rax
	addq	%rax, -32(%rbp)
	addq	$1, -24(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jl	.L3
	subq	$1, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	sarq	$63, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	addq	%rax, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rcx, %rsi
	sarq	$63, %rsi
	movq	%rdx, %rax
	subq	%rsi, %rax
	movq	%rax, %rdx
	salq	$3, %rdx
	addq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	testq	%rax, %rax
	jne	.L4
	subq	$1, -32(%rbp)
.L4:
	movq	-32(%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	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	imulq	%rdx, %rax
	addq	%rax, -16(%rbp)
	movq	-40(%rbp), %rax
	addq	%rax, -32(%rbp)
	addq	$1, -24(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jl	.L3
	subq	$1, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	sarq	$63, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	addq	%rax, -32(%rbp)
	movq	-16(%rbp), %rcx
	movabsq	$2049638230412172402, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rcx, %rsi
	sarq	$63, %rsi
	movq	%rdx, %rax
	subq	%rsi, %rax
	movq	%rax, %rdx
	salq	$3, %rdx
	addq	%rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	testq	%rax, %rax
	jne	.L4
	subq	$1, -32(%rbp)
.L4:
	movq	-32(%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	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
