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<string.h>

#define MAX(a, b) (((a)>(b)) ? (a) : (b))
#define MIN(a, b) (((a)<(b)) ? (a) : (b))

int main()
{
    int n;
    int array_a[101];
    int array_b[101];
    long long int a = 0;

    scanf("%d", &n);

    for (int i = 1; i<n; i++)
    {
        scanf("%d", &array_b[i]);
        array_a[i] = 0;
    }

    a += array_b[1];

    for (int i = 2; i<n; i++)
    {
        a += MIN(array_b[i], array_b[i-1]);
    }

    a += array_b[n-1];

    printf("%lld", a);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -840(%rbp)
	leaq	-852(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -848(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-848(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-848(%rbp), %eax
	cltq
	movl	$0, -832(%rbp,%rax,4)
	addl	$1, -848(%rbp)
.L2:
	movl	-852(%rbp), %eax
	cmpl	%eax, -848(%rbp)
	jl	.L3
	movl	-412(%rbp), %eax
	cltq
	addq	%rax, -840(%rbp)
	movl	$2, -844(%rbp)
	jmp	.L4
.L5:
	movl	-844(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	addq	%rax, -840(%rbp)
	addl	$1, -844(%rbp)
.L4:
	movl	-852(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jl	.L5
	movl	-852(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -840(%rbp)
	movq	-840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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"
.LC1:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	cmpl	$1, %edx
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	movslq	20(%rsp), %rcx
	cmpl	$2, %edx
	jle	.L8
	leal	-3(%rdx), %eax
	leal	-2(%rdx), %edi
	cmpl	$2, %eax
	jbe	.L11
	movl	%edi, %esi
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	movq	%rbx, %rax
	shrl	$2, %esi
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rax), %xmm5
	movdqu	4(%rax), %xmm0
	addq	$16, %rax
	movdqu	-12(%rax), %xmm6
	pcmpgtd	%xmm5, %xmm0
	movdqa	%xmm5, %xmm2
	pand	%xmm0, %xmm2
	pandn	%xmm6, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm4, %xmm2
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%rsi, %rax
	jne	.L6
	movdqa	%xmm1, %xmm0
	movl	%edi, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rax
	addq	%rax, %rcx
	leal	2(%rsi), %eax
	cmpl	%edi, %esi
	je	.L8
.L5:
	movslq	%eax, %rdi
	movslq	16(%rsp,%rdi,4), %rsi
	movslq	12(%rsp,%rdi,4), %rdi
	cmpl	%edi, %esi
	cmovle	%rsi, %rdi
	addq	%rdi, %rcx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L8
	movslq	%edi, %rdi
	movslq	16(%rsp,%rdi,4), %rdi
	cmpl	%edi, %esi
	cmovg	%rdi, %rsi
	addl	$2, %eax
	addq	%rsi, %rcx
	cmpl	%eax, %edx
	jle	.L8
	cltq
	movslq	16(%rsp,%rax,4), %rax
	cmpl	%eax, %edi
	cmovg	%rax, %rdi
	addq	%rdi, %rcx
.L8:
	subl	$1, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	movslq	%edx, %rdx
	leaq	.LC1(%rip), %rsi
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rcx, %rdx
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movslq	20(%rsp), %rcx
	jmp	.L8
.L11:
	movl	$2, %eax
	jmp	.L5
.L17:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	cmpl	$1, %edx
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	movslq	20(%rsp), %rcx
	cmpl	$2, %edx
	jle	.L8
	leal	-3(%rdx), %eax
	leal	-2(%rdx), %edi
	cmpl	$2, %eax
	jbe	.L11
	movl	%edi, %esi
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	movq	%rbx, %rax
	shrl	$2, %esi
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rax), %xmm5
	movdqu	4(%rax), %xmm0
	addq	$16, %rax
	movdqu	-12(%rax), %xmm6
	pcmpgtd	%xmm5, %xmm0
	movdqa	%xmm5, %xmm2
	pand	%xmm0, %xmm2
	pandn	%xmm6, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm4, %xmm2
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%rsi, %rax
	jne	.L6
	movdqa	%xmm1, %xmm0
	movl	%edi, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rax
	addq	%rax, %rcx
	leal	2(%rsi), %eax
	cmpl	%edi, %esi
	je	.L8
.L5:
	movslq	%eax, %rdi
	movslq	16(%rsp,%rdi,4), %rsi
	movslq	12(%rsp,%rdi,4), %rdi
	cmpl	%edi, %esi
	cmovle	%rsi, %rdi
	addq	%rdi, %rcx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L8
	movslq	%edi, %rdi
	movslq	16(%rsp,%rdi,4), %rdi
	cmpl	%edi, %esi
	cmovg	%rdi, %rsi
	addl	$2, %eax
	addq	%rsi, %rcx
	cmpl	%eax, %edx
	jle	.L8
	cltq
	movslq	16(%rsp,%rax,4), %rax
	cmpl	%eax, %edi
	cmovg	%rax, %rdi
	addq	%rdi, %rcx
.L8:
	subl	$1, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	movslq	%edx, %rdx
	leaq	.LC1(%rip), %rsi
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rcx, %rdx
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movslq	20(%rsp), %rcx
	jmp	.L8
.L11:
	movl	$2, %eax
	jmp	.L5
.L17:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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<string.h>

#define MAX(a, b) (((a)>(b)) ? (a) : (b))
#define MIN(a, b) (((a)<(b)) ? (a) : (b))

int main()
{
    int n;
    int array_a[101];
    int array_b[101];
    long long int a = 0;

    scanf("%d", &n);

    for (int i = 1; i<n; i++)
    {
        scanf("%d", &array_b[i]);
        array_a[i] = 0;
    }

    a += array_b[1];

    for (int i = 2; i<n; i++)
    {
        a += MIN(array_b[i], array_b[i-1]);
    }

    a += array_b[n-1];

    printf("%lld", a);

    return 0;
}
2
5
 6
0 153 10 14 23
 3
2 9
 2
4
 6
0 153 10 14 17
 3
2 12
 2
1
 6
0 153 10 14 26
 3
1 12
 2
0

10 57 13 8 51 16 2 60 14 0
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<string.h>

#define MAX(a, b) (((a)>(b)) ? (a) : (b))
#define MIN(a, b) (((a)<(b)) ? (a) : (b))

int main()
{
    int n;
    int array_a[101];
    int array_b[101];
    long long int a = 0;

    scanf("%d", &n);

    for (int i = 1; i<n; i++)
    {
        scanf("%d", &array_b[i]);
        array_a[i] = 0;
    }

    a += array_b[1];

    for (int i = 2; i<n; i++)
    {
        a += MIN(array_b[i], array_b[i-1]);
    }

    a += array_b[n-1];

    printf("%lld", a);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -840(%rbp)
	leaq	-852(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -848(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-848(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-848(%rbp), %eax
	cltq
	movl	$0, -832(%rbp,%rax,4)
	addl	$1, -848(%rbp)
.L2:
	movl	-852(%rbp), %eax
	cmpl	%eax, -848(%rbp)
	jl	.L3
	movl	-412(%rbp), %eax
	cltq
	addq	%rax, -840(%rbp)
	movl	$2, -844(%rbp)
	jmp	.L4
.L5:
	movl	-844(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	addq	%rax, -840(%rbp)
	addl	$1, -844(%rbp)
.L4:
	movl	-852(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jl	.L5
	movl	-852(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -840(%rbp)
	movq	-840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -840(%rbp)
	leaq	-852(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -848(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-848(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-848(%rbp), %eax
	cltq
	movl	$0, -832(%rbp,%rax,4)
	addl	$1, -848(%rbp)
.L2:
	movl	-852(%rbp), %eax
	cmpl	%eax, -848(%rbp)
	jl	.L3
	movl	-412(%rbp), %eax
	cltq
	addq	%rax, -840(%rbp)
	movl	$2, -844(%rbp)
	jmp	.L4
.L5:
	movl	-844(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cltq
	addq	%rax, -840(%rbp)
	addl	$1, -844(%rbp)
.L4:
	movl	-852(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jl	.L5
	movl	-852(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -840(%rbp)
	movq	-840(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
