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

```c
/* Coached by rainboy */
#include <stdio.h>
#include <string.h>

#define N 100000
#define M 100000

int oo[1 + M * 2], oj[1 + M * 2];

int link(int o, int j) {
	static int _ = 1;

	oo[_] = o, oj[_] = j;
	return _++;
}

int ae[N], cc[N];
char visited[N];

void dfs(int i, int c) {
	int o;

	if (visited[i])
		return;
	visited[i] = 1;
	cc[i] = c;
	for (o = ae[i]; o; o = oo[o])
		dfs(oj[o], c);
}

int main() {
	static int ii[N + 1];
	int n, m, i, p, c, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) {
		scanf("%d", &p);
		ii[p] = i;
	}
	while (m--) {
		int x, y;

		scanf("%d%d", &x, &y), x--, y--;
		ae[x] = link(ae[x], y);
		ae[y] = link(ae[y], x);
	}
	memset(cc, -1, n * sizeof *cc);
	c = 0;
	for (i = 0; i < n; i++)
		if (!visited[i])
			dfs(i, c++);
	ans = 0;
	for (p = 1; p <= n; p++)
		if (cc[ii[p]] == cc[p - 1])
			ans++;
	printf("%d\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	oo
	.bss
	.align 32
	.type	oo, @object
	.size	oo, 800004
oo:
	.zero	800004
	.globl	oj
	.align 32
	.type	oj, @object
	.size	oj, 800004
oj:
	.zero	800004
	.text
	.globl	link
	.type	link, @function
link:
.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oo(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oj(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, _.1(%rip)
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	link, .-link
	.globl	ae
	.bss
	.align 32
	.type	ae, @object
	.size	ae, 400000
ae:
	.zero	400000
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 400000
cc:
	.zero	400000
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 100000
visited:
	.zero	100000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.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	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ae(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oj(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	cmpl	$0, -4(%rbp)
	jne	.L7
	jmp	.L3
.L8:
	nop
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ii.0(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L11
	jmp	.L12
.L13:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-44(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-40(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L12:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L13
	movl	-56(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$-1, %esi
	leaq	cc(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L14
.L16:
	movl	-36(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L15
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -32(%rbp)
	movl	-36(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
.L15:
	addl	$1, -36(%rbp)
.L14:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L16
	movl	$0, -28(%rbp)
	movl	$1, -48(%rbp)
	jmp	.L17
.L19:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ii.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cc(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -28(%rbp)
.L18:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L17:
	movl	-48(%rbp), %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L19
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.data
	.align 4
	.type	_.1, @object
	.size	_.1, 4
_.1:
	.long	1
	.local	ii.0
	.comm	ii.0,400004,32
	.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	dfs.part.0, @function
dfs.part.0:
.LFB38:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	ae(%rip), %rcx
	leaq	cc(%rip), %rdx
	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	visited(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movslq	(%rcx,%rax,4), %r8
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r8d, %r8d
	je	.L1
	leaq	oj(%rip), %r12
	leaq	oo(%rip), %r13
.L13:
	movslq	(%r12,%r8,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L3
	movslq	(%rcx,%rax,4), %r15
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r15d, %r15d
	je	.L3
.L12:
	movslq	(%r12,%r15,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L4
	movslq	(%rcx,%rax,4), %r14
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r14d, %r14d
	je	.L4
.L11:
	movslq	(%r12,%r14,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L5
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	movl	(%rcx,%rax,4), %eax
	testl	%eax, %eax
	je	.L5
.L10:
	movslq	%eax, %rbx
	movslq	(%r12,%rbx,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L6
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	movslq	(%rcx,%rax,4), %rax
	testl	%eax, %eax
	je	.L6
.L9:
	movslq	(%r12,%rax,4), %r9
	cmpb	$0, 0(%rbp,%r9)
	movq	%r9, %rdi
	jne	.L7
	movq	%r8, 24(%rsp)
	movq	%rax, 16(%rsp)
	movl	%esi, 12(%rsp)
	call	dfs.part.0
	movq	16(%rsp), %rax
	movl	12(%rsp), %esi
	leaq	cc(%rip), %rdx
	movq	24(%rsp), %r8
	leaq	ae(%rip), %rcx
	movslq	0(%r13,%rax,4), %rax
	testl	%eax, %eax
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%r13,%rbx,4), %eax
	testl	%eax, %eax
	jne	.L10
.L5:
	movslq	0(%r13,%r14,4), %r14
	testl	%r14d, %r14d
	jne	.L11
.L4:
	movslq	0(%r13,%r15,4), %r15
	testl	%r15d, %r15d
	jne	.L12
.L3:
	movslq	0(%r13,%r8,4), %r8
	testl	%r8d, %r8d
	jne	.L13
.L1:
	addq	$40, %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
.L7:
	.cfi_restore_state
	movslq	0(%r13,%rax,4), %rax
	testl	%eax, %eax
	jne	.L9
	movl	0(%r13,%rbx,4), %eax
	testl	%eax, %eax
	jne	.L10
	jmp	.L5
	.cfi_endproc
.LFE38:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	link
	.type	link, @function
link:
.LFB35:
	.cfi_startproc
	endbr64
	movslq	_.1(%rip), %rdx
	leaq	oo(%rip), %rcx
	movl	%edi, (%rcx,%rdx,4)
	leaq	oj(%rip), %rcx
	movq	%rdx, %rax
	movl	%esi, (%rcx,%rdx,4)
	leal	1(%rdx), %edx
	movl	%edx, _.1(%rip)
	ret
	.cfi_endproc
.LFE35:
	.size	link, .-link
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movslq	%edi, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	visited(%rip), %rbx
	cmpb	$0, (%rbx,%rdi)
	jne	.L39
	leaq	cc(%rip), %rax
	movb	$1, (%rbx,%rdi)
	movl	%esi, %r11d
	movl	%esi, (%rax,%rdi,4)
	leaq	ae(%rip), %rax
	movl	(%rax,%rdi,4), %eax
	testl	%eax, %eax
	je	.L39
	leaq	oj(%rip), %rbp
	leaq	oo(%rip), %r12
.L43:
	movslq	%eax, %r10
	movslq	0(%rbp,%r10,4), %rax
	cmpb	$0, (%rbx,%rax)
	movq	%rax, %rdi
	jne	.L41
	movl	%r11d, %esi
	call	dfs.part.0
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L43
.L39:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L41:
	.cfi_restore_state
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L43
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	ii.0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	leaq	28(%rsp), %r14
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L55
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	%ebp, (%r12,%rax,4)
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jg	.L52
.L55:
	movl	24(%rsp), %eax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	ae(%rip), %r14
	leaq	oj(%rip), %r15
	leal	-1(%rax), %edx
	leaq	oo(%rip), %rbp
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	je	.L54
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movslq	_.1(%rip), %rdi
	leal	-1(%rax), %ecx
	movl	36(%rsp), %eax
	leal	1(%rdi), %esi
	movq	%rdi, %rdx
	movslq	%ecx, %r8
	addl	$2, %edx
	subl	$1, %eax
	movd	(%r14,%r8,4), %xmm0
	movl	%edi, (%r14,%r8,4)
	movl	%eax, (%r15,%rdi,4)
	cltq
	movd	(%r14,%rax,4), %xmm1
	movl	%edx, _.1(%rip)
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, 0(%rbp,%rdi,4)
	movslq	%esi, %rdi
	movl	%esi, (%r14,%rax,4)
	movl	24(%rsp), %eax
	movl	%ecx, (%r15,%rdi,4)
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	jne	.L53
.L54:
	movslq	20(%rsp), %rdx
	leaq	cc(%rip), %rbx
	movl	$400000, %ecx
	xorl	%r14d, %r14d
	movl	$-1, %esi
	movq	%rbx, %rdi
	leaq	visited(%rip), %r15
	movl	%edx, 12(%rsp)
	salq	$2, %rdx
	leaq	oj(%rip), %rbp
	leaq	oo(%rip), %r12
	call	__memset_chk@PLT
	movl	12(%rsp), %r8d
	xorl	%r11d, %r11d
	testl	%r8d, %r8d
	jg	.L56
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L58:
	addq	$1, %r11
	cmpl	%r11d, %r8d
	jle	.L88
.L56:
	cmpb	$0, (%r15,%r11)
	jne	.L58
	leaq	ae(%rip), %rax
	movb	$1, (%r15,%r11)
	leal	1(%r14), %r13d
	movl	(%rax,%r11,4), %eax
	movl	%r14d, (%rbx,%r11,4)
	testl	%eax, %eax
	je	.L62
.L59:
	movslq	%eax, %r10
	movslq	0(%rbp,%r10,4), %rax
	cmpb	$0, (%r15,%rax)
	movq	%rax, %rdi
	jne	.L60
	movl	%r14d, %esi
	call	dfs.part.0
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L59
.L62:
	movl	20(%rsp), %r8d
	movl	%r13d, %r14d
.L90:
	addq	$1, %r11
	cmpl	%r11d, %r8d
	jg	.L56
.L88:
	movl	$1, 28(%rsp)
	testl	%r8d, %r8d
	jle	.L69
	leal	1(%r8), %esi
	movl	$1, %eax
	xorl	%r9d, %r9d
	movq	%rsi, %r8
	leaq	ii.0(%rip), %r12
	leaq	-4+cc(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	(%r12,%rax,4), %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, (%rcx,%rax,4)
	jne	.L64
	addl	$1, %r9d
.L64:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L65
	movl	%r8d, 28(%rsp)
.L63:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L89
	addq	$56, %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
.L60:
	.cfi_restore_state
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L59
	movl	20(%rsp), %r8d
	movl	%r13d, %r14d
	jmp	.L90
.L87:
	movl	$1, 28(%rsp)
	xorl	%r9d, %r9d
	jmp	.L63
.L69:
	xorl	%r9d, %r9d
	jmp	.L63
.L89:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.size	main, .-main
	.local	ii.0
	.comm	ii.0,400004,32
	.data
	.align 4
	.type	_.1, @object
	.size	_.1, 4
_.1:
	.long	1
	.globl	visited
	.bss
	.align 32
	.type	visited, @object
	.size	visited, 100000
visited:
	.zero	100000
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 400000
cc:
	.zero	400000
	.globl	ae
	.align 32
	.type	ae, @object
	.size	ae, 400000
ae:
	.zero	400000
	.globl	oj
	.align 32
	.type	oj, @object
	.size	oj, 800004
oj:
	.zero	800004
	.globl	oo
	.align 32
	.type	oo, @object
	.size	oo, 800004
oo:
	.zero	800004
	.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	dfs.part.0, @function
dfs.part.0:
.LFB38:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	ae(%rip), %rcx
	leaq	cc(%rip), %rdx
	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	visited(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movslq	(%rcx,%rax,4), %r8
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r8d, %r8d
	je	.L1
	leaq	oj(%rip), %r12
	leaq	oo(%rip), %r13
.L13:
	movslq	(%r12,%r8,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L3
	movslq	(%rcx,%rax,4), %r15
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r15d, %r15d
	je	.L3
.L12:
	movslq	(%r12,%r15,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L4
	movslq	(%rcx,%rax,4), %r14
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	testl	%r14d, %r14d
	je	.L4
.L11:
	movslq	(%r12,%r14,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L5
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	movl	(%rcx,%rax,4), %eax
	testl	%eax, %eax
	je	.L5
.L10:
	movslq	%eax, %rbx
	movslq	(%r12,%rbx,4), %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L6
	movb	$1, 0(%rbp,%rax)
	movl	%esi, (%rdx,%rax,4)
	movslq	(%rcx,%rax,4), %rax
	testl	%eax, %eax
	je	.L6
.L9:
	movslq	(%r12,%rax,4), %r9
	cmpb	$0, 0(%rbp,%r9)
	movq	%r9, %rdi
	jne	.L7
	movq	%r8, 24(%rsp)
	movq	%rax, 16(%rsp)
	movl	%esi, 12(%rsp)
	call	dfs.part.0
	movq	16(%rsp), %rax
	movl	12(%rsp), %esi
	leaq	cc(%rip), %rdx
	movq	24(%rsp), %r8
	leaq	ae(%rip), %rcx
	movslq	0(%r13,%rax,4), %rax
	testl	%eax, %eax
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%r13,%rbx,4), %eax
	testl	%eax, %eax
	jne	.L10
.L5:
	movslq	0(%r13,%r14,4), %r14
	testl	%r14d, %r14d
	jne	.L11
.L4:
	movslq	0(%r13,%r15,4), %r15
	testl	%r15d, %r15d
	jne	.L12
.L3:
	movslq	0(%r13,%r8,4), %r8
	testl	%r8d, %r8d
	jne	.L13
.L1:
	addq	$40, %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
.L7:
	.cfi_restore_state
	movslq	0(%r13,%rax,4), %rax
	testl	%eax, %eax
	jne	.L9
	movl	0(%r13,%rbx,4), %eax
	testl	%eax, %eax
	jne	.L10
	jmp	.L5
	.cfi_endproc
.LFE38:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	link
	.type	link, @function
link:
.LFB35:
	.cfi_startproc
	endbr64
	movslq	_.1(%rip), %rdx
	leaq	oo(%rip), %rcx
	movl	%edi, (%rcx,%rdx,4)
	leaq	oj(%rip), %rcx
	movq	%rdx, %rax
	movl	%esi, (%rcx,%rdx,4)
	leal	1(%rdx), %edx
	movl	%edx, _.1(%rip)
	ret
	.cfi_endproc
.LFE35:
	.size	link, .-link
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movslq	%edi, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	visited(%rip), %rbx
	cmpb	$0, (%rbx,%rdi)
	jne	.L39
	leaq	cc(%rip), %rax
	movb	$1, (%rbx,%rdi)
	movl	%esi, %r11d
	movl	%esi, (%rax,%rdi,4)
	leaq	ae(%rip), %rax
	movl	(%rax,%rdi,4), %eax
	testl	%eax, %eax
	je	.L39
	leaq	oj(%rip), %rbp
	leaq	oo(%rip), %r12
.L43:
	movslq	%eax, %r10
	movslq	0(%rbp,%r10,4), %rax
	cmpb	$0, (%rbx,%rax)
	movq	%rax, %rdi
	jne	.L41
	movl	%r11d, %esi
	call	dfs.part.0
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L43
.L39:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L41:
	.cfi_restore_state
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L43
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	ii.0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	leaq	28(%rsp), %r14
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L55
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	%ebp, (%r12,%rax,4)
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jg	.L52
.L55:
	movl	24(%rsp), %eax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	ae(%rip), %r14
	leaq	oj(%rip), %r15
	leal	-1(%rax), %edx
	leaq	oo(%rip), %rbp
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	je	.L54
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movslq	_.1(%rip), %rdi
	leal	-1(%rax), %ecx
	movl	36(%rsp), %eax
	leal	1(%rdi), %esi
	movq	%rdi, %rdx
	movslq	%ecx, %r8
	addl	$2, %edx
	subl	$1, %eax
	movd	(%r14,%r8,4), %xmm0
	movl	%edi, (%r14,%r8,4)
	movl	%eax, (%r15,%rdi,4)
	cltq
	movd	(%r14,%rax,4), %xmm1
	movl	%edx, _.1(%rip)
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, 0(%rbp,%rdi,4)
	movslq	%esi, %rdi
	movl	%esi, (%r14,%rax,4)
	movl	24(%rsp), %eax
	movl	%ecx, (%r15,%rdi,4)
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	jne	.L53
.L54:
	movslq	20(%rsp), %rdx
	leaq	cc(%rip), %rbx
	movl	$400000, %ecx
	xorl	%r14d, %r14d
	movl	$-1, %esi
	movq	%rbx, %rdi
	leaq	visited(%rip), %r15
	movl	%edx, 12(%rsp)
	salq	$2, %rdx
	leaq	oj(%rip), %rbp
	leaq	oo(%rip), %r12
	call	__memset_chk@PLT
	movl	12(%rsp), %r8d
	xorl	%r11d, %r11d
	testl	%r8d, %r8d
	jg	.L56
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L58:
	addq	$1, %r11
	cmpl	%r11d, %r8d
	jle	.L88
.L56:
	cmpb	$0, (%r15,%r11)
	jne	.L58
	leaq	ae(%rip), %rax
	movb	$1, (%r15,%r11)
	leal	1(%r14), %r13d
	movl	(%rax,%r11,4), %eax
	movl	%r14d, (%rbx,%r11,4)
	testl	%eax, %eax
	je	.L62
.L59:
	movslq	%eax, %r10
	movslq	0(%rbp,%r10,4), %rax
	cmpb	$0, (%r15,%rax)
	movq	%rax, %rdi
	jne	.L60
	movl	%r14d, %esi
	call	dfs.part.0
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L59
.L62:
	movl	20(%rsp), %r8d
	movl	%r13d, %r14d
.L90:
	addq	$1, %r11
	cmpl	%r11d, %r8d
	jg	.L56
.L88:
	movl	$1, 28(%rsp)
	testl	%r8d, %r8d
	jle	.L69
	leal	1(%r8), %esi
	movl	$1, %eax
	xorl	%r9d, %r9d
	movq	%rsi, %r8
	leaq	ii.0(%rip), %r12
	leaq	-4+cc(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	(%r12,%rax,4), %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, (%rcx,%rax,4)
	jne	.L64
	addl	$1, %r9d
.L64:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L65
	movl	%r8d, 28(%rsp)
.L63:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L89
	addq	$56, %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
.L60:
	.cfi_restore_state
	movl	(%r12,%r10,4), %eax
	testl	%eax, %eax
	jne	.L59
	movl	20(%rsp), %r8d
	movl	%r13d, %r14d
	jmp	.L90
.L87:
	movl	$1, 28(%rsp)
	xorl	%r9d, %r9d
	jmp	.L63
.L69:
	xorl	%r9d, %r9d
	jmp	.L63
.L89:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE37:
	.size	main, .-main
	.local	ii.0
	.comm	ii.0,400004,32
	.data
	.align 4
	.type	_.1, @object
	.size	_.1, 4
_.1:
	.long	1
	.globl	visited
	.bss
	.align 32
	.type	visited, @object
	.size	visited, 100000
visited:
	.zero	100000
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 400000
cc:
	.zero	400000
	.globl	ae
	.align 32
	.type	ae, @object
	.size	ae, 400000
ae:
	.zero	400000
	.globl	oj
	.align 32
	.type	oj, @object
	.size	oj, 800004
oj:
	.zero	800004
	.globl	oo
	.align 32
	.type	oo, @object
	.size	oo, 800004
oo:
	.zero	800004
	.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:

/* Coached by rainboy */
#include <stdio.h>
#include <string.h>

#define N 100000
#define M 100000

int oo[1 + M * 2], oj[1 + M * 2];

int link(int o, int j) {
	static int _ = 1;

	oo[_] = o, oj[_] = j;
	return _++;
}

int ae[N], cc[N];
char visited[N];

void dfs(int i, int c) {
	int o;

	if (visited[i])
		return;
	visited[i] = 1;
	cc[i] = c;
	for (o = ae[i]; o; o = oo[o])
		dfs(oj[o], c);
}

int main() {
	static int ii[N + 1];
	int n, m, i, p, c, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) {
		scanf("%d", &p);
		ii[p] = i;
	}
	while (m--) {
		int x, y;

		scanf("%d%d", &x, &y), x--, y--;
		ae[x] = link(ae[x], y);
		ae[y] = link(ae[y], x);
	}
	memset(cc, -1, n * sizeof *cc);
	c = 0;
	for (i = 0; i < n; i++)
		if (!visited[i])
			dfs(i, c++);
	ans = 0;
	for (p = 1; p <= n; p++)
		if (cc[ii[p]] == cc[p - 1])
			ans++;
	printf("%d\n", ans);
	return 0;
}

3 2
3 2 1
1 2
1 3
 5 2
5 3 1 4 3
1 3
5 4
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
4 2
5 9
2 5
6 5
3 5
8 9
7 9
 5 2
5 3 1 4 2
1 2
5 4
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
7 1
5 9
2 8
6 5
3 5
8 9
7 9
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
4 1
5 9
2 2
6 5
3 5
8 9
7 9
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
4 2
5 9
2 5
6 5
4 4
8 9
7 9
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
6 1
5 9
2 2
6 5
3 5
8 9
7 9
 10 8
5 3 6 8 7 10 9 1 3 4
3 1
6 2
5 9
2 5
6 5
4 4
8 9
9 9
 10 8
5 3 6 8 7 10 9 1 2 4
3 1
4 1
5 9
2 8
6 5
3 5
8 9
7 9

3
 2
 8
 1
 7
 6
 4
 5
 0
 8

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

```c
/* Coached by rainboy */
#include <stdio.h>
#include <string.h>

#define N 100000
#define M 100000

int oo[1 + M * 2], oj[1 + M * 2];

int link(int o, int j) {
	static int _ = 1;

	oo[_] = o, oj[_] = j;
	return _++;
}

int ae[N], cc[N];
char visited[N];

void dfs(int i, int c) {
	int o;

	if (visited[i])
		return;
	visited[i] = 1;
	cc[i] = c;
	for (o = ae[i]; o; o = oo[o])
		dfs(oj[o], c);
}

int main() {
	static int ii[N + 1];
	int n, m, i, p, c, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) {
		scanf("%d", &p);
		ii[p] = i;
	}
	while (m--) {
		int x, y;

		scanf("%d%d", &x, &y), x--, y--;
		ae[x] = link(ae[x], y);
		ae[y] = link(ae[y], x);
	}
	memset(cc, -1, n * sizeof *cc);
	c = 0;
	for (i = 0; i < n; i++)
		if (!visited[i])
			dfs(i, c++);
	ans = 0;
	for (p = 1; p <= n; p++)
		if (cc[ii[p]] == cc[p - 1])
			ans++;
	printf("%d\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	oo
	.bss
	.align 32
	.type	oo, @object
	.size	oo, 800004
oo:
	.zero	800004
	.globl	oj
	.align 32
	.type	oj, @object
	.size	oj, 800004
oj:
	.zero	800004
	.text
	.globl	link
	.type	link, @function
link:
.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oo(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oj(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, _.1(%rip)
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	link, .-link
	.globl	ae
	.bss
	.align 32
	.type	ae, @object
	.size	ae, 400000
ae:
	.zero	400000
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 400000
cc:
	.zero	400000
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 100000
visited:
	.zero	100000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.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	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ae(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oj(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	cmpl	$0, -4(%rbp)
	jne	.L7
	jmp	.L3
.L8:
	nop
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ii.0(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L11
	jmp	.L12
.L13:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-44(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-40(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L12:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L13
	movl	-56(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$-1, %esi
	leaq	cc(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L14
.L16:
	movl	-36(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L15
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -32(%rbp)
	movl	-36(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
.L15:
	addl	$1, -36(%rbp)
.L14:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L16
	movl	$0, -28(%rbp)
	movl	$1, -48(%rbp)
	jmp	.L17
.L19:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ii.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cc(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -28(%rbp)
.L18:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L17:
	movl	-48(%rbp), %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L19
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.data
	.align 4
	.type	_.1, @object
	.size	_.1, 4
_.1:
	.long	1
	.local	ii.0
	.comm	ii.0,400004,32
	.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	oo
	.bss
	.align 32
	.type	oo, @object
	.size	oo, 800004
oo:
	.zero	800004
	.globl	oj
	.align 32
	.type	oj, @object
	.size	oj, 800004
oj:
	.zero	800004
	.text
	.globl	link
	.type	link, @function
link:
.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oo(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	oj(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	_.1(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, _.1(%rip)
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	link, .-link
	.globl	ae
	.bss
	.align 32
	.type	ae, @object
	.size	ae, 400000
ae:
	.zero	400000
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 400000
cc:
	.zero	400000
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 100000
visited:
	.zero	100000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.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	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ae(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oj(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	oo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	cmpl	$0, -4(%rbp)
	jne	.L7
	jmp	.L3
.L8:
	nop
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L10
.L11:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ii.0(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L10:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L11
	jmp	.L12
.L13:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-44(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ae(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-40(%rbp), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	link
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ae(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L12:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L13
	movl	-56(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$-1, %esi
	leaq	cc(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L14
.L16:
	movl	-36(%rbp), %eax
	cltq
	leaq	visited(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L15
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -32(%rbp)
	movl	-36(%rbp), %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
.L15:
	addl	$1, -36(%rbp)
.L14:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L16
	movl	$0, -28(%rbp)
	movl	$1, -48(%rbp)
	jmp	.L17
.L19:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ii.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cc(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cc(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -28(%rbp)
.L18:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L17:
	movl	-48(%rbp), %edx
	movl	-56(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L19
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.data
	.align 4
	.type	_.1, @object
	.size	_.1, 4
_.1:
	.long	1
	.local	ii.0
	.comm	ii.0,400004,32
	.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:
