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

```c
// AOJ 2236 Rabbit Plays Games!
// 2018.2.10 bal4u

#include <stdio.h>
#include <stdlib.h>

typedef struct { int a; int d; } T;
T tbl[40002];
int h[40002], a[40002], d[40002], s[40002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }

int main()
{
	int n, i, j, k, sz;
	long long turn, ans;

	n = in();
	for (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();
	
	sz = 0, ans = turn = 0;
	for (i = 1; i <= n; i++) {
		j = a[0] - d[i];
		k = a[i] - d[0];
		if (k <= 0) continue;
		if (j <= 0) { puts("-1"); return 0; }

		turn += k; if (s[i] > s[0]) ans += k;
		tbl[sz].d = k;
		tbl[sz++].a = (h[i]+j-1)/j;
	}
	qsort(tbl, sz, sizeof(T), cmp);

	for (i = 0; i < sz; i++) {
		ans += turn*tbl[i].a - tbl[i].d;
		if (h[0] <= ans) { puts("-1"); return 0; }
		turn -= tbl[i].d;
	}
	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 320016
tbl:
	.zero	320016
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 160008
h:
	.zero	160008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 160008
a:
	.zero	160008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 160008
d:
	.zero	160008
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 160008
s:
	.zero	160008
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.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), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%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
.LFE6:
	.size	in, .-in
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB7:
	.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
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rcx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"-1"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	s(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L8
	movl	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L9
.L15:
	movl	a(%rip), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L19
	cmpl	$0, -24(%rbp)
	jg	.L12
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	s(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %ecx
	leal	1(%rcx), %eax
	movl	%eax, -32(%rbp)
	movl	%edx, %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	%esi, (%rdx,%rax)
	jmp	.L11
.L19:
	nop
.L11:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L15
	movl	-32(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	tbl(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	jmp	.L16
.L18:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	addq	%rax, -8(%rbp)
	movl	h(%rip), %eax
	cltq
	cmpq	%rax, -8(%rbp)
	jl	.L17
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L17:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L16:
	movl	-36(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L18
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	cmp
	.type	cmp, @function
cmp:
.LFB40:
	.cfi_startproc
	endbr64
	movslq	4(%rsi), %rax
	movslq	(%rdi), %rdx
	movslq	4(%rdi), %rcx
	imulq	%rax, %rdx
	movslq	(%rsi), %rax
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	cmp, .-cmp
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB39:
	.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	.L12
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L5:
	xorl	%r12d, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L3
.L7:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L9:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L6
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L3
	movq	stdin(%rip), %rdi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L5
	.cfi_endproc
.LFE39:
	.size	in, .-in
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-1"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	testl	%eax, %eax
	js	.L15
	movl	%eax, 4(%rsp)
	xorl	%r15d, %r15d
	leaq	h(%rip), %r14
	leaq	a(%rip), %rbp
	leaq	d(%rip), %r12
	leaq	s(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rdx
	cmpq	%rdx, %rax
	jnb	.L64
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L18:
	xorl	%ebx, %ebx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L21
.L20:
	movq	%r8, %rcx
.L22:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L19
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L20
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, (%r14,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L65
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L24:
	xorl	%ebx, %ebx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L27
.L26:
	movq	%r8, %rcx
.L28:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L25
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%ebx, 0(%rbp,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L66
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L30:
	xorl	%ebx, %ebx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L33
.L32:
	movq	%r8, %rcx
.L34:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L31
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L32
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%ebx, (%r12,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L67
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L36:
	xorl	%ebx, %ebx
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L39
.L38:
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
.L40:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L37
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L39
	movq	stdin(%rip), %rdi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%ebx, 0(%r13,%r15,4)
	addq	$1, %r15
	cmpl	%r15d, 4(%rsp)
	jge	.L14
	movl	4(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L15
	movl	a(%rip), %eax
	xorl	%r8d, %r8d
	xorl	%r15d, %r15d
	xorl	%r9d, %r9d
	movl	d(%rip), %r11d
	movl	$1, %ecx
	movl	%eax, 4(%rsp)
	movl	0(%r13), %eax
	movl	%eax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L46:
	movl	0(%rbp,%rcx,4), %esi
	movl	(%r12,%rcx,4), %eax
	subl	%r11d, %esi
	testl	%esi, %esi
	jle	.L42
	movl	4(%rsp), %edi
	subl	%eax, %edi
	testl	%edi, %edi
	jle	.L48
	movslq	%esi, %rax
	movl	8(%rsp), %edx
	addq	%rax, %r15
	cmpl	%edx, 0(%r13,%rcx,4)
	jle	.L45
	addq	%rax, %r8
.L45:
	movl	(%r14,%rcx,4), %eax
	movd	%esi, %xmm1
	movslq	%r9d, %r10
	addl	$1, %r9d
	addl	%edi, %eax
	subl	$1, %eax
	cltd
	idivl	%edi
	movd	%eax, %xmm0
	leaq	tbl(%rip), %rax
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rax,%r10,8)
.L42:
	addq	$1, %rcx
	cmpl	%ecx, %ebx
	jge	.L46
	leaq	tbl(%rip), %rbx
	movslq	%r9d, %rsi
	movl	$8, %edx
	movq	%r8, 8(%rsp)
	leaq	cmp(%rip), %rcx
	movq	%rbx, %rdi
	movl	%r9d, 4(%rsp)
	call	qsort@PLT
	movl	4(%rsp), %r9d
	movq	8(%rsp), %r8
	testl	%r9d, %r9d
	je	.L47
	leal	-1(%r9), %ecx
	leaq	8(%rbx), %rax
	movslq	h(%rip), %rsi
	movq	%rbx, %rdx
	leaq	(%rax,%rcx,8), %rdi
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L68:
	addq	$8, %rdx
	subq	%rcx, %r15
	cmpq	%rdi, %rdx
	je	.L47
.L49:
	movslq	(%rdx), %rax
	movslq	4(%rdx), %rcx
	imulq	%r15, %rax
	subq	%rcx, %rax
	addq	%rax, %r8
	cmpq	%r8, %rsi
	jg	.L68
.L48:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
.L60:
	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
.L67:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L66:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L65:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L64:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L18
.L15:
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	xorl	%esi, %esi
	leaq	tbl(%rip), %rdi
	call	qsort@PLT
	xorl	%r8d, %r8d
.L47:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L60
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 160008
s:
	.zero	160008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 160008
d:
	.zero	160008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 160008
a:
	.zero	160008
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 160008
h:
	.zero	160008
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 320016
tbl:
	.zero	320016
	.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	cmp
	.type	cmp, @function
cmp:
.LFB40:
	.cfi_startproc
	endbr64
	movslq	4(%rsi), %rax
	movslq	(%rdi), %rdx
	movslq	4(%rdi), %rcx
	imulq	%rax, %rdx
	movslq	(%rsi), %rax
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	cmp, .-cmp
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB39:
	.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	.L12
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L5:
	xorl	%r12d, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L3
.L7:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L9:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L6
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L3
	movq	stdin(%rip), %rdi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L5
	.cfi_endproc
.LFE39:
	.size	in, .-in
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-1"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	testl	%eax, %eax
	js	.L15
	movl	%eax, 4(%rsp)
	xorl	%r15d, %r15d
	leaq	h(%rip), %r14
	leaq	a(%rip), %rbp
	leaq	d(%rip), %r12
	leaq	s(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rdx
	cmpq	%rdx, %rax
	jnb	.L64
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L18:
	xorl	%ebx, %ebx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L21
.L20:
	movq	%r8, %rcx
.L22:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L19
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L20
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, (%r14,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L65
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L24:
	xorl	%ebx, %ebx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L27
.L26:
	movq	%r8, %rcx
.L28:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L25
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%ebx, 0(%rbp,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L66
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L30:
	xorl	%ebx, %ebx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	1(%rcx), %r8
	movq	%r8, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L33
.L32:
	movq	%r8, %rcx
.L34:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L31
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %r8
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L32
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%ebx, (%r12,%r15,4)
	cmpq	%r8, %rdx
	jbe	.L67
	leaq	1(%r8), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%r8), %eax
.L36:
	xorl	%ebx, %ebx
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L39
.L38:
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
.L40:
	leal	(%rbx,%rbx,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %ebx
	cmpq	%rdx, %rcx
	jb	.L37
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L39
	movq	stdin(%rip), %rdi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%ebx, 0(%r13,%r15,4)
	addq	$1, %r15
	cmpl	%r15d, 4(%rsp)
	jge	.L14
	movl	4(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L15
	movl	a(%rip), %eax
	xorl	%r8d, %r8d
	xorl	%r15d, %r15d
	xorl	%r9d, %r9d
	movl	d(%rip), %r11d
	movl	$1, %ecx
	movl	%eax, 4(%rsp)
	movl	0(%r13), %eax
	movl	%eax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L46:
	movl	0(%rbp,%rcx,4), %esi
	movl	(%r12,%rcx,4), %eax
	subl	%r11d, %esi
	testl	%esi, %esi
	jle	.L42
	movl	4(%rsp), %edi
	subl	%eax, %edi
	testl	%edi, %edi
	jle	.L48
	movslq	%esi, %rax
	movl	8(%rsp), %edx
	addq	%rax, %r15
	cmpl	%edx, 0(%r13,%rcx,4)
	jle	.L45
	addq	%rax, %r8
.L45:
	movl	(%r14,%rcx,4), %eax
	movd	%esi, %xmm1
	movslq	%r9d, %r10
	addl	$1, %r9d
	addl	%edi, %eax
	subl	$1, %eax
	cltd
	idivl	%edi
	movd	%eax, %xmm0
	leaq	tbl(%rip), %rax
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rax,%r10,8)
.L42:
	addq	$1, %rcx
	cmpl	%ecx, %ebx
	jge	.L46
	leaq	tbl(%rip), %rbx
	movslq	%r9d, %rsi
	movl	$8, %edx
	movq	%r8, 8(%rsp)
	leaq	cmp(%rip), %rcx
	movq	%rbx, %rdi
	movl	%r9d, 4(%rsp)
	call	qsort@PLT
	movl	4(%rsp), %r9d
	movq	8(%rsp), %r8
	testl	%r9d, %r9d
	je	.L47
	leal	-1(%r9), %ecx
	leaq	8(%rbx), %rax
	movslq	h(%rip), %rsi
	movq	%rbx, %rdx
	leaq	(%rax,%rcx,8), %rdi
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L68:
	addq	$8, %rdx
	subq	%rcx, %r15
	cmpq	%rdi, %rdx
	je	.L47
.L49:
	movslq	(%rdx), %rax
	movslq	4(%rdx), %rcx
	imulq	%r15, %rax
	subq	%rcx, %rax
	addq	%rax, %r8
	cmpq	%r8, %rsi
	jg	.L68
.L48:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
.L60:
	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
.L67:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L66:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L65:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L64:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L18
.L15:
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	xorl	%esi, %esi
	leaq	tbl(%rip), %rdi
	call	qsort@PLT
	xorl	%r8d, %r8d
.L47:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L60
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 160008
s:
	.zero	160008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 160008
d:
	.zero	160008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 160008
a:
	.zero	160008
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 160008
h:
	.zero	160008
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 320016
tbl:
	.zero	320016
	.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:

// AOJ 2236 Rabbit Plays Games!
// 2018.2.10 bal4u

#include <stdio.h>
#include <stdlib.h>

typedef struct { int a; int d; } T;
T tbl[40002];
int h[40002], a[40002], d[40002], s[40002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }

int main()
{
	int n, i, j, k, sz;
	long long turn, ans;

	n = in();
	for (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();
	
	sz = 0, ans = turn = 0;
	for (i = 1; i <= n; i++) {
		j = a[0] - d[i];
		k = a[i] - d[0];
		if (k <= 0) continue;
		if (j <= 0) { puts("-1"); return 0; }

		turn += k; if (s[i] > s[0]) ans += k;
		tbl[sz].d = k;
		tbl[sz++].a = (h[i]+j-1)/j;
	}
	qsort(tbl, sz, sizeof(T), cmp);

	for (i = 0; i < sz; i++) {
		ans += turn*tbl[i].a - tbl[i].d;
		if (h[0] <= ans) { puts("-1"); return 0; }
		turn -= tbl[i].d;
	}
	printf("%lld\n", ans);
	return 0;
}

1
1 0 1 1
10000 10000 10000 10000
 2
10 3 1 2
2 4 1 3
1 2 1 1
 2
10 3 1 2
2 4 1 3
1 3 1 1
 2
10 3 1 2
3 4 1 3
1 3 1 1
 2
10 3 2 2
3 4 1 3
1 3 1 1
 1
1 0 1 1
10000 10010 10000 10000
 1
1 0 1 1
10000 10010 10000 10100
 1
1 0 1 1
10000 10010 10000 10101
 1
1 0 1 1
10000 10010 11000 10101
 2
10 3 2 2
3 8 1 3
1 3 1 1

-1
 4
 5
 9
 6
 -1
 -1
 -1
 -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
// AOJ 2236 Rabbit Plays Games!
// 2018.2.10 bal4u

#include <stdio.h>
#include <stdlib.h>

typedef struct { int a; int d; } T;
T tbl[40002];
int h[40002], a[40002], d[40002], s[40002];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }

int main()
{
	int n, i, j, k, sz;
	long long turn, ans;

	n = in();
	for (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();
	
	sz = 0, ans = turn = 0;
	for (i = 1; i <= n; i++) {
		j = a[0] - d[i];
		k = a[i] - d[0];
		if (k <= 0) continue;
		if (j <= 0) { puts("-1"); return 0; }

		turn += k; if (s[i] > s[0]) ans += k;
		tbl[sz].d = k;
		tbl[sz++].a = (h[i]+j-1)/j;
	}
	qsort(tbl, sz, sizeof(T), cmp);

	for (i = 0; i < sz; i++) {
		ans += turn*tbl[i].a - tbl[i].d;
		if (h[0] <= ans) { puts("-1"); return 0; }
		turn -= tbl[i].d;
	}
	printf("%lld\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 320016
tbl:
	.zero	320016
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 160008
h:
	.zero	160008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 160008
a:
	.zero	160008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 160008
d:
	.zero	160008
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 160008
s:
	.zero	160008
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.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), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%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
.LFE6:
	.size	in, .-in
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB7:
	.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
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rcx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"-1"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	s(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L8
	movl	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L9
.L15:
	movl	a(%rip), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L19
	cmpl	$0, -24(%rbp)
	jg	.L12
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	s(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %ecx
	leal	1(%rcx), %eax
	movl	%eax, -32(%rbp)
	movl	%edx, %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	%esi, (%rdx,%rax)
	jmp	.L11
.L19:
	nop
.L11:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L15
	movl	-32(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	tbl(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	jmp	.L16
.L18:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	addq	%rax, -8(%rbp)
	movl	h(%rip), %eax
	cltq
	cmpq	%rax, -8(%rbp)
	jl	.L17
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L17:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L16:
	movl	-36(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L18
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 320016
tbl:
	.zero	320016
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 160008
h:
	.zero	160008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 160008
a:
	.zero	160008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 160008
d:
	.zero	160008
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 160008
s:
	.zero	160008
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.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), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%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
.LFE6:
	.size	in, .-in
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB7:
	.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
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rcx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cltq
	imulq	%rcx, %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"-1"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	h(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$0, %eax
	call	in
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	s(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L8
	movl	$0, -32(%rbp)
	movq	$0, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L9
.L15:
	movl	a(%rip), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L19
	cmpl	$0, -24(%rbp)
	jg	.L12
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L12:
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -16(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	s(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-20(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	h(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %ecx
	leal	1(%rcx), %eax
	movl	%eax, -32(%rbp)
	movl	%edx, %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	%esi, (%rdx,%rax)
	jmp	.L11
.L19:
	nop
.L11:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L15
	movl	-32(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	leaq	tbl(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	jmp	.L16
.L18:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+tbl(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	addq	%rax, -8(%rbp)
	movl	h(%rip), %eax
	cltq
	cmpq	%rax, -8(%rbp)
	jl	.L17
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L17:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L16:
	movl	-36(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L18
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
