Given the following C code and 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;

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

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    node t = {1, a};
    while (len > 0 && p[len - 1].val > a) {
      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;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
.LC1:
	.string	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB39:
	.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
	xorl	%r13d, %r13d
	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
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdi
	movl	$8, %esi
	movq	%rdi, %rbx
	call	calloc@PLT
	testl	%ebx, %ebx
	jle	.L3
	movq	%rax, %r15
	leaq	20(%rsp), %rax
	movq	%rbp, %rdi
	movl	$1, %r12d
	movq	%rax, 8(%rsp)
	movq	%rax, %rsi
	xorl	%eax, %eax
	movl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %r13
	cmpl	$1, 16(%rsp)
	movl	$1, (%r15)
	movl	%r13d, 4(%r15)
	movq	%r13, %r14
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rdi
	movslq	%ebx, %rax
	movl	$1, %esi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	-8(%r15,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %r14
	movslq	%eax, %rdx
	testl	%eax, %eax
	je	.L5
.L4:
	movslq	-4(%r15,%rax,8), %rcx
	movslq	%eax, %rdx
	cmpl	%ecx, %edi
	jl	.L6
.L5:
	movd	%esi, %xmm0
	movslq	%esi, %rsi
	movd	%edi, %xmm1
	addl	$1, %r12d
	imulq	%rdi, %rsi
	punpckldq	%xmm1, %xmm0
	leal	1(%rdx), %ebx
	movq	%xmm0, (%r15,%rdx,8)
	addq	%rsi, %r14
	addq	%r14, %r13
	cmpl	%r12d, 16(%rsp)
	jg	.L7
.L3:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
.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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
.LC1:
	.string	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB39:
	.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
	xorl	%r13d, %r13d
	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
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdi
	movl	$8, %esi
	movq	%rdi, %rbx
	call	calloc@PLT
	testl	%ebx, %ebx
	jle	.L3
	movq	%rax, %r15
	leaq	20(%rsp), %rax
	movq	%rbp, %rdi
	movl	$1, %r12d
	movq	%rax, 8(%rsp)
	movq	%rax, %rsi
	xorl	%eax, %eax
	movl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %r13
	cmpl	$1, 16(%rsp)
	movl	$1, (%r15)
	movl	%r13d, 4(%r15)
	movq	%r13, %r14
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rdi
	movslq	%ebx, %rax
	movl	$1, %esi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	-8(%r15,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %r14
	movslq	%eax, %rdx
	testl	%eax, %eax
	je	.L5
.L4:
	movslq	-4(%r15,%rax,8), %rcx
	movslq	%eax, %rdx
	cmpl	%ecx, %edi
	jl	.L6
.L5:
	movd	%esi, %xmm0
	movslq	%esi, %rsi
	movd	%edi, %xmm1
	addl	$1, %r12d
	imulq	%rdi, %rsi
	punpckldq	%xmm1, %xmm0
	leal	1(%rdx), %ebx
	movq	%xmm0, (%r15,%rdx,8)
	addq	%rsi, %r14
	addq	%r14, %r13
	cmpl	%r12d, 16(%rsp)
	jg	.L7
.L3:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
.LC1:
	.string	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB39:
	.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
	xorl	%r13d, %r13d
	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
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdi
	movl	$8, %esi
	movq	%rdi, %rbx
	call	calloc@PLT
	testl	%ebx, %ebx
	jle	.L3
	movq	%rax, %r15
	leaq	20(%rsp), %rax
	movq	%rbp, %rdi
	movl	$1, %r12d
	movq	%rax, 8(%rsp)
	movq	%rax, %rsi
	xorl	%eax, %eax
	movl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %r13
	cmpl	$1, 16(%rsp)
	movl	$1, (%r15)
	movl	%r13d, 4(%r15)
	movq	%r13, %r14
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rdi
	movslq	%ebx, %rax
	movl	$1, %esi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	-8(%r15,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %r14
	movslq	%eax, %rdx
	testl	%eax, %eax
	je	.L5
.L4:
	movslq	-4(%r15,%rax,8), %rcx
	movslq	%eax, %rdx
	cmpl	%ecx, %edi
	jl	.L6
.L5:
	movd	%esi, %xmm0
	movslq	%esi, %rsi
	movd	%edi, %xmm1
	addl	$1, %r12d
	imulq	%rdi, %rsi
	punpckldq	%xmm1, %xmm0
	leal	1(%rdx), %ebx
	movq	%xmm0, (%r15,%rdx,8)
	addq	%rsi, %r14
	addq	%r14, %r13
	cmpl	%r12d, 16(%rsp)
	jg	.L7
.L3:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
.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:
```
```c
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

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

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    node t = {1, a};
    while (len > 0 && p[len - 1].val > a) {
      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;
}
```
Given the following C 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;

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

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    node t = {1, a};
    while (len > 0 && p[len - 1].val > a) {
      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;
}
```

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.
Optimized Assembly Code:

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 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;

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

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  node *p = (node *) calloc (n, sizeof (node));
  i64 sum = 0;
  i64 ans = 0;
  i32 len = 0;
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    node t = {1, a};
    while (len > 0 && p[len - 1].val > a) {
      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;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
.LC1:
	.string	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB39:
	.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
	xorl	%r13d, %r13d
	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
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdi
	movl	$8, %esi
	movq	%rdi, %rbx
	call	calloc@PLT
	testl	%ebx, %ebx
	jle	.L3
	movq	%rax, %r15
	leaq	20(%rsp), %rax
	movq	%rbp, %rdi
	movl	$1, %r12d
	movq	%rax, 8(%rsp)
	movq	%rax, %rsi
	xorl	%eax, %eax
	movl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %r13
	cmpl	$1, 16(%rsp)
	movl	$1, (%r15)
	movl	%r13d, 4(%r15)
	movq	%r13, %r14
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rdi
	movslq	%ebx, %rax
	movl	$1, %esi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	-8(%r15,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %r14
	movslq	%eax, %rdx
	testl	%eax, %eax
	je	.L5
.L4:
	movslq	-4(%r15,%rax,8), %rcx
	movslq	%eax, %rdx
	cmpl	%ecx, %edi
	jl	.L6
.L5:
	movd	%esi, %xmm0
	movslq	%esi, %rsi
	movd	%edi, %xmm1
	addl	$1, %r12d
	imulq	%rdi, %rsi
	punpckldq	%xmm1, %xmm0
	leal	1(%rdx), %ebx
	movq	%xmm0, (%r15,%rdx,8)
	addq	%rsi, %r14
	addq	%r14, %r13
	cmpl	%r12d, 16(%rsp)
	jg	.L7
.L3:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
.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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i"
.LC1:
	.string	"%li\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB39:
	.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
	xorl	%r13d, %r13d
	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
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdi
	movl	$8, %esi
	movq	%rdi, %rbx
	call	calloc@PLT
	testl	%ebx, %ebx
	jle	.L3
	movq	%rax, %r15
	leaq	20(%rsp), %rax
	movq	%rbp, %rdi
	movl	$1, %r12d
	movq	%rax, 8(%rsp)
	movq	%rax, %rsi
	xorl	%eax, %eax
	movl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %r13
	cmpl	$1, 16(%rsp)
	movl	$1, (%r15)
	movl	%r13d, 4(%r15)
	movq	%r13, %r14
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rdi
	movslq	%ebx, %rax
	movl	$1, %esi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	-8(%r15,%rax,8), %rdx
	subq	$1, %rax
	addl	%edx, %esi
	imulq	%rcx, %rdx
	subq	%rdx, %r14
	movslq	%eax, %rdx
	testl	%eax, %eax
	je	.L5
.L4:
	movslq	-4(%r15,%rax,8), %rcx
	movslq	%eax, %rdx
	cmpl	%ecx, %edi
	jl	.L6
.L5:
	movd	%esi, %xmm0
	movslq	%esi, %rsi
	movd	%edi, %xmm1
	addl	$1, %r12d
	imulq	%rdi, %rsi
	punpckldq	%xmm1, %xmm0
	leal	1(%rdx), %ebx
	movq	%xmm0, (%r15,%rdx,8)
	addq	%rsi, %r14
	addq	%r14, %r13
	cmpl	%r12d, 16(%rsp)
	jg	.L7
.L3:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
.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:
```