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>

int main(void)
{
	int n;
	int i = 0;
	int *table1, *value;
	int newvalue1, newvalue2;
	
	scanf("%d",&n);
	table1 = (int*)malloc(sizeof(int)*n);
	value = (int*)malloc(sizeof(int)*n);

	while(i < n)
	{
		scanf("%d",&table1[i]);
		i++;
	}
	
	value[0] = 0;
	value[1] = abs(table1[1]-table1[0]);
	
	i = 2;
	while(i != n){
		newvalue1 = value[i-2] + abs(table1[i-2] - table1[i]);
		newvalue2 = value[i-1] + abs(table1[i-1] - table1[i]);
		if(newvalue1 > newvalue2)
		{
			value[i] = newvalue2;
		}else
		{
			value[i] = newvalue1;
		}
		i++;
	}

	printf("%d",value[n-1]);

	free(table1);
	free(value);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -36(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L3
	movq	-16(%rbp), %rax
	movl	$0, (%rax)
	movq	-24(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movq	-16(%rbp), %rdx
	addq	$4, %rdx
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%eax, (%rdx)
	movl	$2, -36(%rbp)
	jmp	.L4
.L7:
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L5
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L6
.L5:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L7
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	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	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r14
	leaq	0(,%r14,4), %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r14d, %r14d
	jle	.L2
	movq	%r12, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$4, %r15
	cmpl	%r14d, %ebx
	jg	.L3
	movl	4(%r12), %edi
	movl	(%r12), %esi
	movl	$0, 0(%rbp)
	movslq	%ebx, %r14
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovs	%eax, %ecx
	movl	%ecx, 4(%rbp)
	cmpl	$2, %ebx
	je	.L18
.L4:
	cmpl	$4, %ebx
	jle	.L10
	leal	-5(%rbx), %eax
	movl	$4, %edx
	xorl	%r8d, %r8d
	shrl	%eax
	leal	3(%rax), %r9d
	addq	%r9, %r9
.L6:
	movl	%esi, %r11d
	movl	-8(%r12,%rdx,4), %esi
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %r10d
	negl	%r10d
	cmovs	%eax, %r10d
	subl	%esi, %r11d
	movl	%r11d, %eax
	addl	%ecx, %r10d
	negl	%eax
	cmovs	%r11d, %eax
	movl	%edi, %r11d
	movl	-4(%r12,%rdx,4), %edi
	addl	%r8d, %eax
	cmpl	%eax, %r10d
	cmovle	%r10d, %eax
	movl	%eax, -8(%rbp,%rdx,4)
	movl	%eax, %r8d
	movl	%esi, %eax
	subl	%edi, %eax
	movl	%eax, %r10d
	negl	%r10d
	cmovs	%eax, %r10d
	subl	%edi, %r11d
	movl	%r11d, %eax
	addl	%r8d, %r10d
	negl	%eax
	cmovs	%r11d, %eax
	addl	%ecx, %eax
	cmpl	%eax, %r10d
	cmovle	%r10d, %eax
	movl	%eax, -4(%rbp,%rdx,4)
	movl	%eax, %ecx
	movslq	%edx, %rax
	addq	$2, %rdx
	cmpq	%r9, %rdx
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%r12,%rax,4), %ecx
	subl	(%r12,%rax,4), %ecx
	movl	%ecx, %edx
	movl	-8(%r12,%rax,4), %esi
	negl	%edx
	cmovs	%ecx, %edx
	subl	(%r12,%rax,4), %esi
	addl	-4(%rbp,%rax,4), %edx
	movl	%esi, %ecx
	negl	%ecx
	cmovs	%esi, %ecx
	addl	-8(%rbp,%rax,4), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	movl	%edx, 0(%rbp,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %ebx
	jne	.L7
.L8:
	movl	-4(%rbp,%r14,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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	4(%r12), %edi
	movl	(%r12), %esi
	movl	$0, (%rax)
	movq	%r14, %rbx
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovs	%eax, %ecx
	movl	%ecx, 4(%rbp)
	jmp	.L4
.L18:
	movl	$2, %r14d
	jmp	.L8
.L10:
	movl	$2, %eax
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	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	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r14
	leaq	0(,%r14,4), %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r14d, %r14d
	jle	.L2
	movq	%r12, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ebx
	addq	$4, %r15
	cmpl	%r14d, %ebx
	jg	.L3
	movl	4(%r12), %edi
	movl	(%r12), %esi
	movl	$0, 0(%rbp)
	movslq	%ebx, %r14
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovs	%eax, %ecx
	movl	%ecx, 4(%rbp)
	cmpl	$2, %ebx
	je	.L18
.L4:
	cmpl	$4, %ebx
	jle	.L10
	leal	-5(%rbx), %eax
	movl	$4, %edx
	xorl	%r8d, %r8d
	shrl	%eax
	leal	3(%rax), %r9d
	addq	%r9, %r9
.L6:
	movl	%esi, %r11d
	movl	-8(%r12,%rdx,4), %esi
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %r10d
	negl	%r10d
	cmovs	%eax, %r10d
	subl	%esi, %r11d
	movl	%r11d, %eax
	addl	%ecx, %r10d
	negl	%eax
	cmovs	%r11d, %eax
	movl	%edi, %r11d
	movl	-4(%r12,%rdx,4), %edi
	addl	%r8d, %eax
	cmpl	%eax, %r10d
	cmovle	%r10d, %eax
	movl	%eax, -8(%rbp,%rdx,4)
	movl	%eax, %r8d
	movl	%esi, %eax
	subl	%edi, %eax
	movl	%eax, %r10d
	negl	%r10d
	cmovs	%eax, %r10d
	subl	%edi, %r11d
	movl	%r11d, %eax
	addl	%r8d, %r10d
	negl	%eax
	cmovs	%r11d, %eax
	addl	%ecx, %eax
	cmpl	%eax, %r10d
	cmovle	%r10d, %eax
	movl	%eax, -4(%rbp,%rdx,4)
	movl	%eax, %ecx
	movslq	%edx, %rax
	addq	$2, %rdx
	cmpq	%r9, %rdx
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%r12,%rax,4), %ecx
	subl	(%r12,%rax,4), %ecx
	movl	%ecx, %edx
	movl	-8(%r12,%rax,4), %esi
	negl	%edx
	cmovs	%ecx, %edx
	subl	(%r12,%rax,4), %esi
	addl	-4(%rbp,%rax,4), %edx
	movl	%esi, %ecx
	negl	%ecx
	cmovs	%esi, %ecx
	addl	-8(%rbp,%rax,4), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	movl	%edx, 0(%rbp,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %ebx
	jne	.L7
.L8:
	movl	-4(%rbp,%r14,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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	4(%r12), %edi
	movl	(%r12), %esi
	movl	$0, (%rax)
	movq	%r14, %rbx
	movl	%edi, %eax
	subl	%esi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovs	%eax, %ecx
	movl	%ecx, 4(%rbp)
	jmp	.L4
.L18:
	movl	$2, %r14d
	jmp	.L8
.L10:
	movl	$2, %eax
	jmp	.L7
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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 <math.h>
#include <string.h>

int main(void)
{
	int n;
	int i = 0;
	int *table1, *value;
	int newvalue1, newvalue2;
	
	scanf("%d",&n);
	table1 = (int*)malloc(sizeof(int)*n);
	value = (int*)malloc(sizeof(int)*n);

	while(i < n)
	{
		scanf("%d",&table1[i]);
		i++;
	}
	
	value[0] = 0;
	value[1] = abs(table1[1]-table1[0]);
	
	i = 2;
	while(i != n){
		newvalue1 = value[i-2] + abs(table1[i-2] - table1[i]);
		newvalue2 = value[i-1] + abs(table1[i-1] - table1[i]);
		if(newvalue1 > newvalue2)
		{
			value[i] = newvalue2;
		}else
		{
			value[i] = newvalue1;
		}
		i++;
	}

	printf("%d",value[n-1]);

	free(table1);
	free(value);
	return 0;
}
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 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>

int main(void)
{
	int n;
	int i = 0;
	int *table1, *value;
	int newvalue1, newvalue2;
	
	scanf("%d",&n);
	table1 = (int*)malloc(sizeof(int)*n);
	value = (int*)malloc(sizeof(int)*n);

	while(i < n)
	{
		scanf("%d",&table1[i]);
		i++;
	}
	
	value[0] = 0;
	value[1] = abs(table1[1]-table1[0]);
	
	i = 2;
	while(i != n){
		newvalue1 = value[i-2] + abs(table1[i-2] - table1[i]);
		newvalue2 = value[i-1] + abs(table1[i-1] - table1[i]);
		if(newvalue1 > newvalue2)
		{
			value[i] = newvalue2;
		}else
		{
			value[i] = newvalue1;
		}
		i++;
	}

	printf("%d",value[n-1]);

	free(table1);
	free(value);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -36(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L3
	movq	-16(%rbp), %rax
	movl	$0, (%rax)
	movq	-24(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movq	-16(%rbp), %rdx
	addq	$4, %rdx
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%eax, (%rdx)
	movl	$2, -36(%rbp)
	jmp	.L4
.L7:
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L5
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L6
.L5:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L7
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -36(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L3
	movq	-16(%rbp), %rax
	movl	$0, (%rax)
	movq	-24(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movq	-16(%rbp), %rdx
	addq	$4, %rdx
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	movl	%eax, (%rdx)
	movl	$2, -36(%rbp)
	jmp	.L4
.L7:
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L5
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L6
.L5:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L7
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
