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

```c
// ABC 153-F
// 2020.1.26 bal4u

#include <stdio.h>
#include <string.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MAX 200005
typedef struct { int X, H; } T;
T a[MAX]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;
	
	i = l, j = r, m = a[(l+r) >> 1].X;
	while (1) {
        // 昇順
		while (a[i].X < m) i++;
		while (m < a[j].X) j--;

		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

// 見つからなければ、一つ小さい要素を返す
int bs(int x) {
	int m, l = 1, r = N+1;

    while (l < r) {
        m = (l+r) >> 1;
        if (a[m].X <= x) l = m + 1; else r = m;
    }
	return l-1;
}

ll imos[MAX];

int main()
{
	int i, j, A, D;
	ll h, t, ans;
	
	N = in(), D = in(), A = in();
	for (i = 1; i <= N; ++i) a[i].X = in(), a[i].H = in();
	Qsort(a, 1, N);

	if ((ll)D*2 > a[N].X) D = a[N].X; else D *= 2;
	
	ans = 0;
	for (i = 1; i <= N; ++i) {
		imos[i] += imos[i-1];
		h = a[i].H - imos[i];
		if (h > 0) {
			t = (h-1)/A + 1;
			ans += t, t *= A;
			j = bs(a[i].X + D);
			imos[i] += t, imos[j+1] -= t;
		}
	}
	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	Qsort
	.type	Qsort, @function
Qsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L5
.L6:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L6
	jmp	.L7
.L8:
	subl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jge	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -20(%rbp)
	subl	$1, -16(%rbp)
	jmp	.L5
.L15:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L12:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -48(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L16:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Qsort, .-Qsort
	.globl	bs
	.type	bs, @function
bs:
.LFB2:
	.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	$1, -12(%rbp)
	movl	N(%rip), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L19
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L19:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L20
	movl	-12(%rbp), %eax
	subl	$1, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bs, .-bs
	.globl	imos
	.bss
	.align 32
	.type	imos, @object
	.size	imos, 1600040
imos:
	.zero	1600040
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L23
.L24:
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L24
	movl	N(%rip), %eax
	movl	%eax, %edx
	movl	$1, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	Qsort
	movl	-36(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rcx
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	cmpq	%rax, %rcx
	jle	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L26
.L25:
	sall	-36(%rbp)
.L26:
	movq	$0, -24(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L27
.L29:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L28
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	call	bs
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	addl	$1, %edx
	subq	-8(%rbp), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L28:
	addl	$1, -40(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L29
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	in
	.type	in, @function
in:
.LFB35:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	in, .-in
	.p2align 4
	.globl	Qsort
	.type	Qsort, @function
Qsort:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r9d
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
.L19:
	leal	(%r9,%rbp), %eax
	movl	%r9d, %r8d
	movl	%ebp, %ebx
	sarl	%eax
	cltq
	movl	0(%r13,%rax,8), %ecx
	movslq	%r9d, %rax
	leaq	0(%r13,%rax,8), %rsi
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi), %edi
	leaq	0(%r13,%rax,8), %rdx
	movl	(%rdx), %r10d
	cmpl	%ecx, %edi
	jl	.L14
	cmpl	%r10d, %ecx
	jge	.L15
	leaq	-8(%r13,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rax, %rdx
	subq	$8, %rax
	subl	$1, %ebx
	cmpl	%ecx, 8(%rax)
	jg	.L16
.L15:
	cmpl	%ebx, %r8d
	jge	.L17
	movd	4(%rsi), %xmm1
	movq	(%rdx), %rax
	movd	%edi, %xmm0
	subl	$1, %ebx
	punpckldq	%xmm1, %xmm0
	movq	%rax, (%rsi)
	movslq	%ebx, %rax
	movq	%xmm0, (%rdx)
.L14:
	addq	$8, %rsi
	addl	$1, %r8d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%r9), %eax
	cmpl	%r8d, %eax
	jl	.L23
.L18:
	leal	1(%rbx), %r9d
	cmpl	%ebp, %r9d
	jl	.L19
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	-1(%r8), %edx
	movl	%r9d, %esi
	movq	%r13, %rdi
	call	Qsort
	jmp	.L18
	.cfi_endproc
.LFE36:
	.size	Qsort, .-Qsort
	.p2align 4
	.globl	bs
	.type	bs, @function
bs:
.LFB37:
	.cfi_startproc
	endbr64
	movl	N(%rip), %eax
	leaq	a(%rip), %r8
	leal	1(%rax), %ecx
	movl	$1, %eax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	leal	(%rcx,%rax), %edx
	sarl	%edx
	movslq	%edx, %rsi
	cmpl	%edi, (%r8,%rsi,8)
	jle	.L29
	movl	%edx, %ecx
.L26:
	cmpl	%eax, %ecx
	jg	.L27
	subl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L29:
	leal	1(%rdx), %eax
	jmp	.L26
	.cfi_endproc
.LFE37:
	.size	bs, .-bs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %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
	leaq	a(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	movl	%eax, N(%rip)
	xorl	%eax, %eax
	call	in
	movl	%eax, %r12d
	xorl	%eax, %eax
	call	in
	movl	N(%rip), %edx
	movl	%eax, %ebp
	testl	%edx, %edx
	jle	.L31
	movl	$1, %r14d
	leaq	4(%rbx), %r13
	.p2align 4,,10
	.p2align 3
.L44:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L59
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L33:
	xorl	%r15d, %r15d
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	1(%rdx), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L36
.L35:
	movq	%rsi, %rdx
.L37:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rcx, %rdx
	jb	.L34
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rsi
	movq	16(%rdi), %rcx
	cmpl	$47, %eax
	jg	.L35
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%r15d, (%rbx,%r14,8)
	cmpq	%rsi, %rcx
	jbe	.L60
	leaq	1(%rsi), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rsi), %eax
.L39:
	xorl	%r15d, %r15d
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L42
.L41:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L43:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rcx, %rdx
	jb	.L40
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L42
	movq	stdin(%rip), %rdi
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L42:
	movl	N(%rip), %edx
	movl	%r15d, 0(%r13,%r14,8)
	addq	$1, %r14
	cmpl	%r14d, %edx
	jge	.L44
.L31:
	movl	$1, %esi
	movq	%rbx, %rdi
	call	Qsort
	movslq	N(%rip), %rdx
	movslq	(%rbx,%rdx,8), %rcx
	movq	%rdx, %rax
	movslq	%r12d, %rdx
	addl	%r12d, %r12d
	addq	%rdx, %rdx
	movq	%rcx, %r13
	cmpq	%rcx, %rdx
	cmovle	%r12d, %r13d
	testl	%eax, %eax
	jle	.L52
	leaq	8+imos(%rip), %rdi
	leal	-1(%rax), %ecx
	addl	$1, %eax
	leaq	8(%rdi), %rdx
	movslq	%ebp, %r10
	movl	%eax, 12(%rsp)
	xorl	%r12d, %r12d
	leaq	8+a(%rip), %r9
	leaq	(%rdx,%rcx,8), %r11
	leaq	-8(%rdi), %rbp
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L47:
	addq	$8, %rdi
	addq	$8, %r9
	cmpq	%rdi, %r11
	je	.L46
.L51:
	movslq	4(%r9), %rax
	movq	-8(%rdi), %r8
	addq	(%rdi), %r8
	subq	%r8, %rax
	movq	%r8, (%rdi)
	testq	%rax, %rax
	jle	.L47
	subq	$1, %rax
	movl	(%r9), %r15d
	movl	$1, %ecx
	cqto
	idivq	%r10
	movl	12(%rsp), %edx
	addl	%r13d, %r15d
	leaq	1(%rax), %r14
	addq	%r14, %r12
	imulq	%r10, %r14
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L50:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,8), %r15d
	jge	.L61
	movl	%eax, %edx
.L49:
	cmpl	%ecx, %edx
	jg	.L50
	addq	%r14, %r8
	movslq	%ecx, %rcx
	addq	$8, %rdi
	addq	$8, %r9
	movq	%r8, -8(%rdi)
	subq	%r14, 0(%rbp,%rcx,8)
	cmpq	%rdi, %r11
	jne	.L51
.L46:
	movq	%r12, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.L61:
	.cfi_restore_state
	leal	1(%rax), %ecx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L60:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L59:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L33
.L52:
	xorl	%r12d, %r12d
	jmp	.L46
	.cfi_endproc
.LFE38:
	.size	main, .-main
	.globl	imos
	.bss
	.align 32
	.type	imos, @object
	.size	imos, 1600040
imos:
	.zero	1600040
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.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	in
	.type	in, @function
in:
.LFB35:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	in, .-in
	.p2align 4
	.globl	Qsort
	.type	Qsort, @function
Qsort:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r9d
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
.L19:
	leal	(%r9,%rbp), %eax
	movl	%r9d, %r8d
	movl	%ebp, %ebx
	sarl	%eax
	cltq
	movl	0(%r13,%rax,8), %ecx
	movslq	%r9d, %rax
	leaq	0(%r13,%rax,8), %rsi
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi), %edi
	leaq	0(%r13,%rax,8), %rdx
	movl	(%rdx), %r10d
	cmpl	%ecx, %edi
	jl	.L14
	cmpl	%r10d, %ecx
	jge	.L15
	leaq	-8(%r13,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rax, %rdx
	subq	$8, %rax
	subl	$1, %ebx
	cmpl	%ecx, 8(%rax)
	jg	.L16
.L15:
	cmpl	%ebx, %r8d
	jge	.L17
	movd	4(%rsi), %xmm1
	movq	(%rdx), %rax
	movd	%edi, %xmm0
	subl	$1, %ebx
	punpckldq	%xmm1, %xmm0
	movq	%rax, (%rsi)
	movslq	%ebx, %rax
	movq	%xmm0, (%rdx)
.L14:
	addq	$8, %rsi
	addl	$1, %r8d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%r9), %eax
	cmpl	%r8d, %eax
	jl	.L23
.L18:
	leal	1(%rbx), %r9d
	cmpl	%ebp, %r9d
	jl	.L19
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	-1(%r8), %edx
	movl	%r9d, %esi
	movq	%r13, %rdi
	call	Qsort
	jmp	.L18
	.cfi_endproc
.LFE36:
	.size	Qsort, .-Qsort
	.p2align 4
	.globl	bs
	.type	bs, @function
bs:
.LFB37:
	.cfi_startproc
	endbr64
	movl	N(%rip), %eax
	leaq	a(%rip), %r8
	leal	1(%rax), %ecx
	movl	$1, %eax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	leal	(%rcx,%rax), %edx
	sarl	%edx
	movslq	%edx, %rsi
	cmpl	%edi, (%r8,%rsi,8)
	jle	.L29
	movl	%edx, %ecx
.L26:
	cmpl	%eax, %ecx
	jg	.L27
	subl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L29:
	leal	1(%rdx), %eax
	jmp	.L26
	.cfi_endproc
.LFE37:
	.size	bs, .-bs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %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
	leaq	a(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	movl	%eax, N(%rip)
	xorl	%eax, %eax
	call	in
	movl	%eax, %r12d
	xorl	%eax, %eax
	call	in
	movl	N(%rip), %edx
	movl	%eax, %ebp
	testl	%edx, %edx
	jle	.L31
	movl	$1, %r14d
	leaq	4(%rbx), %r13
	.p2align 4,,10
	.p2align 3
.L44:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L59
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L33:
	xorl	%r15d, %r15d
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	1(%rdx), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L36
.L35:
	movq	%rsi, %rdx
.L37:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rcx, %rdx
	jb	.L34
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rsi
	movq	16(%rdi), %rcx
	cmpl	$47, %eax
	jg	.L35
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%r15d, (%rbx,%r14,8)
	cmpq	%rsi, %rcx
	jbe	.L60
	leaq	1(%rsi), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rsi), %eax
.L39:
	xorl	%r15d, %r15d
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L40:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L42
.L41:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L43:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rcx, %rdx
	jb	.L40
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L42
	movq	stdin(%rip), %rdi
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L42:
	movl	N(%rip), %edx
	movl	%r15d, 0(%r13,%r14,8)
	addq	$1, %r14
	cmpl	%r14d, %edx
	jge	.L44
.L31:
	movl	$1, %esi
	movq	%rbx, %rdi
	call	Qsort
	movslq	N(%rip), %rdx
	movslq	(%rbx,%rdx,8), %rcx
	movq	%rdx, %rax
	movslq	%r12d, %rdx
	addl	%r12d, %r12d
	addq	%rdx, %rdx
	movq	%rcx, %r13
	cmpq	%rcx, %rdx
	cmovle	%r12d, %r13d
	testl	%eax, %eax
	jle	.L52
	leaq	8+imos(%rip), %rdi
	leal	-1(%rax), %ecx
	addl	$1, %eax
	leaq	8(%rdi), %rdx
	movslq	%ebp, %r10
	movl	%eax, 12(%rsp)
	xorl	%r12d, %r12d
	leaq	8+a(%rip), %r9
	leaq	(%rdx,%rcx,8), %r11
	leaq	-8(%rdi), %rbp
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L47:
	addq	$8, %rdi
	addq	$8, %r9
	cmpq	%rdi, %r11
	je	.L46
.L51:
	movslq	4(%r9), %rax
	movq	-8(%rdi), %r8
	addq	(%rdi), %r8
	subq	%r8, %rax
	movq	%r8, (%rdi)
	testq	%rax, %rax
	jle	.L47
	subq	$1, %rax
	movl	(%r9), %r15d
	movl	$1, %ecx
	cqto
	idivq	%r10
	movl	12(%rsp), %edx
	addl	%r13d, %r15d
	leaq	1(%rax), %r14
	addq	%r14, %r12
	imulq	%r10, %r14
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L50:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,8), %r15d
	jge	.L61
	movl	%eax, %edx
.L49:
	cmpl	%ecx, %edx
	jg	.L50
	addq	%r14, %r8
	movslq	%ecx, %rcx
	addq	$8, %rdi
	addq	$8, %r9
	movq	%r8, -8(%rdi)
	subq	%r14, 0(%rbp,%rcx,8)
	cmpq	%rdi, %r11
	jne	.L51
.L46:
	movq	%r12, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.L61:
	.cfi_restore_state
	leal	1(%rax), %ecx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L60:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L59:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L33
.L52:
	xorl	%r12d, %r12d
	jmp	.L46
	.cfi_endproc
.LFE38:
	.size	main, .-main
	.globl	imos
	.bss
	.align 32
	.type	imos, @object
	.size	imos, 1600040
imos:
	.zero	1600040
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.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:

// ABC 153-F
// 2020.1.26 bal4u

#include <stdio.h>
#include <string.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MAX 200005
typedef struct { int X, H; } T;
T a[MAX]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;
	
	i = l, j = r, m = a[(l+r) >> 1].X;
	while (1) {
        // 昇順
		while (a[i].X < m) i++;
		while (m < a[j].X) j--;

		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

// 見つからなければ、一つ小さい要素を返す
int bs(int x) {
	int m, l = 1, r = N+1;

    while (l < r) {
        m = (l+r) >> 1;
        if (a[m].X <= x) l = m + 1; else r = m;
    }
	return l-1;
}

ll imos[MAX];

int main()
{
	int i, j, A, D;
	ll h, t, ans;
	
	N = in(), D = in(), A = in();
	for (i = 1; i <= N; ++i) a[i].X = in(), a[i].H = in();
	Qsort(a, 1, N);

	if ((ll)D*2 > a[N].X) D = a[N].X; else D *= 2;
	
	ans = 0;
	for (i = 1; i <= N; ++i) {
		imos[i] += imos[i-1];
		h = a[i].H - imos[i];
		if (h > 0) {
			t = (h-1)/A + 1;
			ans += t, t *= A;
			j = bs(a[i].X + D);
			imos[i] += t, imos[j+1] -= t;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

9 4 1
1 5
2 4
3 3
4 2
5 1
6 2
7 3
8 4
9 0
 3 3 2
1 4
5 4
9 2
 3 0 1
77888184 1000000000
100000000 1000000000
200000000 1000000000
 3 0 1
86580931 1000000000
100000000 1000001000
200000000 1000000000
 2 3 1
1 1
5 6
9 2
 2 0 1
1 1
5 6
9 2
 2 0 2
1 1
5 6
9 2
 1 0 2
1 1
5 6
9 2
 0 2 1
1 1
5 6
4 3
 9 4 1
1 10
2 5
3 3
1 2
5 0
9 1
0 3
8 3
18 -1

5
 3
 3000000000
 3000001000
 6
 7
 4
 1
 0
 141

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

```c
// ABC 153-F
// 2020.1.26 bal4u

#include <stdio.h>
#include <string.h>

typedef long long ll;

#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MAX 200005
typedef struct { int X, H; } T;
T a[MAX]; int N;

void Qsort(T *a, int l, int r) {
	int i, j, m; T t;
	
	i = l, j = r, m = a[(l+r) >> 1].X;
	while (1) {
        // 昇順
		while (a[i].X < m) i++;
		while (m < a[j].X) j--;

		if (i >= j)	break;
		t = a[i], a[i] = a[j], a[j] = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(a, l, i-1);
	if (j+1 < r) Qsort(a, j+1, r);
}

// 見つからなければ、一つ小さい要素を返す
int bs(int x) {
	int m, l = 1, r = N+1;

    while (l < r) {
        m = (l+r) >> 1;
        if (a[m].X <= x) l = m + 1; else r = m;
    }
	return l-1;
}

ll imos[MAX];

int main()
{
	int i, j, A, D;
	ll h, t, ans;
	
	N = in(), D = in(), A = in();
	for (i = 1; i <= N; ++i) a[i].X = in(), a[i].H = in();
	Qsort(a, 1, N);

	if ((ll)D*2 > a[N].X) D = a[N].X; else D *= 2;
	
	ans = 0;
	for (i = 1; i <= N; ++i) {
		imos[i] += imos[i-1];
		h = a[i].H - imos[i];
		if (h > 0) {
			t = (h-1)/A + 1;
			ans += t, t *= A;
			j = bs(a[i].X + D);
			imos[i] += t, imos[j+1] -= t;
		}
	}
	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	Qsort
	.type	Qsort, @function
Qsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L5
.L6:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L6
	jmp	.L7
.L8:
	subl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jge	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -20(%rbp)
	subl	$1, -16(%rbp)
	jmp	.L5
.L15:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L12:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -48(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L16:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Qsort, .-Qsort
	.globl	bs
	.type	bs, @function
bs:
.LFB2:
	.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	$1, -12(%rbp)
	movl	N(%rip), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L19
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L19:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L20
	movl	-12(%rbp), %eax
	subl	$1, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bs, .-bs
	.globl	imos
	.bss
	.align 32
	.type	imos, @object
	.size	imos, 1600040
imos:
	.zero	1600040
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L23
.L24:
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L24
	movl	N(%rip), %eax
	movl	%eax, %edx
	movl	$1, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	Qsort
	movl	-36(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rcx
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	cmpq	%rax, %rcx
	jle	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L26
.L25:
	sall	-36(%rbp)
.L26:
	movq	$0, -24(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L27
.L29:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L28
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	call	bs
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	addl	$1, %edx
	subq	-8(%rbp), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L28:
	addl	$1, -40(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L29
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	Qsort
	.type	Qsort, @function
Qsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L5
.L6:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L6
	jmp	.L7
.L8:
	subl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jge	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -20(%rbp)
	subl	$1, -16(%rbp)
	jmp	.L5
.L15:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L12
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L12:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -48(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	Qsort
.L16:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Qsort, .-Qsort
	.globl	bs
	.type	bs, @function
bs:
.LFB2:
	.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	$1, -12(%rbp)
	movl	N(%rip), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L19
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L19:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L20
	movl	-12(%rbp), %eax
	subl	$1, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bs, .-bs
	.globl	imos
	.bss
	.align 32
	.type	imos, @object
	.size	imos, 1600040
imos:
	.zero	1600040
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -36(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L23
.L24:
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -40(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L24
	movl	N(%rip), %eax
	movl	%eax, %edx
	movl	$1, %esi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	Qsort
	movl	-36(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rcx
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	cmpq	%rax, %rcx
	jle	.L25
	movl	N(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -36(%rbp)
	jmp	.L26
.L25:
	sall	-36(%rbp)
.L26:
	movq	$0, -24(%rbp)
	movl	$1, -40(%rbp)
	jmp	.L27
.L29:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L28
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movq	-8(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	call	bs
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-8(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	imos(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	addl	$1, %edx
	subq	-8(%rbp), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	imos(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L28:
	addl	$1, -40(%rbp)
.L27:
	movl	N(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L29
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
