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<stdlib.h>
#define MAX 100000

typedef struct node *link;
struct node{
	int v;
	link next;
};

int loop[MAX];
link adj[MAX];

link NEW(int v,link n){
	link x = malloc(sizeof(*x));
	x->v = v; x->next=n;
	return x;
}

void search(int n,int cnt){
	if(loop[n]==-1){
		link t;
		loop[n]=cnt;
		for(t=adj[n];t!=NULL;t=t->next)search(t->v,cnt);
	}
}

int main(void){
	int n,m,q,s,t;
	int i;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		adj[i]=NULL;
		loop[i]=-1;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&s,&t);
		adj[s]=NEW(t,adj[s]);
		adj[t]=NEW(s,adj[t]);
	}
	
	for(i=0;i<n;i++)search(i,i);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d",&s,&t);
		if(loop[s]==loop[t])printf("yes\n");
		else printf("no\n");
	}
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	loop
	.bss
	.align 32
	.type	loop, @object
	.size	loop, 400000
loop:
	.zero	400000
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 800000
adj:
	.zero	800000
	.text
	.globl	NEW
	.type	NEW, @function
NEW:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	NEW, .-NEW
	.globl	search
	.type	search, @function
search:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L7
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L5:
	cmpq	$0, -8(%rbp)
	jne	.L6
.L7:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"yes"
.LC3:
	.string	"no"
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-32(%rbp), %eax
	movl	-36(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movl	$0, -28(%rbp)
	jmp	.L13
.L14:
	movl	-28(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	addl	$1, -28(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L17
.L16:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	movq	-8(%rbp), %rbx
	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
	.type	search.part.0, @function
search.part.0:
.LFB42:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	adj(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	loop(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	(%rcx,%rdi,8), %r15
	movl	%esi, (%rbx,%rdi,4)
	testq	%r15, %r15
	je	.L1
.L13:
	movslq	(%r15), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L42
.L3:
	movq	8(%r15), %r15
	testq	%r15, %r15
	jne	.L13
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L42:
	.cfi_restore_state
	movq	(%rcx,%rax,8), %r14
	movl	%esi, (%rbx,%rax,4)
	testq	%r14, %r14
	je	.L3
	movslq	(%r14), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L43
	.p2align 4,,10
	.p2align 3
.L4:
	movq	8(%r14), %r14
	testq	%r14, %r14
	je	.L3
	movslq	(%r14), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L4
.L43:
	movq	(%rcx,%rax,8), %r13
	movl	%esi, (%rbx,%rax,4)
	testq	%r13, %r13
	je	.L4
	movslq	0(%r13), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L44
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%r13), %r13
	testq	%r13, %r13
	je	.L4
	movslq	0(%r13), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L5
.L44:
	movq	(%rcx,%rax,8), %r12
	movl	%esi, (%rbx,%rax,4)
	testq	%r12, %r12
	je	.L5
	movslq	(%r12), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L45
	.p2align 4,,10
	.p2align 3
.L6:
	movq	8(%r12), %r12
	testq	%r12, %r12
	je	.L5
	movslq	(%r12), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L6
.L45:
	movq	(%rcx,%rax,8), %rbp
	movl	%esi, (%rbx,%rax,4)
	testq	%rbp, %rbp
	je	.L6
.L9:
	movslq	0(%rbp), %rax
	cmpl	$-1, (%rbx,%rax,4)
	movq	%rax, %rdi
	je	.L46
.L7:
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	je	.L6
	movslq	0(%rbp), %rax
	cmpl	$-1, (%rbx,%rax,4)
	movq	%rax, %rdi
	jne	.L7
.L46:
	movl	%esi, 12(%rsp)
	call	search.part.0
	movq	8(%rbp), %rbp
	movl	12(%rsp), %esi
	leaq	adj(%rip), %rcx
	testq	%rbp, %rbp
	jne	.L9
	jmp	.L6
	.cfi_endproc
.LFE42:
	.size	search.part.0, .-search.part.0
	.p2align 4
	.globl	NEW
	.type	NEW, @function
NEW:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	movl	$16, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movl	%ebp, (%rax)
	movq	%rbx, 8(%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	NEW, .-NEW
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB40:
	.cfi_startproc
	endbr64
	leaq	loop(%rip), %r9
	movslq	%edi, %rdi
	cmpl	$-1, (%r9,%rdi,4)
	je	.L66
.L61:
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	leaq	adj(%rip), %rax
	movl	%esi, (%r9,%rdi,4)
	movl	%esi, %r8d
	movq	(%rax,%rdi,8), %rdx
	testq	%rdx, %rdx
	je	.L61
.L62:
	movslq	(%rdx), %rax
	cmpl	$-1, (%r9,%rax,4)
	movq	%rax, %rdi
	je	.L65
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	jne	.L62
	ret
	.p2align 4,,10
	.p2align 3
.L65:
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
.L63:
	movl	%r8d, %esi
	call	search.part.0
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	je	.L49
.L53:
	movslq	(%rdx), %rax
	cmpl	$-1, (%r9,%rax,4)
	movq	%rax, %rdi
	je	.L63
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	jne	.L53
.L49:
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	search, .-search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"yes"
.LC3:
	.string	"no"
	.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
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rdx
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	jle	.L71
	movslq	%edx, %rbx
	leaq	adj(%rip), %rbp
	xorl	%esi, %esi
	leaq	0(,%rbx,8), %rdx
	movq	%rbp, %rdi
	leaq	loop(%rip), %r15
	call	memset@PLT
	leaq	0(,%rbx,4), %rdx
	movl	$255, %esi
	movq	%r15, %rdi
	call	memset@PLT
.L71:
	movl	40(%rsp), %edx
	testl	%edx, %edx
	jle	.L70
	xorl	%r15d, %r15d
	leaq	52(%rsp), %r14
	leaq	48(%rsp), %r13
	leaq	adj(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	48(%rsp), %rcx
	movl	$16, %edi
	movslq	52(%rsp), %rbx
	addl	$1, %r15d
	movq	0(%rbp,%rcx,8), %rsi
	movl	%ecx, 28(%rsp)
	movq	%rcx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rcx
	movl	$16, %edi
	movl	%ebx, (%rax)
	movq	%rax, 0(%rbp,%rcx,8)
	movq	0(%rbp,%rbx,8), %rcx
	movq	%rsi, 8(%rax)
	movq	%rcx, 8(%rsp)
	call	malloc@PLT
	movl	28(%rsp), %edx
	movq	8(%rsp), %rcx
	movq	%rax, 0(%rbp,%rbx,8)
	movl	%edx, (%rax)
	movq	%rcx, 8(%rax)
	cmpl	%r15d, 40(%rsp)
	jg	.L69
.L70:
	movl	36(%rsp), %eax
	xorl	%edx, %edx
	leaq	loop(%rip), %r15
	leaq	adj(%rip), %r11
	testl	%eax, %eax
	jg	.L72
	jmp	.L73
	.p2align 4,,10
	.p2align 3
.L76:
	addq	$1, %rdx
	cmpl	%edx, %eax
	jle	.L73
.L72:
	cmpl	$-1, (%r15,%rdx,4)
	movl	%edx, %r10d
	jne	.L76
	movq	(%r11,%rdx,8), %r8
	movl	%edx, (%r15,%rdx,4)
	testq	%r8, %r8
	je	.L76
.L77:
	movslq	(%r8), %rax
	cmpl	$-1, (%r15,%rax,4)
	movq	%rax, %rdi
	je	.L96
	movq	8(%r8), %r8
	testq	%r8, %r8
	jne	.L77
	movl	36(%rsp), %eax
.L99:
	addq	$1, %rdx
	cmpl	%edx, %eax
	jg	.L72
.L73:
	leaq	44(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L75
	xorl	%ebx, %ebx
	leaq	52(%rsp), %r14
	leaq	loop(%rip), %r15
	leaq	48(%rsp), %r13
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L74:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	52(%rsp), %rax
	movslq	48(%rsp), %rdx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, (%r15,%rdx,4)
	je	.L97
	movq	%rbp, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 44(%rsp)
	jg	.L74
.L75:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L98
	addq	$72, %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
.L96:
	.cfi_restore_state
	movl	%r10d, %esi
	call	search.part.0
	movq	8(%r8), %r8
	testq	%r8, %r8
	jne	.L77
	movl	36(%rsp), %eax
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L97:
	leaq	.LC2(%rip), %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 44(%rsp)
	jg	.L74
	jmp	.L75
.L98:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	adj
	.bss
	.align 32
	.type	adj, @object
	.size	adj, 800000
adj:
	.zero	800000
	.globl	loop
	.align 32
	.type	loop, @object
	.size	loop, 400000
loop:
	.zero	400000
	.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:
.LFB42:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	adj(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	loop(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	(%rcx,%rdi,8), %r15
	movl	%esi, (%rbx,%rdi,4)
	testq	%r15, %r15
	je	.L1
.L13:
	movslq	(%r15), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L42
.L3:
	movq	8(%r15), %r15
	testq	%r15, %r15
	jne	.L13
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L42:
	.cfi_restore_state
	movq	(%rcx,%rax,8), %r14
	movl	%esi, (%rbx,%rax,4)
	testq	%r14, %r14
	je	.L3
	movslq	(%r14), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L43
	.p2align 4,,10
	.p2align 3
.L4:
	movq	8(%r14), %r14
	testq	%r14, %r14
	je	.L3
	movslq	(%r14), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L4
.L43:
	movq	(%rcx,%rax,8), %r13
	movl	%esi, (%rbx,%rax,4)
	testq	%r13, %r13
	je	.L4
	movslq	0(%r13), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L44
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%r13), %r13
	testq	%r13, %r13
	je	.L4
	movslq	0(%r13), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L5
.L44:
	movq	(%rcx,%rax,8), %r12
	movl	%esi, (%rbx,%rax,4)
	testq	%r12, %r12
	je	.L5
	movslq	(%r12), %rax
	cmpl	$-1, (%rbx,%rax,4)
	je	.L45
	.p2align 4,,10
	.p2align 3
.L6:
	movq	8(%r12), %r12
	testq	%r12, %r12
	je	.L5
	movslq	(%r12), %rax
	cmpl	$-1, (%rbx,%rax,4)
	jne	.L6
.L45:
	movq	(%rcx,%rax,8), %rbp
	movl	%esi, (%rbx,%rax,4)
	testq	%rbp, %rbp
	je	.L6
.L9:
	movslq	0(%rbp), %rax
	cmpl	$-1, (%rbx,%rax,4)
	movq	%rax, %rdi
	je	.L46
.L7:
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	je	.L6
	movslq	0(%rbp), %rax
	cmpl	$-1, (%rbx,%rax,4)
	movq	%rax, %rdi
	jne	.L7
.L46:
	movl	%esi, 12(%rsp)
	call	search.part.0
	movq	8(%rbp), %rbp
	movl	12(%rsp), %esi
	leaq	adj(%rip), %rcx
	testq	%rbp, %rbp
	jne	.L9
	jmp	.L6
	.cfi_endproc
.LFE42:
	.size	search.part.0, .-search.part.0
	.p2align 4
	.globl	NEW
	.type	NEW, @function
NEW:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	movl	$16, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movl	%ebp, (%rax)
	movq	%rbx, 8(%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	NEW, .-NEW
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB40:
	.cfi_startproc
	endbr64
	leaq	loop(%rip), %r9
	movslq	%edi, %rdi
	cmpl	$-1, (%r9,%rdi,4)
	je	.L66
.L61:
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	leaq	adj(%rip), %rax
	movl	%esi, (%r9,%rdi,4)
	movl	%esi, %r8d
	movq	(%rax,%rdi,8), %rdx
	testq	%rdx, %rdx
	je	.L61
.L62:
	movslq	(%rdx), %rax
	cmpl	$-1, (%r9,%rax,4)
	movq	%rax, %rdi
	je	.L65
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	jne	.L62
	ret
	.p2align 4,,10
	.p2align 3
.L65:
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
.L63:
	movl	%r8d, %esi
	call	search.part.0
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	je	.L49
.L53:
	movslq	(%rdx), %rax
	cmpl	$-1, (%r9,%rax,4)
	movq	%rax, %rdi
	je	.L63
	movq	8(%rdx), %rdx
	testq	%rdx, %rdx
	jne	.L53
.L49:
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	search, .-search
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"yes"
.LC3:
	.string	"no"
	.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
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rdx
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	jle	.L71
	movslq	%edx, %rbx
	leaq	adj(%rip), %rbp
	xorl	%esi, %esi
	leaq	0(,%rbx,8), %rdx
	movq	%rbp, %rdi
	leaq	loop(%rip), %r15
	call	memset@PLT
	leaq	0(,%rbx,4), %rdx
	movl	$255, %esi
	movq	%r15, %rdi
	call	memset@PLT
.L71:
	movl	40(%rsp), %edx
	testl	%edx, %edx
	jle	.L70
	xorl	%r15d, %r15d
	leaq	52(%rsp), %r14
	leaq	48(%rsp), %r13
	leaq	adj(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	48(%rsp), %rcx
	movl	$16, %edi
	movslq	52(%rsp), %rbx
	addl	$1, %r15d
	movq	0(%rbp,%rcx,8), %rsi
	movl	%ecx, 28(%rsp)
	movq	%rcx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rcx
	movl	$16, %edi
	movl	%ebx, (%rax)
	movq	%rax, 0(%rbp,%rcx,8)
	movq	0(%rbp,%rbx,8), %rcx
	movq	%rsi, 8(%rax)
	movq	%rcx, 8(%rsp)
	call	malloc@PLT
	movl	28(%rsp), %edx
	movq	8(%rsp), %rcx
	movq	%rax, 0(%rbp,%rbx,8)
	movl	%edx, (%rax)
	movq	%rcx, 8(%rax)
	cmpl	%r15d, 40(%rsp)
	jg	.L69
.L70:
	movl	36(%rsp), %eax
	xorl	%edx, %edx
	leaq	loop(%rip), %r15
	leaq	adj(%rip), %r11
	testl	%eax, %eax
	jg	.L72
	jmp	.L73
	.p2align 4,,10
	.p2align 3
.L76:
	addq	$1, %rdx
	cmpl	%edx, %eax
	jle	.L73
.L72:
	cmpl	$-1, (%r15,%rdx,4)
	movl	%edx, %r10d
	jne	.L76
	movq	(%r11,%rdx,8), %r8
	movl	%edx, (%r15,%rdx,4)
	testq	%r8, %r8
	je	.L76
.L77:
	movslq	(%r8), %rax
	cmpl	$-1, (%r15,%rax,4)
	movq	%rax, %rdi
	je	.L96
	movq	8(%r8), %r8
	testq	%r8, %r8
	jne	.L77
	movl	36(%rsp), %eax
.L99:
	addq	$1, %rdx
	cmpl	%edx, %eax
	jg	.L72
.L73:
	leaq	44(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L75
	xorl	%ebx, %ebx
	leaq	52(%rsp), %r14
	leaq	loop(%rip), %r15
	leaq	48(%rsp), %r13
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L74:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	52(%rsp), %rax
	movslq	48(%rsp), %rdx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, (%r15,%rdx,4)
	je	.L97
	movq	%rbp, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 44(%rsp)
	jg	.L74
.L75:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L98
	addq	$72, %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
.L96:
	.cfi_restore_state
	movl	%r10d, %esi
	call	search.part.0
	movq	8(%r8), %r8
	testq	%r8, %r8
	jne	.L77
	movl	36(%rsp), %eax
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L97:
	leaq	.LC2(%rip), %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 44(%rsp)
	jg	.L74
	jmp	.L75
.L98:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	adj
	.bss
	.align 32
	.type	adj, @object
	.size	adj, 800000
adj:
	.zero	800000
	.globl	loop
	.align 32
	.type	loop, @object
	.size	loop, 400000
loop:
	.zero	400000
	.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<stdlib.h>
#define MAX 100000

typedef struct node *link;
struct node{
	int v;
	link next;
};

int loop[MAX];
link adj[MAX];

link NEW(int v,link n){
	link x = malloc(sizeof(*x));
	x->v = v; x->next=n;
	return x;
}

void search(int n,int cnt){
	if(loop[n]==-1){
		link t;
		loop[n]=cnt;
		for(t=adj[n];t!=NULL;t=t->next)search(t->v,cnt);
	}
}

int main(void){
	int n,m,q,s,t;
	int i;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		adj[i]=NULL;
		loop[i]=-1;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&s,&t);
		adj[s]=NEW(t,adj[s]);
		adj[t]=NEW(s,adj[t]);
	}
	
	for(i=0;i<n;i++)search(i,i);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d",&s,&t);
		if(loop[s]==loop[t])printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


10 9
0 1
0 2
3 4
5 7
5 6
3 7
6 8
7 8
8 9
3
0 1
5 9
1 3
 16 9
0 2
0 2
3 4
5 7
5 6
3 7
6 13
7 8
8 9
3
0 1
5 9
1 3
 16 9
0 2
0 2
3 4
2 7
5 6
3 7
6 13
7 8
8 9
3
0 1
5 9
1 3
 16 9
0 2
0 2
3 4
2 7
5 6
3 7
6 13
7 8
8 9
3
0 0
5 9
1 3
 10 9
0 1
0 2
3 4
5 7
5 6
3 7
0 8
7 8
8 9
3
0 1
5 9
1 3
 16 9
0 2
0 2
3 4
2 7
5 6
3 7
0 13
7 8
8 9
3
1 0
5 2
2 3
 16 9
0 2
0 2
3 4
2 7
5 6
3 7
0 13
7 8
8 9
3
1 0
4 2
2 3
 10 9
0 1
0 2
3 4
5 7
5 6
3 7
0 8
7 8
8 5
3
0 1
5 9
1 3
 16 9
0 2
0 2
0 4
2 7
5 6
3 11
6 13
3 8
8 9
1
0 1
5 9
1 3
 16 9
0 2
1 2
0 4
4 7
5 6
3 11
6 7
3 8
8 9
1
0 1
5 9
1 3

yes
yes
no
 no
yes
no
 no
no
no
 yes
no
no
 yes
yes
yes
 no
no
yes
 no
yes
yes
 yes
no
yes
 no
 yes

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<stdlib.h>
#define MAX 100000

typedef struct node *link;
struct node{
	int v;
	link next;
};

int loop[MAX];
link adj[MAX];

link NEW(int v,link n){
	link x = malloc(sizeof(*x));
	x->v = v; x->next=n;
	return x;
}

void search(int n,int cnt){
	if(loop[n]==-1){
		link t;
		loop[n]=cnt;
		for(t=adj[n];t!=NULL;t=t->next)search(t->v,cnt);
	}
}

int main(void){
	int n,m,q,s,t;
	int i;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		adj[i]=NULL;
		loop[i]=-1;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&s,&t);
		adj[s]=NEW(t,adj[s]);
		adj[t]=NEW(s,adj[t]);
	}
	
	for(i=0;i<n;i++)search(i,i);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d",&s,&t);
		if(loop[s]==loop[t])printf("yes\n");
		else printf("no\n");
	}
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	loop
	.bss
	.align 32
	.type	loop, @object
	.size	loop, 400000
loop:
	.zero	400000
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 800000
adj:
	.zero	800000
	.text
	.globl	NEW
	.type	NEW, @function
NEW:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	NEW, .-NEW
	.globl	search
	.type	search, @function
search:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L7
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L5:
	cmpq	$0, -8(%rbp)
	jne	.L6
.L7:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"yes"
.LC3:
	.string	"no"
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-32(%rbp), %eax
	movl	-36(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movl	$0, -28(%rbp)
	jmp	.L13
.L14:
	movl	-28(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	addl	$1, -28(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L17
.L16:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	movq	-8(%rbp), %rbx
	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	loop
	.bss
	.align 32
	.type	loop, @object
	.size	loop, 400000
loop:
	.zero	400000
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 800000
adj:
	.zero	800000
	.text
	.globl	NEW
	.type	NEW, @function
NEW:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	NEW, .-NEW
	.globl	search
	.type	search, @function
search:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L7
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L6:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L5:
	cmpq	$0, -8(%rbp)
	jne	.L6
.L7:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"yes"
.LC3:
	.string	"no"
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	$0, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-32(%rbp), %eax
	movl	-36(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %ebx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	NEW
	movslq	%ebx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movl	$0, -28(%rbp)
	jmp	.L13
.L14:
	movl	-28(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	search
	addl	$1, -28(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	loop(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	loop(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L17
.L16:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	movq	-8(%rbp), %rbx
	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:
