Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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

int main()
{
	int i, N, T, A, H[1001];
	scanf("%d", &N);
	scanf("%d %d", &T, &A);
	for (i = 1; i <= N; i++) scanf("%d", &(H[i]));
	
	int min = abs(T * 1000 - H[1] * 6 - A * 1000), argmin = 1;
	for (i = 2; i <= N; i++) {
		if (abs(T * 1000 - H[i] * 6 - A * 1000) < min) {
			min = abs(T * 1000 - H[i] * 6 - A * 1000);
			argmin = i;
		}
	}
	printf("%d\n", argmin);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4032, %rsp
	.cfi_def_cfa_offset 4064
	movq	%fs:40, %rax
	movq	%rax, 4024(%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	.L8
	leaq	20(%rsp), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jge	.L3
	movl	20(%rsp), %edx
	imull	$1000, 8(%rsp), %edi
	imull	$-1000, 12(%rsp), %r8d
	leal	0(,%rdx,4), %ecx
	subl	%ecx, %edx
	leal	(%rdi,%rdx,2), %edx
	addl	%r8d, %edx
	movl	%edx, %esi
	negl	%esi
	cmovs	%edx, %esi
	cmpl	$1, %eax
	jle	.L8
	leal	1(%rax), %r10d
	movl	$2, %edx
	movl	$1, %r11d
	leaq	16(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r9,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%rdi,%rax,2), %eax
	addl	%r8d, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%esi, %eax
	jge	.L4
	movl	%edx, %r11d
	movl	%eax, %esi
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r10
	jne	.L5
.L2:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$4032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	movl	$1, %r11d
	jmp	.L2
.L14:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4032, %rsp
	.cfi_def_cfa_offset 4064
	movq	%fs:40, %rax
	movq	%rax, 4024(%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	.L8
	leaq	20(%rsp), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jge	.L3
	movl	20(%rsp), %edx
	imull	$1000, 8(%rsp), %edi
	imull	$-1000, 12(%rsp), %r8d
	leal	0(,%rdx,4), %ecx
	subl	%ecx, %edx
	leal	(%rdi,%rdx,2), %edx
	addl	%r8d, %edx
	movl	%edx, %esi
	negl	%esi
	cmovs	%edx, %esi
	cmpl	$1, %eax
	jle	.L8
	leal	1(%rax), %r10d
	movl	$2, %edx
	movl	$1, %r11d
	leaq	16(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r9,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%rdi,%rax,2), %eax
	addl	%r8d, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%esi, %eax
	jge	.L4
	movl	%edx, %r11d
	movl	%eax, %esi
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r10
	jne	.L5
.L2:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$4032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	movl	$1, %r11d
	jmp	.L2
.L14:
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4032, %rsp
	.cfi_def_cfa_offset 4064
	movq	%fs:40, %rax
	movq	%rax, 4024(%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	.L8
	leaq	20(%rsp), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jge	.L3
	movl	20(%rsp), %edx
	imull	$1000, 8(%rsp), %edi
	imull	$-1000, 12(%rsp), %r8d
	leal	0(,%rdx,4), %ecx
	subl	%ecx, %edx
	leal	(%rdi,%rdx,2), %edx
	addl	%r8d, %edx
	movl	%edx, %esi
	negl	%esi
	cmovs	%edx, %esi
	cmpl	$1, %eax
	jle	.L8
	leal	1(%rax), %r10d
	movl	$2, %edx
	movl	$1, %r11d
	leaq	16(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r9,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%rdi,%rax,2), %eax
	addl	%r8d, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%esi, %eax
	jge	.L4
	movl	%edx, %r11d
	movl	%eax, %esi
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r10
	jne	.L5
.L2:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$4032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	movl	$1, %r11d
	jmp	.L2
.L14:
	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:
```
```c
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N, T, A, H[1001];
	scanf("%d", &N);
	scanf("%d %d", &T, &A);
	for (i = 1; i <= N; i++) scanf("%d", &(H[i]));
	
	int min = abs(T * 1000 - H[1] * 6 - A * 1000), argmin = 1;
	for (i = 2; i <= N; i++) {
		if (abs(T * 1000 - H[i] * 6 - A * 1000) < min) {
			min = abs(T * 1000 - H[i] * 6 - A * 1000);
			argmin = i;
		}
	}
	printf("%d\n", argmin);
	fflush(stdout);
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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

int main()
{
	int i, N, T, A, H[1001];
	scanf("%d", &N);
	scanf("%d %d", &T, &A);
	for (i = 1; i <= N; i++) scanf("%d", &(H[i]));
	
	int min = abs(T * 1000 - H[1] * 6 - A * 1000), argmin = 1;
	for (i = 2; i <= N; i++) {
		if (abs(T * 1000 - H[i] * 6 - A * 1000) < min) {
			min = abs(T * 1000 - H[i] * 6 - A * 1000);
			argmin = i;
		}
	}
	printf("%d\n", argmin);
	fflush(stdout);
	return 0;
}```

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.
Optimized Assembly Code:

2
12 5
1000 2000

1

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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

int main()
{
	int i, N, T, A, H[1001];
	scanf("%d", &N);
	scanf("%d %d", &T, &A);
	for (i = 1; i <= N; i++) scanf("%d", &(H[i]));
	
	int min = abs(T * 1000 - H[1] * 6 - A * 1000), argmin = 1;
	for (i = 2; i <= N; i++) {
		if (abs(T * 1000 - H[i] * 6 - A * 1000) < min) {
			min = abs(T * 1000 - H[i] * 6 - A * 1000);
			argmin = i;
		}
	}
	printf("%d\n", argmin);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4032, %rsp
	.cfi_def_cfa_offset 4064
	movq	%fs:40, %rax
	movq	%rax, 4024(%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	.L8
	leaq	20(%rsp), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jge	.L3
	movl	20(%rsp), %edx
	imull	$1000, 8(%rsp), %edi
	imull	$-1000, 12(%rsp), %r8d
	leal	0(,%rdx,4), %ecx
	subl	%ecx, %edx
	leal	(%rdi,%rdx,2), %edx
	addl	%r8d, %edx
	movl	%edx, %esi
	negl	%esi
	cmovs	%edx, %esi
	cmpl	$1, %eax
	jle	.L8
	leal	1(%rax), %r10d
	movl	$2, %edx
	movl	$1, %r11d
	leaq	16(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r9,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%rdi,%rax,2), %eax
	addl	%r8d, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%esi, %eax
	jge	.L4
	movl	%edx, %r11d
	movl	%eax, %esi
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r10
	jne	.L5
.L2:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$4032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	movl	$1, %r11d
	jmp	.L2
.L14:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$4032, %rsp
	.cfi_def_cfa_offset 4064
	movq	%fs:40, %rax
	movq	%rax, 4024(%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	.L8
	leaq	20(%rsp), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jge	.L3
	movl	20(%rsp), %edx
	imull	$1000, 8(%rsp), %edi
	imull	$-1000, 12(%rsp), %r8d
	leal	0(,%rdx,4), %ecx
	subl	%ecx, %edx
	leal	(%rdi,%rdx,2), %edx
	addl	%r8d, %edx
	movl	%edx, %esi
	negl	%esi
	cmovs	%edx, %esi
	cmpl	$1, %eax
	jle	.L8
	leal	1(%rax), %r10d
	movl	$2, %edx
	movl	$1, %r11d
	leaq	16(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%r9,%rdx,4), %eax
	leal	0(,%rax,4), %ecx
	subl	%ecx, %eax
	leal	(%rdi,%rax,2), %eax
	addl	%r8d, %eax
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	cmpl	%esi, %eax
	jge	.L4
	movl	%edx, %r11d
	movl	%eax, %esi
.L4:
	addq	$1, %rdx
	cmpq	%rdx, %r10
	jne	.L5
.L2:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r11d, %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$4032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	movl	$1, %r11d
	jmp	.L2
.L14:
	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:
```