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 <stdbool.h>

#define MAX 300000

bool Trampoline(void);

int d[MAX];
int N;

int main(void) {
  int i, tmp;

  scanf("%d", &N);

  for(i=0; i<N; ++i) {
    scanf("%d", &d[i]);
  }

  if(!Trampoline()) {
    printf("no\n");
    return 0;
  }

  for(i=0; i<N/2; ++i) {
    tmp = d[i];
    d[i] = d[N-1-i];
    d[N-1-i] = tmp;
  }

  if(Trampoline()) printf("yes\n");
  else printf("no\n");

  return 0;
}

bool Trampoline(void) {
  int i, dmax = 0;

  for(i=0; i<N; ++i) {
    if(dmax < 10*i) return false;
    if(dmax < 10*i+d[i]) dmax = 10*i + d[i];
  }

  return true;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 1200000
d:
	.zero	1200000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"no"
.LC2:
	.string	"yes"
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L2
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	call	Trampoline
	xorl	$1, %eax
	testb	%al, %al
	je	.L4
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	call	Trampoline
	testb	%al, %al
	je	.L8
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	Trampoline
	.type	Trampoline, @function
Trampoline:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L15:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L12
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L14
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L14:
	addl	$1, -8(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L15
	movl	$1, %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Trampoline, .-Trampoline
	.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"
.LC1:
	.string	"yes"
.LC2:
	.string	"no"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	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
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	d(%rip), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	(%rcx,%rcx,4), %eax
	xorl	%edx, %edx
	leal	-10(%rax,%rax), %edi
	xorl	%eax, %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$10, %eax
	addq	$4, %rbx
	cmpl	%edx, %eax
	jg	.L5
.L4:
	movl	(%rbx), %esi
	addl	%eax, %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	cmpl	%edi, %eax
	jne	.L6
	movl	%ecx, %esi
	sarl	%esi
	cmpl	$1, %ecx
	je	.L17
	movslq	%esi, %rdx
	movslq	%ecx, %rdi
	movl	$4, %r8d
	xorl	%r9d, %r9d
	salq	$2, %rdx
	salq	$2, %rdi
	leal	-1(%rcx), %eax
	subq	%rdx, %r8
	testl	%esi, %esi
	cmovle	%r9, %r8
	addq	%r13, %rdx
	leaq	4+d(%rip), %r9
	leaq	-4(%rdi,%r8), %r8
	addq	%r13, %r8
	testl	%esi, %esi
	cmovle	%r9, %rdx
	cmpq	%rdx, %r8
	jb	.L8
	cmpl	$1, %esi
	jle	.L8
	testl	%esi, %esi
	movl	$1, %r9d
	cmovg	%esi, %r9d
	cmpl	$3, %esi
	jle	.L21
	leaq	d(%rip), %rdx
	leaq	-16(%r13,%rdi), %rsi
	movl	%r9d, %r8d
	shrl	$2, %r8d
	leaq	16(%rdx), %r10
	subl	$1, %r8d
	salq	$4, %r8
	addq	%r10, %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rsi), %xmm2
	movdqa	(%rdx), %xmm0
	addq	$16, %rdx
	subq	$16, %rsi
	pshufd	$27, %xmm2, %xmm1
	pshufd	$27, %xmm0, %xmm0
	movaps	%xmm1, -16(%rdx)
	movups	%xmm0, 16(%rsi)
	cmpq	%r8, %rdx
	jne	.L10
	movl	%r9d, %edx
	andl	$-4, %edx
	movl	%edx, %esi
	cmpl	%edx, %r9d
	je	.L15
.L9:
	subl	%edx, %r9d
	cmpl	$1, %r9d
	je	.L12
	salq	$2, %rdx
	subq	$8, %rdi
	subq	%rdx, %rdi
	leaq	0(%r13,%rdx), %r8
	leaq	0(%r13,%rdi), %rdx
	movq	(%r8), %xmm0
	movq	(%rdx), %xmm1
	pshufd	$225, %xmm0, %xmm0
	pshufd	$225, %xmm1, %xmm1
	movq	%xmm1, (%r8)
	movq	%xmm0, (%rdx)
	movl	%r9d, %edx
	andl	$-2, %edx
	addl	%edx, %esi
	cmpl	%edx, %r9d
	je	.L15
.L12:
	subl	%esi, %eax
	movslq	%esi, %rdx
	cltq
	movl	0(%r13,%rdx,4), %edi
	movl	0(%r13,%rax,4), %esi
	movl	%esi, 0(%r13,%rdx,4)
	movl	%edi, 0(%r13,%rax,4)
.L15:
	movl	$1, %edx
	xorl	%eax, %eax
	leaq	-4+d(%rip), %r8
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L20:
	movl	(%r8,%rdx,4), %edi
	addl	%esi, %edi
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	cmpl	%edx, %ecx
	jle	.L17
	addl	$10, %esi
	addq	$1, %rdx
	cmpl	%esi, %eax
	jge	.L20
.L5:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L17:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L8:
	leaq	0(%r13,%rdi), %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L14:
	movl	-4(%rax), %r8d
	movl	0(%r13,%rdx,4), %edi
	subq	$4, %rax
	movl	%r8d, 0(%r13,%rdx,4)
	addq	$1, %rdx
	movl	%edi, (%rax)
	cmpl	%edx, %esi
	jg	.L14
	jmp	.L15
.L21:
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L9
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Trampoline
	.type	Trampoline, @function
Trampoline:
.LFB24:
	.cfi_startproc
	endbr64
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L42
	leal	(%rax,%rax,4), %eax
	leaq	d(%rip), %rcx
	xorl	%edx, %edx
	leal	-10(%rax,%rax), %edi
	xorl	%eax, %eax
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L41:
	addl	$10, %eax
	addq	$4, %rcx
	cmpl	%eax, %edx
	jl	.L43
.L40:
	movl	(%rcx), %esi
	addl	%eax, %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	cmpl	%eax, %edi
	jne	.L41
.L42:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	Trampoline, .-Trampoline
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 1200000
d:
	.zero	1200000
	.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"
.LC1:
	.string	"yes"
.LC2:
	.string	"no"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	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
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	d(%rip), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	(%rcx,%rcx,4), %eax
	xorl	%edx, %edx
	leal	-10(%rax,%rax), %edi
	xorl	%eax, %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$10, %eax
	addq	$4, %rbx
	cmpl	%edx, %eax
	jg	.L5
.L4:
	movl	(%rbx), %esi
	addl	%eax, %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	cmpl	%edi, %eax
	jne	.L6
	movl	%ecx, %esi
	sarl	%esi
	cmpl	$1, %ecx
	je	.L17
	movslq	%esi, %rdx
	movslq	%ecx, %rdi
	movl	$4, %r8d
	xorl	%r9d, %r9d
	salq	$2, %rdx
	salq	$2, %rdi
	leal	-1(%rcx), %eax
	subq	%rdx, %r8
	testl	%esi, %esi
	cmovle	%r9, %r8
	addq	%r13, %rdx
	leaq	4+d(%rip), %r9
	leaq	-4(%rdi,%r8), %r8
	addq	%r13, %r8
	testl	%esi, %esi
	cmovle	%r9, %rdx
	cmpq	%rdx, %r8
	jb	.L8
	cmpl	$1, %esi
	jle	.L8
	testl	%esi, %esi
	movl	$1, %r9d
	cmovg	%esi, %r9d
	cmpl	$3, %esi
	jle	.L21
	leaq	d(%rip), %rdx
	leaq	-16(%r13,%rdi), %rsi
	movl	%r9d, %r8d
	shrl	$2, %r8d
	leaq	16(%rdx), %r10
	subl	$1, %r8d
	salq	$4, %r8
	addq	%r10, %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rsi), %xmm2
	movdqa	(%rdx), %xmm0
	addq	$16, %rdx
	subq	$16, %rsi
	pshufd	$27, %xmm2, %xmm1
	pshufd	$27, %xmm0, %xmm0
	movaps	%xmm1, -16(%rdx)
	movups	%xmm0, 16(%rsi)
	cmpq	%r8, %rdx
	jne	.L10
	movl	%r9d, %edx
	andl	$-4, %edx
	movl	%edx, %esi
	cmpl	%edx, %r9d
	je	.L15
.L9:
	subl	%edx, %r9d
	cmpl	$1, %r9d
	je	.L12
	salq	$2, %rdx
	subq	$8, %rdi
	subq	%rdx, %rdi
	leaq	0(%r13,%rdx), %r8
	leaq	0(%r13,%rdi), %rdx
	movq	(%r8), %xmm0
	movq	(%rdx), %xmm1
	pshufd	$225, %xmm0, %xmm0
	pshufd	$225, %xmm1, %xmm1
	movq	%xmm1, (%r8)
	movq	%xmm0, (%rdx)
	movl	%r9d, %edx
	andl	$-2, %edx
	addl	%edx, %esi
	cmpl	%edx, %r9d
	je	.L15
.L12:
	subl	%esi, %eax
	movslq	%esi, %rdx
	cltq
	movl	0(%r13,%rdx,4), %edi
	movl	0(%r13,%rax,4), %esi
	movl	%esi, 0(%r13,%rdx,4)
	movl	%edi, 0(%r13,%rax,4)
.L15:
	movl	$1, %edx
	xorl	%eax, %eax
	leaq	-4+d(%rip), %r8
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L20:
	movl	(%r8,%rdx,4), %edi
	addl	%esi, %edi
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	cmpl	%edx, %ecx
	jle	.L17
	addl	$10, %esi
	addq	$1, %rdx
	cmpl	%esi, %eax
	jge	.L20
.L5:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L17:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L8:
	leaq	0(%r13,%rdi), %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L14:
	movl	-4(%rax), %r8d
	movl	0(%r13,%rdx,4), %edi
	subq	$4, %rax
	movl	%r8d, 0(%r13,%rdx,4)
	addq	$1, %rdx
	movl	%edi, (%rax)
	cmpl	%edx, %esi
	jg	.L14
	jmp	.L15
.L21:
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L9
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Trampoline
	.type	Trampoline, @function
Trampoline:
.LFB24:
	.cfi_startproc
	endbr64
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L42
	leal	(%rax,%rax,4), %eax
	leaq	d(%rip), %rcx
	xorl	%edx, %edx
	leal	-10(%rax,%rax), %edi
	xorl	%eax, %eax
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L41:
	addl	$10, %eax
	addq	$4, %rcx
	cmpl	%eax, %edx
	jl	.L43
.L40:
	movl	(%rcx), %esi
	addl	%eax, %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	cmpl	%eax, %edi
	jne	.L41
.L42:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	Trampoline, .-Trampoline
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 1200000
d:
	.zero	1200000
	.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 <stdbool.h>

#define MAX 300000

bool Trampoline(void);

int d[MAX];
int N;

int main(void) {
  int i, tmp;

  scanf("%d", &N);

  for(i=0; i<N; ++i) {
    scanf("%d", &d[i]);
  }

  if(!Trampoline()) {
    printf("no\n");
    return 0;
  }

  for(i=0; i<N/2; ++i) {
    tmp = d[i];
    d[i] = d[N-1-i];
    d[N-1-i] = tmp;
  }

  if(Trampoline()) printf("yes\n");
  else printf("no\n");

  return 0;
}

bool Trampoline(void) {
  int i, dmax = 0;

  for(i=0; i<N; ++i) {
    if(dmax < 10*i) return false;
    if(dmax < 10*i+d[i]) dmax = 10*i + d[i];
  }

  return true;
}


4
20
51
1
20
 4
20
5
17
1
 3
12
5
10
 4
37
51
1
20
 4
20
5
5
1
 3
20
5
10
 4
54
51
1
20
 4
35
5
5
1
 3
20
5
5
 4
84
51
1
20

yes
 no
 no
 yes
 no
 no
 yes
 no
 no
 yes

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 <stdbool.h>

#define MAX 300000

bool Trampoline(void);

int d[MAX];
int N;

int main(void) {
  int i, tmp;

  scanf("%d", &N);

  for(i=0; i<N; ++i) {
    scanf("%d", &d[i]);
  }

  if(!Trampoline()) {
    printf("no\n");
    return 0;
  }

  for(i=0; i<N/2; ++i) {
    tmp = d[i];
    d[i] = d[N-1-i];
    d[N-1-i] = tmp;
  }

  if(Trampoline()) printf("yes\n");
  else printf("no\n");

  return 0;
}

bool Trampoline(void) {
  int i, dmax = 0;

  for(i=0; i<N; ++i) {
    if(dmax < 10*i) return false;
    if(dmax < 10*i+d[i]) dmax = 10*i + d[i];
  }

  return true;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 1200000
d:
	.zero	1200000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"no"
.LC2:
	.string	"yes"
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L2
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	call	Trampoline
	xorl	$1, %eax
	testb	%al, %al
	je	.L4
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	call	Trampoline
	testb	%al, %al
	je	.L8
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	Trampoline
	.type	Trampoline, @function
Trampoline:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L15:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L12
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L14
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L14:
	addl	$1, -8(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L15
	movl	$1, %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Trampoline, .-Trampoline
	.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	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 1200000
d:
	.zero	1200000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"no"
.LC2:
	.string	"yes"
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L2
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	call	Trampoline
	xorl	$1, %eax
	testb	%al, %al
	je	.L4
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	call	Trampoline
	testb	%al, %al
	je	.L8
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	Trampoline
	.type	Trampoline, @function
Trampoline:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L15:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L12
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L14
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L14:
	addl	$1, -8(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L15
	movl	$1, %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Trampoline, .-Trampoline
	.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:
