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

```c
i,r=-1;main(n,t,e,x){for(scanf("%d%d%d",&n,&t,&e);i<n;r=t-e>(t+e)/x*x?r:i+1,i++)scanf("%d",&x);r=!printf("%d\n",r);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	r
	.data
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.long	-1
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	-16(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, %ecx
	jg	.L3
	movl	i(%rip), %eax
	addl	$1, %eax
	jmp	.L4
.L3:
	movl	r(%rip), %eax
.L4:
	movl	%eax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, r(%rip)
	movl	$0, %eax
	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%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, 12(%rsp)
	leaq	.LC0(%rip), %rdi
	movl	%esi, 8(%rsp)
	leaq	12(%rsp), %rsi
	movl	%edx, 4(%rsp)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rsp)
	leaq	4(%rsp), %rcx
	call	scanf@PLT
	movl	12(%rsp), %eax
	cmpl	%eax, i(%rip)
	jge	.L2
	movq	%rsp, %rbp
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	8(%rsp), %eax
	movl	(%rsp), %ecx
	movl	%eax, %esi
	addl	4(%rsp), %eax
	subl	4(%rsp), %esi
	cltd
	idivl	%ecx
	imull	%ecx, %eax
	cmpl	%eax, %esi
	jg	.L3
	movl	i(%rip), %eax
	leal	1(%rax), %esi
	movl	%esi, r(%rip)
	movl	%esi, i(%rip)
	cmpl	12(%rsp), %esi
	jl	.L6
.L5:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, r(%rip)
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	movl	i(%rip), %eax
	movl	r(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%eax, 12(%rsp)
	jg	.L6
	jmp	.L5
.L2:
	movl	r(%rip), %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.data
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.long	-1
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, 12(%rsp)
	leaq	.LC0(%rip), %rdi
	movl	%esi, 8(%rsp)
	leaq	12(%rsp), %rsi
	movl	%edx, 4(%rsp)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rsp)
	leaq	4(%rsp), %rcx
	call	scanf@PLT
	movl	12(%rsp), %eax
	cmpl	%eax, i(%rip)
	jge	.L2
	movq	%rsp, %rbp
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	8(%rsp), %eax
	movl	(%rsp), %ecx
	movl	%eax, %esi
	addl	4(%rsp), %eax
	subl	4(%rsp), %esi
	cltd
	idivl	%ecx
	imull	%ecx, %eax
	cmpl	%eax, %esi
	jg	.L3
	movl	i(%rip), %eax
	leal	1(%rax), %esi
	movl	%esi, r(%rip)
	movl	%esi, i(%rip)
	cmpl	12(%rsp), %esi
	jl	.L6
.L5:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, r(%rip)
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	movl	i(%rip), %eax
	movl	r(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%eax, 12(%rsp)
	jg	.L6
	jmp	.L5
.L2:
	movl	r(%rip), %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.data
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.long	-1
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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:

i,r=-1;main(n,t,e,x){for(scanf("%d%d%d",&n,&t,&e);i<n;r=t-e>(t+e)/x*x?r:i+1,i++)scanf("%d",&x);r=!printf("%d\n",r);}
2 10 2
3 4

2

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

```c
i,r=-1;main(n,t,e,x){for(scanf("%d%d%d",&n,&t,&e);i<n;r=t-e>(t+e)/x*x?r:i+1,i++)scanf("%d",&x);r=!printf("%d\n",r);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	r
	.data
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.long	-1
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	-16(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, %ecx
	jg	.L3
	movl	i(%rip), %eax
	addl	$1, %eax
	jmp	.L4
.L3:
	movl	r(%rip), %eax
.L4:
	movl	%eax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, r(%rip)
	movl	$0, %eax
	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
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	r
	.data
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.long	-1
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	-16(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	imull	%edx, %eax
	cmpl	%eax, %ecx
	jg	.L3
	movl	i(%rip), %eax
	addl	$1, %eax
	jmp	.L4
.L3:
	movl	r(%rip), %eax
.L4:
	movl	%eax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, r(%rip)
	movl	$0, %eax
	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:
