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<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)
#define INF 10000000000

long min(long a, long b){
    if(a>b) return b;
    else return a;
}

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    long h[n];
    F(i,0,n){
        scanf("%ld",h+i);
    }
    long dp[n];
    F(j,0,n) dp[j]=INF;
    dp[0]=0;
    F(i,0,n){
        F(j,1,k+1){
            if(i+j<n){
                long tmp=min(dp[i]+abs(h[i]-h[i+j]),dp[i+j]);
                dp[i+j]=tmp;
            }
        }
    }
    printf("%ld\n",dp[n-1]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	min
	.type	min, @function
min:
.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
	cmpq	-16(%rbp), %rax
	jle	.L2
	movq	-16(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
	.text
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L8
.L9:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L9
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L13
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movabsq	$10000000000, %rsi
	movq	%rsi, (%rax,%rdx,8)
	addl	$1, -108(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movq	-72(%rbp), %rax
	movq	$0, (%rax)
	movl	$0, -104(%rbp)
	jmp	.L15
.L19:
	movl	$1, -100(%rbp)
	jmp	.L16
.L18:
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movl	-120(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rsi
	movq	-88(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %edi
	movl	-104(%rbp), %ecx
	movl	-100(%rbp), %eax
	addl	%eax, %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %ecx
	movl	%edi, %eax
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cltq
	addq	%rsi, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -64(%rbp)
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L17:
	addl	$1, -100(%rbp)
.L16:
	movl	-116(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L18
	addl	$1, -104(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L19
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB51:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE51:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r8
	leaq	15(,%rax,8), %rax
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
	cmpq	%rcx, %rsp
	je	.L5
.L40:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L40
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L6:
	movq	%rsp, %rbx
	testl	%r8d, %r8d
	jle	.L7
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %r8d
	addq	$8, %r13
	cmpl	%r12d, %r8d
	jg	.L8
	movslq	%r8d, %rax
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L9:
	cmpq	%rcx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L42
.L11:
	leaq	7(%rsp), %rsi
	movq	%rsi, %rcx
	andq	$-8, %rsi
	shrq	$3, %rcx
	movq	%rsi, %r11
	testl	%r8d, %r8d
	jle	.L12
	cmpl	$1, %r8d
	je	.L25
	movl	%r8d, %edx
	movdqa	.LC2(%rip), %xmm0
	movq	%rsi, %rax
	shrl	%edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L14
	movl	%r8d, %eax
	andl	$-2, %eax
	testb	$1, %r8b
	je	.L15
.L13:
	movabsq	$10000000000, %rdi
	cltq
	movq	%rdi, (%rsi,%rax,8)
.L15:
	movq	$0, 0(,%rcx,8)
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.L20
	leal	1(%rax), %r9d
	leal	1(%r8), %r10d
	movl	$1, %edi
	salq	$3, %r9
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %ecx
	leaq	0(,%rdi,8), %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%ecx, %r8d
	jle	.L16
	movq	-8(%rbx,%rdi,8), %r12
	subl	(%rbx,%rdx), %r12d
	movl	%r12d, %eax
	negl	%eax
	cmovs	%r12d, %eax
	movq	(%rsi,%rdx), %r12
	cltq
	addq	-8(%rsi,%rdi,8), %rax
	cmpq	%r12, %rax
	cmovg	%r12, %rax
	movq	%rax, (%rsi,%rdx)
.L16:
	addq	$8, %rdx
	addl	$1, %ecx
	cmpq	%r9, %rdx
	jne	.L17
	addq	$1, %rdi
	addq	$8, %r9
	cmpq	%r10, %rdi
	jne	.L19
.L20:
	leal	-1(%r8), %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	cltq
	movq	(%r11,%rax,8), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L43
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L41:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L42:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L11
.L7:
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L21:
	cmpq	%rcx, %rsp
	je	.L22
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
.L22:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L23
	orq	$0, -8(%rsp,%rax)
.L23:
	movq	%rsp, %r11
.L12:
	movq	$0, (%r11)
	jmp	.L20
.L25:
	xorl	%eax, %eax
	jmp	.L13
.L43:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	10000000000
	.quad	10000000000
	.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	min
	.type	min, @function
min:
.LFB51:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE51:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r8
	leaq	15(,%rax,8), %rax
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
	cmpq	%rcx, %rsp
	je	.L5
.L40:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L40
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L6:
	movq	%rsp, %rbx
	testl	%r8d, %r8d
	jle	.L7
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %r8d
	addq	$8, %r13
	cmpl	%r12d, %r8d
	jg	.L8
	movslq	%r8d, %rax
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L9:
	cmpq	%rcx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L42
.L11:
	leaq	7(%rsp), %rsi
	movq	%rsi, %rcx
	andq	$-8, %rsi
	shrq	$3, %rcx
	movq	%rsi, %r11
	testl	%r8d, %r8d
	jle	.L12
	cmpl	$1, %r8d
	je	.L25
	movl	%r8d, %edx
	movdqa	.LC2(%rip), %xmm0
	movq	%rsi, %rax
	shrl	%edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L14
	movl	%r8d, %eax
	andl	$-2, %eax
	testb	$1, %r8b
	je	.L15
.L13:
	movabsq	$10000000000, %rdi
	cltq
	movq	%rdi, (%rsi,%rax,8)
.L15:
	movq	$0, 0(,%rcx,8)
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.L20
	leal	1(%rax), %r9d
	leal	1(%r8), %r10d
	movl	$1, %edi
	salq	$3, %r9
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %ecx
	leaq	0(,%rdi,8), %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%ecx, %r8d
	jle	.L16
	movq	-8(%rbx,%rdi,8), %r12
	subl	(%rbx,%rdx), %r12d
	movl	%r12d, %eax
	negl	%eax
	cmovs	%r12d, %eax
	movq	(%rsi,%rdx), %r12
	cltq
	addq	-8(%rsi,%rdi,8), %rax
	cmpq	%r12, %rax
	cmovg	%r12, %rax
	movq	%rax, (%rsi,%rdx)
.L16:
	addq	$8, %rdx
	addl	$1, %ecx
	cmpq	%r9, %rdx
	jne	.L17
	addq	$1, %rdi
	addq	$8, %r9
	cmpq	%r10, %rdi
	jne	.L19
.L20:
	leal	-1(%r8), %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	cltq
	movq	(%r11,%rax,8), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L43
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L41:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L42:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L11
.L7:
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L21:
	cmpq	%rcx, %rsp
	je	.L22
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
.L22:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L23
	orq	$0, -8(%rsp,%rax)
.L23:
	movq	%rsp, %r11
.L12:
	movq	$0, (%r11)
	jmp	.L20
.L25:
	xorl	%eax, %eax
	jmp	.L13
.L43:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	10000000000
	.quad	10000000000
	.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<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)
#define INF 10000000000

long min(long a, long b){
    if(a>b) return b;
    else return a;
}

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    long h[n];
    F(i,0,n){
        scanf("%ld",h+i);
    }
    long dp[n];
    F(j,0,n) dp[j]=INF;
    dp[0]=0;
    F(i,0,n){
        F(j,1,k+1){
            if(i+j<n){
                long tmp=min(dp[i]+abs(h[i]-h[i+j]),dp[i+j]);
                dp[i+j]=tmp;
            }
        }
    }
    printf("%ld\n",dp[n-1]);
    return 0;
}
2 100
10 9
 5 3
10 30 40 50 24
 3 4
40 10 20 70 80 10 20 70 80 60
 3 1
0 20 10
 3 4
40 10 17 70 80 10 20 70 80 60
 2 100
7 10
 10 4
40 9 20 70 80 10 20 70 80 60
 3 1
9 20 10
 2 100
17 9
 3 4
40 10 34 70 80 10 20 70 80 60

1
 26
 20
 30
 23
 3
 40
 21
 8
 6

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<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)
#define INF 10000000000

long min(long a, long b){
    if(a>b) return b;
    else return a;
}

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    long h[n];
    F(i,0,n){
        scanf("%ld",h+i);
    }
    long dp[n];
    F(j,0,n) dp[j]=INF;
    dp[0]=0;
    F(i,0,n){
        F(j,1,k+1){
            if(i+j<n){
                long tmp=min(dp[i]+abs(h[i]-h[i+j]),dp[i+j]);
                dp[i+j]=tmp;
            }
        }
    }
    printf("%ld\n",dp[n-1]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	min
	.type	min, @function
min:
.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
	cmpq	-16(%rbp), %rax
	jle	.L2
	movq	-16(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
	.text
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L8
.L9:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L9
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L13
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movabsq	$10000000000, %rsi
	movq	%rsi, (%rax,%rdx,8)
	addl	$1, -108(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movq	-72(%rbp), %rax
	movq	$0, (%rax)
	movl	$0, -104(%rbp)
	jmp	.L15
.L19:
	movl	$1, -100(%rbp)
	jmp	.L16
.L18:
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movl	-120(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rsi
	movq	-88(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %edi
	movl	-104(%rbp), %ecx
	movl	-100(%rbp), %eax
	addl	%eax, %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %ecx
	movl	%edi, %eax
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cltq
	addq	%rsi, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -64(%rbp)
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L17:
	addl	$1, -100(%rbp)
.L16:
	movl	-116(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L18
	addl	$1, -104(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L19
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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
	.globl	min
	.type	min, @function
min:
.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
	cmpq	-16(%rbp), %rax
	jle	.L2
	movq	-16(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
	.text
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L8
.L9:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L9
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L13
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movabsq	$10000000000, %rsi
	movq	%rsi, (%rax,%rdx,8)
	addl	$1, -108(%rbp)
.L13:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movq	-72(%rbp), %rax
	movq	$0, (%rax)
	movl	$0, -104(%rbp)
	jmp	.L15
.L19:
	movl	$1, -100(%rbp)
	jmp	.L16
.L18:
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movl	-120(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L17
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-72(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rsi
	movq	-88(%rbp), %rax
	movl	-104(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %edi
	movl	-104(%rbp), %ecx
	movl	-100(%rbp), %eax
	addl	%eax, %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %ecx
	movl	%edi, %eax
	subl	%ecx, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cltq
	addq	%rsi, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -64(%rbp)
	movl	-104(%rbp), %edx
	movl	-100(%rbp), %eax
	addl	%eax, %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L17:
	addl	$1, -100(%rbp)
.L16:
	movl	-116(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L18
	addl	$1, -104(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L19
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-72(%rbp), %rax
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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:
