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>

int main() {
  int h1, h2, h3, c1, c2, c3, c3_s, n;
  scanf("%d", &n);
  scanf("%d %d", &h1, &h2);
  c1 = 0;
  c2 = abs(h1 - h2);
  for (int i = 0; i < n - 2; i++) {
    scanf("%d", &h3);
    c3 = c1 + abs(h1 - h3);
    c3_s = c2 + abs(h2 - h3);
    h1 = h2;
    h2 = h3;
    c1 = c2;
    if (c3 <= c3_s) {
      c2 = c3;
    } else {
      c2 = c3_s;
    }
  }
  printf("%d\n", c2);
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	12(%rsp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	$2, 20(%rsp)
	movl	%eax, %r12d
	jle	.L2
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %esi
	movl	8(%rsp), %edx
	movl	12(%rsp), %ecx
	subl	%esi, %edx
	movl	%esi, 12(%rsp)
	movl	%edx, %eax
	movl	%ecx, 8(%rsp)
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %ecx
	movl	%ecx, %edx
	addl	%r13d, %eax
	negl	%edx
	movl	%r12d, %r13d
	cmovs	%ecx, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	addl	$1, %r14d
	movl	%eax, %r12d
	movl	20(%rsp), %eax
	subl	$2, %eax
	cmpl	%r14d, %eax
	jg	.L3
.L2:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	12(%rsp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	$2, 20(%rsp)
	movl	%eax, %r12d
	jle	.L2
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %esi
	movl	8(%rsp), %edx
	movl	12(%rsp), %ecx
	subl	%esi, %edx
	movl	%esi, 12(%rsp)
	movl	%edx, %eax
	movl	%ecx, 8(%rsp)
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %ecx
	movl	%ecx, %edx
	addl	%r13d, %eax
	negl	%edx
	movl	%r12d, %r13d
	cmovs	%ecx, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	addl	$1, %r14d
	movl	%eax, %r12d
	movl	20(%rsp), %eax
	subl	$2, %eax
	cmpl	%r14d, %eax
	jg	.L3
.L2:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	12(%rsp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	$2, 20(%rsp)
	movl	%eax, %r12d
	jle	.L2
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %esi
	movl	8(%rsp), %edx
	movl	12(%rsp), %ecx
	subl	%esi, %edx
	movl	%esi, 12(%rsp)
	movl	%edx, %eax
	movl	%ecx, 8(%rsp)
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %ecx
	movl	%ecx, %edx
	addl	%r13d, %eax
	negl	%edx
	movl	%r12d, %r13d
	cmovs	%ecx, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	addl	$1, %r14d
	movl	%eax, %r12d
	movl	20(%rsp), %eax
	subl	$2, %eax
	cmpl	%r14d, %eax
	jg	.L3
.L2:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>

int main() {
  int h1, h2, h3, c1, c2, c3, c3_s, n;
  scanf("%d", &n);
  scanf("%d %d", &h1, &h2);
  c1 = 0;
  c2 = abs(h1 - h2);
  for (int i = 0; i < n - 2; i++) {
    scanf("%d", &h3);
    c3 = c1 + abs(h1 - h3);
    c3_s = c2 + abs(h2 - h3);
    h1 = h2;
    h2 = h3;
    c1 = c2;
    if (c3 <= c3_s) {
      c2 = c3;
    } else {
      c2 = c3_s;
    }
  }
  printf("%d\n", c2);
  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>

int main() {
  int h1, h2, h3, c1, c2, c3, c3_s, n;
  scanf("%d", &n);
  scanf("%d %d", &h1, &h2);
  c1 = 0;
  c2 = abs(h1 - h2);
  for (int i = 0; i < n - 2; i++) {
    scanf("%d", &h3);
    c3 = c1 + abs(h1 - h3);
    c3_s = c2 + abs(h2 - h3);
    h1 = h2;
    h2 = h3;
    c1 = c2;
    if (c3 <= c3_s) {
      c2 = c3;
    } else {
      c2 = c3_s;
    }
  }
  printf("%d\n", c2);
  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:

6
30 10 60 10 60 57
 4
10 14 40 20
 2
18 10
 4
5 14 40 20
 2
33 10
 6
30 12 60 10 60 9
 2
9 10
 6
30 12 60 17 60 9
 2
9 18
 6
30 12 60 33 60 9

33
 10
 8
 15
 23
 21
 1
 31
 9
 63

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>

int main() {
  int h1, h2, h3, c1, c2, c3, c3_s, n;
  scanf("%d", &n);
  scanf("%d %d", &h1, &h2);
  c1 = 0;
  c2 = abs(h1 - h2);
  for (int i = 0; i < n - 2; i++) {
    scanf("%d", &h3);
    c3 = c1 + abs(h1 - h3);
    c3_s = c2 + abs(h2 - h3);
    h1 = h2;
    h2 = h3;
    c1 = c2;
    if (c3 <= c3_s) {
      c2 = c3;
    } else {
      c2 = c3_s;
    }
  }
  printf("%d\n", c2);
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	12(%rsp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	$2, 20(%rsp)
	movl	%eax, %r12d
	jle	.L2
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %esi
	movl	8(%rsp), %edx
	movl	12(%rsp), %ecx
	subl	%esi, %edx
	movl	%esi, 12(%rsp)
	movl	%edx, %eax
	movl	%ecx, 8(%rsp)
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %ecx
	movl	%ecx, %edx
	addl	%r13d, %eax
	negl	%edx
	movl	%r12d, %r13d
	cmovs	%ecx, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	addl	$1, %r14d
	movl	%eax, %r12d
	movl	20(%rsp), %eax
	subl	$2, %eax
	cmpl	%r14d, %eax
	jg	.L3
.L2:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	subl	12(%rsp), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	$2, 20(%rsp)
	movl	%eax, %r12d
	jle	.L2
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %esi
	movl	8(%rsp), %edx
	movl	12(%rsp), %ecx
	subl	%esi, %edx
	movl	%esi, 12(%rsp)
	movl	%edx, %eax
	movl	%ecx, 8(%rsp)
	negl	%eax
	cmovs	%edx, %eax
	subl	%esi, %ecx
	movl	%ecx, %edx
	addl	%r13d, %eax
	negl	%edx
	movl	%r12d, %r13d
	cmovs	%ecx, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	addl	$1, %r14d
	movl	%eax, %r12d
	movl	20(%rsp), %eax
	subl	$2, %eax
	cmpl	%r14d, %eax
	jg	.L3
.L2:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```