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

```c
// Aizu 1045: Split Up!
// 2017.9.6 bal4u@uu

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

#define MAX 1048600  // > 2^20
#define HASHSIZ 2000081
int hash[HASHSIZ + 5], *hashend = hash + HASHSIZ;

int lookup(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

int insert(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 0;
		if (++p == hashend) p = hash;
	}
	*p = n;
	return 1;
}

int q[MAX], *top, *end, qlen;

int a[22], alen;

int main()
{
	int n, i, k, s, v, v2, ans;
	int t[22];

	while (scanf("%d", &n) && n) {
		for (s = 0, i = 0; i < n; i++) scanf("%d", t+i), s += t[i];
		ans = s / 2;
		for (alen = 0, i = 0; i < n; i++) {
			if (t[i] == ans) goto Done;
			if (t[i] < ans) a[alen++] = t[i];
		}
		memset(hash, 0, sizeof(hash));
		top = end = q; *end++ = 0, qlen = 1;
		for (i = 0; i < alen; i++) {
			v = a[i];
			top = q, k = qlen;
			while (k--) {
				if ((v2 = v + *top++) == ans) goto Done;
				if (v2 < ans && insert(v2)) *end++ = v2, qlen++;
			}
		}
		while (--ans) {
			if (lookup(ans)) break;
		}
Done:	printf("%d\n", s - 2*ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	hash
	.bss
	.align 32
	.type	hash, @object
	.size	hash, 8000344
hash:
	.zero	8000344
	.globl	hashend
	.section	.data.rel.local,"aw"
	.align 8
	.type	hashend, @object
	.size	hashend, 8
hashend:
	.quad	hash+8000324
	.text
	.globl	lookup
	.type	lookup, @function
lookup:
.LFB0:
	.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	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L5:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L2
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	lookup, .-lookup
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L8
	movl	$0, %eax
	jmp	.L9
.L8:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L7
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L7:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, %eax
.L9:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 4194400
q:
	.zero	4194400
	.globl	top
	.align 8
	.type	top, @object
	.size	top, 8
top:
	.zero	8
	.globl	end
	.align 8
	.type	end, @object
	.size	end, 8
end:
	.zero	8
	.globl	qlen
	.align 4
	.type	qlen, @object
	.size	qlen, 4
qlen:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 88
a:
	.zero	88
	.globl	alen
	.align 4
	.type	alen, @object
	.size	alen, 4
alen:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L12
.L28:
	movl	$0, -112(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L13
.L14:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	addl	%eax, -112(%rbp)
	addl	$1, -120(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -108(%rbp)
	movl	$0, alen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L15
.L19:
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	je	.L31
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L18
	movl	alen(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, alen(%rip)
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L18:
	addl	$1, -120(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L19
	movl	$8000344, %edx
	movl	$0, %esi
	leaq	hash(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	leaq	q(%rip), %rax
	movq	%rax, end(%rip)
	movq	end(%rip), %rax
	movq	%rax, top(%rip)
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	$0, (%rax)
	movl	$1, qlen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L20
.L24:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -104(%rbp)
	leaq	q(%rip), %rax
	movq	%rax, top(%rip)
	movl	qlen(%rip), %eax
	movl	%eax, -116(%rbp)
	jmp	.L21
.L23:
	movq	top(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, top(%rip)
	movl	(%rax), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -100(%rbp)
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	je	.L32
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L21
	movl	-100(%rbp), %eax
	movl	%eax, %edi
	call	insert
	testl	%eax, %eax
	je	.L21
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	-100(%rbp), %edx
	movl	%edx, (%rax)
	movl	qlen(%rip), %eax
	addl	$1, %eax
	movl	%eax, qlen(%rip)
.L21:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -116(%rbp)
	testl	%eax, %eax
	jne	.L23
	addl	$1, -120(%rbp)
.L20:
	movl	alen(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	jmp	.L25
.L26:
	movl	-108(%rbp), %eax
	movl	%eax, %edi
	call	lookup
	testl	%eax, %eax
	jne	.L33
.L25:
	subl	$1, -108(%rbp)
	cmpl	$0, -108(%rbp)
	jne	.L26
	jmp	.L17
.L31:
	nop
	jmp	.L17
.L32:
	nop
	jmp	.L17
.L33:
	nop
.L17:
	movl	-108(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-112(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L27
	movl	-124(%rbp), %eax
	testl	%eax, %eax
	jne	.L28
.L27:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	lookup
	.type	lookup, @function
lookup:
.LFB35:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movl	%edi, %edx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%edi, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	movq	hashend(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%edi, %r8d
	je	.L6
	addq	$4, %rax
	leaq	hash(%rip), %rcx
	cmpq	%rax, %rdx
	cmove	%rcx, %rax
.L4:
	movl	(%rax), %r8d
	testl	%r8d, %r8d
	jne	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	lookup, .-lookup
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB36:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movl	%edi, %edx
	movq	hashend(%rip), %rcx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%edi, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	%edi, %edx
	je	.L14
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rax, %rcx
	cmove	%rdx, %rax
.L12:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L13
	movl	%edi, (%rax)
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L40
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L40
	movl	$0, %r15d
	movl	$0, %r14d
	leaq	32(%rsp), %r13
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	0(%r13,%r15,4), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%r13, %r12
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	addl	0(%r13,%r15,4), %r14d
	addq	$1, %r15
	cmpl	%r15d, %eax
	jg	.L18
	movl	$0, alen(%rip)
	movl	%r14d, %r15d
	shrl	$31, %r15d
	addl	%r14d, %r15d
	sarl	%r15d
	movl	%r15d, %r13d
	testl	%eax, %eax
	jle	.L23
	subl	$1, %eax
	xorl	%edi, %edi
	xorl	%ecx, %ecx
	leaq	36(%rsp,%rax,4), %rsi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L75:
	jge	.L21
	movslq	%ecx, %rdx
	movl	$1, %edi
	addl	$1, %ecx
	movl	%eax, 0(%rbp,%rdx,4)
.L21:
	addq	$4, %r12
	cmpq	%r12, %rsi
	je	.L74
.L22:
	movl	(%r12), %eax
	cmpl	%r15d, %eax
	jne	.L75
	testb	%dil, %dil
	je	.L39
	movl	%ecx, alen(%rip)
.L39:
	movl	%r15d, %ecx
.L27:
	addl	%ecx, %ecx
	movl	%r14d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	subl	%ecx, %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L74:
	testb	%dil, %dil
	je	.L23
	movl	$8000344, %edx
	xorl	%esi, %esi
	movl	%ecx, alen(%rip)
	leaq	hash(%rip), %rdi
	movl	%ecx, 12(%rsp)
	call	memset@PLT
	leaq	q(%rip), %r11
	movl	12(%rsp), %ecx
	movl	$0, q(%rip)
	leaq	4(%r11), %rax
	movq	%r11, top(%rip)
	movq	%rax, end(%rip)
	movl	$1, qlen(%rip)
	testl	%ecx, %ecx
	je	.L24
	movq	hashend(%rip), %rsi
	xorl	%r10d, %r10d
	movl	$1, %eax
.L34:
	movq	%r11, top(%rip)
	movl	0(%rbp,%r10,4), %r8d
	testl	%eax, %eax
	je	.L33
	leaq	4+q(%rip), %rdi
	subl	$1, %eax
	leaq	4(%rdi), %rcx
	leaq	(%rcx,%rax,4), %r9
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L28:
	addq	$4, %rdi
	cmpq	%rdi, %r9
	je	.L33
.L32:
	movl	-4(%rdi), %ecx
	movq	%rdi, top(%rip)
	addl	%r8d, %ecx
	cmpl	%ecx, %r15d
	je	.L27
	jle	.L28
	movslq	%ecx, %rax
	movl	%ecx, %edx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%ecx, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	cmpl	%edx, %ecx
	je	.L28
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rsi, %rax
	cmove	%rdx, %rax
.L30:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L31
	movl	%ecx, (%rax)
	movq	end(%rip), %rax
	addq	$4, %rdi
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	%ecx, (%rax)
	addl	$1, qlen(%rip)
	cmpq	%rdi, %r9
	jne	.L32
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$1, %r10
	cmpl	%r10d, alen(%rip)
	jle	.L24
	movl	qlen(%rip), %eax
	jmp	.L34
.L73:
	movl	$0, alen(%rip)
	xorl	%r13d, %r13d
.L23:
	movl	$8000344, %edx
	xorl	%esi, %esi
	leaq	hash(%rip), %rdi
	call	memset@PLT
	leaq	q(%rip), %rax
	movl	$0, q(%rip)
	movq	%rax, top(%rip)
	addq	$4, %rax
	movq	%rax, end(%rip)
	movl	$1, qlen(%rip)
.L24:
	movl	%r13d, %ecx
	subl	$1, %ecx
	je	.L27
	movq	hashend(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%ecx, %rax
	movl	%ecx, %edx
	leaq	hash(%rip), %rdi
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%ecx, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	(%rdi,%rax,4), %rax
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L37:
	cmpl	%ecx, %edx
	je	.L27
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rsi, %rax
	cmove	%rdx, %rax
.L36:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L37
	subl	$1, %ecx
	jne	.L38
	jmp	.L27
.L40:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L76
	addq	$136, %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
.L76:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.size	main, .-main
	.globl	alen
	.bss
	.align 4
	.type	alen, @object
	.size	alen, 4
alen:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 88
a:
	.zero	88
	.globl	qlen
	.align 4
	.type	qlen, @object
	.size	qlen, 4
qlen:
	.zero	4
	.globl	end
	.align 8
	.type	end, @object
	.size	end, 8
end:
	.zero	8
	.globl	top
	.align 8
	.type	top, @object
	.size	top, 8
top:
	.zero	8
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 4194400
q:
	.zero	4194400
	.globl	hashend
	.section	.data.rel.local,"aw"
	.align 8
	.type	hashend, @object
	.size	hashend, 8
hashend:
	.quad	hash+8000324
	.globl	hash
	.bss
	.align 32
	.type	hash, @object
	.size	hash, 8000344
hash:
	.zero	8000344
	.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	lookup
	.type	lookup, @function
lookup:
.LFB35:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movl	%edi, %edx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%edi, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	movq	hashend(%rip), %rdx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%edi, %r8d
	je	.L6
	addq	$4, %rax
	leaq	hash(%rip), %rcx
	cmpq	%rax, %rdx
	cmove	%rcx, %rax
.L4:
	movl	(%rax), %r8d
	testl	%r8d, %r8d
	jne	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	lookup, .-lookup
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB36:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movl	%edi, %edx
	movq	hashend(%rip), %rcx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%edi, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	%edi, %edx
	je	.L14
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rax, %rcx
	cmove	%rdx, %rax
.L12:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L13
	movl	%edi, (%rax)
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L40
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L40
	movl	$0, %r15d
	movl	$0, %r14d
	leaq	32(%rsp), %r13
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	0(%r13,%r15,4), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%r13, %r12
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	addl	0(%r13,%r15,4), %r14d
	addq	$1, %r15
	cmpl	%r15d, %eax
	jg	.L18
	movl	$0, alen(%rip)
	movl	%r14d, %r15d
	shrl	$31, %r15d
	addl	%r14d, %r15d
	sarl	%r15d
	movl	%r15d, %r13d
	testl	%eax, %eax
	jle	.L23
	subl	$1, %eax
	xorl	%edi, %edi
	xorl	%ecx, %ecx
	leaq	36(%rsp,%rax,4), %rsi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L75:
	jge	.L21
	movslq	%ecx, %rdx
	movl	$1, %edi
	addl	$1, %ecx
	movl	%eax, 0(%rbp,%rdx,4)
.L21:
	addq	$4, %r12
	cmpq	%r12, %rsi
	je	.L74
.L22:
	movl	(%r12), %eax
	cmpl	%r15d, %eax
	jne	.L75
	testb	%dil, %dil
	je	.L39
	movl	%ecx, alen(%rip)
.L39:
	movl	%r15d, %ecx
.L27:
	addl	%ecx, %ecx
	movl	%r14d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	subl	%ecx, %edx
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L74:
	testb	%dil, %dil
	je	.L23
	movl	$8000344, %edx
	xorl	%esi, %esi
	movl	%ecx, alen(%rip)
	leaq	hash(%rip), %rdi
	movl	%ecx, 12(%rsp)
	call	memset@PLT
	leaq	q(%rip), %r11
	movl	12(%rsp), %ecx
	movl	$0, q(%rip)
	leaq	4(%r11), %rax
	movq	%r11, top(%rip)
	movq	%rax, end(%rip)
	movl	$1, qlen(%rip)
	testl	%ecx, %ecx
	je	.L24
	movq	hashend(%rip), %rsi
	xorl	%r10d, %r10d
	movl	$1, %eax
.L34:
	movq	%r11, top(%rip)
	movl	0(%rbp,%r10,4), %r8d
	testl	%eax, %eax
	je	.L33
	leaq	4+q(%rip), %rdi
	subl	$1, %eax
	leaq	4(%rdi), %rcx
	leaq	(%rcx,%rax,4), %r9
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L28:
	addq	$4, %rdi
	cmpq	%rdi, %r9
	je	.L33
.L32:
	movl	-4(%rdi), %ecx
	movq	%rdi, top(%rip)
	addl	%r8d, %ecx
	cmpl	%ecx, %r15d
	je	.L27
	jle	.L28
	movslq	%ecx, %rax
	movl	%ecx, %edx
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%ecx, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	hash(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	cmpl	%edx, %ecx
	je	.L28
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rsi, %rax
	cmove	%rdx, %rax
.L30:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L31
	movl	%ecx, (%rax)
	movq	end(%rip), %rax
	addq	$4, %rdi
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	%ecx, (%rax)
	addl	$1, qlen(%rip)
	cmpq	%rdi, %r9
	jne	.L32
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$1, %r10
	cmpl	%r10d, alen(%rip)
	jle	.L24
	movl	qlen(%rip), %eax
	jmp	.L34
.L73:
	movl	$0, alen(%rip)
	xorl	%r13d, %r13d
.L23:
	movl	$8000344, %edx
	xorl	%esi, %esi
	leaq	hash(%rip), %rdi
	call	memset@PLT
	leaq	q(%rip), %rax
	movl	$0, q(%rip)
	movq	%rax, top(%rip)
	addq	$4, %rax
	movq	%rax, end(%rip)
	movl	$1, qlen(%rip)
.L24:
	movl	%r13d, %ecx
	subl	$1, %ecx
	je	.L27
	movq	hashend(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%ecx, %rax
	movl	%ecx, %edx
	leaq	hash(%rip), %rdi
	imulq	$562927155, %rax, %rax
	sarl	$31, %edx
	sarq	$50, %rax
	subl	%edx, %eax
	movl	%ecx, %edx
	imull	$2000081, %eax, %eax
	subl	%eax, %edx
	movslq	%edx, %rax
	leaq	(%rdi,%rax,4), %rax
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L37:
	cmpl	%ecx, %edx
	je	.L27
	addq	$4, %rax
	leaq	hash(%rip), %rdx
	cmpq	%rsi, %rax
	cmove	%rdx, %rax
.L36:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L37
	subl	$1, %ecx
	jne	.L38
	jmp	.L27
.L40:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L76
	addq	$136, %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
.L76:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.size	main, .-main
	.globl	alen
	.bss
	.align 4
	.type	alen, @object
	.size	alen, 4
alen:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 88
a:
	.zero	88
	.globl	qlen
	.align 4
	.type	qlen, @object
	.size	qlen, 4
qlen:
	.zero	4
	.globl	end
	.align 8
	.type	end, @object
	.size	end, 8
end:
	.zero	8
	.globl	top
	.align 8
	.type	top, @object
	.size	top, 8
top:
	.zero	8
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 4194400
q:
	.zero	4194400
	.globl	hashend
	.section	.data.rel.local,"aw"
	.align 8
	.type	hashend, @object
	.size	hashend, 8
hashend:
	.quad	hash+8000324
	.globl	hash
	.bss
	.align 32
	.type	hash, @object
	.size	hash, 8000344
hash:
	.zero	8000344
	.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:

// Aizu 1045: Split Up!
// 2017.9.6 bal4u@uu

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

#define MAX 1048600  // > 2^20
#define HASHSIZ 2000081
int hash[HASHSIZ + 5], *hashend = hash + HASHSIZ;

int lookup(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

int insert(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 0;
		if (++p == hashend) p = hash;
	}
	*p = n;
	return 1;
}

int q[MAX], *top, *end, qlen;

int a[22], alen;

int main()
{
	int n, i, k, s, v, v2, ans;
	int t[22];

	while (scanf("%d", &n) && n) {
		for (s = 0, i = 0; i < n; i++) scanf("%d", t+i), s += t[i];
		ans = s / 2;
		for (alen = 0, i = 0; i < n; i++) {
			if (t[i] == ans) goto Done;
			if (t[i] < ans) a[alen++] = t[i];
		}
		memset(hash, 0, sizeof(hash));
		top = end = q; *end++ = 0, qlen = 1;
		for (i = 0; i < alen; i++) {
			v = a[i];
			top = q, k = qlen;
			while (k--) {
				if ((v2 = v + *top++) == ans) goto Done;
				if (v2 < ans && insert(v2)) *end++ = v2, qlen++;
			}
		}
		while (--ans) {
			if (lookup(ans)) break;
		}
Done:	printf("%d\n", s - 2*ans);
	}
	return 0;
}
5
1 2 3 4 5
4
2 3 5 10
0
 5
1 2 3 4 5
4
1 3 5 10
0
 5
1 2 3 4 5
4
1 3 4 10
0
 5
1 3 3 4 5
4
2 3 5 7
0
 5
1 2 3 4 4
4
1 3 4 10
0
 5
1 3 3 4 5
4
2 3 5 10
0
 5
1 2 3 4 5
4
0 3 5 11
0

1
0
 1
1
 1
2
 0
1
 0
2
 0
0
 1
3

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

```c
// Aizu 1045: Split Up!
// 2017.9.6 bal4u@uu

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

#define MAX 1048600  // > 2^20
#define HASHSIZ 2000081
int hash[HASHSIZ + 5], *hashend = hash + HASHSIZ;

int lookup(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

int insert(int n)
{
	int *p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 0;
		if (++p == hashend) p = hash;
	}
	*p = n;
	return 1;
}

int q[MAX], *top, *end, qlen;

int a[22], alen;

int main()
{
	int n, i, k, s, v, v2, ans;
	int t[22];

	while (scanf("%d", &n) && n) {
		for (s = 0, i = 0; i < n; i++) scanf("%d", t+i), s += t[i];
		ans = s / 2;
		for (alen = 0, i = 0; i < n; i++) {
			if (t[i] == ans) goto Done;
			if (t[i] < ans) a[alen++] = t[i];
		}
		memset(hash, 0, sizeof(hash));
		top = end = q; *end++ = 0, qlen = 1;
		for (i = 0; i < alen; i++) {
			v = a[i];
			top = q, k = qlen;
			while (k--) {
				if ((v2 = v + *top++) == ans) goto Done;
				if (v2 < ans && insert(v2)) *end++ = v2, qlen++;
			}
		}
		while (--ans) {
			if (lookup(ans)) break;
		}
Done:	printf("%d\n", s - 2*ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	hash
	.bss
	.align 32
	.type	hash, @object
	.size	hash, 8000344
hash:
	.zero	8000344
	.globl	hashend
	.section	.data.rel.local,"aw"
	.align 8
	.type	hashend, @object
	.size	hashend, 8
hashend:
	.quad	hash+8000324
	.text
	.globl	lookup
	.type	lookup, @function
lookup:
.LFB0:
	.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	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L5:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L2
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	lookup, .-lookup
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L8
	movl	$0, %eax
	jmp	.L9
.L8:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L7
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L7:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, %eax
.L9:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 4194400
q:
	.zero	4194400
	.globl	top
	.align 8
	.type	top, @object
	.size	top, 8
top:
	.zero	8
	.globl	end
	.align 8
	.type	end, @object
	.size	end, 8
end:
	.zero	8
	.globl	qlen
	.align 4
	.type	qlen, @object
	.size	qlen, 4
qlen:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 88
a:
	.zero	88
	.globl	alen
	.align 4
	.type	alen, @object
	.size	alen, 4
alen:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L12
.L28:
	movl	$0, -112(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L13
.L14:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	addl	%eax, -112(%rbp)
	addl	$1, -120(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -108(%rbp)
	movl	$0, alen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L15
.L19:
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	je	.L31
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L18
	movl	alen(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, alen(%rip)
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L18:
	addl	$1, -120(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L19
	movl	$8000344, %edx
	movl	$0, %esi
	leaq	hash(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	leaq	q(%rip), %rax
	movq	%rax, end(%rip)
	movq	end(%rip), %rax
	movq	%rax, top(%rip)
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	$0, (%rax)
	movl	$1, qlen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L20
.L24:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -104(%rbp)
	leaq	q(%rip), %rax
	movq	%rax, top(%rip)
	movl	qlen(%rip), %eax
	movl	%eax, -116(%rbp)
	jmp	.L21
.L23:
	movq	top(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, top(%rip)
	movl	(%rax), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -100(%rbp)
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	je	.L32
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L21
	movl	-100(%rbp), %eax
	movl	%eax, %edi
	call	insert
	testl	%eax, %eax
	je	.L21
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	-100(%rbp), %edx
	movl	%edx, (%rax)
	movl	qlen(%rip), %eax
	addl	$1, %eax
	movl	%eax, qlen(%rip)
.L21:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -116(%rbp)
	testl	%eax, %eax
	jne	.L23
	addl	$1, -120(%rbp)
.L20:
	movl	alen(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	jmp	.L25
.L26:
	movl	-108(%rbp), %eax
	movl	%eax, %edi
	call	lookup
	testl	%eax, %eax
	jne	.L33
.L25:
	subl	$1, -108(%rbp)
	cmpl	$0, -108(%rbp)
	jne	.L26
	jmp	.L17
.L31:
	nop
	jmp	.L17
.L32:
	nop
	jmp	.L17
.L33:
	nop
.L17:
	movl	-108(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-112(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L27
	movl	-124(%rbp), %eax
	testl	%eax, %eax
	jne	.L28
.L27:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	hash
	.bss
	.align 32
	.type	hash, @object
	.size	hash, 8000344
hash:
	.zero	8000344
	.globl	hashend
	.section	.data.rel.local,"aw"
	.align 8
	.type	hashend, @object
	.size	hashend, 8
hashend:
	.quad	hash+8000324
	.text
	.globl	lookup
	.type	lookup, @function
lookup:
.LFB0:
	.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	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L5:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L2
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	lookup, .-lookup
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$562927155, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$18, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$2000081, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	hash(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L8
	movl	$0, %eax
	jmp	.L9
.L8:
	addq	$4, -8(%rbp)
	movq	hashend(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L7
	leaq	hash(%rip), %rax
	movq	%rax, -8(%rbp)
.L7:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movl	$1, %eax
.L9:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 4194400
q:
	.zero	4194400
	.globl	top
	.align 8
	.type	top, @object
	.size	top, 8
top:
	.zero	8
	.globl	end
	.align 8
	.type	end, @object
	.size	end, 8
end:
	.zero	8
	.globl	qlen
	.align 4
	.type	qlen, @object
	.size	qlen, 4
qlen:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 88
a:
	.zero	88
	.globl	alen
	.align 4
	.type	alen, @object
	.size	alen, 4
alen:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L12
.L28:
	movl	$0, -112(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L13
.L14:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	addl	%eax, -112(%rbp)
	addl	$1, -120(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -108(%rbp)
	movl	$0, alen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L15
.L19:
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	je	.L31
	movl	-120(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L18
	movl	alen(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, alen(%rip)
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L18:
	addl	$1, -120(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L19
	movl	$8000344, %edx
	movl	$0, %esi
	leaq	hash(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	leaq	q(%rip), %rax
	movq	%rax, end(%rip)
	movq	end(%rip), %rax
	movq	%rax, top(%rip)
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	$0, (%rax)
	movl	$1, qlen(%rip)
	movl	$0, -120(%rbp)
	jmp	.L20
.L24:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -104(%rbp)
	leaq	q(%rip), %rax
	movq	%rax, top(%rip)
	movl	qlen(%rip), %eax
	movl	%eax, -116(%rbp)
	jmp	.L21
.L23:
	movq	top(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, top(%rip)
	movl	(%rax), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -100(%rbp)
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	je	.L32
	movl	-100(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L21
	movl	-100(%rbp), %eax
	movl	%eax, %edi
	call	insert
	testl	%eax, %eax
	je	.L21
	movq	end(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, end(%rip)
	movl	-100(%rbp), %edx
	movl	%edx, (%rax)
	movl	qlen(%rip), %eax
	addl	$1, %eax
	movl	%eax, qlen(%rip)
.L21:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -116(%rbp)
	testl	%eax, %eax
	jne	.L23
	addl	$1, -120(%rbp)
.L20:
	movl	alen(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	jmp	.L25
.L26:
	movl	-108(%rbp), %eax
	movl	%eax, %edi
	call	lookup
	testl	%eax, %eax
	jne	.L33
.L25:
	subl	$1, -108(%rbp)
	cmpl	$0, -108(%rbp)
	jne	.L26
	jmp	.L17
.L31:
	nop
	jmp	.L17
.L32:
	nop
	jmp	.L17
.L33:
	nop
.L17:
	movl	-108(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-112(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L27
	movl	-124(%rbp), %eax
	testl	%eax, %eax
	jne	.L28
.L27:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
