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>

#define N_MAX 110000

int N;
int x[N_MAX];
int L;
int Q;
int a, b;

int ikeru_left[30][N_MAX];
int ikeru_right[30][N_MAX];

void maesyori(void) {
	int i, j;
	/* 各ホテルから1日で行けるホテルを求める */
	for (i = 0; i < N; i++) {
		int left, right, mid;
		/* 左へ */
		left = 0; ikeru_left[0][i] = right = i;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[i] - x[mid] <= L) {
				/* 行ける */
				right = mid - 1;
				if (mid < ikeru_left[0][i]) ikeru_left[0][i] = mid;
			} else {
				/* 行けない */
				left = mid + 1;
			}
		}
		/* 右へ */
		ikeru_right[0][i] = left = i; right = N - 1;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[mid] - x[i] <= L) {
				/* 行ける */
				left = mid + 1;
				if (ikeru_right[0][i] < mid) ikeru_right[0][i] = mid;
			} else {
				/* 行けない */
				right = mid - 1;
			}
		}
	}
	/* 各ホテルから2**k日で行けるホテルを求める */
	for (j = 1; j < 30; j++) {
		for (i = 0; i < N; i++) {
			ikeru_left[j][i] = ikeru_left[j - 1][ikeru_left[j - 1][i]];
			ikeru_right[j][i] = ikeru_right[j - 1][ikeru_right[j - 1][i]];
		}
	}
}

int motomeru(int start, int day, int ikeru[][N_MAX]) {
	int cur = start;
	int i;
	for (i = 0; i < 30; i++) {
		if ((day >> i) & 1) cur = ikeru[i][cur];
	}
	return cur;
}

int main(void) {
	int i, query_count;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &x[i]) != 1) return 1;
	}
	if (scanf("%d%d", &L, &Q) != 2) return 1;
	maesyori();
	for (query_count = 0; query_count < Q; query_count++) {
		int left, right, mid;
		int ret = N + 10;
		if (scanf("%d%d", &a, &b) != 2) return 1;
		a--; b--;
		left = 0; right = N; /* 着けるから絶対付くまで進捗する */
		while (left <= right) {
			int judge;
			mid = (left + right) / 2;
			if (a < b) {
				judge = motomeru(a, mid, ikeru_right) >= b;
			} else {
				judge = motomeru(a, mid, ikeru_left) <= b;
			}
			if (judge) {
				if (mid < ret) ret = mid;
				right = mid - 1;
			} else {
				left = mid + 1;
			}
		}
		printf("%d\n", ret);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 440000
x:
	.zero	440000
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	ikeru_left
	.align 32
	.type	ikeru_left, @object
	.size	ikeru_left, 13200000
ikeru_left:
	.zero	13200000
	.globl	ikeru_right
	.align 32
	.type	ikeru_right, @object
	.size	ikeru_right, 13200000
ikeru_right:
	.zero	13200000
	.text
	.globl	maesyori
	.type	maesyori, @function
maesyori:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -20(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L5:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L4
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L5
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L8
	addl	$1, -20(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$1, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	cmpl	$29, -16(%rbp)
	jle	.L13
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	maesyori, .-maesyori
	.globl	motomeru
	.type	motomeru, @function
motomeru:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L15
.L17:
	movl	-4(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L16
	movl	-4(%rbp), %eax
	cltq
	imulq	$440000, %rax, %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	movl	%eax, -8(%rbp)
.L16:
	addl	$1, -4(%rbp)
.L15:
	cmpl	$29, -4(%rbp)
	jle	.L17
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	motomeru, .-motomeru
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -28(%rbp)
	jmp	.L22
.L24:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L24
	leaq	Q(%rip), %rax
	movq	%rax, %rdx
	leaq	L(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L25
	movl	$1, %eax
	jmp	.L21
.L25:
	call	maesyori
	movl	$0, -24(%rbp)
	jmp	.L26
.L34:
	movl	N(%rip), %eax
	addl	$10, %eax
	movl	%eax, -12(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L21
.L27:
	movl	a(%rip), %eax
	subl	$1, %eax
	movl	%eax, a(%rip)
	movl	b(%rip), %eax
	subl	$1, %eax
	movl	%eax, b(%rip)
	movl	$0, -20(%rbp)
	movl	N(%rip), %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L33:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	a(%rip), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jge	.L29
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_right(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setge	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
	jmp	.L30
.L29:
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_left(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setle	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
.L30:
	cmpl	$0, -8(%rbp)
	je	.L31
	movl	-4(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L32:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L31:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
.L28:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24(%rbp)
.L26:
	movl	Q(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L34
	movl	$0, %eax
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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
	.p2align 4
	.globl	maesyori
	.type	maesyori, @function
maesyori:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	N(%rip), %eax
	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
	movl	%eax, -4(%rsp)
	testl	%eax, %eax
	jle	.L1
	leaq	ikeru_left(%rip), %rbx
	leaq	x(%rip), %rcx
	movl	L(%rip), %esi
	xorl	%r9d, %r9d
	leaq	ikeru_right(%rip), %r11
	leal	-1(%rax), %r14d
	movq	%rbx, %r12
	movq	%rcx, %r13
	movq	%r11, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%r9d, (%r12)
	movl	0(%r13), %r8d
	movl	%r9d, %edi
	xorl	%edx, %edx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L32:
	leal	-1(%rax), %edi
	cmpl	%eax, (%r12)
	jle	.L4
	movl	%eax, (%r12)
.L4:
	cmpl	%edx, %edi
	jl	.L31
.L5:
	leal	(%rdx,%rdi), %eax
	movl	%r8d, %r10d
	sarl	%eax
	movslq	%eax, %r15
	subl	(%rcx,%r15,4), %r10d
	cmpl	%esi, %r10d
	jle	.L32
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jge	.L5
.L31:
	movl	%r9d, 0(%rbp)
	movl	%r14d, %r15d
	movl	%r9d, %edi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L34:
	leal	1(%rax), %edi
	cmpl	%eax, 0(%rbp)
	jge	.L16
	movl	%eax, 0(%rbp)
.L16:
	cmpl	%edi, %r15d
	jl	.L33
.L6:
	leal	(%r15,%rdi), %eax
	sarl	%eax
	movslq	%eax, %rdx
	movl	(%rcx,%rdx,4), %edx
	subl	%r8d, %edx
	cmpl	%edx, %esi
	jge	.L34
	leal	-1(%rax), %r15d
	cmpl	%edi, %r15d
	jge	.L6
.L33:
	addl	$1, %r9d
	addq	$4, %r12
	addq	$4, %r13
	addq	$4, %rbp
	cmpl	%r14d, %r9d
	jle	.L7
	cmpl	%r9d, -4(%rsp)
	jle	.L14
	movslq	%r9d, %r9
	leaq	(%rbx,%r9,4), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%r9d, 0(%rbp)
	movl	(%rcx,%r9,4), %r12d
	movl	%r9d, %r13d
	movl	%r9d, %edi
	xorl	%edx, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	leal	-1(%rax), %edi
	cmpl	%eax, 0(%rbp)
	jle	.L11
	movl	%eax, 0(%rbp)
.L11:
	cmpl	%edx, %edi
	jl	.L35
.L12:
	leal	(%rdi,%rdx), %eax
	movl	%r12d, %r14d
	sarl	%eax
	movslq	%eax, %r8
	subl	(%rcx,%r8,4), %r14d
	cmpl	%r14d, %esi
	jge	.L36
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jge	.L12
.L35:
	movl	%r13d, (%r11,%r9,4)
	addq	$4, %rbp
	addq	$1, %r9
	cmpl	%r9d, -4(%rsp)
	jg	.L13
.L14:
	leaq	ikeru_left(%rip), %r9
	leaq	ikeru_right(%rip), %rdi
	movslq	-4(%rsp), %r10
	xorl	%ebp, %ebp
	leaq	440000(%r9), %r8
	leaq	440000(%rdi), %rsi
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebp, %rcx
	xorl	%eax, %eax
	imulq	$110000, %rcx, %rcx
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r9,%rax,4), %rdx
	addq	%rcx, %rdx
	movl	(%rbx,%rdx,4), %edx
	movl	%edx, (%r8,%rax,4)
	movslq	(%rdi,%rax,4), %rdx
	addq	%rcx, %rdx
	movl	(%r11,%rdx,4), %edx
	movl	%edx, (%rsi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r10
	jne	.L18
	addq	$1, %rbp
	addq	$440000, %r9
	addq	$440000, %r8
	addq	$440000, %rdi
	addq	$440000, %rsi
	cmpq	$29, %rbp
	jne	.L9
.L1:
	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
	.cfi_endproc
.LFE23:
	.size	maesyori, .-maesyori
	.p2align 4
	.globl	motomeru
	.type	motomeru, @function
motomeru:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L39:
	btl	%ecx, %esi
	jnc	.L38
	movslq	(%rdx,%rax,4), %rax
.L38:
	addl	$1, %ecx
	addq	$440000, %rdx
	cmpl	$30, %ecx
	jne	.L39
	ret
	.cfi_endproc
.LFE24:
	.size	motomeru, .-motomeru
	.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:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L45
	cmpl	$0, N(%rip)
	jle	.L46
	leaq	x(%rip), %rbx
	xorl	%ebp, %ebp
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jle	.L46
.L47:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L78
.L45:
	movl	$1, %eax
.L44:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L46:
	.cfi_restore_state
	leaq	.LC1(%rip), %rbp
	xorl	%eax, %eax
	leaq	Q(%rip), %rdx
	leaq	L(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L45
	call	maesyori
	xorl	%ebx, %ebx
	cmpl	$0, Q(%rip)
	leaq	b(%rip), %r13
	leaq	a(%rip), %r12
	jle	.L59
.L48:
	movl	N(%rip), %eax
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	leal	10(%rax), %r14d
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L45
	movl	a(%rip), %r8d
	movl	b(%rip), %r10d
	movl	N(%rip), %esi
	leal	-1(%r8), %r9d
	leal	-1(%r10), %r11d
	movl	%r9d, a(%rip)
	movl	%r11d, b(%rip)
	testl	%esi, %esi
	js	.L50
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L58:
	leal	(%rsi,%rdi), %ecx
	sarl	%ecx
	cmpl	%r10d, %r8d
	jge	.L51
.L80:
	leaq	ikeru_right(%rip), %rdx
	movslq	%r9d, %r15
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L53:
	btl	%eax, %ecx
	jnc	.L52
	movslq	(%rdx,%r15,4), %r15
.L52:
	addl	$1, %eax
	addq	$440000, %rdx
	cmpl	$30, %eax
	jne	.L53
	xorl	%eax, %eax
	cmpl	%r15d, %r11d
	setle	%al
.L54:
	testl	%eax, %eax
	je	.L79
	cmpl	%ecx, %r14d
	leal	-1(%rcx), %esi
	cmovg	%ecx, %r14d
	cmpl	%edi, %esi
	jge	.L58
.L50:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, Q(%rip)
	jg	.L48
.L59:
	xorl	%eax, %eax
	jmp	.L44
.L79:
	leal	1(%rcx), %edi
	cmpl	%esi, %edi
	jg	.L50
	leal	(%rsi,%rdi), %ecx
	sarl	%ecx
	cmpl	%r10d, %r8d
	jl	.L80
.L51:
	leaq	ikeru_left(%rip), %rdx
	movslq	%r9d, %r15
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L56:
	btl	%eax, %ecx
	jnc	.L55
	movslq	(%rdx,%r15,4), %r15
.L55:
	addl	$1, %eax
	addq	$440000, %rdx
	cmpl	$30, %eax
	jne	.L56
	xorl	%eax, %eax
	cmpl	%r15d, %r11d
	setge	%al
	jmp	.L54
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	ikeru_right
	.bss
	.align 32
	.type	ikeru_right, @object
	.size	ikeru_right, 13200000
ikeru_right:
	.zero	13200000
	.globl	ikeru_left
	.align 32
	.type	ikeru_left, @object
	.size	ikeru_left, 13200000
ikeru_left:
	.zero	13200000
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 440000
x:
	.zero	440000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.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
	.p2align 4
	.globl	maesyori
	.type	maesyori, @function
maesyori:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	N(%rip), %eax
	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
	movl	%eax, -4(%rsp)
	testl	%eax, %eax
	jle	.L1
	leaq	ikeru_left(%rip), %rbx
	leaq	x(%rip), %rcx
	movl	L(%rip), %esi
	xorl	%r9d, %r9d
	leaq	ikeru_right(%rip), %r11
	leal	-1(%rax), %r14d
	movq	%rbx, %r12
	movq	%rcx, %r13
	movq	%r11, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%r9d, (%r12)
	movl	0(%r13), %r8d
	movl	%r9d, %edi
	xorl	%edx, %edx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L32:
	leal	-1(%rax), %edi
	cmpl	%eax, (%r12)
	jle	.L4
	movl	%eax, (%r12)
.L4:
	cmpl	%edx, %edi
	jl	.L31
.L5:
	leal	(%rdx,%rdi), %eax
	movl	%r8d, %r10d
	sarl	%eax
	movslq	%eax, %r15
	subl	(%rcx,%r15,4), %r10d
	cmpl	%esi, %r10d
	jle	.L32
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jge	.L5
.L31:
	movl	%r9d, 0(%rbp)
	movl	%r14d, %r15d
	movl	%r9d, %edi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L34:
	leal	1(%rax), %edi
	cmpl	%eax, 0(%rbp)
	jge	.L16
	movl	%eax, 0(%rbp)
.L16:
	cmpl	%edi, %r15d
	jl	.L33
.L6:
	leal	(%r15,%rdi), %eax
	sarl	%eax
	movslq	%eax, %rdx
	movl	(%rcx,%rdx,4), %edx
	subl	%r8d, %edx
	cmpl	%edx, %esi
	jge	.L34
	leal	-1(%rax), %r15d
	cmpl	%edi, %r15d
	jge	.L6
.L33:
	addl	$1, %r9d
	addq	$4, %r12
	addq	$4, %r13
	addq	$4, %rbp
	cmpl	%r14d, %r9d
	jle	.L7
	cmpl	%r9d, -4(%rsp)
	jle	.L14
	movslq	%r9d, %r9
	leaq	(%rbx,%r9,4), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%r9d, 0(%rbp)
	movl	(%rcx,%r9,4), %r12d
	movl	%r9d, %r13d
	movl	%r9d, %edi
	xorl	%edx, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	leal	-1(%rax), %edi
	cmpl	%eax, 0(%rbp)
	jle	.L11
	movl	%eax, 0(%rbp)
.L11:
	cmpl	%edx, %edi
	jl	.L35
.L12:
	leal	(%rdi,%rdx), %eax
	movl	%r12d, %r14d
	sarl	%eax
	movslq	%eax, %r8
	subl	(%rcx,%r8,4), %r14d
	cmpl	%r14d, %esi
	jge	.L36
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jge	.L12
.L35:
	movl	%r13d, (%r11,%r9,4)
	addq	$4, %rbp
	addq	$1, %r9
	cmpl	%r9d, -4(%rsp)
	jg	.L13
.L14:
	leaq	ikeru_left(%rip), %r9
	leaq	ikeru_right(%rip), %rdi
	movslq	-4(%rsp), %r10
	xorl	%ebp, %ebp
	leaq	440000(%r9), %r8
	leaq	440000(%rdi), %rsi
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebp, %rcx
	xorl	%eax, %eax
	imulq	$110000, %rcx, %rcx
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r9,%rax,4), %rdx
	addq	%rcx, %rdx
	movl	(%rbx,%rdx,4), %edx
	movl	%edx, (%r8,%rax,4)
	movslq	(%rdi,%rax,4), %rdx
	addq	%rcx, %rdx
	movl	(%r11,%rdx,4), %edx
	movl	%edx, (%rsi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r10
	jne	.L18
	addq	$1, %rbp
	addq	$440000, %r9
	addq	$440000, %r8
	addq	$440000, %rdi
	addq	$440000, %rsi
	cmpq	$29, %rbp
	jne	.L9
.L1:
	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
	.cfi_endproc
.LFE23:
	.size	maesyori, .-maesyori
	.p2align 4
	.globl	motomeru
	.type	motomeru, @function
motomeru:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L39:
	btl	%ecx, %esi
	jnc	.L38
	movslq	(%rdx,%rax,4), %rax
.L38:
	addl	$1, %ecx
	addq	$440000, %rdx
	cmpl	$30, %ecx
	jne	.L39
	ret
	.cfi_endproc
.LFE24:
	.size	motomeru, .-motomeru
	.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:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	N(%rip), %rsi
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L45
	cmpl	$0, N(%rip)
	jle	.L46
	leaq	x(%rip), %rbx
	xorl	%ebp, %ebp
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jle	.L46
.L47:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L78
.L45:
	movl	$1, %eax
.L44:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L46:
	.cfi_restore_state
	leaq	.LC1(%rip), %rbp
	xorl	%eax, %eax
	leaq	Q(%rip), %rdx
	leaq	L(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L45
	call	maesyori
	xorl	%ebx, %ebx
	cmpl	$0, Q(%rip)
	leaq	b(%rip), %r13
	leaq	a(%rip), %r12
	jle	.L59
.L48:
	movl	N(%rip), %eax
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	leal	10(%rax), %r14d
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L45
	movl	a(%rip), %r8d
	movl	b(%rip), %r10d
	movl	N(%rip), %esi
	leal	-1(%r8), %r9d
	leal	-1(%r10), %r11d
	movl	%r9d, a(%rip)
	movl	%r11d, b(%rip)
	testl	%esi, %esi
	js	.L50
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L58:
	leal	(%rsi,%rdi), %ecx
	sarl	%ecx
	cmpl	%r10d, %r8d
	jge	.L51
.L80:
	leaq	ikeru_right(%rip), %rdx
	movslq	%r9d, %r15
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L53:
	btl	%eax, %ecx
	jnc	.L52
	movslq	(%rdx,%r15,4), %r15
.L52:
	addl	$1, %eax
	addq	$440000, %rdx
	cmpl	$30, %eax
	jne	.L53
	xorl	%eax, %eax
	cmpl	%r15d, %r11d
	setle	%al
.L54:
	testl	%eax, %eax
	je	.L79
	cmpl	%ecx, %r14d
	leal	-1(%rcx), %esi
	cmovg	%ecx, %r14d
	cmpl	%edi, %esi
	jge	.L58
.L50:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, Q(%rip)
	jg	.L48
.L59:
	xorl	%eax, %eax
	jmp	.L44
.L79:
	leal	1(%rcx), %edi
	cmpl	%esi, %edi
	jg	.L50
	leal	(%rsi,%rdi), %ecx
	sarl	%ecx
	cmpl	%r10d, %r8d
	jl	.L80
.L51:
	leaq	ikeru_left(%rip), %rdx
	movslq	%r9d, %r15
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L56:
	btl	%eax, %ecx
	jnc	.L55
	movslq	(%rdx,%r15,4), %r15
.L55:
	addl	$1, %eax
	addq	$440000, %rdx
	cmpl	$30, %eax
	jne	.L56
	xorl	%eax, %eax
	cmpl	%r15d, %r11d
	setge	%al
	jmp	.L54
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	ikeru_right
	.bss
	.align 32
	.type	ikeru_right, @object
	.size	ikeru_right, 13200000
ikeru_right:
	.zero	13200000
	.globl	ikeru_left
	.align 32
	.type	ikeru_left, @object
	.size	ikeru_left, 13200000
ikeru_left:
	.zero	13200000
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 440000
x:
	.zero	440000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.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:

#include <stdio.h>

#define N_MAX 110000

int N;
int x[N_MAX];
int L;
int Q;
int a, b;

int ikeru_left[30][N_MAX];
int ikeru_right[30][N_MAX];

void maesyori(void) {
	int i, j;
	/* 各ホテルから1日で行けるホテルを求める */
	for (i = 0; i < N; i++) {
		int left, right, mid;
		/* 左へ */
		left = 0; ikeru_left[0][i] = right = i;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[i] - x[mid] <= L) {
				/* 行ける */
				right = mid - 1;
				if (mid < ikeru_left[0][i]) ikeru_left[0][i] = mid;
			} else {
				/* 行けない */
				left = mid + 1;
			}
		}
		/* 右へ */
		ikeru_right[0][i] = left = i; right = N - 1;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[mid] - x[i] <= L) {
				/* 行ける */
				left = mid + 1;
				if (ikeru_right[0][i] < mid) ikeru_right[0][i] = mid;
			} else {
				/* 行けない */
				right = mid - 1;
			}
		}
	}
	/* 各ホテルから2**k日で行けるホテルを求める */
	for (j = 1; j < 30; j++) {
		for (i = 0; i < N; i++) {
			ikeru_left[j][i] = ikeru_left[j - 1][ikeru_left[j - 1][i]];
			ikeru_right[j][i] = ikeru_right[j - 1][ikeru_right[j - 1][i]];
		}
	}
}

int motomeru(int start, int day, int ikeru[][N_MAX]) {
	int cur = start;
	int i;
	for (i = 0; i < 30; i++) {
		if ((day >> i) & 1) cur = ikeru[i][cur];
	}
	return cur;
}

int main(void) {
	int i, query_count;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &x[i]) != 1) return 1;
	}
	if (scanf("%d%d", &L, &Q) != 2) return 1;
	maesyori();
	for (query_count = 0; query_count < Q; query_count++) {
		int left, right, mid;
		int ret = N + 10;
		if (scanf("%d%d", &a, &b) != 2) return 1;
		a--; b--;
		left = 0; right = N; /* 着けるから絶対付くまで進捗する */
		while (left <= right) {
			int judge;
			mid = (left + right) / 2;
			if (a < b) {
				judge = motomeru(a, mid, ikeru_right) >= b;
			} else {
				judge = motomeru(a, mid, ikeru_left) <= b;
			}
			if (judge) {
				if (mid < ret) ret = mid;
				right = mid - 1;
			} else {
				left = mid + 1;
			}
		}
		printf("%d\n", ret);
	}
	return 0;
}

9
1 3 6 13 15 18 19 29 31
10
2
1 8
7 3
6 7
8 5
 9
1 6 6 13 23 18 19 29 31
10
3
1 8
7 3
6 7
8 10
 9
1 3 6 13 23 18 19 29 31
10
2
1 8
7 5
6 7
8 5
 9
1 3 6 13 23 18 19 29 31
10
2
1 9
7 3
6 7
8 10
 9
1 3 6 13 23 18 19 29 31
12
2
1 8
1 3
9 7
8 7
 9
1 3 6 13 23 18 19 29 31
12
2
1 8
1 5
9 7
8 7
 9
1 6 6 13 23 18 27 29 31
10
2
1 8
7 3
6 7
8 10
 9
1 3 6 13 23 18 19 29 31
10
3
1 9
7 3
6 7
8 10
 9
1 3 6 13 23 18 19 29 58
10
2
1 2
7 5
6 7
8 5
 9
1 7 6 13 23 18 19 29 31
18
3
1 8
7 3
6 7
8 10

4
2
 4
2
1
 4
1
 5
2
 3
1
 3
2
 5
3
 5
2
1
 1
1
 2
1
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>

#define N_MAX 110000

int N;
int x[N_MAX];
int L;
int Q;
int a, b;

int ikeru_left[30][N_MAX];
int ikeru_right[30][N_MAX];

void maesyori(void) {
	int i, j;
	/* 各ホテルから1日で行けるホテルを求める */
	for (i = 0; i < N; i++) {
		int left, right, mid;
		/* 左へ */
		left = 0; ikeru_left[0][i] = right = i;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[i] - x[mid] <= L) {
				/* 行ける */
				right = mid - 1;
				if (mid < ikeru_left[0][i]) ikeru_left[0][i] = mid;
			} else {
				/* 行けない */
				left = mid + 1;
			}
		}
		/* 右へ */
		ikeru_right[0][i] = left = i; right = N - 1;
		while (left <= right) {
			mid = (left + right) / 2;
			if (x[mid] - x[i] <= L) {
				/* 行ける */
				left = mid + 1;
				if (ikeru_right[0][i] < mid) ikeru_right[0][i] = mid;
			} else {
				/* 行けない */
				right = mid - 1;
			}
		}
	}
	/* 各ホテルから2**k日で行けるホテルを求める */
	for (j = 1; j < 30; j++) {
		for (i = 0; i < N; i++) {
			ikeru_left[j][i] = ikeru_left[j - 1][ikeru_left[j - 1][i]];
			ikeru_right[j][i] = ikeru_right[j - 1][ikeru_right[j - 1][i]];
		}
	}
}

int motomeru(int start, int day, int ikeru[][N_MAX]) {
	int cur = start;
	int i;
	for (i = 0; i < 30; i++) {
		if ((day >> i) & 1) cur = ikeru[i][cur];
	}
	return cur;
}

int main(void) {
	int i, query_count;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &x[i]) != 1) return 1;
	}
	if (scanf("%d%d", &L, &Q) != 2) return 1;
	maesyori();
	for (query_count = 0; query_count < Q; query_count++) {
		int left, right, mid;
		int ret = N + 10;
		if (scanf("%d%d", &a, &b) != 2) return 1;
		a--; b--;
		left = 0; right = N; /* 着けるから絶対付くまで進捗する */
		while (left <= right) {
			int judge;
			mid = (left + right) / 2;
			if (a < b) {
				judge = motomeru(a, mid, ikeru_right) >= b;
			} else {
				judge = motomeru(a, mid, ikeru_left) <= b;
			}
			if (judge) {
				if (mid < ret) ret = mid;
				right = mid - 1;
			} else {
				left = mid + 1;
			}
		}
		printf("%d\n", ret);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 440000
x:
	.zero	440000
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	ikeru_left
	.align 32
	.type	ikeru_left, @object
	.size	ikeru_left, 13200000
ikeru_left:
	.zero	13200000
	.globl	ikeru_right
	.align 32
	.type	ikeru_right, @object
	.size	ikeru_right, 13200000
ikeru_right:
	.zero	13200000
	.text
	.globl	maesyori
	.type	maesyori, @function
maesyori:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -20(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L5:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L4
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L5
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L8
	addl	$1, -20(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$1, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	cmpl	$29, -16(%rbp)
	jle	.L13
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	maesyori, .-maesyori
	.globl	motomeru
	.type	motomeru, @function
motomeru:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L15
.L17:
	movl	-4(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L16
	movl	-4(%rbp), %eax
	cltq
	imulq	$440000, %rax, %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	movl	%eax, -8(%rbp)
.L16:
	addl	$1, -4(%rbp)
.L15:
	cmpl	$29, -4(%rbp)
	jle	.L17
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	motomeru, .-motomeru
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -28(%rbp)
	jmp	.L22
.L24:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L24
	leaq	Q(%rip), %rax
	movq	%rax, %rdx
	leaq	L(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L25
	movl	$1, %eax
	jmp	.L21
.L25:
	call	maesyori
	movl	$0, -24(%rbp)
	jmp	.L26
.L34:
	movl	N(%rip), %eax
	addl	$10, %eax
	movl	%eax, -12(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L21
.L27:
	movl	a(%rip), %eax
	subl	$1, %eax
	movl	%eax, a(%rip)
	movl	b(%rip), %eax
	subl	$1, %eax
	movl	%eax, b(%rip)
	movl	$0, -20(%rbp)
	movl	N(%rip), %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L33:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	a(%rip), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jge	.L29
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_right(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setge	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
	jmp	.L30
.L29:
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_left(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setle	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
.L30:
	cmpl	$0, -8(%rbp)
	je	.L31
	movl	-4(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L32:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L31:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
.L28:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24(%rbp)
.L26:
	movl	Q(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L34
	movl	$0, %eax
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 440000
x:
	.zero	440000
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	ikeru_left
	.align 32
	.type	ikeru_left, @object
	.size	ikeru_left, 13200000
ikeru_left:
	.zero	13200000
	.globl	ikeru_right
	.align 32
	.type	ikeru_right, @object
	.size	ikeru_right, 13200000
ikeru_right:
	.zero	13200000
	.text
	.globl	maesyori
	.type	maesyori, @function
maesyori:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -20(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L5:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L4
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L5
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L8
	addl	$1, -20(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$1, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_left(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_left(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$110000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movslq	%ecx, %rax
	imulq	$110000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ikeru_right(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ikeru_right(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	cmpl	$29, -16(%rbp)
	jle	.L13
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	maesyori, .-maesyori
	.globl	motomeru
	.type	motomeru, @function
motomeru:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L15
.L17:
	movl	-4(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L16
	movl	-4(%rbp), %eax
	cltq
	imulq	$440000, %rax, %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	movl	%eax, -8(%rbp)
.L16:
	addl	$1, -4(%rbp)
.L15:
	cmpl	$29, -4(%rbp)
	jle	.L17
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	motomeru, .-motomeru
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L21
.L20:
	movl	$0, -28(%rbp)
	jmp	.L22
.L24:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L23
	movl	$1, %eax
	jmp	.L21
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	N(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L24
	leaq	Q(%rip), %rax
	movq	%rax, %rdx
	leaq	L(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L25
	movl	$1, %eax
	jmp	.L21
.L25:
	call	maesyori
	movl	$0, -24(%rbp)
	jmp	.L26
.L34:
	movl	N(%rip), %eax
	addl	$10, %eax
	movl	%eax, -12(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L21
.L27:
	movl	a(%rip), %eax
	subl	$1, %eax
	movl	%eax, a(%rip)
	movl	b(%rip), %eax
	subl	$1, %eax
	movl	%eax, b(%rip)
	movl	$0, -20(%rbp)
	movl	N(%rip), %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L33:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	a(%rip), %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jge	.L29
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_right(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setge	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
	jmp	.L30
.L29:
	movl	a(%rip), %eax
	movl	-4(%rbp), %ecx
	leaq	ikeru_left(%rip), %rdx
	movl	%ecx, %esi
	movl	%eax, %edi
	call	motomeru
	movl	b(%rip), %edx
	cmpl	%edx, %eax
	setle	%al
	movzbl	%al, %eax
	movl	%eax, -8(%rbp)
.L30:
	cmpl	$0, -8(%rbp)
	je	.L31
	movl	-4(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L32:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L28
.L31:
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
.L28:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24(%rbp)
.L26:
	movl	Q(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L34
	movl	$0, %eax
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
