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>
#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int L, i;
	scanf("%lld", &L);
	int *A = (int *)malloc(sizeof(int) * (L + 1));
	int *B = (int *)malloc(sizeof(int) * (L + 1));
	int *C = (int *)malloc(sizeof(int) * (L + 1));
	int *S = (int *)malloc(sizeof(int) * (L + 1));
	S[0] = 0;
	int f = 1;
	for(i = 1; i <= L; i++){
		scanf("%lld", &A[i]);
		if(A[i] == 0){
			B[i] = 2;
		}
		else{
			f = 0;
			B[i] = A[i] % 2;
		}
		if(A[i] % 2 == 0){
			C[i] = 1;
		}
		else{
			C[i] = 0;
		}
		S[i] = S[i - 1] + A[i];
	}
	if(f == 1){
		printf("0\n");
		return 0;
	}
	int *dp1 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp2 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp3 = (int *)malloc(sizeof(int) * (L + 1));
	dp1[0] = inf;
	dp2[0] = inf;
	dp3[0] = inf;
	int ans = inf;
	for(i = 1; i <= L; i++){
		dp1[i] = min(S[i - 1], dp1[i - 1]) + B[i];
		dp2[i] = min(S[i - 1], min(dp1[i - 1], dp2[i - 1])) + C[i];
		dp3[i] = min(min(S[i - 1], dp1[i - 1]), min(dp2[i - 1], dp3[i - 1])) + B[i];
		ans = min(ans, min(min(dp1[i], dp2[i]), dp3[i]) + S[L] - S[i]);
	}
	printf("%lld\n", ans);
	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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"0"
.LC2:
	.string	"%lld\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	%rbx
	subq	$104, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -80(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -72(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -56(%rbp)
	movq	-56(%rbp), %rax
	movq	$0, (%rax)
	movq	$1, -96(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L4
.L9:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	$2, (%rax)
	jmp	.L6
.L5:
	movq	$0, -96(%rbp)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	-104(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-72(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rax, %rcx
	sarq	$63, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	andl	$1, %eax
	subq	%rcx, %rax
	movq	%rax, (%rdx)
.L6:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L7
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, (%rax)
	jmp	.L8
.L7:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L8:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-56(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addq	$1, -104(%rbp)
.L4:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L9
	cmpq	$1, -96(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L10:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-48(%rbp), %rax
	movabsq	$1000000000000000000, %rbx
	movq	%rbx, (%rax)
	movq	-40(%rbp), %rax
	movq	%rbx, (%rax)
	movq	-32(%rbp), %rax
	movq	%rbx, (%rax)
	movq	%rbx, -88(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L12
.L13:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rbx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	subq	%rax, %rdx
	movq	-88(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -88(%rbp)
	addq	$1, -104(%rbp)
.L12:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L13
	movq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"0"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rsi
	leaq	8(,%rsi,8), %rbp
	movq	%rsi, 8(%rsp)
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rbp, %rdi
	addq	$8, %r14
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	8(%rsp), %rsi
	movq	$0, (%rax)
	testq	%rsi, %rsi
	jle	.L10
	movq	%rax, %rbx
	movl	$1, %eax
	movl	$1, %r15d
	movq	%rax, %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L29:
	movq	$2, (%r12,%r15,8)
.L7:
	movl	$1, %edx
.L8:
	addq	-8(%rbx,%r15,8), %rax
	movq	%rdx, 0(%r13,%r15,8)
	addq	$8, %r14
	movq	%rax, (%rbx,%r15,8)
	movq	32(%rsp), %rax
	addq	$1, %r15
	cmpq	%r15, %rax
	jl	.L28
.L9:
	movq	%r14, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%r14), %rax
	testq	%rax, %rax
	je	.L29
	movq	%rax, %rcx
	shrq	$63, %rcx
	leaq	(%rax,%rcx), %rdx
	andl	$1, %edx
	subq	%rcx, %rdx
	movq	%rdx, (%r12,%r15,8)
	testb	$1, %al
	je	.L30
	xorl	%edx, %edx
	xorl	%ebp, %ebp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rbp, %rdi
	movq	%rax, %rbp
	cmpq	$1, %rdi
	je	.L10
	leaq	8(,%rax,8), %rsi
	movq	%rsi, %rdi
	movq	%rsi, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movabsq	$1000000000000000000, %rdx
	movq	%rdx, (%r14)
	movq	%rax, %rcx
	movq	%rdx, (%r15)
	movq	%rdx, (%rax)
	testq	%rbp, %rbp
	jle	.L11
	movq	8(%rsp), %rsi
	movq	-8(%rbx,%rsi), %rax
	movq	%rax, 8(%rsp)
	cmpq	$2, %rbp
	jle	.L18
	movq	%rbp, 16(%rsp)
	movq	(%rbx), %r9
	movq	%rdx, %r11
	movq	%rdx, %r10
	movq	%rdx, %rsi
	movl	$1, %eax
.L13:
	cmpq	%r11, %r9
	movq	%r11, %rdi
	movq	%r11, %r8
	movq	%rax, 24(%rsp)
	cmovle	%r9, %rdi
	addq	(%r12,%rax,8), %rdi
	cmpq	%r11, %r10
	cmovle	%r10, %r8
	movq	%rdi, (%r14,%rax,8)
	cmpq	%r9, %r8
	cmovg	%r9, %r8
	addq	0(%r13,%rax,8), %r8
	cmpq	%r9, %rsi
	cmovg	%r9, %rsi
	movq	%r8, (%r15,%rax,8)
	movq	8(%rbx,%rax,8), %r9
	cmpq	%r11, %rsi
	cmovg	%r11, %rsi
	movq	8(%r12,%rax,8), %r11
	cmpq	%r10, %rsi
	cmovg	%r10, %rsi
	addq	(%r12,%rax,8), %rsi
	cmpq	(%rbx,%rax,8), %rdi
	movq	%rsi, %rbp
	movq	%rsi, (%rcx,%rax,8)
	movq	%rdi, %rsi
	cmovg	(%rbx,%rax,8), %rsi
	movq	8(%r13,%rax,8), %r10
	addq	%rsi, %r11
	cmpq	%rsi, %r8
	cmovle	%r8, %rsi
	movq	%r11, 8(%r14,%rax,8)
	addq	%rsi, %r10
	cmpq	%rsi, %rbp
	cmovle	%rbp, %rsi
	addq	8(%r12,%rax,8), %rsi
	cmpq	%r8, %rdi
	movq	%r10, 8(%r15,%rax,8)
	cmovg	%r8, %rdi
	movq	%r10, %r8
	movq	%rsi, 8(%rcx,%rax,8)
	cmpq	%rbp, %rdi
	cmovg	%rbp, %rdi
	movq	8(%rsp), %rbp
	addq	%rbp, %rdi
	subq	(%rbx,%rax,8), %rdi
	cmpq	%r10, %r11
	cmovle	%r11, %r8
	cmpq	%rsi, %r8
	cmovg	%rsi, %r8
	addq	%rbp, %r8
	subq	%r9, %r8
	cmpq	%r8, %rdi
	cmovg	%r8, %rdi
	cmpq	%rdi, %rdx
	cmovg	%rdi, %rdx
	movq	24(%rsp), %rdi
	addq	$2, %rax
	addq	$3, %rdi
	cmpq	%rdi, 16(%rsp)
	jg	.L13
	movq	16(%rsp), %rbp
	movq	8(%rsp), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	-8(%r14,%rax,8), %rsi
	movq	-8(%rbx,%rax,8), %r11
	movq	-8(%r15,%rax,8), %r10
	movq	(%r12,%rax,8), %r9
	cmpq	%rsi, %r11
	movq	%rsi, %r8
	cmovle	%r11, %r8
	addq	%r8, %r9
	cmpq	%r11, %r10
	cmovle	%r10, %r11
	movq	%r9, (%r14,%rax,8)
	cmpq	%rsi, %r11
	cmovle	%r11, %rsi
	movq	-8(%rcx,%rax,8), %r11
	addq	0(%r13,%rax,8), %rsi
	movq	%rsi, (%r15,%rax,8)
	cmpq	%r11, %r8
	cmovg	%r11, %r8
	cmpq	%r10, %r8
	cmovg	%r10, %r8
	addq	(%r12,%rax,8), %r8
	cmpq	%r9, %rsi
	cmovg	%r9, %rsi
	movq	%r8, (%rcx,%rax,8)
	cmpq	%r8, %rsi
	cmovg	%r8, %rsi
	addq	%rdi, %rsi
	subq	(%rbx,%rax,8), %rsi
	cmpq	%rsi, %rdx
	cmovg	%rsi, %rdx
	addq	$1, %rax
	cmpq	%rax, %rbp
	jge	.L14
.L11:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L10:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L18:
	movq	8(%rsp), %rdi
	movl	$1, %eax
	jmp	.L14
.L30:
	xorl	%ebp, %ebp
	jmp	.L7
.L31:
	call	__stack_chk_fail@PLT
	.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
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB39:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"0"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rsi
	leaq	8(,%rsi,8), %rbp
	movq	%rsi, 8(%rsp)
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rbp, %rdi
	addq	$8, %r14
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	8(%rsp), %rsi
	movq	$0, (%rax)
	testq	%rsi, %rsi
	jle	.L10
	movq	%rax, %rbx
	movl	$1, %eax
	movl	$1, %r15d
	movq	%rax, %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L29:
	movq	$2, (%r12,%r15,8)
.L7:
	movl	$1, %edx
.L8:
	addq	-8(%rbx,%r15,8), %rax
	movq	%rdx, 0(%r13,%r15,8)
	addq	$8, %r14
	movq	%rax, (%rbx,%r15,8)
	movq	32(%rsp), %rax
	addq	$1, %r15
	cmpq	%r15, %rax
	jl	.L28
.L9:
	movq	%r14, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%r14), %rax
	testq	%rax, %rax
	je	.L29
	movq	%rax, %rcx
	shrq	$63, %rcx
	leaq	(%rax,%rcx), %rdx
	andl	$1, %edx
	subq	%rcx, %rdx
	movq	%rdx, (%r12,%r15,8)
	testb	$1, %al
	je	.L30
	xorl	%edx, %edx
	xorl	%ebp, %ebp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rbp, %rdi
	movq	%rax, %rbp
	cmpq	$1, %rdi
	je	.L10
	leaq	8(,%rax,8), %rsi
	movq	%rsi, %rdi
	movq	%rsi, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movabsq	$1000000000000000000, %rdx
	movq	%rdx, (%r14)
	movq	%rax, %rcx
	movq	%rdx, (%r15)
	movq	%rdx, (%rax)
	testq	%rbp, %rbp
	jle	.L11
	movq	8(%rsp), %rsi
	movq	-8(%rbx,%rsi), %rax
	movq	%rax, 8(%rsp)
	cmpq	$2, %rbp
	jle	.L18
	movq	%rbp, 16(%rsp)
	movq	(%rbx), %r9
	movq	%rdx, %r11
	movq	%rdx, %r10
	movq	%rdx, %rsi
	movl	$1, %eax
.L13:
	cmpq	%r11, %r9
	movq	%r11, %rdi
	movq	%r11, %r8
	movq	%rax, 24(%rsp)
	cmovle	%r9, %rdi
	addq	(%r12,%rax,8), %rdi
	cmpq	%r11, %r10
	cmovle	%r10, %r8
	movq	%rdi, (%r14,%rax,8)
	cmpq	%r9, %r8
	cmovg	%r9, %r8
	addq	0(%r13,%rax,8), %r8
	cmpq	%r9, %rsi
	cmovg	%r9, %rsi
	movq	%r8, (%r15,%rax,8)
	movq	8(%rbx,%rax,8), %r9
	cmpq	%r11, %rsi
	cmovg	%r11, %rsi
	movq	8(%r12,%rax,8), %r11
	cmpq	%r10, %rsi
	cmovg	%r10, %rsi
	addq	(%r12,%rax,8), %rsi
	cmpq	(%rbx,%rax,8), %rdi
	movq	%rsi, %rbp
	movq	%rsi, (%rcx,%rax,8)
	movq	%rdi, %rsi
	cmovg	(%rbx,%rax,8), %rsi
	movq	8(%r13,%rax,8), %r10
	addq	%rsi, %r11
	cmpq	%rsi, %r8
	cmovle	%r8, %rsi
	movq	%r11, 8(%r14,%rax,8)
	addq	%rsi, %r10
	cmpq	%rsi, %rbp
	cmovle	%rbp, %rsi
	addq	8(%r12,%rax,8), %rsi
	cmpq	%r8, %rdi
	movq	%r10, 8(%r15,%rax,8)
	cmovg	%r8, %rdi
	movq	%r10, %r8
	movq	%rsi, 8(%rcx,%rax,8)
	cmpq	%rbp, %rdi
	cmovg	%rbp, %rdi
	movq	8(%rsp), %rbp
	addq	%rbp, %rdi
	subq	(%rbx,%rax,8), %rdi
	cmpq	%r10, %r11
	cmovle	%r11, %r8
	cmpq	%rsi, %r8
	cmovg	%rsi, %r8
	addq	%rbp, %r8
	subq	%r9, %r8
	cmpq	%r8, %rdi
	cmovg	%r8, %rdi
	cmpq	%rdi, %rdx
	cmovg	%rdi, %rdx
	movq	24(%rsp), %rdi
	addq	$2, %rax
	addq	$3, %rdi
	cmpq	%rdi, 16(%rsp)
	jg	.L13
	movq	16(%rsp), %rbp
	movq	8(%rsp), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	-8(%r14,%rax,8), %rsi
	movq	-8(%rbx,%rax,8), %r11
	movq	-8(%r15,%rax,8), %r10
	movq	(%r12,%rax,8), %r9
	cmpq	%rsi, %r11
	movq	%rsi, %r8
	cmovle	%r11, %r8
	addq	%r8, %r9
	cmpq	%r11, %r10
	cmovle	%r10, %r11
	movq	%r9, (%r14,%rax,8)
	cmpq	%rsi, %r11
	cmovle	%r11, %rsi
	movq	-8(%rcx,%rax,8), %r11
	addq	0(%r13,%rax,8), %rsi
	movq	%rsi, (%r15,%rax,8)
	cmpq	%r11, %r8
	cmovg	%r11, %r8
	cmpq	%r10, %r8
	cmovg	%r10, %r8
	addq	(%r12,%rax,8), %r8
	cmpq	%r9, %rsi
	cmovg	%r9, %rsi
	movq	%r8, (%rcx,%rax,8)
	cmpq	%r8, %rsi
	cmovg	%r8, %rsi
	addq	%rdi, %rsi
	subq	(%rbx,%rax,8), %rsi
	cmpq	%rsi, %rdx
	cmovg	%rsi, %rdx
	addq	$1, %rax
	cmpq	%rax, %rbp
	jge	.L14
.L11:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L10:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L18:
	movq	8(%rsp), %rdi
	movl	$1, %eax
	jmp	.L14
.L30:
	xorl	%ebp, %ebp
	jmp	.L7
.L31:
	call	__stack_chk_fail@PLT
	.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>
#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int L, i;
	scanf("%lld", &L);
	int *A = (int *)malloc(sizeof(int) * (L + 1));
	int *B = (int *)malloc(sizeof(int) * (L + 1));
	int *C = (int *)malloc(sizeof(int) * (L + 1));
	int *S = (int *)malloc(sizeof(int) * (L + 1));
	S[0] = 0;
	int f = 1;
	for(i = 1; i <= L; i++){
		scanf("%lld", &A[i]);
		if(A[i] == 0){
			B[i] = 2;
		}
		else{
			f = 0;
			B[i] = A[i] % 2;
		}
		if(A[i] % 2 == 0){
			C[i] = 1;
		}
		else{
			C[i] = 0;
		}
		S[i] = S[i - 1] + A[i];
	}
	if(f == 1){
		printf("0\n");
		return 0;
	}
	int *dp1 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp2 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp3 = (int *)malloc(sizeof(int) * (L + 1));
	dp1[0] = inf;
	dp2[0] = inf;
	dp3[0] = inf;
	int ans = inf;
	for(i = 1; i <= L; i++){
		dp1[i] = min(S[i - 1], dp1[i - 1]) + B[i];
		dp2[i] = min(S[i - 1], min(dp1[i - 1], dp2[i - 1])) + C[i];
		dp3[i] = min(min(S[i - 1], dp1[i - 1]), min(dp2[i - 1], dp3[i - 1])) + B[i];
		ans = min(ans, min(min(dp1[i], dp2[i]), dp3[i]) + S[L] - S[i]);
	}
	printf("%lld\n", ans);
	return 0;
}
4
1
0
4
3
 8
2
0
0
2
0
3
4
1
 4
0
0
4
3
 8
2
0
1
2
0
1
0
1
 8
2
0
1
2
0
1
0
0
 8
4
0
0
2
0
1
2
1
 7
314159265
429733551
846264338
327950288
419716939
937510582
0
 8
2
0
0
2
0
0
4
1
 7
314159265
429733551
846264338
327950288
419716939
937510582
-1
 4
0
1
4
3

1
 4
 0
 3
 2
 5
 1
 4
 0
 1

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>
#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int L, i;
	scanf("%lld", &L);
	int *A = (int *)malloc(sizeof(int) * (L + 1));
	int *B = (int *)malloc(sizeof(int) * (L + 1));
	int *C = (int *)malloc(sizeof(int) * (L + 1));
	int *S = (int *)malloc(sizeof(int) * (L + 1));
	S[0] = 0;
	int f = 1;
	for(i = 1; i <= L; i++){
		scanf("%lld", &A[i]);
		if(A[i] == 0){
			B[i] = 2;
		}
		else{
			f = 0;
			B[i] = A[i] % 2;
		}
		if(A[i] % 2 == 0){
			C[i] = 1;
		}
		else{
			C[i] = 0;
		}
		S[i] = S[i - 1] + A[i];
	}
	if(f == 1){
		printf("0\n");
		return 0;
	}
	int *dp1 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp2 = (int *)malloc(sizeof(int) * (L + 1));
	int *dp3 = (int *)malloc(sizeof(int) * (L + 1));
	dp1[0] = inf;
	dp2[0] = inf;
	dp3[0] = inf;
	int ans = inf;
	for(i = 1; i <= L; i++){
		dp1[i] = min(S[i - 1], dp1[i - 1]) + B[i];
		dp2[i] = min(S[i - 1], min(dp1[i - 1], dp2[i - 1])) + C[i];
		dp3[i] = min(min(S[i - 1], dp1[i - 1]), min(dp2[i - 1], dp3[i - 1])) + B[i];
		ans = min(ans, min(min(dp1[i], dp2[i]), dp3[i]) + S[L] - S[i]);
	}
	printf("%lld\n", ans);
	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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"0"
.LC2:
	.string	"%lld\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	%rbx
	subq	$104, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -80(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -72(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -56(%rbp)
	movq	-56(%rbp), %rax
	movq	$0, (%rax)
	movq	$1, -96(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L4
.L9:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	$2, (%rax)
	jmp	.L6
.L5:
	movq	$0, -96(%rbp)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	-104(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-72(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rax, %rcx
	sarq	$63, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	andl	$1, %eax
	subq	%rcx, %rax
	movq	%rax, (%rdx)
.L6:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L7
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, (%rax)
	jmp	.L8
.L7:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L8:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-56(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addq	$1, -104(%rbp)
.L4:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L9
	cmpq	$1, -96(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L10:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-48(%rbp), %rax
	movabsq	$1000000000000000000, %rbx
	movq	%rbx, (%rax)
	movq	-40(%rbp), %rax
	movq	%rbx, (%rax)
	movq	-32(%rbp), %rax
	movq	%rbx, (%rax)
	movq	%rbx, -88(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L12
.L13:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rbx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	subq	%rax, %rdx
	movq	-88(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -88(%rbp)
	addq	$1, -104(%rbp)
.L12:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L13
	movq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"0"
.LC2:
	.string	"%lld\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	%rbx
	subq	$104, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -80(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -72(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -56(%rbp)
	movq	-56(%rbp), %rax
	movq	$0, (%rax)
	movq	$1, -96(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L4
.L9:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	$2, (%rax)
	jmp	.L6
.L5:
	movq	$0, -96(%rbp)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	-104(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-72(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rax, %rcx
	sarq	$63, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	andl	$1, %eax
	subq	%rcx, %rax
	movq	%rax, (%rdx)
.L6:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L7
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, (%rax)
	jmp	.L8
.L7:
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
.L8:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-56(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addq	$1, -104(%rbp)
.L4:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L9
	cmpq	$1, -96(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L10:
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	-112(%rbp), %rax
	addq	$1, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-48(%rbp), %rax
	movabsq	$1000000000000000000, %rbx
	movq	%rbx, (%rax)
	movq	-40(%rbp), %rax
	movq	%rbx, (%rax)
	movq	-32(%rbp), %rax
	movq	%rbx, (%rax)
	movq	%rbx, -88(%rbp)
	movq	$1, -104(%rbp)
	jmp	.L12
.L13:
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rbx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-72(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-48(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-104(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-56(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	subq	%rax, %rdx
	movq	-88(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -88(%rbp)
	addq	$1, -104(%rbp)
.L12:
	movq	-112(%rbp), %rax
	cmpq	%rax, -104(%rbp)
	jle	.L13
	movq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.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:
