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<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

typedef struct count_val {
  i32 cnt;
  i32 val;
} node;

void run (void) {
  i32 n = read_int();
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    node t = {1, read_int()};
    while (len > 0 && p[len - 1].val > t.val) {
      t.cnt += p[--len].cnt;
      sum -= (i64) p[len].cnt * p[len].val;
    }
    p[len++] = t;
    sum += (i64) t.cnt * t.val;
    ans += sum;
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	read_int, @function
read_int:
.LFB6:
	.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
	movl	$0, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L2:
	cmpl	$47, -12(%rbp)
	jle	.L3
	cmpl	$57, -12(%rbp)
	jg	.L3
	movq	$0, -8(%rbp)
	jmp	.L4
.L6:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L4:
	cmpl	$47, -12(%rbp)
	jle	.L5
	cmpl	$57, -12(%rbp)
	jle	.L6
.L5:
	cmpl	$45, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L9
.L7:
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	read_int, .-read_int
	.section	.rodata
.LC0:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.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
	call	read_int
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movq	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L11
.L15:
	movl	$1, -8(%rbp)
	call	read_int
	movl	%eax, -4(%rbp)
	jmp	.L12
.L14:
	subl	$1, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rdx, %rax
	subq	%rax, -32(%rbp)
.L12:
	cmpl	$0, -44(%rbp)
	jle	.L13
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L14
.L13:
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L15
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L16
	.p2align 4,,10
	.p2align 3
.L3:
	movq	stdin(%rip), %rdi
	movl	%eax, %ebp
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	ja	.L3
.L2:
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdin(%rip), %rdi
	leaq	(%rbx,%rbx,4), %rdx
	cltq
	leaq	(%rax,%rdx,2), %r12
	call	getc@PLT
	leaq	-48(%r12), %rbx
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L4
	movl	$48, %eax
	movl	$8, %esi
	subq	%r12, %rax
	cmpl	$45, %ebp
	cmove	%rax, %rbx
	movslq	%ebx, %rdi
	movl	%ebx, 12(%rsp)
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L17
	movl	$0, 8(%rsp)
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	movq	$0, (%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	movl	%eax, %r13d
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	ja	.L8
.L7:
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	stdin(%rip), %rdi
	leaq	(%r15,%r15,4), %rdx
	cltq
	leaq	(%rax,%rdx,2), %r14
	call	getc@PLT
	leaq	-48(%r14), %r15
	leal	-48(%rax), %esi
	cmpl	$9, %esi
	jbe	.L9
	movl	$48, %edi
	movslq	%r12d, %rax
	movl	$1, %esi
	subq	%r14, %rdi
	cmpl	$45, %r13d
	cmovne	%r15, %rdi
	testl	%r12d, %r12d
	jne	.L13
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	-8(%rbp,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %rbx
	testl	%eax, %eax
	je	.L29
.L13:
	movslq	-4(%rbp,%rax,8), %rcx
	movl	%eax, %r12d
	leaq	0(,%rax,8), %rdx
	cmpl	%ecx, %edi
	jl	.L14
	addq	%rbp, %rdx
	movslq	%esi, %rax
	addl	$1, %r12d
.L12:
	movd	%edi, %xmm1
	movslq	%edi, %rdi
	movd	%esi, %xmm0
	addl	$1, 8(%rsp)
	imulq	%rax, %rdi
	punpckldq	%xmm1, %xmm0
	movl	8(%rsp), %eax
	movq	%xmm0, (%rdx)
	addq	%rdi, %rbx
	addq	%rbx, (%rsp)
	cmpl	%eax, 12(%rsp)
	jne	.L15
.L6:
	movq	(%rsp), %rdx
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %edi
	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
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L29:
	.cfi_restore_state
	movslq	%esi, %rax
	movq	%rbp, %rdx
	movl	$1, %r12d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%r13d, %r13d
	jmp	.L7
.L28:
	movq	%rbp, %rdx
	movl	$1, %r12d
	movl	$1, %eax
	jmp	.L12
.L17:
	movq	$0, (%rsp)
	jmp	.L6
.L16:
	xorl	%ebp, %ebp
	jmp	.L2
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L16
	.p2align 4,,10
	.p2align 3
.L3:
	movq	stdin(%rip), %rdi
	movl	%eax, %ebp
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	ja	.L3
.L2:
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdin(%rip), %rdi
	leaq	(%rbx,%rbx,4), %rdx
	cltq
	leaq	(%rax,%rdx,2), %r12
	call	getc@PLT
	leaq	-48(%r12), %rbx
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L4
	movl	$48, %eax
	movl	$8, %esi
	subq	%r12, %rax
	cmpl	$45, %ebp
	cmove	%rax, %rbx
	movslq	%ebx, %rdi
	movl	%ebx, 12(%rsp)
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L17
	movl	$0, 8(%rsp)
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	movq	$0, (%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	movl	%eax, %r13d
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	ja	.L8
.L7:
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	stdin(%rip), %rdi
	leaq	(%r15,%r15,4), %rdx
	cltq
	leaq	(%rax,%rdx,2), %r14
	call	getc@PLT
	leaq	-48(%r14), %r15
	leal	-48(%rax), %esi
	cmpl	$9, %esi
	jbe	.L9
	movl	$48, %edi
	movslq	%r12d, %rax
	movl	$1, %esi
	subq	%r14, %rdi
	cmpl	$45, %r13d
	cmovne	%r15, %rdi
	testl	%r12d, %r12d
	jne	.L13
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	-8(%rbp,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %rbx
	testl	%eax, %eax
	je	.L29
.L13:
	movslq	-4(%rbp,%rax,8), %rcx
	movl	%eax, %r12d
	leaq	0(,%rax,8), %rdx
	cmpl	%ecx, %edi
	jl	.L14
	addq	%rbp, %rdx
	movslq	%esi, %rax
	addl	$1, %r12d
.L12:
	movd	%edi, %xmm1
	movslq	%edi, %rdi
	movd	%esi, %xmm0
	addl	$1, 8(%rsp)
	imulq	%rax, %rdi
	punpckldq	%xmm1, %xmm0
	movl	8(%rsp), %eax
	movq	%xmm0, (%rdx)
	addq	%rdi, %rbx
	addq	%rbx, (%rsp)
	cmpl	%eax, 12(%rsp)
	jne	.L15
.L6:
	movq	(%rsp), %rdx
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %edi
	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
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L29:
	.cfi_restore_state
	movslq	%esi, %rax
	movq	%rbp, %rdx
	movl	$1, %r12d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%r13d, %r13d
	jmp	.L7
.L28:
	movq	%rbp, %rdx
	movl	$1, %r12d
	movl	$1, %eax
	jmp	.L12
.L17:
	movq	$0, (%rsp)
	jmp	.L6
.L16:
	xorl	%ebp, %ebp
	jmp	.L2
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

typedef struct count_val {
  i32 cnt;
  i32 val;
} node;

void run (void) {
  i32 n = read_int();
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    node t = {1, read_int()};
    while (len > 0 && p[len - 1].val > t.val) {
      t.cnt += p[--len].cnt;
      sum -= (i64) p[len].cnt * p[len].val;
    }
    p[len++] = t;
    sum += (i64) t.cnt * t.val;
    ans += sum;
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}

3
3 1 2
 3
1 2 3
 4
2 3 1 4
 4
1 3 4 2
 8
5 3 8 1 2 6 7 4
 4
3 2 4 1
 8
4 5 8 1 2 6 7 3
 3
1 3 2
 3
2 3 1
 3
3 2 1

9
 10
 17
 20
 84
 19
 86
 10
 10
 10

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<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

typedef struct count_val {
  i32 cnt;
  i32 val;
} node;

void run (void) {
  i32 n = read_int();
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    node t = {1, read_int()};
    while (len > 0 && p[len - 1].val > t.val) {
      t.cnt += p[--len].cnt;
      sum -= (i64) p[len].cnt * p[len].val;
    }
    p[len++] = t;
    sum += (i64) t.cnt * t.val;
    ans += sum;
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	read_int, @function
read_int:
.LFB6:
	.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
	movl	$0, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L2:
	cmpl	$47, -12(%rbp)
	jle	.L3
	cmpl	$57, -12(%rbp)
	jg	.L3
	movq	$0, -8(%rbp)
	jmp	.L4
.L6:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L4:
	cmpl	$47, -12(%rbp)
	jle	.L5
	cmpl	$57, -12(%rbp)
	jle	.L6
.L5:
	cmpl	$45, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L9
.L7:
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	read_int, .-read_int
	.section	.rodata
.LC0:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.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
	call	read_int
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movq	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L11
.L15:
	movl	$1, -8(%rbp)
	call	read_int
	movl	%eax, -4(%rbp)
	jmp	.L12
.L14:
	subl	$1, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rdx, %rax
	subq	%rax, -32(%rbp)
.L12:
	cmpl	$0, -44(%rbp)
	jle	.L13
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L14
.L13:
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L15
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.type	read_int, @function
read_int:
.LFB6:
	.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
	movl	$0, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L2:
	cmpl	$47, -12(%rbp)
	jle	.L3
	cmpl	$57, -12(%rbp)
	jg	.L3
	movq	$0, -8(%rbp)
	jmp	.L4
.L6:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movl	%eax, -12(%rbp)
.L4:
	cmpl	$47, -12(%rbp)
	jle	.L5
	cmpl	$57, -12(%rbp)
	jle	.L6
.L5:
	cmpl	$45, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L9
.L7:
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	read_int, .-read_int
	.section	.rodata
.LC0:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.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
	call	read_int
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movq	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L11
.L15:
	movl	$1, -8(%rbp)
	call	read_int
	movl	%eax, -4(%rbp)
	jmp	.L12
.L14:
	subl	$1, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rdx, %rax
	subq	%rax, -32(%rbp)
.L12:
	cmpl	$0, -44(%rbp)
	jle	.L13
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L14
.L13:
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L15
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
