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

```c
#include <stdio.h>
#include <inttypes.h>
#include <string.h>

int x[4], y[4];

uint64_t memo[1 << 16];

uint64_t search(int current) {
	int i, j, k;
	if (current == (1 << 16) - 1) return 1;
	if (memo[current]) return ~memo[current];
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 4; j++) {
			if (!((current >> (i * 4 + j)) & 1)) {
				uint64_t ret = 0;
				int next = current | (1 << (i * 4 + j));
				for (k = 0; k < 8; k++) {
					int ni, nj;
					if (k % 2 == 0) {
						ni = i + y[k / 2];
						nj = j + x[k / 2];
					} else {
						ni = i - y[k / 2];
						nj = j - x[k / 2];
					}
					if (0 <= ni && ni < 4 && 0 <= nj && nj < 4 && !((current >> (ni * 4 + nj)) & 1)) {
						ret += search(next | (1 << (ni * 4 + nj)));
					}
				}
				return ~(memo[current] = ~ret);
			}
		}
	}
	return 0; /* will not come here */
}

int main(void) {
	while (scanf("%d", &x[0]) == 1 && x[0] <= 4) {
		int i;
		if (scanf("%d", &y[0]) != 1) return 1;
		for (i = 1; i < 4; i++) {
			if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
		}
		memset(memo, 0, sizeof(memo));
		printf("%"PRIu64"\n", search(0));
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	x
	.bss
	.align 16
	.type	x, @object
	.size	x, 16
x:
	.zero	16
	.globl	y
	.align 16
	.type	y, @object
	.size	y, 16
y:
	.zero	16
	.globl	memo
	.align 32
	.type	memo, @object
	.size	memo, 524288
memo:
	.zero	524288
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.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	%edi, -36(%rbp)
	cmpl	$65535, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L4
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L4:
	movl	$0, -32(%rbp)
	jmp	.L5
.L14:
	movl	$0, -28(%rbp)
	jmp	.L6
.L13:
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movq	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-36(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L8
.L12:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
.L10:
	cmpl	$0, -20(%rbp)
	js	.L11
	cmpl	$3, -20(%rbp)
	jg	.L11
	cmpl	$0, -16(%rbp)
	js	.L11
	cmpl	$3, -16(%rbp)
	jg	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-12(%rbp), %eax
	movl	%eax, %edi
	call	search
	addq	%rax, -8(%rbp)
.L11:
	addl	$1, -24(%rbp)
.L8:
	cmpl	$7, -24(%rbp)
	jle	.L12
	movq	-8(%rbp), %rax
	notq	%rax
	movq	%rax, %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L7:
	addl	$1, -28(%rbp)
.L6:
	cmpl	$3, -28(%rbp)
	jle	.L13
	addl	$1, -32(%rbp)
.L5:
	cmpl	$3, -32(%rbp)
	jle	.L14
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	jmp	.L16
.L23:
	leaq	y(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L17
	movl	$1, %eax
	jmp	.L18
.L17:
	movl	$1, -4(%rbp)
	jmp	.L19
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L18
.L20:
	addl	$1, -4(%rbp)
.L19:
	cmpl	$3, -4(%rbp)
	jle	.L21
	movl	$524288, %edx
	movl	$0, %esi
	leaq	memo(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %edi
	call	search
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	x(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L22
	movl	x(%rip), %eax
	cmpl	$4, %eax
	jle	.L23
.L22:
	movl	$0, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.type	search.part.0, @function
search.part.0:
.LFB37:
	.cfi_startproc
	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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ebp, %r13d
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	andl	$1, %r13d
	je	.L42
	movl	%ebp, %ebx
	sarl	%ebx
	andl	$1, %ebx
	je	.L43
	movl	%ebp, %ebx
	sarl	$2, %ebx
	andl	$1, %ebx
	je	.L44
	movl	%ebp, %ebx
	sarl	$3, %ebx
	andl	$1, %ebx
	je	.L45
	movl	%ebp, %eax
	sarl	$4, %eax
	andl	$1, %eax
	je	.L46
	movl	%ebp, %ebx
	sarl	$5, %ebx
	andl	$1, %ebx
	je	.L47
	movl	%ebp, %eax
	sarl	$6, %eax
	andl	$1, %eax
	je	.L48
	testb	$-128, %bpl
	je	.L49
	testl	$256, %ebp
	je	.L50
	testl	$512, %ebp
	je	.L51
	testl	$1024, %ebp
	je	.L52
	testl	$2048, %ebp
	je	.L53
	movl	$3, %ebx
	movl	$12, %eax
	testl	$4096, %ebp
	je	.L2
	movl	$3, %ebx
	movl	$13, %eax
	testl	$8192, %ebp
	je	.L40
	movl	$3, %ebx
	movl	$14, %eax
	testl	$16384, %ebp
	je	.L4
	xorl	%r12d, %r12d
	movl	$15, %eax
	movl	$3, %ebx
	testl	$32768, %ebp
	je	.L5
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r12, %rax
	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
.L42:
	.cfi_restore_state
	xorl	%ebx, %ebx
	xorl	%eax, %eax
.L2:
	xorl	%r13d, %r13d
.L40:
	movl	x(%rip), %r14d
	movl	y(%rip), %r15d
	movl	%ebp, %ecx
	xorl	%r12d, %r12d
	btsl	%eax, %ecx
	leaq	memo(%rip), %rdx
	leal	0(%r13,%r14), %eax
	leal	(%r15,%rbx), %esi
	movl	%eax, %edi
	orl	%esi, %edi
	cmpl	$3, %edi
	jbe	.L61
.L7:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L62
.L11:
	movl	4+y(%rip), %r15d
	movl	4+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L63
.L15:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L64
.L19:
	movl	8+y(%rip), %r15d
	movl	8+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L65
.L23:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L66
.L27:
	movl	12+y(%rip), %r15d
	movl	12+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L67
.L31:
	subl	%r15d, %ebx
	subl	%r14d, %r13d
	movl	%ebx, %eax
	orl	%r13d, %eax
	cmpl	$3, %eax
	jbe	.L68
.L35:
	movq	%r12, %rax
	notq	%rax
	movq	%rax, (%rdx,%rbp,8)
	jmp	.L1
.L45:
	movl	$3, %eax
.L5:
	movl	$3, %r13d
	jmp	.L40
.L44:
	movl	$2, %eax
.L4:
	movl	$2, %r13d
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L68:
	leal	0(%r13,%rbx,4), %eax
	btl	%eax, %ebp
	jc	.L35
	btsl	%eax, %ecx
	movl	$1, %eax
	cmpl	$65535, %ecx
	je	.L36
	movslq	%ecx, %rax
	movq	(%rdx,%rax,8), %rax
	testq	%rax, %rax
	jne	.L69
	movl	%ecx, %edi
	call	search.part.0
	leaq	memo(%rip), %rdx
.L36:
	addq	%rax, %r12
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L67:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L31
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L70
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L34
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L34:
	addq	%rax, %r12
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L66:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L27
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L71
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L30
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L30:
	addq	%rax, %r12
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L65:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L23
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L72
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L26
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L26:
	addq	%rax, %r12
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L64:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L19
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L73
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L22
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L22:
	addq	%rax, %r12
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L63:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L15
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L74
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L18
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L18:
	addq	%rax, %r12
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L62:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L11
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L75
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L14
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L14:
	addq	%rax, %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L61:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L7
	movl	%ecx, %edi
	movl	$1, %r12d
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L7
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rax
	movq	%rax, %r12
	notq	%r12
	testq	%rax, %rax
	jne	.L7
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
	movq	%rax, %r12
	jmp	.L7
.L43:
	movl	%r13d, %eax
	jmp	.L40
.L46:
	movl	$4, %eax
	jmp	.L2
.L47:
	movl	%eax, %ebx
	movl	$5, %eax
	jmp	.L40
.L48:
	movl	$6, %eax
	jmp	.L4
.L49:
	movl	%eax, %ebx
	movl	$7, %eax
	jmp	.L5
.L50:
	movl	$2, %ebx
	movl	$8, %eax
	jmp	.L2
.L51:
	movl	$2, %ebx
	movl	$9, %eax
	jmp	.L40
.L52:
	movl	$2, %ebx
	movl	$10, %eax
	jmp	.L4
.L53:
	movl	$11, %eax
	movl	$2, %ebx
	jmp	.L5
.L69:
	notq	%rax
	jmp	.L36
.L70:
	movl	$1, %eax
	jmp	.L34
.L71:
	movl	$1, %eax
	jmp	.L30
.L72:
	movl	$1, %eax
	jmp	.L26
.L73:
	movl	$1, %eax
	jmp	.L22
.L74:
	movl	$1, %eax
	jmp	.L18
.L75:
	movl	$1, %eax
	jmp	.L14
	.cfi_endproc
.LFE37:
	.size	search.part.0, .-search.part.0
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	$65535, %edi
	je	.L79
	movslq	%edi, %rax
	leaq	memo(%rip), %rdx
	movq	(%rdx,%rax,8), %rax
	testq	%rax, %rax
	jne	.L80
	jmp	search.part.0
	.p2align 4,,10
	.p2align 3
.L80:
	notq	%rax
	ret
	.p2align 4,,10
	.p2align 3
.L79:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	search, .-search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	y(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	x(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L82:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%eax, %r12d
	cmpl	$1, %eax
	jne	.L88
	cmpl	$4, (%rbx)
	jg	.L88
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L81
	movl	$4, %r15d
.L83:
	xorl	%eax, %eax
	leaq	0(%rbp,%r15), %rdx
	leaq	(%rbx,%r15), %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L81
	addq	$4, %r15
	cmpq	$16, %r15
	jne	.L83
	xorl	%esi, %esi
	movl	$524288, %edx
	leaq	memo(%rip), %rdi
	call	memset@PLT
	xorl	%edi, %edi
	call	search.part.0
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L82
.L88:
	xorl	%r12d, %r12d
.L81:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 524288
memo:
	.zero	524288
	.globl	y
	.align 16
	.type	y, @object
	.size	y, 16
y:
	.zero	16
	.globl	x
	.align 16
	.type	x, @object
	.size	x, 16
x:
	.zero	16
	.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
	.type	search.part.0, @function
search.part.0:
.LFB37:
	.cfi_startproc
	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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ebp, %r13d
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	andl	$1, %r13d
	je	.L42
	movl	%ebp, %ebx
	sarl	%ebx
	andl	$1, %ebx
	je	.L43
	movl	%ebp, %ebx
	sarl	$2, %ebx
	andl	$1, %ebx
	je	.L44
	movl	%ebp, %ebx
	sarl	$3, %ebx
	andl	$1, %ebx
	je	.L45
	movl	%ebp, %eax
	sarl	$4, %eax
	andl	$1, %eax
	je	.L46
	movl	%ebp, %ebx
	sarl	$5, %ebx
	andl	$1, %ebx
	je	.L47
	movl	%ebp, %eax
	sarl	$6, %eax
	andl	$1, %eax
	je	.L48
	testb	$-128, %bpl
	je	.L49
	testl	$256, %ebp
	je	.L50
	testl	$512, %ebp
	je	.L51
	testl	$1024, %ebp
	je	.L52
	testl	$2048, %ebp
	je	.L53
	movl	$3, %ebx
	movl	$12, %eax
	testl	$4096, %ebp
	je	.L2
	movl	$3, %ebx
	movl	$13, %eax
	testl	$8192, %ebp
	je	.L40
	movl	$3, %ebx
	movl	$14, %eax
	testl	$16384, %ebp
	je	.L4
	xorl	%r12d, %r12d
	movl	$15, %eax
	movl	$3, %ebx
	testl	$32768, %ebp
	je	.L5
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r12, %rax
	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
.L42:
	.cfi_restore_state
	xorl	%ebx, %ebx
	xorl	%eax, %eax
.L2:
	xorl	%r13d, %r13d
.L40:
	movl	x(%rip), %r14d
	movl	y(%rip), %r15d
	movl	%ebp, %ecx
	xorl	%r12d, %r12d
	btsl	%eax, %ecx
	leaq	memo(%rip), %rdx
	leal	0(%r13,%r14), %eax
	leal	(%r15,%rbx), %esi
	movl	%eax, %edi
	orl	%esi, %edi
	cmpl	$3, %edi
	jbe	.L61
.L7:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L62
.L11:
	movl	4+y(%rip), %r15d
	movl	4+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L63
.L15:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L64
.L19:
	movl	8+y(%rip), %r15d
	movl	8+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L65
.L23:
	movl	%ebx, %esi
	movl	%r13d, %eax
	subl	%r15d, %esi
	subl	%r14d, %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L66
.L27:
	movl	12+y(%rip), %r15d
	movl	12+x(%rip), %r14d
	leal	(%rbx,%r15), %esi
	leal	0(%r13,%r14), %eax
	movl	%esi, %edi
	orl	%eax, %edi
	cmpl	$3, %edi
	jbe	.L67
.L31:
	subl	%r15d, %ebx
	subl	%r14d, %r13d
	movl	%ebx, %eax
	orl	%r13d, %eax
	cmpl	$3, %eax
	jbe	.L68
.L35:
	movq	%r12, %rax
	notq	%rax
	movq	%rax, (%rdx,%rbp,8)
	jmp	.L1
.L45:
	movl	$3, %eax
.L5:
	movl	$3, %r13d
	jmp	.L40
.L44:
	movl	$2, %eax
.L4:
	movl	$2, %r13d
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L68:
	leal	0(%r13,%rbx,4), %eax
	btl	%eax, %ebp
	jc	.L35
	btsl	%eax, %ecx
	movl	$1, %eax
	cmpl	$65535, %ecx
	je	.L36
	movslq	%ecx, %rax
	movq	(%rdx,%rax,8), %rax
	testq	%rax, %rax
	jne	.L69
	movl	%ecx, %edi
	call	search.part.0
	leaq	memo(%rip), %rdx
.L36:
	addq	%rax, %r12
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L67:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L31
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L70
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L34
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L34:
	addq	%rax, %r12
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L66:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L27
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L71
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L30
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L30:
	addq	%rax, %r12
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L65:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L23
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L72
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L26
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L26:
	addq	%rax, %r12
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L64:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L19
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L73
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L22
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L22:
	addq	%rax, %r12
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L63:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L15
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L74
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L18
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L18:
	addq	%rax, %r12
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L62:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L11
	movl	%ecx, %edi
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L75
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rsi
	movq	%rsi, %rax
	notq	%rax
	testq	%rsi, %rsi
	jne	.L14
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
.L14:
	addq	%rax, %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L61:
	leal	(%rax,%rsi,4), %eax
	btl	%eax, %ebp
	jc	.L7
	movl	%ecx, %edi
	movl	$1, %r12d
	btsl	%eax, %edi
	cmpl	$65535, %edi
	je	.L7
	movslq	%edi, %rax
	movq	(%rdx,%rax,8), %rax
	movq	%rax, %r12
	notq	%r12
	testq	%rax, %rax
	jne	.L7
	movl	%ecx, 12(%rsp)
	call	search.part.0
	movl	12(%rsp), %ecx
	leaq	memo(%rip), %rdx
	movq	%rax, %r12
	jmp	.L7
.L43:
	movl	%r13d, %eax
	jmp	.L40
.L46:
	movl	$4, %eax
	jmp	.L2
.L47:
	movl	%eax, %ebx
	movl	$5, %eax
	jmp	.L40
.L48:
	movl	$6, %eax
	jmp	.L4
.L49:
	movl	%eax, %ebx
	movl	$7, %eax
	jmp	.L5
.L50:
	movl	$2, %ebx
	movl	$8, %eax
	jmp	.L2
.L51:
	movl	$2, %ebx
	movl	$9, %eax
	jmp	.L40
.L52:
	movl	$2, %ebx
	movl	$10, %eax
	jmp	.L4
.L53:
	movl	$11, %eax
	movl	$2, %ebx
	jmp	.L5
.L69:
	notq	%rax
	jmp	.L36
.L70:
	movl	$1, %eax
	jmp	.L34
.L71:
	movl	$1, %eax
	jmp	.L30
.L72:
	movl	$1, %eax
	jmp	.L26
.L73:
	movl	$1, %eax
	jmp	.L22
.L74:
	movl	$1, %eax
	jmp	.L18
.L75:
	movl	$1, %eax
	jmp	.L14
	.cfi_endproc
.LFE37:
	.size	search.part.0, .-search.part.0
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	$65535, %edi
	je	.L79
	movslq	%edi, %rax
	leaq	memo(%rip), %rdx
	movq	(%rdx,%rax,8), %rax
	testq	%rax, %rax
	jne	.L80
	jmp	search.part.0
	.p2align 4,,10
	.p2align 3
.L80:
	notq	%rax
	ret
	.p2align 4,,10
	.p2align 3
.L79:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE35:
	.size	search, .-search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	y(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	x(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L82:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%eax, %r12d
	cmpl	$1, %eax
	jne	.L88
	cmpl	$4, (%rbx)
	jg	.L88
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L81
	movl	$4, %r15d
.L83:
	xorl	%eax, %eax
	leaq	0(%rbp,%r15), %rdx
	leaq	(%rbx,%r15), %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L81
	addq	$4, %r15
	cmpq	$16, %r15
	jne	.L83
	xorl	%esi, %esi
	movl	$524288, %edx
	leaq	memo(%rip), %rdi
	call	memset@PLT
	xorl	%edi, %edi
	call	search.part.0
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L82
.L88:
	xorl	%r12d, %r12d
.L81:
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 524288
memo:
	.zero	524288
	.globl	y
	.align 16
	.type	y, @object
	.size	y, 16
y:
	.zero	16
	.globl	x
	.align 16
	.type	x, @object
	.size	x, 16
x:
	.zero	16
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

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

int x[4], y[4];

uint64_t memo[1 << 16];

uint64_t search(int current) {
	int i, j, k;
	if (current == (1 << 16) - 1) return 1;
	if (memo[current]) return ~memo[current];
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 4; j++) {
			if (!((current >> (i * 4 + j)) & 1)) {
				uint64_t ret = 0;
				int next = current | (1 << (i * 4 + j));
				for (k = 0; k < 8; k++) {
					int ni, nj;
					if (k % 2 == 0) {
						ni = i + y[k / 2];
						nj = j + x[k / 2];
					} else {
						ni = i - y[k / 2];
						nj = j - x[k / 2];
					}
					if (0 <= ni && ni < 4 && 0 <= nj && nj < 4 && !((current >> (ni * 4 + nj)) & 1)) {
						ret += search(next | (1 << (ni * 4 + nj)));
					}
				}
				return ~(memo[current] = ~ret);
			}
		}
	}
	return 0; /* will not come here */
}

int main(void) {
	while (scanf("%d", &x[0]) == 1 && x[0] <= 4) {
		int i;
		if (scanf("%d", &y[0]) != 1) return 1;
		for (i = 1; i < 4; i++) {
			if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
		}
		memset(memo, 0, sizeof(memo));
		printf("%"PRIu64"\n", search(0));
	}
	return 0;
}
-2 1 -1 1 1 1 1 2
1 0 2 1 2 2 0 3
5
 -4 1 -1 1 1 1 1 2
1 0 2 1 2 2 3 3
5
 -2 1 -2 1 1 1 1 2
1 0 2 1 2 2 0 3
5
 -4 1 -1 1 1 1 1 2
1 0 1 1 2 2 3 3
5
 -2 1 -2 1 1 0 1 2
1 0 2 1 2 2 0 3
5
 -2 1 -2 1 1 0 1 3
1 0 2 1 2 2 0 3
5
 0 1 -2 1 1 0 1 3
1 0 2 1 2 2 0 3
5
 0 1 -2 1 1 0 1 3
1 0 2 1 2 2 0 6
5
 0 1 -2 1 1 0 1 3
1 0 2 1 0 2 0 6
5
 -2 1 -1 1 1 1 0 2
1 0 2 1 2 2 0 3
5

2
29
 1
15
 0
29
 1
6
 145
29
 125
29
 173
29
 173
13
 173
58
 41
29

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

```c
#include <stdio.h>
#include <inttypes.h>
#include <string.h>

int x[4], y[4];

uint64_t memo[1 << 16];

uint64_t search(int current) {
	int i, j, k;
	if (current == (1 << 16) - 1) return 1;
	if (memo[current]) return ~memo[current];
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 4; j++) {
			if (!((current >> (i * 4 + j)) & 1)) {
				uint64_t ret = 0;
				int next = current | (1 << (i * 4 + j));
				for (k = 0; k < 8; k++) {
					int ni, nj;
					if (k % 2 == 0) {
						ni = i + y[k / 2];
						nj = j + x[k / 2];
					} else {
						ni = i - y[k / 2];
						nj = j - x[k / 2];
					}
					if (0 <= ni && ni < 4 && 0 <= nj && nj < 4 && !((current >> (ni * 4 + nj)) & 1)) {
						ret += search(next | (1 << (ni * 4 + nj)));
					}
				}
				return ~(memo[current] = ~ret);
			}
		}
	}
	return 0; /* will not come here */
}

int main(void) {
	while (scanf("%d", &x[0]) == 1 && x[0] <= 4) {
		int i;
		if (scanf("%d", &y[0]) != 1) return 1;
		for (i = 1; i < 4; i++) {
			if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
		}
		memset(memo, 0, sizeof(memo));
		printf("%"PRIu64"\n", search(0));
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	x
	.bss
	.align 16
	.type	x, @object
	.size	x, 16
x:
	.zero	16
	.globl	y
	.align 16
	.type	y, @object
	.size	y, 16
y:
	.zero	16
	.globl	memo
	.align 32
	.type	memo, @object
	.size	memo, 524288
memo:
	.zero	524288
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.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	%edi, -36(%rbp)
	cmpl	$65535, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L4
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L4:
	movl	$0, -32(%rbp)
	jmp	.L5
.L14:
	movl	$0, -28(%rbp)
	jmp	.L6
.L13:
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movq	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-36(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L8
.L12:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
.L10:
	cmpl	$0, -20(%rbp)
	js	.L11
	cmpl	$3, -20(%rbp)
	jg	.L11
	cmpl	$0, -16(%rbp)
	js	.L11
	cmpl	$3, -16(%rbp)
	jg	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-12(%rbp), %eax
	movl	%eax, %edi
	call	search
	addq	%rax, -8(%rbp)
.L11:
	addl	$1, -24(%rbp)
.L8:
	cmpl	$7, -24(%rbp)
	jle	.L12
	movq	-8(%rbp), %rax
	notq	%rax
	movq	%rax, %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L7:
	addl	$1, -28(%rbp)
.L6:
	cmpl	$3, -28(%rbp)
	jle	.L13
	addl	$1, -32(%rbp)
.L5:
	cmpl	$3, -32(%rbp)
	jle	.L14
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	jmp	.L16
.L23:
	leaq	y(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L17
	movl	$1, %eax
	jmp	.L18
.L17:
	movl	$1, -4(%rbp)
	jmp	.L19
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L18
.L20:
	addl	$1, -4(%rbp)
.L19:
	cmpl	$3, -4(%rbp)
	jle	.L21
	movl	$524288, %edx
	movl	$0, %esi
	leaq	memo(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %edi
	call	search
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	x(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L22
	movl	x(%rip), %eax
	cmpl	$4, %eax
	jle	.L23
.L22:
	movl	$0, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	x
	.bss
	.align 16
	.type	x, @object
	.size	x, 16
x:
	.zero	16
	.globl	y
	.align 16
	.type	y, @object
	.size	y, 16
y:
	.zero	16
	.globl	memo
	.align 32
	.type	memo, @object
	.size	memo, 524288
memo:
	.zero	524288
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.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	%edi, -36(%rbp)
	cmpl	$65535, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L4
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L4:
	movl	$0, -32(%rbp)
	jmp	.L5
.L14:
	movl	$0, -28(%rbp)
	jmp	.L6
.L13:
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L7
	movq	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-36(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L8
.L12:
	movl	-24(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
.L10:
	cmpl	$0, -20(%rbp)
	js	.L11
	cmpl	$3, -20(%rbp)
	jg	.L11
	cmpl	$0, -16(%rbp)
	js	.L11
	cmpl	$3, -16(%rbp)
	jg	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-20(%rbp), %eax
	leal	0(,%rax,4), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	orl	-12(%rbp), %eax
	movl	%eax, %edi
	call	search
	addq	%rax, -8(%rbp)
.L11:
	addl	$1, -24(%rbp)
.L8:
	cmpl	$7, -24(%rbp)
	jle	.L12
	movq	-8(%rbp), %rax
	notq	%rax
	movq	%rax, %rcx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	memo(%rip), %rax
	movq	(%rdx,%rax), %rax
	notq	%rax
	jmp	.L3
.L7:
	addl	$1, -28(%rbp)
.L6:
	cmpl	$3, -28(%rbp)
	jle	.L13
	addl	$1, -32(%rbp)
.L5:
	cmpl	$3, -32(%rbp)
	jle	.L14
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	jmp	.L16
.L23:
	leaq	y(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L17
	movl	$1, %eax
	jmp	.L18
.L17:
	movl	$1, -4(%rbp)
	jmp	.L19
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L20
	movl	$1, %eax
	jmp	.L18
.L20:
	addl	$1, -4(%rbp)
.L19:
	cmpl	$3, -4(%rbp)
	jle	.L21
	movl	$524288, %edx
	movl	$0, %esi
	leaq	memo(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %edi
	call	search
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	x(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L22
	movl	x(%rip), %eax
	cmpl	$4, %eax
	jle	.L23
.L22:
	movl	$0, %eax
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
