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

```c
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

typedef struct{
	TLong x;
	TLong h;
} XH;

int ASC(const XH *a, const XH *b){
	return ((*a).x - (*b).x);
}

int main(int argc, char const *argv[])
{
	int n;
	int j, m, l = 1, r;
	TLong d,a;
	TLong ans = 0, psum[200003] = { 0 }, temp, t;
	XH xh[200003];

	scanf("%d%lld%lld", &n,&d,&a);
	for (int i = 1; i <= n; ++i)	scanf("%lld%lld", &xh[i].x, &xh[i].h);
	qsort(xh, n + 1, sizeof(XH), ASC);

	if(xh[n].x < d * 2) d = xh[n].x;
	else d *= 2;
	
	for (int i = 1; i <= n; ++i)
	{
		psum[i] += psum[i - 1];
		temp = xh[i].h - psum[i];
		if(temp > 0){
			t = (temp - 1) / a + 1;
			ans += t;
			t *= a;
			
			r = n + 1;
			while(l < r){
				m = (l + r) >> 1;
				if(xh[m].x <= xh[i].x + d)  l = m + 1;
				else r = m;
			}
			j = l - 1;

			psum[i] += t;
			psum[j + 1] -= t;
		}
	}

	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ASC
	.type	ASC, @function
ASC:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	ASC, .-ASC
	.section	.rodata
.LC0:
	.string	"%d%lld%lld"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-4796416(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3776, %rsp
	movl	%edi, -4800180(%rbp)
	movq	%rsi, -4800192(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -4800160(%rbp)
	movq	$0, -4800120(%rbp)
	leaq	-4800096(%rbp), %rax
	movl	$1600024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-4800128(%rbp), %rcx
	leaq	-4800136(%rbp), %rdx
	leaq	-4800164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4800152(%rbp)
	jmp	.L4
.L5:
	leaq	-3200064(%rbp), %rdx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	leaq	-3200064(%rbp), %rcx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4800152(%rbp)
.L4:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800152(%rbp)
	jle	.L5
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rsi
	leaq	-3200064(%rbp), %rax
	leaq	ASC(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	-4800136(%rbp), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jge	.L6
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	%rax, -4800136(%rbp)
	jmp	.L7
.L6:
	movq	-4800136(%rbp), %rax
	addq	%rax, %rax
	movq	%rax, -4800136(%rbp)
.L7:
	movl	$1, -4800148(%rbp)
	jmp	.L8
.L13:
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movl	-4800148(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800148(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200056, %rax
	movq	(%rax), %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -4800112(%rbp)
	cmpq	$0, -4800112(%rbp)
	jle	.L9
	movq	-4800112(%rbp), %rax
	subq	$1, %rax
	movq	-4800128(%rbp), %rdi
	cqto
	idivq	%rdi
	addq	$1, %rax
	movq	%rax, -4800104(%rbp)
	movq	-4800104(%rbp), %rax
	addq	%rax, -4800120(%rbp)
	movq	-4800128(%rbp), %rax
	movq	-4800104(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -4800104(%rbp)
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800156(%rbp)
	jmp	.L10
.L12:
	movl	-4800160(%rbp), %edx
	movl	-4800156(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4800140(%rbp)
	movl	-4800140(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movl	-4800148(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$3200064, %rdx
	movq	(%rdx), %rcx
	movq	-4800136(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L11
	movl	-4800140(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800160(%rbp)
	jmp	.L10
.L11:
	movl	-4800140(%rbp), %eax
	movl	%eax, -4800156(%rbp)
.L10:
	movl	-4800160(%rbp), %eax
	cmpl	-4800156(%rbp), %eax
	jl	.L12
	movl	-4800160(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4800144(%rbp)
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movq	-4800104(%rbp), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800144(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	movl	-4800144(%rbp), %edx
	leal	1(%rdx), %ecx
	subq	-4800104(%rbp), %rax
	movq	%rax, %rdx
	movslq	%ecx, %rax
	movq	%rdx, -4800096(%rbp,%rax,8)
.L9:
	addl	$1, -4800148(%rbp)
.L8:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800148(%rbp)
	jle	.L13
	movq	-4800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	ASC
	.type	ASC, @function
ASC:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	ASC, .-ASC
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%lld%lld"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-4796416(%rsp), %r11
	.cfi_def_cfa 11, 4796464
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3712, %rsp
	.cfi_def_cfa_offset 4800176
	movl	$1600024, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 4800120(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rdi
	call	memset@PLT
	leaq	24(%rsp), %rcx
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	leaq	1600080(%rsp), %rbx
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	8(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, %eax
	jge	.L5
.L4:
	addl	$1, %eax
	leaq	1600064(%rsp), %rdi
	movl	$16, %edx
	movslq	%eax, %rsi
	leaq	ASC(%rip), %rcx
	call	qsort@PLT
	movq	16(%rsp), %rax
	movl	12(%rsp), %ebx
	leaq	(%rax,%rax), %rdi
	movslq	%ebx, %rax
	salq	$4, %rax
	movq	1600064(%rsp,%rax), %rax
	cmpq	%rax, %rdi
	cmovg	%rax, %rdi
	movq	%rdi, 16(%rsp)
	testl	%ebx, %ebx
	jle	.L13
	leal	-1(%rbx), %eax
	movq	24(%rsp), %r10
	leaq	40(%rsp), %r9
	xorl	%r12d, %r12d
	salq	$4, %rax
	leaq	1600080(%rsp), %rsi
	movl	$1, %ecx
	addl	$1, %ebx
	leaq	1600096(%rsp,%rax), %r11
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$16, %rsi
	addq	$8, %r9
	cmpq	%rsi, %r11
	je	.L6
.L11:
	movq	8(%rsi), %rax
	movq	-8(%r9), %r8
	addq	(%r9), %r8
	subq	%r8, %rax
	movq	%r8, (%r9)
	testq	%rax, %rax
	jle	.L7
	subq	$1, %rax
	movl	%ebx, %ebp
	cqto
	idivq	%r10
	leaq	1(%rax), %r13
	addq	%r13, %r12
	imulq	%r10, %r13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	leal	(%rcx,%rbp), %eax
	movq	(%rsi), %r14
	sarl	%eax
	movslq	%eax, %rdx
	addq	%rdi, %r14
	salq	$4, %rdx
	cmpq	%r14, 1600064(%rsp,%rdx)
	jle	.L18
	movl	%eax, %ebp
.L9:
	cmpl	%ebp, %ecx
	jl	.L10
	addq	%r13, %r8
	movslq	%ecx, %rax
	addq	$16, %rsi
	addq	$8, %r9
	movq	%r8, -8(%r9)
	subq	%r13, 32(%rsp,%rax,8)
	cmpq	%rsi, %r11
	jne	.L11
.L6:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	4800120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$4800128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	leal	1(%rax), %ecx
	jmp	.L9
.L13:
	xorl	%r12d, %r12d
	jmp	.L6
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	ASC
	.type	ASC, @function
ASC:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	ASC, .-ASC
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%lld%lld"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-4796416(%rsp), %r11
	.cfi_def_cfa 11, 4796464
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3712, %rsp
	.cfi_def_cfa_offset 4800176
	movl	$1600024, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 4800120(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rdi
	call	memset@PLT
	leaq	24(%rsp), %rcx
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	leaq	1600080(%rsp), %rbx
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	8(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, %eax
	jge	.L5
.L4:
	addl	$1, %eax
	leaq	1600064(%rsp), %rdi
	movl	$16, %edx
	movslq	%eax, %rsi
	leaq	ASC(%rip), %rcx
	call	qsort@PLT
	movq	16(%rsp), %rax
	movl	12(%rsp), %ebx
	leaq	(%rax,%rax), %rdi
	movslq	%ebx, %rax
	salq	$4, %rax
	movq	1600064(%rsp,%rax), %rax
	cmpq	%rax, %rdi
	cmovg	%rax, %rdi
	movq	%rdi, 16(%rsp)
	testl	%ebx, %ebx
	jle	.L13
	leal	-1(%rbx), %eax
	movq	24(%rsp), %r10
	leaq	40(%rsp), %r9
	xorl	%r12d, %r12d
	salq	$4, %rax
	leaq	1600080(%rsp), %rsi
	movl	$1, %ecx
	addl	$1, %ebx
	leaq	1600096(%rsp,%rax), %r11
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$16, %rsi
	addq	$8, %r9
	cmpq	%rsi, %r11
	je	.L6
.L11:
	movq	8(%rsi), %rax
	movq	-8(%r9), %r8
	addq	(%r9), %r8
	subq	%r8, %rax
	movq	%r8, (%r9)
	testq	%rax, %rax
	jle	.L7
	subq	$1, %rax
	movl	%ebx, %ebp
	cqto
	idivq	%r10
	leaq	1(%rax), %r13
	addq	%r13, %r12
	imulq	%r10, %r13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	leal	(%rcx,%rbp), %eax
	movq	(%rsi), %r14
	sarl	%eax
	movslq	%eax, %rdx
	addq	%rdi, %r14
	salq	$4, %rdx
	cmpq	%r14, 1600064(%rsp,%rdx)
	jle	.L18
	movl	%eax, %ebp
.L9:
	cmpl	%ebp, %ecx
	jl	.L10
	addq	%r13, %r8
	movslq	%ecx, %rax
	addq	$16, %rsi
	addq	$8, %r9
	movq	%r8, -8(%r9)
	subq	%r13, 32(%rsp,%rax,8)
	cmpq	%rsi, %r11
	jne	.L11
.L6:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	4800120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$4800128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	leal	1(%rax), %ecx
	jmp	.L9
.L13:
	xorl	%r12d, %r12d
	jmp	.L6
.L19:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:

/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

typedef struct{
	TLong x;
	TLong h;
} XH;

int ASC(const XH *a, const XH *b){
	return ((*a).x - (*b).x);
}

int main(int argc, char const *argv[])
{
	int n;
	int j, m, l = 1, r;
	TLong d,a;
	TLong ans = 0, psum[200003] = { 0 }, temp, t;
	XH xh[200003];

	scanf("%d%lld%lld", &n,&d,&a);
	for (int i = 1; i <= n; ++i)	scanf("%lld%lld", &xh[i].x, &xh[i].h);
	qsort(xh, n + 1, sizeof(XH), ASC);

	if(xh[n].x < d * 2) d = xh[n].x;
	else d *= 2;
	
	for (int i = 1; i <= n; ++i)
	{
		psum[i] += psum[i - 1];
		temp = xh[i].h - psum[i];
		if(temp > 0){
			t = (temp - 1) / a + 1;
			ans += t;
			t *= a;
			
			r = n + 1;
			while(l < r){
				m = (l + r) >> 1;
				if(xh[m].x <= xh[i].x + d)  l = m + 1;
				else r = m;
			}
			j = l - 1;

			psum[i] += t;
			psum[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
 10

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

```c
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

typedef struct{
	TLong x;
	TLong h;
} XH;

int ASC(const XH *a, const XH *b){
	return ((*a).x - (*b).x);
}

int main(int argc, char const *argv[])
{
	int n;
	int j, m, l = 1, r;
	TLong d,a;
	TLong ans = 0, psum[200003] = { 0 }, temp, t;
	XH xh[200003];

	scanf("%d%lld%lld", &n,&d,&a);
	for (int i = 1; i <= n; ++i)	scanf("%lld%lld", &xh[i].x, &xh[i].h);
	qsort(xh, n + 1, sizeof(XH), ASC);

	if(xh[n].x < d * 2) d = xh[n].x;
	else d *= 2;
	
	for (int i = 1; i <= n; ++i)
	{
		psum[i] += psum[i - 1];
		temp = xh[i].h - psum[i];
		if(temp > 0){
			t = (temp - 1) / a + 1;
			ans += t;
			t *= a;
			
			r = n + 1;
			while(l < r){
				m = (l + r) >> 1;
				if(xh[m].x <= xh[i].x + d)  l = m + 1;
				else r = m;
			}
			j = l - 1;

			psum[i] += t;
			psum[j + 1] -= t;
		}
	}

	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ASC
	.type	ASC, @function
ASC:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	ASC, .-ASC
	.section	.rodata
.LC0:
	.string	"%d%lld%lld"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-4796416(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3776, %rsp
	movl	%edi, -4800180(%rbp)
	movq	%rsi, -4800192(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -4800160(%rbp)
	movq	$0, -4800120(%rbp)
	leaq	-4800096(%rbp), %rax
	movl	$1600024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-4800128(%rbp), %rcx
	leaq	-4800136(%rbp), %rdx
	leaq	-4800164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4800152(%rbp)
	jmp	.L4
.L5:
	leaq	-3200064(%rbp), %rdx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	leaq	-3200064(%rbp), %rcx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4800152(%rbp)
.L4:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800152(%rbp)
	jle	.L5
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rsi
	leaq	-3200064(%rbp), %rax
	leaq	ASC(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	-4800136(%rbp), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jge	.L6
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	%rax, -4800136(%rbp)
	jmp	.L7
.L6:
	movq	-4800136(%rbp), %rax
	addq	%rax, %rax
	movq	%rax, -4800136(%rbp)
.L7:
	movl	$1, -4800148(%rbp)
	jmp	.L8
.L13:
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movl	-4800148(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800148(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200056, %rax
	movq	(%rax), %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -4800112(%rbp)
	cmpq	$0, -4800112(%rbp)
	jle	.L9
	movq	-4800112(%rbp), %rax
	subq	$1, %rax
	movq	-4800128(%rbp), %rdi
	cqto
	idivq	%rdi
	addq	$1, %rax
	movq	%rax, -4800104(%rbp)
	movq	-4800104(%rbp), %rax
	addq	%rax, -4800120(%rbp)
	movq	-4800128(%rbp), %rax
	movq	-4800104(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -4800104(%rbp)
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800156(%rbp)
	jmp	.L10
.L12:
	movl	-4800160(%rbp), %edx
	movl	-4800156(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4800140(%rbp)
	movl	-4800140(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movl	-4800148(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$3200064, %rdx
	movq	(%rdx), %rcx
	movq	-4800136(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L11
	movl	-4800140(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800160(%rbp)
	jmp	.L10
.L11:
	movl	-4800140(%rbp), %eax
	movl	%eax, -4800156(%rbp)
.L10:
	movl	-4800160(%rbp), %eax
	cmpl	-4800156(%rbp), %eax
	jl	.L12
	movl	-4800160(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4800144(%rbp)
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movq	-4800104(%rbp), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800144(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	movl	-4800144(%rbp), %edx
	leal	1(%rdx), %ecx
	subq	-4800104(%rbp), %rax
	movq	%rax, %rdx
	movslq	%ecx, %rax
	movq	%rdx, -4800096(%rbp,%rax,8)
.L9:
	addl	$1, -4800148(%rbp)
.L8:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800148(%rbp)
	jle	.L13
	movq	-4800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	ASC
	.type	ASC, @function
ASC:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	ASC, .-ASC
	.section	.rodata
.LC0:
	.string	"%d%lld%lld"
.LC1:
	.string	"%lld%lld"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-4796416(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3776, %rsp
	movl	%edi, -4800180(%rbp)
	movq	%rsi, -4800192(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -4800160(%rbp)
	movq	$0, -4800120(%rbp)
	leaq	-4800096(%rbp), %rax
	movl	$1600024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-4800128(%rbp), %rcx
	leaq	-4800136(%rbp), %rdx
	leaq	-4800164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4800152(%rbp)
	jmp	.L4
.L5:
	leaq	-3200064(%rbp), %rdx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rdx
	leaq	-3200064(%rbp), %rcx
	movl	-4800152(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4800152(%rbp)
.L4:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800152(%rbp)
	jle	.L5
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rsi
	leaq	-3200064(%rbp), %rax
	leaq	ASC(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	-4800136(%rbp), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jge	.L6
	movl	-4800164(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movq	%rax, -4800136(%rbp)
	jmp	.L7
.L6:
	movq	-4800136(%rbp), %rax
	addq	%rax, %rax
	movq	%rax, -4800136(%rbp)
.L7:
	movl	$1, -4800148(%rbp)
	jmp	.L8
.L13:
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movl	-4800148(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800148(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200056, %rax
	movq	(%rax), %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -4800112(%rbp)
	cmpq	$0, -4800112(%rbp)
	jle	.L9
	movq	-4800112(%rbp), %rax
	subq	$1, %rax
	movq	-4800128(%rbp), %rdi
	cqto
	idivq	%rdi
	addq	$1, %rax
	movq	%rax, -4800104(%rbp)
	movq	-4800104(%rbp), %rax
	addq	%rax, -4800120(%rbp)
	movq	-4800128(%rbp), %rax
	movq	-4800104(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -4800104(%rbp)
	movl	-4800164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800156(%rbp)
	jmp	.L10
.L12:
	movl	-4800160(%rbp), %edx
	movl	-4800156(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4800140(%rbp)
	movl	-4800140(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$3200064, %rax
	movq	(%rax), %rax
	movl	-4800148(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$3200064, %rdx
	movq	(%rdx), %rcx
	movq	-4800136(%rbp), %rdx
	addq	%rcx, %rdx
	cmpq	%rdx, %rax
	jg	.L11
	movl	-4800140(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4800160(%rbp)
	jmp	.L10
.L11:
	movl	-4800140(%rbp), %eax
	movl	%eax, -4800156(%rbp)
.L10:
	movl	-4800160(%rbp), %eax
	cmpl	-4800156(%rbp), %eax
	jl	.L12
	movl	-4800160(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4800144(%rbp)
	movl	-4800148(%rbp), %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rdx
	movq	-4800104(%rbp), %rax
	addq	%rax, %rdx
	movl	-4800148(%rbp), %eax
	cltq
	movq	%rdx, -4800096(%rbp,%rax,8)
	movl	-4800144(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-4800096(%rbp,%rax,8), %rax
	movl	-4800144(%rbp), %edx
	leal	1(%rdx), %ecx
	subq	-4800104(%rbp), %rax
	movq	%rax, %rdx
	movslq	%ecx, %rax
	movq	%rdx, -4800096(%rbp,%rax,8)
.L9:
	addl	$1, -4800148(%rbp)
.L8:
	movl	-4800164(%rbp), %eax
	cmpl	%eax, -4800148(%rbp)
	jle	.L13
	movq	-4800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
