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;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct index_val {
  i32 k;
  i64 v;
} node;

void run (void) {
  i32 n, m, k;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &m, &k);
  i32 *a = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i64 *dp = ALLOC (n, i64);
  for (i32 i = 0; i < n; ++i) {
    dp[i] = a[i];
  }
  node *d = ALLOC (n, node);
  for (i32 i = 2; i <= k; ++i) {
    i32 f = 0;
    i32 b = 0;
    d[0] = (node){i - 2, dp[i - 2]};
    for (i32 j = i - 1; j < n; ++j) {
      if (d[f].k == j - m - 1) ++f;
      i64 v = d[f].v + (i64) i * a[j];
      while (f <= b && d[b].v <= dp[j]) --b;
      d[++b] = (node) {j, dp[j]};
      dp[j] = v;
    }
  }
  i64 ans = 0;
  for (i32 i = k - 1; i < n; ++i) {
    if (ans < dp[i]) {
      ans = dp[i];
    }
  }
  printf("%" PRIi64 "\n", ans);
}

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

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%i%i%i"
.LC1:
	.string	"%i"
.LC2:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80(%rbp), %rcx
	leaq	-84(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L2
.L3:
	movl	-76(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -76(%rbp)
.L2:
	movl	-88(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L3
	movl	-88(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -72(%rbp)
	jmp	.L4
.L5:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	cltq
	movq	%rax, (%rdx)
	addl	$1, -72(%rbp)
.L4:
	movl	-88(%rbp), %eax
	cmpl	%eax, -72(%rbp)
	jl	.L5
	movl	-88(%rbp), %eax
	cltq
	movl	$16, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -24(%rbp)
	movl	$2, -68(%rbp)
	jmp	.L6
.L13:
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	-68(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-16(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	%ecx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-68(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	jmp	.L7
.L12:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-84(%rbp), %ecx
	movl	-56(%rbp), %edx
	subl	%ecx, %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	jne	.L8
	addl	$1, -64(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, -16(%rbp)
	jmp	.L9
.L11:
	subl	$1, -60(%rbp)
.L9:
	movl	-64(%rbp), %eax
	cmpl	-60(%rbp), %eax
	jg	.L10
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
.L10:
	addl	$1, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rdx
	movl	-56(%rbp), %ecx
	movl	%ecx, (%rax)
	movq	%rdx, 8(%rax)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -56(%rbp)
.L7:
	movl	-88(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	addl	$1, -68(%rbp)
.L6:
	movl	-80(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jle	.L13
	movq	$0, -48(%rbp)
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	jmp	.L14
.L16:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	cmpq	%rax, -48(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
.L15:
	addl	$1, -52(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L16
	movq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	run, .-run
	.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
	call	run
	movl	$0, %eax
	popq	%rbp
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i%i%i"
.LC1:
	.string	"%i"
.LC2:
	.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
	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	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rcx
	leaq	48(%rsp), %rdx
	leaq	44(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %r13
	movl	$4, %esi
	movq	%r13, %rdi
	call	calloc@PLT
	movq	%rax, %r15
	testl	%r13d, %r13d
	jle	.L2
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r12d
	addq	$4, %rbp
	cmpl	%ebx, %r12d
	jg	.L3
	movslq	%r12d, %r13
	movl	$8, %esi
	movq	%r13, %rdi
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%r12d, %r12d
	jle	.L4
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r12d, %edx
	xorl	%eax, %eax
	pxor	%xmm3, %xmm3
	shrl	$2, %edx
	salq	$4, %rdx
.L6:
	movdqu	(%r15,%rax), %xmm0
	movdqa	%xmm3, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	movups	%xmm2, 0(%rbp,%rax,2)
	movups	%xmm0, 16(%rbp,%rax,2)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L6
	movl	%r12d, %eax
	andl	$-4, %eax
	testb	$3, %r12b
	je	.L4
.L5:
	movslq	%eax, %rdx
	movslq	(%r15,%rdx,4), %rdi
	leaq	0(,%rdx,4), %rsi
	leaq	0(,%rdx,8), %rcx
	movq	%rdi, 0(%rbp,%rdx,8)
	leal	1(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L4
	movslq	4(%r15,%rsi), %rdx
	addl	$2, %eax
	movq	%rdx, 8(%rbp,%rcx)
	cmpl	%eax, %r12d
	jle	.L4
	movslq	8(%r15,%rsi), %rax
	movq	%rax, 16(%rbp,%rcx)
.L4:
	movq	%r13, %rdi
	movl	$16, %esi
	call	calloc@PLT
	movq	%rax, %r13
	movl	52(%rsp), %eax
	movl	%eax, 28(%rsp)
	cmpl	$1, %eax
	jle	.L20
	movl	48(%rsp), %eax
	movl	%r12d, 12(%rsp)
	movl	$1, %r9d
	movl	%eax, 24(%rsp)
	movslq	28(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-8(%rbp,%r9,8), %rax
	leal	-1(%r9), %edx
	leaq	1(%r9), %r14
	xorl	%ecx, %ecx
	movl	%edx, 0(%r13)
	xorl	%ebx, %ebx
	movq	%rax, 8(%r13)
	cmpl	%r9d, 12(%rsp)
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%r9d, %eax
	subl	24(%rsp), %eax
	movl	%r9d, %r12d
	subl	$1, %eax
	cmpl	%edx, %eax
	jne	.L34
	addl	$1, %ebx
.L34:
	movslq	%ebx, %r10
	movslq	(%r15,%r9,4), %r11
	movq	0(%rbp,%r9,8), %rdi
	salq	$4, %r10
	addq	%r13, %r10
	imulq	%r14, %r11
	addq	8(%r10), %r11
	cmpl	%ecx, %ebx
	jg	.L35
	movslq	%ecx, %rax
	leal	-1(%rbx), %r8d
	salq	$4, %rax
	addq	%r13, %rax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	leal	-1(%rcx), %edx
	subq	$16, %rax
	cmpl	%r8d, %edx
	je	.L16
	movl	%edx, %ecx
.L15:
	movq	%rax, %rsi
	cmpq	%rdi, 8(%rax)
	jle	.L17
.L35:
	addl	$1, %ecx
	movslq	%ecx, %rsi
	salq	$4, %rsi
	addq	%r13, %rsi
.L16:
	movq	%r11, 0(%rbp,%r9,8)
	addq	$1, %r9
	movl	%r12d, (%rsi)
	movq	%rdi, 8(%rsi)
	cmpl	%r9d, 12(%rsp)
	jle	.L11
	movl	(%r10), %edx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r14, %r9
	cmpq	%r14, 16(%rsp)
	jne	.L19
	movl	12(%rsp), %r12d
.L20:
	movl	28(%rsp), %eax
	xorl	%edx, %edx
	subl	$1, %eax
	cmpl	%eax, %r12d
	jle	.L10
	movslq	28(%rsp), %rdx
	cltq
	leaq	0(%rbp,%rax,8), %rax
	subl	%edx, %r12d
	addq	%r12, %rdx
	leaq	0(%rbp,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rax), %rcx
	cmpq	%rcx, %rdx
	cmovl	%rcx, %rdx
	addq	$8, %rax
	cmpq	%rax, %rsi
	jne	.L21
.L10:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$72, %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
.L2:
	.cfi_restore_state
	movl	$8, %esi
	movq	%r13, %rdi
	movq	%r13, %r12
	call	calloc@PLT
	movq	%rax, %rbp
	jmp	.L4
.L23:
	xorl	%eax, %eax
	jmp	.L5
.L37:
	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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i%i%i"
.LC1:
	.string	"%i"
.LC2:
	.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
	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	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rcx
	leaq	48(%rsp), %rdx
	leaq	44(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %r13
	movl	$4, %esi
	movq	%r13, %rdi
	call	calloc@PLT
	movq	%rax, %r15
	testl	%r13d, %r13d
	jle	.L2
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r12d
	addq	$4, %rbp
	cmpl	%ebx, %r12d
	jg	.L3
	movslq	%r12d, %r13
	movl	$8, %esi
	movq	%r13, %rdi
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%r12d, %r12d
	jle	.L4
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r12d, %edx
	xorl	%eax, %eax
	pxor	%xmm3, %xmm3
	shrl	$2, %edx
	salq	$4, %rdx
.L6:
	movdqu	(%r15,%rax), %xmm0
	movdqa	%xmm3, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	movups	%xmm2, 0(%rbp,%rax,2)
	movups	%xmm0, 16(%rbp,%rax,2)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L6
	movl	%r12d, %eax
	andl	$-4, %eax
	testb	$3, %r12b
	je	.L4
.L5:
	movslq	%eax, %rdx
	movslq	(%r15,%rdx,4), %rdi
	leaq	0(,%rdx,4), %rsi
	leaq	0(,%rdx,8), %rcx
	movq	%rdi, 0(%rbp,%rdx,8)
	leal	1(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L4
	movslq	4(%r15,%rsi), %rdx
	addl	$2, %eax
	movq	%rdx, 8(%rbp,%rcx)
	cmpl	%eax, %r12d
	jle	.L4
	movslq	8(%r15,%rsi), %rax
	movq	%rax, 16(%rbp,%rcx)
.L4:
	movq	%r13, %rdi
	movl	$16, %esi
	call	calloc@PLT
	movq	%rax, %r13
	movl	52(%rsp), %eax
	movl	%eax, 28(%rsp)
	cmpl	$1, %eax
	jle	.L20
	movl	48(%rsp), %eax
	movl	%r12d, 12(%rsp)
	movl	$1, %r9d
	movl	%eax, 24(%rsp)
	movslq	28(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-8(%rbp,%r9,8), %rax
	leal	-1(%r9), %edx
	leaq	1(%r9), %r14
	xorl	%ecx, %ecx
	movl	%edx, 0(%r13)
	xorl	%ebx, %ebx
	movq	%rax, 8(%r13)
	cmpl	%r9d, 12(%rsp)
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%r9d, %eax
	subl	24(%rsp), %eax
	movl	%r9d, %r12d
	subl	$1, %eax
	cmpl	%edx, %eax
	jne	.L34
	addl	$1, %ebx
.L34:
	movslq	%ebx, %r10
	movslq	(%r15,%r9,4), %r11
	movq	0(%rbp,%r9,8), %rdi
	salq	$4, %r10
	addq	%r13, %r10
	imulq	%r14, %r11
	addq	8(%r10), %r11
	cmpl	%ecx, %ebx
	jg	.L35
	movslq	%ecx, %rax
	leal	-1(%rbx), %r8d
	salq	$4, %rax
	addq	%r13, %rax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	leal	-1(%rcx), %edx
	subq	$16, %rax
	cmpl	%r8d, %edx
	je	.L16
	movl	%edx, %ecx
.L15:
	movq	%rax, %rsi
	cmpq	%rdi, 8(%rax)
	jle	.L17
.L35:
	addl	$1, %ecx
	movslq	%ecx, %rsi
	salq	$4, %rsi
	addq	%r13, %rsi
.L16:
	movq	%r11, 0(%rbp,%r9,8)
	addq	$1, %r9
	movl	%r12d, (%rsi)
	movq	%rdi, 8(%rsi)
	cmpl	%r9d, 12(%rsp)
	jle	.L11
	movl	(%r10), %edx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r14, %r9
	cmpq	%r14, 16(%rsp)
	jne	.L19
	movl	12(%rsp), %r12d
.L20:
	movl	28(%rsp), %eax
	xorl	%edx, %edx
	subl	$1, %eax
	cmpl	%eax, %r12d
	jle	.L10
	movslq	28(%rsp), %rdx
	cltq
	leaq	0(%rbp,%rax,8), %rax
	subl	%edx, %r12d
	addq	%r12, %rdx
	leaq	0(%rbp,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rax), %rcx
	cmpq	%rcx, %rdx
	cmovl	%rcx, %rdx
	addq	$8, %rax
	cmpq	%rax, %rsi
	jne	.L21
.L10:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$72, %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
.L2:
	.cfi_restore_state
	movl	$8, %esi
	movq	%r13, %rdi
	movq	%r13, %r12
	call	calloc@PLT
	movq	%rax, %rbp
	jmp	.L4
.L23:
	xorl	%eax, %eax
	jmp	.L5
.L37:
	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:

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

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct index_val {
  i32 k;
  i64 v;
} node;

void run (void) {
  i32 n, m, k;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &m, &k);
  i32 *a = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i64 *dp = ALLOC (n, i64);
  for (i32 i = 0; i < n; ++i) {
    dp[i] = a[i];
  }
  node *d = ALLOC (n, node);
  for (i32 i = 2; i <= k; ++i) {
    i32 f = 0;
    i32 b = 0;
    d[0] = (node){i - 2, dp[i - 2]};
    for (i32 j = i - 1; j < n; ++j) {
      if (d[f].k == j - m - 1) ++f;
      i64 v = d[f].v + (i64) i * a[j];
      while (f <= b && d[b].v <= dp[j]) --b;
      d[++b] = (node) {j, dp[j]};
      dp[j] = v;
    }
  }
  i64 ans = 0;
  for (i32 i = k - 1; i < n; ++i) {
    if (ans < dp[i]) {
      ans = dp[i];
    }
  }
  printf("%" PRIi64 "\n", ans);
}

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

5 2 3
10 2 11 10 2
 10 3 5
0 7 2 6 9 4 8 5 1 1000000000
 5 5 2
1 2 10 5 9
 10 3 5
0 7 2 6 9 4 2 5 1 1000000000
 5 5 2
1 2 5 5 9
 5 2 2
10 2 11 10 1
 5 2 2
5 2 11 10 1
 5 5 2
2 2 5 8 9
 5 2 2
5 2 11 6 1
 5 5 2
2 2 5 8 6

62
 5000000078
 28
 5000000066
 23
 32
 31
 26
 27
 21

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;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct index_val {
  i32 k;
  i64 v;
} node;

void run (void) {
  i32 n, m, k;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &m, &k);
  i32 *a = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i64 *dp = ALLOC (n, i64);
  for (i32 i = 0; i < n; ++i) {
    dp[i] = a[i];
  }
  node *d = ALLOC (n, node);
  for (i32 i = 2; i <= k; ++i) {
    i32 f = 0;
    i32 b = 0;
    d[0] = (node){i - 2, dp[i - 2]};
    for (i32 j = i - 1; j < n; ++j) {
      if (d[f].k == j - m - 1) ++f;
      i64 v = d[f].v + (i64) i * a[j];
      while (f <= b && d[b].v <= dp[j]) --b;
      d[++b] = (node) {j, dp[j]};
      dp[j] = v;
    }
  }
  i64 ans = 0;
  for (i32 i = k - 1; i < n; ++i) {
    if (ans < dp[i]) {
      ans = dp[i];
    }
  }
  printf("%" PRIi64 "\n", ans);
}

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

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%i%i%i"
.LC1:
	.string	"%i"
.LC2:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80(%rbp), %rcx
	leaq	-84(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L2
.L3:
	movl	-76(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -76(%rbp)
.L2:
	movl	-88(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L3
	movl	-88(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -72(%rbp)
	jmp	.L4
.L5:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	cltq
	movq	%rax, (%rdx)
	addl	$1, -72(%rbp)
.L4:
	movl	-88(%rbp), %eax
	cmpl	%eax, -72(%rbp)
	jl	.L5
	movl	-88(%rbp), %eax
	cltq
	movl	$16, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -24(%rbp)
	movl	$2, -68(%rbp)
	jmp	.L6
.L13:
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	-68(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-16(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	%ecx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-68(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	jmp	.L7
.L12:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-84(%rbp), %ecx
	movl	-56(%rbp), %edx
	subl	%ecx, %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	jne	.L8
	addl	$1, -64(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, -16(%rbp)
	jmp	.L9
.L11:
	subl	$1, -60(%rbp)
.L9:
	movl	-64(%rbp), %eax
	cmpl	-60(%rbp), %eax
	jg	.L10
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
.L10:
	addl	$1, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rdx
	movl	-56(%rbp), %ecx
	movl	%ecx, (%rax)
	movq	%rdx, 8(%rax)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -56(%rbp)
.L7:
	movl	-88(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	addl	$1, -68(%rbp)
.L6:
	movl	-80(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jle	.L13
	movq	$0, -48(%rbp)
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	jmp	.L14
.L16:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	cmpq	%rax, -48(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
.L15:
	addl	$1, -52(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L16
	movq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	run, .-run
	.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
	call	run
	movl	$0, %eax
	popq	%rbp
	.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
	.section	.rodata
.LC0:
	.string	"%i%i%i"
.LC1:
	.string	"%i"
.LC2:
	.string	"%li\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80(%rbp), %rcx
	leaq	-84(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L2
.L3:
	movl	-76(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -76(%rbp)
.L2:
	movl	-88(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L3
	movl	-88(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -72(%rbp)
	jmp	.L4
.L5:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	cltq
	movq	%rax, (%rdx)
	addl	$1, -72(%rbp)
.L4:
	movl	-88(%rbp), %eax
	cmpl	%eax, -72(%rbp)
	jl	.L5
	movl	-88(%rbp), %eax
	cltq
	movl	$16, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -24(%rbp)
	movl	$2, -68(%rbp)
	jmp	.L6
.L13:
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	-68(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-16(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	%ecx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-68(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	jmp	.L7
.L12:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-84(%rbp), %ecx
	movl	-56(%rbp), %edx
	subl	%ecx, %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	jne	.L8
	addl	$1, -64(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, -16(%rbp)
	jmp	.L9
.L11:
	subl	$1, -60(%rbp)
.L9:
	movl	-64(%rbp), %eax
	cmpl	-60(%rbp), %eax
	jg	.L10
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L11
.L10:
	addl	$1, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rdx
	movl	-56(%rbp), %ecx
	movl	%ecx, (%rax)
	movq	%rdx, 8(%rax)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -56(%rbp)
.L7:
	movl	-88(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	addl	$1, -68(%rbp)
.L6:
	movl	-80(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jle	.L13
	movq	$0, -48(%rbp)
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	jmp	.L14
.L16:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	cmpq	%rax, -48(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
.L15:
	addl	$1, -52(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L16
	movq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	run, .-run
	.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
	call	run
	movl	$0, %eax
	popq	%rbp
	.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:
