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>

int main(void) 
{
  int i, n;
  int nowtemp, targettemp;
  int high[2000];
  int mindiff = 10000000;
  int minpoint;
  
  scanf("%d\n", &n);
  scanf("%d%d\n", &nowtemp, &targettemp);
  for (i = 0; i < n; i++) 
    scanf("%d", &high[i]);
  
  for (i = 0; i < n; i++) {
    if (mindiff > abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp)) {
       mindiff = abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp);
       minpoint = i;
    }
  }
  printf("%d", minpoint + 1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d\n"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$10000000, -8024(%rbp)
	leaq	-8040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-8032(%rbp), %rdx
	leaq	-8036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8028(%rbp)
	jmp	.L2
.L3:
	leaq	-8016(%rbp), %rdx
	movl	-8028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8028(%rbp)
.L2:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L3
	movl	$0, -8028(%rbp)
	jmp	.L4
.L6:
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -8024(%rbp)
	jle	.L5
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -8024(%rbp)
	movl	-8028(%rbp), %eax
	movl	%eax, -8020(%rbp)
.L5:
	addl	$1, -8028(%rbp)
.L4:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L6
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	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\n"
.LC1:
	.string	"%d%d\n"
.LC2:
	.string	"%d"
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %rdi
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leaq	16(%rsp), %r12
	xorl	%r13d, %r13d
	movq	%r12, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L6
	imull	$1000, 8(%rsp), %r8d
	movslq	%eax, %rsi
	xorl	%edx, %edx
	movl	$10000000, %r9d
	imull	$-1000, 12(%rsp), %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r12,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%r8,%rax,2), %eax
	addl	%edi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%r9d, %eax
	jge	.L4
	movl	%edx, %ebx
	movl	%eax, %r9d
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %rsi
	jne	.L5
.L6:
	xorl	%eax, %eax
	leal	1(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$8032, %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
.L13:
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d\n"
.LC2:
	.string	"%d"
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %rdi
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leaq	16(%rsp), %r12
	xorl	%r13d, %r13d
	movq	%r12, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L6
	imull	$1000, 8(%rsp), %r8d
	movslq	%eax, %rsi
	xorl	%edx, %edx
	movl	$10000000, %r9d
	imull	$-1000, 12(%rsp), %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r12,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%r8,%rax,2), %eax
	addl	%edi, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%r9d, %eax
	jge	.L4
	movl	%edx, %ebx
	movl	%eax, %r9d
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %rsi
	jne	.L5
.L6:
	xorl	%eax, %eax
	leal	1(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$8032, %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
.L13:
	.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:

#include <stdio.h>
#include <stdlib.h>

int main(void) 
{
  int i, n;
  int nowtemp, targettemp;
  int high[2000];
  int mindiff = 10000000;
  int minpoint;
  
  scanf("%d\n", &n);
  scanf("%d%d\n", &nowtemp, &targettemp);
  for (i = 0; i < n; i++) 
    scanf("%d", &high[i]);
  
  for (i = 0; i < n; i++) {
    if (mindiff > abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp)) {
       mindiff = abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp);
       minpoint = i;
    }
  }
  printf("%d", minpoint + 1);
  return 0;
}
2
12 5
1000 2000

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>

int main(void) 
{
  int i, n;
  int nowtemp, targettemp;
  int high[2000];
  int mindiff = 10000000;
  int minpoint;
  
  scanf("%d\n", &n);
  scanf("%d%d\n", &nowtemp, &targettemp);
  for (i = 0; i < n; i++) 
    scanf("%d", &high[i]);
  
  for (i = 0; i < n; i++) {
    if (mindiff > abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp)) {
       mindiff = abs(1000 * nowtemp - high[i] * 6 - 1000 * targettemp);
       minpoint = i;
    }
  }
  printf("%d", minpoint + 1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d\n"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$10000000, -8024(%rbp)
	leaq	-8040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-8032(%rbp), %rdx
	leaq	-8036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8028(%rbp)
	jmp	.L2
.L3:
	leaq	-8016(%rbp), %rdx
	movl	-8028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8028(%rbp)
.L2:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L3
	movl	$0, -8028(%rbp)
	jmp	.L4
.L6:
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -8024(%rbp)
	jle	.L5
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -8024(%rbp)
	movl	-8028(%rbp), %eax
	movl	%eax, -8020(%rbp)
.L5:
	addl	$1, -8028(%rbp)
.L4:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L6
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	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\n"
.LC1:
	.string	"%d%d\n"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$10000000, -8024(%rbp)
	leaq	-8040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-8032(%rbp), %rdx
	leaq	-8036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8028(%rbp)
	jmp	.L2
.L3:
	leaq	-8016(%rbp), %rdx
	movl	-8028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8028(%rbp)
.L2:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L3
	movl	$0, -8028(%rbp)
	jmp	.L4
.L6:
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -8024(%rbp)
	jle	.L5
	movl	-8036(%rbp), %eax
	imull	$1000, %eax, %ecx
	movl	-8028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %edx
	subl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-8032(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -8024(%rbp)
	movl	-8028(%rbp), %eax
	movl	%eax, -8020(%rbp)
.L5:
	addl	$1, -8028(%rbp)
.L4:
	movl	-8040(%rbp), %eax
	cmpl	%eax, -8028(%rbp)
	jl	.L6
	movl	-8020(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	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:
