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>
long long f(long long a,long long b){//printf("%d %d\n",a,b);
  if((a%2)==(b%2))return a*2;
  else return a*2-1;
}
long long MIN(long long a,long long b){return a<b?a:b;}
int main(){
  long long n,i,s=0,a=0,d[200010];
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++)d[i]*=2;
  for(i=0;i<n;i++)s+=d[i];//printf("%d \n",s);
  s=s/2;//printf("%d\n",s);
  for(i=0;s>d[i]&&i<n;i++)s-=d[i];
  //printf("%d %d %d\n",d[i],s,a);
  //printf("%d %d\n",f(s,a),f(d[i]-s,a));
  printf("%lld\n",MIN(s,d[i]-s));
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.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
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	%rax, %rcx
	jne	.L2
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	subq	$1, %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB1:
	.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	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2688, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -1600112(%rbp)
	movq	$0, -1600104(%rbp)
	leaq	-1600128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1600120(%rbp)
	jmp	.L7
.L8:
	leaq	-1600096(%rbp), %rdx
	movq	-1600120(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -1600120(%rbp)
.L7:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L8
	movq	$0, -1600120(%rbp)
	jmp	.L9
.L10:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	leaq	(%rax,%rax), %rdx
	movq	-1600120(%rbp), %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	addq	$1, -1600120(%rbp)
.L9:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L10
	movq	$0, -1600120(%rbp)
	jmp	.L11
.L12:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	addq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L11:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L12
	movq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -1600112(%rbp)
	movq	$0, -1600120(%rbp)
	jmp	.L13
.L15:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L13:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -1600112(%rbp)
	jle	.L14
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L15
.L14:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	movq	-1600112(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	f
	.type	f, @function
f:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	leaq	(%rdi,%rdi), %rax
	shrq	$63, %rdx
	addq	%rdx, %rdi
	andl	$1, %edi
	subq	%rdx, %rdi
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rsi
	andl	$1, %esi
	subq	%rdx, %rsi
	xorl	%edx, %edx
	cmpq	%rsi, %rdi
	setne	%dl
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	f, .-f
	.p2align 4
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	MIN, .-MIN
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.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	-1597440(%rsp), %r11
	.cfi_def_cfa 11, 1597488
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2672, %rsp
	.cfi_def_cfa_offset 1600160
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1600104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, 8(%rsp)
	jle	.L6
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	addq	$8, %r12
	cmpq	%rbp, %rsi
	jg	.L7
	testq	%rsi, %rsi
	jle	.L6
	leaq	(%rbx,%rsi,8), %rdx
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L8:
	salq	(%rax)
	addq	$8, %rax
	cmpq	%rax, %rdx
	jne	.L8
	cmpq	$1, %rsi
	je	.L16
	movq	%rsi, %rax
	pxor	%xmm0, %xmm0
	shrq	%rax
	salq	$4, %rax
	addq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	paddq	0(%r13), %xmm0
	addq	$16, %r13
	cmpq	%rax, %r13
	jne	.L10
	movdqa	%xmm0, %xmm1
	movq	%rsi, %rdx
	psrldq	$8, %xmm1
	andq	$-2, %rdx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L11
.L9:
	addq	16(%rsp,%rdx,8), %rax
.L11:
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	shrq	$63, %rcx
	addq	%rax, %rcx
	sarq	%rcx
	cmpq	%rdx, %rcx
	jle	.L12
	xorl	%eax, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	cmpq	%rax, %rsi
	jle	.L12
.L13:
	addq	$1, %rax
	subq	%rdx, %rcx
	movq	(%rbx,%rax,8), %rdx
	cmpq	%rcx, %rdx
	jl	.L26
.L12:
	subq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmpq	%rcx, %rdx
	cmovg	%rcx, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	1600104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$1600112, %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
.L6:
	.cfi_restore_state
	movq	16(%rsp), %rdx
	xorl	%ecx, %ecx
	jmp	.L12
.L16:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L9
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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	f
	.type	f, @function
f:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rdx
	leaq	(%rdi,%rdi), %rax
	shrq	$63, %rdx
	addq	%rdx, %rdi
	andl	$1, %edi
	subq	%rdx, %rdi
	movq	%rsi, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rsi
	andl	$1, %esi
	subq	%rdx, %rsi
	xorl	%edx, %edx
	cmpq	%rsi, %rdi
	setne	%dl
	subq	%rdx, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	f, .-f
	.p2align 4
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	MIN, .-MIN
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.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	-1597440(%rsp), %r11
	.cfi_def_cfa 11, 1597488
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2672, %rsp
	.cfi_def_cfa_offset 1600160
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1600104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpq	$0, 8(%rsp)
	jle	.L6
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rsi
	addq	$8, %r12
	cmpq	%rbp, %rsi
	jg	.L7
	testq	%rsi, %rsi
	jle	.L6
	leaq	(%rbx,%rsi,8), %rdx
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L8:
	salq	(%rax)
	addq	$8, %rax
	cmpq	%rax, %rdx
	jne	.L8
	cmpq	$1, %rsi
	je	.L16
	movq	%rsi, %rax
	pxor	%xmm0, %xmm0
	shrq	%rax
	salq	$4, %rax
	addq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	paddq	0(%r13), %xmm0
	addq	$16, %r13
	cmpq	%rax, %r13
	jne	.L10
	movdqa	%xmm0, %xmm1
	movq	%rsi, %rdx
	psrldq	$8, %xmm1
	andq	$-2, %rdx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L11
.L9:
	addq	16(%rsp,%rdx,8), %rax
.L11:
	movq	%rax, %rcx
	movq	16(%rsp), %rdx
	shrq	$63, %rcx
	addq	%rax, %rcx
	sarq	%rcx
	cmpq	%rdx, %rcx
	jle	.L12
	xorl	%eax, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	cmpq	%rax, %rsi
	jle	.L12
.L13:
	addq	$1, %rax
	subq	%rdx, %rcx
	movq	(%rbx,%rax,8), %rdx
	cmpq	%rcx, %rdx
	jl	.L26
.L12:
	subq	%rcx, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	cmpq	%rcx, %rdx
	cmovg	%rcx, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	1600104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$1600112, %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
.L6:
	.cfi_restore_state
	movq	16(%rsp), %rdx
	xorl	%ecx, %ecx
	jmp	.L12
.L16:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L9
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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>
long long f(long long a,long long b){//printf("%d %d\n",a,b);
  if((a%2)==(b%2))return a*2;
  else return a*2-1;
}
long long MIN(long long a,long long b){return a<b?a:b;}
int main(){
  long long n,i,s=0,a=0,d[200010];
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++)d[i]*=2;
  for(i=0;i<n;i++)s+=d[i];//printf("%d \n",s);
  s=s/2;//printf("%d\n",s);
  for(i=0;s>d[i]&&i<n;i++)s-=d[i];
  //printf("%d %d %d\n",d[i],s,a);
  //printf("%d %d\n",f(s,a),f(d[i]-s,a));
  printf("%lld\n",MIN(s,d[i]-s));
  return 0;
}

3
2 5 3
 12
100 104 102 105 103 103 100 105 104 102 104 101
 3
2 8 3
 12
100 104 102 105 103 103 100 117 104 102 104 101
 3
2 8 2
 12
101 104 102 105 103 103 100 117 104 102 104 101
 12
101 104 102 105 103 103 100 117 104 102 104 111
 3
2 0 4
 12
101 104 102 187 103 103 100 117 104 102 104 111
 12
101 104 102 187 103 103 110 117 104 102 104 111

4
 1
 7
 11
 8
 10
 20
 2
 62
 52

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>
long long f(long long a,long long b){//printf("%d %d\n",a,b);
  if((a%2)==(b%2))return a*2;
  else return a*2-1;
}
long long MIN(long long a,long long b){return a<b?a:b;}
int main(){
  long long n,i,s=0,a=0,d[200010];
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++)d[i]*=2;
  for(i=0;i<n;i++)s+=d[i];//printf("%d \n",s);
  s=s/2;//printf("%d\n",s);
  for(i=0;s>d[i]&&i<n;i++)s-=d[i];
  //printf("%d %d %d\n",d[i],s,a);
  //printf("%d %d\n",f(s,a),f(d[i]-s,a));
  printf("%lld\n",MIN(s,d[i]-s));
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.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
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	%rax, %rcx
	jne	.L2
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	subq	$1, %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB1:
	.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	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2688, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -1600112(%rbp)
	movq	$0, -1600104(%rbp)
	leaq	-1600128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1600120(%rbp)
	jmp	.L7
.L8:
	leaq	-1600096(%rbp), %rdx
	movq	-1600120(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -1600120(%rbp)
.L7:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L8
	movq	$0, -1600120(%rbp)
	jmp	.L9
.L10:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	leaq	(%rax,%rax), %rdx
	movq	-1600120(%rbp), %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	addq	$1, -1600120(%rbp)
.L9:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L10
	movq	$0, -1600120(%rbp)
	jmp	.L11
.L12:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	addq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L11:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L12
	movq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -1600112(%rbp)
	movq	$0, -1600120(%rbp)
	jmp	.L13
.L15:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L13:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -1600112(%rbp)
	jle	.L14
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L15
.L14:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	movq	-1600112(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	f
	.type	f, @function
f:
.LFB0:
	.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
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-16(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	%rax, %rcx
	jne	.L2
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	addq	%rax, %rax
	subq	$1, %rax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB1:
	.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	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2688, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -1600112(%rbp)
	movq	$0, -1600104(%rbp)
	leaq	-1600128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1600120(%rbp)
	jmp	.L7
.L8:
	leaq	-1600096(%rbp), %rdx
	movq	-1600120(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -1600120(%rbp)
.L7:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L8
	movq	$0, -1600120(%rbp)
	jmp	.L9
.L10:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	leaq	(%rax,%rax), %rdx
	movq	-1600120(%rbp), %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	addq	$1, -1600120(%rbp)
.L9:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L10
	movq	$0, -1600120(%rbp)
	jmp	.L11
.L12:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	addq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L11:
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L12
	movq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -1600112(%rbp)
	movq	$0, -1600120(%rbp)
	jmp	.L13
.L15:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	%rax, -1600112(%rbp)
	addq	$1, -1600120(%rbp)
.L13:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -1600112(%rbp)
	jle	.L14
	movq	-1600128(%rbp), %rax
	cmpq	%rax, -1600120(%rbp)
	jl	.L15
.L14:
	movq	-1600120(%rbp), %rax
	movq	-1600096(%rbp,%rax,8), %rax
	subq	-1600112(%rbp), %rax
	movq	%rax, %rdx
	movq	-1600112(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	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	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
