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 int a[100001],d[100001],x[1001],syutu[1001],f[100001];
int main(void)
{
	long long int i,j,n,t,q,M,flg,a1,aba,cnt;
	M=9223372036854775807;
	scanf("%lld %lld %lld",&n,&t,&q);
	for(i=0;i<=n;i++) f[i]=M;
	for(i=1;i<=n;i++) scanf("%lld %lld",&a[i],&d[i]);
	for(i=1;i<=q;i++) scanf("%lld",&x[i]);
	flg=0; cnt=0;
	for(i=1;i<=n;i++){
		if(d[i]==1){
			a1=a[i];
			aba=i;
			flg=1;
		}
		if(d[i]==2&&flg==1){
			f[i]=(a1+a[i])/2;
			f[aba]=(a1+a[i])/2;
			flg=0;
		}
	}
	for(i=1;i<=q;i++){
		flg=0;
		if(d[x[i]]==1){
			for(j=x[i]+1;j<=n;j++){
				if(f[j]!=M&&f[j]>a[x[i]]+t) break;
				if(f[j]!=M&&f[j]<=a[x[i]]+t){	
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]+t;
		}
		if(d[x[i]]==2){
			for(j=x[i]-1;j>=0;j--){
				if(f[j]!=M&&f[j]<a[x[i]]-t) break;
				if(f[j]!=M&&f[j]>=a[x[i]]-t){
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]-t;
		}
	}
	for(i=1;i<=q;i++) printf("%lld\n",syutu[i]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 8008
x:
	.zero	8008
	.globl	syutu
	.align 32
	.type	syutu, @object
	.size	syutu, 8008
syutu:
	.zero	8008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 800008
f:
	.zero	800008
	.section	.rodata
.LC0:
	.string	"%lld %lld %lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	leaq	-72(%rbp), %rcx
	leaq	-80(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -64(%rbp)
	jmp	.L2
.L3:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	f(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -64(%rbp)
.L2:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L3
	movq	$1, -64(%rbp)
	jmp	.L4
.L5:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L4:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L5
	movq	$1, -64(%rbp)
	jmp	.L6
.L7:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L6:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L7
	movq	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	$1, -64(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L9
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -40(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	$1, -48(%rbp)
.L9:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L10
	cmpq	$1, -48(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, -48(%rbp)
.L10:
	addq	$1, -64(%rbp)
.L8:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L11
	movq	$1, -64(%rbp)
	jmp	.L12
.L25:
	movq	$0, -48(%rbp)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L18:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L15
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L30
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L16
.L17:
	addq	$1, -56(%rbp)
.L14:
	movq	-88(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jle	.L18
	jmp	.L16
.L30:
	nop
.L16:
	cmpq	$1, -48(%rbp)
	je	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L20
.L24:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L21
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L31
.L21:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L22
.L23:
	subq	$1, -56(%rbp)
.L20:
	cmpq	$0, -56(%rbp)
	jns	.L24
	jmp	.L22
.L31:
	nop
.L22:
	cmpq	$1, -48(%rbp)
	je	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-80(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L19:
	addq	$1, -64(%rbp)
.L12:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L25
	movq	$1, -64(%rbp)
	jmp	.L26
.L27:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -64(%rbp)
.L26:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L27
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	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	"%lld %lld %lld"
.LC2:
	.string	"%lld %lld"
.LC3:
	.string	"%lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	testq	%rdx, %rdx
	js	.L2
	leaq	1(%rdx), %rdi
	je	.L28
	movq	%rdi, %rcx
	leaq	f(%rip), %rsi
	movdqa	.LC1(%rip), %xmm0
	shrq	%rcx
	movq	%rsi, %rax
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L4
	movq	%rdi, %rax
	andq	$-2, %rax
	andl	$1, %edi
	je	.L5
.L3:
	movabsq	$9223372036854775807, %rcx
	movq	%rcx, (%rsi,%rax,8)
	testq	%rdx, %rdx
	jle	.L2
.L5:
	leaq	8+a(%rip), %r14
	movl	$1, %ebx
	leaq	d(%rip), %rbp
	leaq	.LC2(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	0(%rbp,%rbx,8), %rdx
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$1, %rbx
	addq	$8, %r14
	cmpq	%rbx, (%rsp)
	jge	.L8
.L2:
	movq	16(%rsp), %rsi
	leaq	8+x(%rip), %rbp
	movl	$1, %ebx
	leaq	.LC3(%rip), %r14
	testq	%rsi, %rsi
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rsi
	addq	$8, %rbp
	cmpq	%rbx, %rsi
	jge	.L9
	movq	(%rsp), %r8
	testq	%r8, %r8
	jle	.L10
.L26:
	xorl	%ecx, %ecx
	movl	$1, %eax
	leaq	d(%rip), %rbp
	leaq	a(%rip), %rdi
	leaq	f(%rip), %r9
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	cmpq	$2, %rdx
	je	.L43
.L12:
	addq	$1, %rax
	cmpq	%rax, %r8
	jl	.L10
.L13:
	movq	0(%rbp,%rax,8), %rdx
	cmpq	$1, %rdx
	jne	.L11
	movq	(%rdi,%rax,8), %r12
	movq	%rax, %r13
	addq	$1, %rax
	movl	$1, %ecx
	cmpq	%rax, %r8
	jge	.L13
.L10:
	testq	%rsi, %rsi
	jle	.L25
	leaq	x(%rip), %rcx
	movq	8(%rsp), %r11
	leaq	8+syutu(%rip), %r9
	leaq	(%rcx,%rsi,8), %r10
	leaq	d(%rip), %rbp
	movabsq	$9223372036854775807, %rsi
	leaq	a(%rip), %rbx
	leaq	f(%rip), %rdi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L18:
	addq	$8, %rcx
	addq	$8, %r9
	cmpq	%r10, %rcx
	je	.L44
.L23:
	movq	8(%rcx), %rax
	movq	0(%rbp,%rax,8), %rdx
	cmpq	$1, %rdx
	je	.L45
	cmpq	$2, %rdx
	jne	.L18
	movq	(%rbx,%rax,8), %r12
	subq	%r11, %r12
	subq	$1, %rax
	js	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	movq	(%rdi,%rax,8), %rdx
	cmpq	%rsi, %rdx
	je	.L21
	cmpq	%r12, %rdx
	jl	.L20
	movq	%rdx, (%r9)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L43:
	cmpq	$1, %rcx
	jne	.L12
	movq	(%rdi,%rax,8), %rcx
	addq	%r12, %rcx
	movq	%rcx, %rdx
	shrq	$63, %rdx
	addq	%rcx, %rdx
	xorl	%ecx, %ecx
	sarq	%rdx
	movq	%rdx, (%r9,%rax,8)
	movq	%rdx, (%r9,%r13,8)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L21:
	subq	$1, %rax
	jnb	.L22
.L20:
	addq	$8, %rcx
	movq	%r12, (%r9)
	addq	$8, %r9
	cmpq	%r10, %rcx
	jne	.L23
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$1, %ebx
	leaq	syutu(%rip), %r12
	leaq	.LC4(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L24:
	movq	(%r12,%rbx,8), %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, 16(%rsp)
	jge	.L24
.L25:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L45:
	.cfi_restore_state
	movq	(%rbx,%rax,8), %r12
	leaq	1(%rax), %rdx
	addq	%r11, %r12
	cmpq	%rdx, %r8
	jl	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movq	(%rdi,%rdx,8), %rax
	cmpq	%rsi, %rax
	je	.L17
	cmpq	%r12, %rax
	jg	.L20
	movq	%rax, (%r9)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rdx
	cmpq	%rdx, %r8
	jge	.L19
	jmp	.L20
.L42:
	movq	(%rsp), %r8
	testq	%r8, %r8
	jg	.L26
	jmp	.L25
.L28:
	xorl	%eax, %eax
	leaq	f(%rip), %rsi
	jmp	.L3
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 800008
f:
	.zero	800008
	.globl	syutu
	.align 32
	.type	syutu, @object
	.size	syutu, 8008
syutu:
	.zero	8008
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 8008
x:
	.zero	8008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.quad	9223372036854775807
	.quad	9223372036854775807
	.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	"%lld %lld %lld"
.LC2:
	.string	"%lld %lld"
.LC3:
	.string	"%lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	16(%rsp), %rcx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rdx
	testq	%rdx, %rdx
	js	.L2
	leaq	1(%rdx), %rdi
	je	.L28
	movq	%rdi, %rcx
	leaq	f(%rip), %rsi
	movdqa	.LC1(%rip), %xmm0
	shrq	%rcx
	movq	%rsi, %rax
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L4
	movq	%rdi, %rax
	andq	$-2, %rax
	andl	$1, %edi
	je	.L5
.L3:
	movabsq	$9223372036854775807, %rcx
	movq	%rcx, (%rsi,%rax,8)
	testq	%rdx, %rdx
	jle	.L2
.L5:
	leaq	8+a(%rip), %r14
	movl	$1, %ebx
	leaq	d(%rip), %rbp
	leaq	.LC2(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	0(%rbp,%rbx,8), %rdx
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$1, %rbx
	addq	$8, %r14
	cmpq	%rbx, (%rsp)
	jge	.L8
.L2:
	movq	16(%rsp), %rsi
	leaq	8+x(%rip), %rbp
	movl	$1, %ebx
	leaq	.LC3(%rip), %r14
	testq	%rsi, %rsi
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rsi
	addq	$8, %rbp
	cmpq	%rbx, %rsi
	jge	.L9
	movq	(%rsp), %r8
	testq	%r8, %r8
	jle	.L10
.L26:
	xorl	%ecx, %ecx
	movl	$1, %eax
	leaq	d(%rip), %rbp
	leaq	a(%rip), %rdi
	leaq	f(%rip), %r9
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	cmpq	$2, %rdx
	je	.L43
.L12:
	addq	$1, %rax
	cmpq	%rax, %r8
	jl	.L10
.L13:
	movq	0(%rbp,%rax,8), %rdx
	cmpq	$1, %rdx
	jne	.L11
	movq	(%rdi,%rax,8), %r12
	movq	%rax, %r13
	addq	$1, %rax
	movl	$1, %ecx
	cmpq	%rax, %r8
	jge	.L13
.L10:
	testq	%rsi, %rsi
	jle	.L25
	leaq	x(%rip), %rcx
	movq	8(%rsp), %r11
	leaq	8+syutu(%rip), %r9
	leaq	(%rcx,%rsi,8), %r10
	leaq	d(%rip), %rbp
	movabsq	$9223372036854775807, %rsi
	leaq	a(%rip), %rbx
	leaq	f(%rip), %rdi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L18:
	addq	$8, %rcx
	addq	$8, %r9
	cmpq	%r10, %rcx
	je	.L44
.L23:
	movq	8(%rcx), %rax
	movq	0(%rbp,%rax,8), %rdx
	cmpq	$1, %rdx
	je	.L45
	cmpq	$2, %rdx
	jne	.L18
	movq	(%rbx,%rax,8), %r12
	subq	%r11, %r12
	subq	$1, %rax
	js	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	movq	(%rdi,%rax,8), %rdx
	cmpq	%rsi, %rdx
	je	.L21
	cmpq	%r12, %rdx
	jl	.L20
	movq	%rdx, (%r9)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L43:
	cmpq	$1, %rcx
	jne	.L12
	movq	(%rdi,%rax,8), %rcx
	addq	%r12, %rcx
	movq	%rcx, %rdx
	shrq	$63, %rdx
	addq	%rcx, %rdx
	xorl	%ecx, %ecx
	sarq	%rdx
	movq	%rdx, (%r9,%rax,8)
	movq	%rdx, (%r9,%r13,8)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L21:
	subq	$1, %rax
	jnb	.L22
.L20:
	addq	$8, %rcx
	movq	%r12, (%r9)
	addq	$8, %r9
	cmpq	%r10, %rcx
	jne	.L23
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$1, %ebx
	leaq	syutu(%rip), %r12
	leaq	.LC4(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L24:
	movq	(%r12,%rbx,8), %rdx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, 16(%rsp)
	jge	.L24
.L25:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L45:
	.cfi_restore_state
	movq	(%rbx,%rax,8), %r12
	leaq	1(%rax), %rdx
	addq	%r11, %r12
	cmpq	%rdx, %r8
	jl	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movq	(%rdi,%rdx,8), %rax
	cmpq	%rsi, %rax
	je	.L17
	cmpq	%r12, %rax
	jg	.L20
	movq	%rax, (%r9)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %rdx
	cmpq	%rdx, %r8
	jge	.L19
	jmp	.L20
.L42:
	movq	(%rsp), %r8
	testq	%r8, %r8
	jg	.L26
	jmp	.L25
.L28:
	xorl	%eax, %eax
	leaq	f(%rip), %rsi
	jmp	.L3
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 800008
f:
	.zero	800008
	.globl	syutu
	.align 32
	.type	syutu, @object
	.size	syutu, 8008
syutu:
	.zero	8008
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 8008
x:
	.zero	8008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.quad	9223372036854775807
	.quad	9223372036854775807
	.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 int a[100001],d[100001],x[1001],syutu[1001],f[100001];
int main(void)
{
	long long int i,j,n,t,q,M,flg,a1,aba,cnt;
	M=9223372036854775807;
	scanf("%lld %lld %lld",&n,&t,&q);
	for(i=0;i<=n;i++) f[i]=M;
	for(i=1;i<=n;i++) scanf("%lld %lld",&a[i],&d[i]);
	for(i=1;i<=q;i++) scanf("%lld",&x[i]);
	flg=0; cnt=0;
	for(i=1;i<=n;i++){
		if(d[i]==1){
			a1=a[i];
			aba=i;
			flg=1;
		}
		if(d[i]==2&&flg==1){
			f[i]=(a1+a[i])/2;
			f[aba]=(a1+a[i])/2;
			flg=0;
		}
	}
	for(i=1;i<=q;i++){
		flg=0;
		if(d[x[i]]==1){
			for(j=x[i]+1;j<=n;j++){
				if(f[j]!=M&&f[j]>a[x[i]]+t) break;
				if(f[j]!=M&&f[j]<=a[x[i]]+t){	
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]+t;
		}
		if(d[x[i]]==2){
			for(j=x[i]-1;j>=0;j--){
				if(f[j]!=M&&f[j]<a[x[i]]-t) break;
				if(f[j]!=M&&f[j]>=a[x[i]]-t){
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]-t;
		}
	}
	for(i=1;i<=q;i++) printf("%lld\n",syutu[i]);
	return 0;
}
5 5 3
-8 1
-4 2
-2 2
4 0
10 1
1
3
5
 5 8 3
-8 1
-4 2
-2 2
4 1
10 1
1
3
5
 5 5 1
-8 1
-4 2
-2 2
4 2
10 1
1
3
5
 5 5 3
-8 1
-4 2
-2 2
4 0
10 1
1
5
5
 5 8 3
-8 1
-4 2
-2 2
4 1
4 1
2
3
5
 5 7 3
-8 1
-4 2
-2 2
4 1
4 1
2
3
5
 5 7 3
-8 2
-4 2
-2 2
4 1
4 1
2
3
5
 5 7 3
-8 2
-4 2
-2 2
4 1
4 1
4
3
5
 5 5 3
-10 1
-4 2
-2 2
7 2
10 1
1
3
5
 5 2 3
-8 1
-4 2
-2 2
10 2
10 1
1
3
5

-6
-6
15
 -6
-6
18
 -6
 -6
15
15
 -6
-6
12
 -6
-6
11
 -11
-9
11
 11
-9
11
 -7
-7
15
 -6
-4
12

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 int a[100001],d[100001],x[1001],syutu[1001],f[100001];
int main(void)
{
	long long int i,j,n,t,q,M,flg,a1,aba,cnt;
	M=9223372036854775807;
	scanf("%lld %lld %lld",&n,&t,&q);
	for(i=0;i<=n;i++) f[i]=M;
	for(i=1;i<=n;i++) scanf("%lld %lld",&a[i],&d[i]);
	for(i=1;i<=q;i++) scanf("%lld",&x[i]);
	flg=0; cnt=0;
	for(i=1;i<=n;i++){
		if(d[i]==1){
			a1=a[i];
			aba=i;
			flg=1;
		}
		if(d[i]==2&&flg==1){
			f[i]=(a1+a[i])/2;
			f[aba]=(a1+a[i])/2;
			flg=0;
		}
	}
	for(i=1;i<=q;i++){
		flg=0;
		if(d[x[i]]==1){
			for(j=x[i]+1;j<=n;j++){
				if(f[j]!=M&&f[j]>a[x[i]]+t) break;
				if(f[j]!=M&&f[j]<=a[x[i]]+t){	
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]+t;
		}
		if(d[x[i]]==2){
			for(j=x[i]-1;j>=0;j--){
				if(f[j]!=M&&f[j]<a[x[i]]-t) break;
				if(f[j]!=M&&f[j]>=a[x[i]]-t){
					syutu[i]=f[j];
					flg=1;
					break;
				}
			}
			if(flg!=1) syutu[i]=a[x[i]]-t;
		}
	}
	for(i=1;i<=q;i++) printf("%lld\n",syutu[i]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 8008
x:
	.zero	8008
	.globl	syutu
	.align 32
	.type	syutu, @object
	.size	syutu, 8008
syutu:
	.zero	8008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 800008
f:
	.zero	800008
	.section	.rodata
.LC0:
	.string	"%lld %lld %lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	leaq	-72(%rbp), %rcx
	leaq	-80(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -64(%rbp)
	jmp	.L2
.L3:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	f(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -64(%rbp)
.L2:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L3
	movq	$1, -64(%rbp)
	jmp	.L4
.L5:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L4:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L5
	movq	$1, -64(%rbp)
	jmp	.L6
.L7:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L6:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L7
	movq	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	$1, -64(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L9
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -40(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	$1, -48(%rbp)
.L9:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L10
	cmpq	$1, -48(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, -48(%rbp)
.L10:
	addq	$1, -64(%rbp)
.L8:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L11
	movq	$1, -64(%rbp)
	jmp	.L12
.L25:
	movq	$0, -48(%rbp)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L18:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L15
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L30
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L16
.L17:
	addq	$1, -56(%rbp)
.L14:
	movq	-88(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jle	.L18
	jmp	.L16
.L30:
	nop
.L16:
	cmpq	$1, -48(%rbp)
	je	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L20
.L24:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L21
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L31
.L21:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L22
.L23:
	subq	$1, -56(%rbp)
.L20:
	cmpq	$0, -56(%rbp)
	jns	.L24
	jmp	.L22
.L31:
	nop
.L22:
	cmpq	$1, -48(%rbp)
	je	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-80(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L19:
	addq	$1, -64(%rbp)
.L12:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L25
	movq	$1, -64(%rbp)
	jmp	.L26
.L27:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -64(%rbp)
.L26:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L27
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	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.
val
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 8008
x:
	.zero	8008
	.globl	syutu
	.align 32
	.type	syutu, @object
	.size	syutu, 8008
syutu:
	.zero	8008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 800008
f:
	.zero	800008
	.section	.rodata
.LC0:
	.string	"%lld %lld %lld"
.LC1:
	.string	"%lld %lld"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	leaq	-72(%rbp), %rcx
	leaq	-80(%rbp), %rdx
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -64(%rbp)
	jmp	.L2
.L3:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	f(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -64(%rbp)
.L2:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L3
	movq	$1, -64(%rbp)
	jmp	.L4
.L5:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L4:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L5
	movq	$1, -64(%rbp)
	jmp	.L6
.L7:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -64(%rbp)
.L6:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L7
	movq	$0, -48(%rbp)
	movq	$0, -16(%rbp)
	movq	$1, -64(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L9
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -40(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	$1, -48(%rbp)
.L9:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L10
	cmpq	$1, -48(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, -48(%rbp)
.L10:
	addq	$1, -64(%rbp)
.L8:
	movq	-88(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L11
	movq	$1, -64(%rbp)
	jmp	.L12
.L25:
	movq	$0, -48(%rbp)
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L18:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L15
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L30
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	movq	-80(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L17
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L16
.L17:
	addq	$1, -56(%rbp)
.L14:
	movq	-88(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jle	.L18
	jmp	.L16
.L30:
	nop
.L16:
	cmpq	$1, -48(%rbp)
	je	.L13
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$2, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	subq	$1, %rax
	movq	%rax, -56(%rbp)
	jmp	.L20
.L24:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L21
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L31
.L21:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -24(%rbp)
	je	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	movq	-80(%rbp), %rcx
	subq	%rcx, %rdx
	cmpq	%rdx, %rax
	jl	.L23
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	f(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	syutu(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	$1, -48(%rbp)
	jmp	.L22
.L23:
	subq	$1, -56(%rbp)
.L20:
	cmpq	$0, -56(%rbp)
	jns	.L24
	jmp	.L22
.L31:
	nop
.L22:
	cmpq	$1, -48(%rbp)
	je	.L19
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	x(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-80(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L19:
	addq	$1, -64(%rbp)
.L12:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L25
	movq	$1, -64(%rbp)
	jmp	.L26
.L27:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	syutu(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -64(%rbp)
.L26:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jle	.L27
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	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:
