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<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

typedef struct node node;
typedef struct edge{
    node* target;
    struct edge* next;
}edge;
typedef struct node{
    int id;
    edge* fst;
    edge* lst;
}node;
void initNodeArray(node* p, int n){
    for(int i=0; i<n; i++){
        (p+i)->id = 0;
        (p+i)->fst = NULL;
        (p+i)->lst = NULL;
    }
}
void addEdge(node* p, node* target){
    if(p->fst == NULL){
        p->fst = (edge*)malloc(sizeof(edge));
        p->lst = p->fst;
    }else{
        p->lst->next = (edge*)malloc(sizeof(edge));
        p->lst = p->lst->next;
    }
    p->lst->target = target;
    p->lst->next = NULL;
}
void rmEdge(node* p, node* q){
    edge* e = p->fst;
    edge* pre = NULL;
    while(e != NULL){
        if(e->target == q){
            if(pre != NULL){
                pre->next = e->next;
            }
            if(e == p->fst){
                p->fst = e->next;
            }
            if(e == p->lst){
                p->lst = pre;
            }
            free(e);
            return;
        }
        pre = e;
        e = e->next;
    }
    return;
}

void func(int* group, node* a, int g){
    if(*(group + (a->id)) != 0){
        return;
    }
    *(group + (a->id)) = g;
    edge* e = a->fst;
    while(e != NULL){
        func(group, e->target, g);
        e = e->next;
    }
}

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int p[n], q[n];
    node a[n];
    initNodeArray(a, n);
    int group[n];
    rep(i, 0, n){
        scanf("%d", &p[i]);
        a[i].id = i;
        group[i] = 0;
    }
    rep(i, 0, m){
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;
        addEdge(&a[x], &a[y]);
        addEdge(&a[y], &a[x]);
    }
    int num = 1;
    rep(i, 0, n){
        func(group, &a[i], num++);
    }
    rep(i, 0, n){
        q[p[i]-1] = group[i];
    }
    int ans = 0;
    rep(i, 0, n){
        if(group[i] == q[i]){
            ans++;
        }
    }
    printf("%d", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	initNodeArray
	.type	initNodeArray, @function
initNodeArray:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 8(%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 16(%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	initNodeArray, .-initNodeArray
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB7:
	.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	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
	jmp	.L6
.L5:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rbx
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
.L6:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	$0, 8(%rax)
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	addEdge, .-addEdge
	.globl	rmEdge
	.type	rmEdge, @function
rmEdge:
.LFB8:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -8(%rbp)
	jmp	.L8
.L14:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, -32(%rbp)
	jne	.L9
	cmpq	$0, -8(%rbp)
	je	.L10
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
.L10:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L11
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L11:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L12
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L12:
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L7
.L9:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	cmpq	$0, -16(%rbp)
	jne	.L14
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	rmEdge, .-rmEdge
	.globl	func
	.type	func, @function
func:
.LFB9:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L18:
	cmpq	$0, -8(%rbp)
	jne	.L19
	jmp	.L15
.L20:
	nop
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	func, .-func
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-160(%rbp), %rdx
	leaq	-164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L22:
	cmpq	%rcx, %rsp
	je	.L23
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L22
.L23:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L24
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L24:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -112(%rbp)
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L25:
	cmpq	%rdx, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L25
.L26:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L27
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L27:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-164(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$192, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$192, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L28:
	cmpq	%rdx, %rsp
	je	.L29
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L28
.L29:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L30
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L30:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movl	-164(%rbp), %edx
	movq	-80(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	initNodeArray
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L31:
	cmpq	%rdx, %rsp
	je	.L32
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L31
.L32:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L33
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L33:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L34
.L35:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-148(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-64(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -148(%rbp)
.L34:
	movl	-164(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L35
	movl	$0, -144(%rbp)
	jmp	.L36
.L37:
	leaq	-152(%rbp), %rdx
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -156(%rbp)
	movl	-152(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -152(%rbp)
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-156(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	addl	$1, -144(%rbp)
.L36:
	movl	-160(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L37
	movl	$1, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L38
.L39:
	movl	-140(%rbp), %edx
	leal	1(%rdx), %eax
	movl	%eax, -140(%rbp)
	movl	-136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rax, %rcx
	movq	-64(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	addl	$1, -136(%rbp)
.L38:
	movl	-164(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L39
	movl	$0, -132(%rbp)
	jmp	.L40
.L41:
	movq	-112(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %esi
	movq	-64(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movslq	%esi, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -132(%rbp)
.L40:
	movl	-164(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L41
	movl	$0, -128(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L42
.L44:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L43
	addl	$1, -128(%rbp)
.L43:
	addl	$1, -124(%rbp)
.L42:
	movl	-164(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L44
	movl	-128(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	initNodeArray
	.type	initNodeArray, @function
initNodeArray:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L1
	leal	-1(%rsi), %eax
	pxor	%xmm0, %xmm0
	leaq	(%rax,%rax,2), %rax
	leaq	24(%rdi,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$0, (%rdi)
	addq	$24, %rdi
	movups	%xmm0, -16(%rdi)
	cmpq	%rax, %rdi
	jne	.L3
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	initNodeArray, .-initNodeArray
	.p2align 4
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	cmpq	$0, 8(%rdi)
	movq	%rdi, %rbx
	je	.L10
	movq	16(%rdi), %r12
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%r12)
.L8:
	movq	%rax, 16(%rbx)
	movq	%rbp, (%rax)
	movq	$0, 8(%rax)
	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
.L10:
	.cfi_restore_state
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	jmp	.L8
	.cfi_endproc
.LFE52:
	.size	addEdge, .-addEdge
	.p2align 4
	.globl	rmEdge
	.type	rmEdge, @function
rmEdge:
.LFB53:
	.cfi_startproc
	endbr64
	movq	8(%rdi), %r8
	movq	%rdi, %rcx
	testq	%r8, %r8
	je	.L11
	movq	%r8, %rdi
	xorl	%edx, %edx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L13:
	movq	8(%rdi), %rax
	movq	%rdi, %rdx
	testq	%rax, %rax
	je	.L11
	movq	%rax, %rdi
.L17:
	cmpq	%rsi, (%rdi)
	jne	.L13
	testq	%rdx, %rdx
	je	.L14
	movq	8(%rdi), %rax
	movq	%rax, 8(%rdx)
.L14:
	cmpq	%rdi, %r8
	je	.L25
	cmpq	%rdi, 16(%rcx)
	je	.L26
.L16:
	jmp	free@PLT
	.p2align 4,,10
	.p2align 3
.L11:
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	movq	8(%rdi), %rax
	movq	%rax, 8(%rcx)
	cmpq	%rdi, 16(%rcx)
	jne	.L16
.L26:
	movq	%rdx, 16(%rcx)
	jmp	free@PLT
	.cfi_endproc
.LFE53:
	.size	rmEdge, .-rmEdge
	.p2align 4
	.globl	func
	.type	func, @function
func:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	(%rsi), %rcx
	leaq	(%rdi,%rcx,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jne	.L83
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edx, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	8(%rsi), %rax
	movl	%edx, (%rcx)
	movq	%rax, 40(%rsp)
	testq	%rax, %rax
	je	.L27
.L45:
	movq	40(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %ebx
	testl	%ebx, %ebx
	jne	.L29
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 32(%rsp)
	testq	%rax, %rax
	je	.L29
.L44:
	movq	32(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jne	.L30
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 24(%rsp)
	testq	%rax, %rax
	je	.L30
.L43:
	movq	24(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r10d
	testl	%r10d, %r10d
	jne	.L31
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	je	.L31
.L42:
	movq	16(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r9d
	testl	%r9d, %r9d
	jne	.L32
	movq	8(%rax), %rbx
	movl	%r15d, (%rcx)
	testq	%rbx, %rbx
	je	.L32
.L41:
	movq	(%rbx), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r8d
	testl	%r8d, %r8d
	jne	.L33
	movq	8(%rax), %r13
	movl	%r15d, (%rcx)
	testq	%r13, %r13
	je	.L33
.L40:
	movq	0(%r13), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L34
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L34
.L39:
	movq	8(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %esi
	testl	%esi, %esi
	jne	.L35
	movq	8(%rax), %r12
	movl	%r15d, (%rcx)
	testq	%r12, %r12
	je	.L35
.L38:
	movq	(%r12), %rax
	movslq	(%rax), %rsi
	leaq	(%r14,%rsi,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jne	.L36
	movq	8(%rax), %rbp
	movl	%r15d, (%rsi)
	testq	%rbp, %rbp
	je	.L36
.L37:
	movq	0(%rbp), %rsi
	movl	%r15d, %edx
	movq	%r14, %rdi
	call	func
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L37
.L36:
	movq	8(%r12), %r12
	testq	%r12, %r12
	jne	.L38
.L35:
	movq	8(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jne	.L39
.L34:
	movq	8(%r13), %r13
	testq	%r13, %r13
	jne	.L40
.L33:
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L41
.L32:
	movq	16(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	jne	.L42
.L31:
	movq	24(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 24(%rsp)
	testq	%rax, %rax
	jne	.L43
.L30:
	movq	32(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 32(%rsp)
	testq	%rax, %rax
	jne	.L44
.L29:
	movq	40(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 40(%rsp)
	testq	%rax, %rax
	jne	.L45
.L27:
	addq	$56, %rsp
	.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
.L83:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE54:
	.size	func, .-func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-72(%rbp), %rcx
	movq	%rsp, %rdi
	leaq	15(,%rcx,4), %rsi
	movq	%rcx, %rax
	movq	%rsi, %r8
	movq	%rsi, %rdx
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L88
.L160:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L160
.L88:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L161
.L89:
	movq	%rsi, %r8
	movq	%rsp, -144(%rbp)
	movq	%rsi, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
.L90:
	cmpq	%rdi, %rsp
	je	.L91
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L90
.L161:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L89
.L91:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L162
.L92:
	leaq	(%rcx,%rcx,2), %rdx
	movq	%rsp, -128(%rbp)
	movq	%rsp, %rdi
	leaq	15(,%rdx,8), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rdi
.L93:
	cmpq	%rdi, %rsp
	je	.L94
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L93
.L162:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L92
.L94:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L95
	orq	$0, -8(%rsp,%rdx)
.L95:
	movq	%rsp, %rbx
	testl	%eax, %eax
	jle	.L96
	movl	%eax, %eax
	movq	%rbx, %rdx
	pxor	%xmm0, %xmm0
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,8), %rcx
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L97:
	movl	$0, (%rax)
	addq	$24, %rax
	movups	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L97
	movq	%rsi, %rax
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rcx
.L120:
	cmpq	%rcx, %rsp
	je	.L121
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L120
.L121:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L122
	orq	$0, -8(%rsp,%rax)
.L122:
	leaq	.LC1(%rip), %rax
	movq	%rsp, %r15
	xorl	%r14d, %r14d
	movq	%rdx, %r12
	movq	-144(%rbp), %r13
	movq	%rax, -152(%rbp)
	movq	%r15, -88(%rbp)
	movq	%rbx, -96(%rbp)
	movq	%r13, %rbx
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L99:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	addq	$24, %r12
	movl	%r14d, -24(%r12)
	movl	$0, (%r15,%r14,4)
	addq	$1, %r14
	cmpl	%r14d, -72(%rbp)
	jg	.L99
	movq	-88(%rbp), %r12
	movq	-96(%rbp), %rbx
.L126:
	leaq	-60(%rbp), %rax
	movl	-68(%rbp), %ecx
	xorl	%r13d, %r13d
	movq	%rax, -120(%rbp)
	leaq	-64(%rbp), %rax
	movq	%rax, -112(%rbp)
	testl	%ecx, %ecx
	jle	.L107
	movq	%r12, -136(%rbp)
	.p2align 4,,10
	.p2align 3
.L100:
	movq	-120(%rbp), %rdx
	movq	-112(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r15d
	movslq	-64(%rbp), %rax
	leal	-1(%r15), %edx
	leal	-1(%rax), %ecx
	movslq	%edx, %r12
	leaq	(%rax,%rax,2), %rax
	movslq	%ecx, %rcx
	leaq	(%r12,%r12,2), %rdi
	leaq	(%rbx,%rax,8), %r10
	movq	%rcx, -104(%rbp)
	leaq	(%rbx,%rdi,8), %r9
	cmpq	$0, -16(%r10)
	leaq	(%rcx,%rcx,2), %rdi
	leaq	(%rbx,%rdi,8), %r14
	je	.L163
	movq	16(%r14), %r10
	movl	$16, %edi
	movq	%r9, -96(%rbp)
	movq	%r10, -88(%rbp)
	call	malloc@PLT
	movq	-88(%rbp), %r10
	movq	-104(%rbp), %rcx
	movq	-96(%rbp), %r9
	movq	%rax, 8(%r10)
.L104:
	movslq	%r15d, %rsi
	leaq	(%rcx,%rcx,2), %rcx
	movq	%rax, 16(%rbx,%rcx,8)
	movq	%r9, (%rax)
	movq	$0, 8(%rax)
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rbx,%rax,8), %r15
	cmpq	$0, -16(%r15)
	je	.L164
	leaq	(%r12,%r12,2), %rax
	movl	$16, %edi
	addl	$1, %r13d
	leaq	(%rbx,%rax,8), %r15
	movq	16(%r15), %r12
	call	malloc@PLT
	movq	%rax, 8(%r12)
	movq	%rax, 16(%r15)
	movq	%r14, (%rax)
	movq	$0, 8(%rax)
	cmpl	%r13d, -68(%rbp)
	jg	.L100
.L159:
	movq	-136(%rbp), %r12
.L107:
	movl	-72(%rbp), %ecx
	movl	$1, %r13d
	testl	%ecx, %ecx
	jle	.L102
	.p2align 4,,10
	.p2align 3
.L110:
	movslq	(%rbx), %rax
	movl	%r13d, %r15d
	addl	$1, %r13d
	leaq	(%r12,%rax,4), %rax
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L108
	movq	8(%rbx), %r14
	movl	%r15d, (%rax)
	testq	%r14, %r14
	je	.L108
.L109:
	movq	(%r14), %rsi
	movl	%r15d, %edx
	movq	%r12, %rdi
	call	func
	movq	8(%r14), %r14
	testq	%r14, %r14
	jne	.L109
	movl	-72(%rbp), %ecx
.L108:
	addq	$24, %rbx
	cmpl	%ecx, %r15d
	jl	.L110
	testl	%ecx, %ecx
	jle	.L102
	movq	-144(%rbp), %r9
	movq	-128(%rbp), %r10
	movl	%ecx, %edi
	xorl	%edx, %edx
	leal	-1(%rcx), %r8d
	.p2align 4,,10
	.p2align 3
.L111:
	movl	(%r9,%rdx,4), %eax
	movl	(%r12,%rdx,4), %esi
	addq	$1, %rdx
	subl	$1, %eax
	cltq
	movl	%esi, (%r10,%rax,4)
	cmpq	%rdi, %rdx
	jne	.L111
	cmpl	$2, %r8d
	jbe	.L129
	movl	%ecx, %edx
	movq	-128(%rbp), %rsi
	xorl	%eax, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L113:
	movdqu	(%rsi,%rax), %xmm1
	movdqu	(%r12,%rax), %xmm2
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L113
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %cl
	je	.L119
.L112:
	movslq	%esi, %rax
	xorl	%edi, %edi
	salq	$2, %rax
	addq	%rax, %r12
	addq	-128(%rbp), %rax
	movl	(%r12), %ebx
	cmpl	%ebx, (%rax)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%ecx, %edi
	jge	.L119
	movl	4(%r12), %ebx
	cmpl	%ebx, 4(%rax)
	jne	.L116
	addl	$1, %edx
.L116:
	addl	$2, %esi
	cmpl	%ecx, %esi
	jge	.L119
	movl	8(%r12), %esi
	cmpl	%esi, 8(%rax)
	jne	.L119
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L119:
	movq	-152(%rbp), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L165
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L164:
	.cfi_restore_state
	movl	$16, %edi
	addl	$1, %r13d
	call	malloc@PLT
	leaq	(%r12,%r12,2), %rdx
	movq	%rax, -16(%r15)
	movq	%r14, (%rax)
	movq	%rax, 16(%rbx,%rdx,8)
	movq	$0, 8(%rax)
	cmpl	-68(%rbp), %r13d
	jl	.L100
	jmp	.L159
	.p2align 4,,10
	.p2align 3
.L163:
	movl	$16, %edi
	movq	%r10, -96(%rbp)
	movq	%r9, -88(%rbp)
	call	malloc@PLT
	movq	-96(%rbp), %r10
	movq	-88(%rbp), %r9
	movq	-104(%rbp), %rcx
	movq	%rax, -16(%r10)
	jmp	.L104
.L102:
	xorl	%edx, %edx
	jmp	.L119
.L96:
	movq	%rsi, %rax
	movq	%rsp, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rdx
.L123:
	cmpq	%rdx, %rsp
	je	.L124
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L123
.L129:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L112
.L124:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L125
	orq	$0, -8(%rsp,%rax)
.L125:
	leaq	.LC1(%rip), %rax
	movq	%rsp, %r12
	movq	%rax, -152(%rbp)
	jmp	.L126
.L165:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	initNodeArray
	.type	initNodeArray, @function
initNodeArray:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L1
	leal	-1(%rsi), %eax
	pxor	%xmm0, %xmm0
	leaq	(%rax,%rax,2), %rax
	leaq	24(%rdi,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$0, (%rdi)
	addq	$24, %rdi
	movups	%xmm0, -16(%rdi)
	cmpq	%rax, %rdi
	jne	.L3
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	initNodeArray, .-initNodeArray
	.p2align 4
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	cmpq	$0, 8(%rdi)
	movq	%rdi, %rbx
	je	.L10
	movq	16(%rdi), %r12
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%r12)
.L8:
	movq	%rax, 16(%rbx)
	movq	%rbp, (%rax)
	movq	$0, 8(%rax)
	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
.L10:
	.cfi_restore_state
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	jmp	.L8
	.cfi_endproc
.LFE52:
	.size	addEdge, .-addEdge
	.p2align 4
	.globl	rmEdge
	.type	rmEdge, @function
rmEdge:
.LFB53:
	.cfi_startproc
	endbr64
	movq	8(%rdi), %r8
	movq	%rdi, %rcx
	testq	%r8, %r8
	je	.L11
	movq	%r8, %rdi
	xorl	%edx, %edx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L13:
	movq	8(%rdi), %rax
	movq	%rdi, %rdx
	testq	%rax, %rax
	je	.L11
	movq	%rax, %rdi
.L17:
	cmpq	%rsi, (%rdi)
	jne	.L13
	testq	%rdx, %rdx
	je	.L14
	movq	8(%rdi), %rax
	movq	%rax, 8(%rdx)
.L14:
	cmpq	%rdi, %r8
	je	.L25
	cmpq	%rdi, 16(%rcx)
	je	.L26
.L16:
	jmp	free@PLT
	.p2align 4,,10
	.p2align 3
.L11:
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	movq	8(%rdi), %rax
	movq	%rax, 8(%rcx)
	cmpq	%rdi, 16(%rcx)
	jne	.L16
.L26:
	movq	%rdx, 16(%rcx)
	jmp	free@PLT
	.cfi_endproc
.LFE53:
	.size	rmEdge, .-rmEdge
	.p2align 4
	.globl	func
	.type	func, @function
func:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	(%rsi), %rcx
	leaq	(%rdi,%rcx,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jne	.L83
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edx, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	8(%rsi), %rax
	movl	%edx, (%rcx)
	movq	%rax, 40(%rsp)
	testq	%rax, %rax
	je	.L27
.L45:
	movq	40(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %ebx
	testl	%ebx, %ebx
	jne	.L29
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 32(%rsp)
	testq	%rax, %rax
	je	.L29
.L44:
	movq	32(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jne	.L30
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 24(%rsp)
	testq	%rax, %rax
	je	.L30
.L43:
	movq	24(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r10d
	testl	%r10d, %r10d
	jne	.L31
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	je	.L31
.L42:
	movq	16(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r9d
	testl	%r9d, %r9d
	jne	.L32
	movq	8(%rax), %rbx
	movl	%r15d, (%rcx)
	testq	%rbx, %rbx
	je	.L32
.L41:
	movq	(%rbx), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %r8d
	testl	%r8d, %r8d
	jne	.L33
	movq	8(%rax), %r13
	movl	%r15d, (%rcx)
	testq	%r13, %r13
	je	.L33
.L40:
	movq	0(%r13), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L34
	movq	8(%rax), %rax
	movl	%r15d, (%rcx)
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L34
.L39:
	movq	8(%rsp), %rax
	movq	(%rax), %rax
	movslq	(%rax), %rcx
	leaq	(%r14,%rcx,4), %rcx
	movl	(%rcx), %esi
	testl	%esi, %esi
	jne	.L35
	movq	8(%rax), %r12
	movl	%r15d, (%rcx)
	testq	%r12, %r12
	je	.L35
.L38:
	movq	(%r12), %rax
	movslq	(%rax), %rsi
	leaq	(%r14,%rsi,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jne	.L36
	movq	8(%rax), %rbp
	movl	%r15d, (%rsi)
	testq	%rbp, %rbp
	je	.L36
.L37:
	movq	0(%rbp), %rsi
	movl	%r15d, %edx
	movq	%r14, %rdi
	call	func
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L37
.L36:
	movq	8(%r12), %r12
	testq	%r12, %r12
	jne	.L38
.L35:
	movq	8(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jne	.L39
.L34:
	movq	8(%r13), %r13
	testq	%r13, %r13
	jne	.L40
.L33:
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L41
.L32:
	movq	16(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	jne	.L42
.L31:
	movq	24(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 24(%rsp)
	testq	%rax, %rax
	jne	.L43
.L30:
	movq	32(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 32(%rsp)
	testq	%rax, %rax
	jne	.L44
.L29:
	movq	40(%rsp), %rax
	movq	8(%rax), %rax
	movq	%rax, 40(%rsp)
	testq	%rax, %rax
	jne	.L45
.L27:
	addq	$56, %rsp
	.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
.L83:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE54:
	.size	func, .-func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-72(%rbp), %rcx
	movq	%rsp, %rdi
	leaq	15(,%rcx,4), %rsi
	movq	%rcx, %rax
	movq	%rsi, %r8
	movq	%rsi, %rdx
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L88
.L160:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L160
.L88:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L161
.L89:
	movq	%rsi, %r8
	movq	%rsp, -144(%rbp)
	movq	%rsi, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
.L90:
	cmpq	%rdi, %rsp
	je	.L91
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L90
.L161:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L89
.L91:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L162
.L92:
	leaq	(%rcx,%rcx,2), %rdx
	movq	%rsp, -128(%rbp)
	movq	%rsp, %rdi
	leaq	15(,%rdx,8), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rdi
.L93:
	cmpq	%rdi, %rsp
	je	.L94
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L93
.L162:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L92
.L94:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L95
	orq	$0, -8(%rsp,%rdx)
.L95:
	movq	%rsp, %rbx
	testl	%eax, %eax
	jle	.L96
	movl	%eax, %eax
	movq	%rbx, %rdx
	pxor	%xmm0, %xmm0
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,8), %rcx
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L97:
	movl	$0, (%rax)
	addq	$24, %rax
	movups	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L97
	movq	%rsi, %rax
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rcx
.L120:
	cmpq	%rcx, %rsp
	je	.L121
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L120
.L121:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L122
	orq	$0, -8(%rsp,%rax)
.L122:
	leaq	.LC1(%rip), %rax
	movq	%rsp, %r15
	xorl	%r14d, %r14d
	movq	%rdx, %r12
	movq	-144(%rbp), %r13
	movq	%rax, -152(%rbp)
	movq	%r15, -88(%rbp)
	movq	%rbx, -96(%rbp)
	movq	%r13, %rbx
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L99:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	addq	$24, %r12
	movl	%r14d, -24(%r12)
	movl	$0, (%r15,%r14,4)
	addq	$1, %r14
	cmpl	%r14d, -72(%rbp)
	jg	.L99
	movq	-88(%rbp), %r12
	movq	-96(%rbp), %rbx
.L126:
	leaq	-60(%rbp), %rax
	movl	-68(%rbp), %ecx
	xorl	%r13d, %r13d
	movq	%rax, -120(%rbp)
	leaq	-64(%rbp), %rax
	movq	%rax, -112(%rbp)
	testl	%ecx, %ecx
	jle	.L107
	movq	%r12, -136(%rbp)
	.p2align 4,,10
	.p2align 3
.L100:
	movq	-120(%rbp), %rdx
	movq	-112(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r15d
	movslq	-64(%rbp), %rax
	leal	-1(%r15), %edx
	leal	-1(%rax), %ecx
	movslq	%edx, %r12
	leaq	(%rax,%rax,2), %rax
	movslq	%ecx, %rcx
	leaq	(%r12,%r12,2), %rdi
	leaq	(%rbx,%rax,8), %r10
	movq	%rcx, -104(%rbp)
	leaq	(%rbx,%rdi,8), %r9
	cmpq	$0, -16(%r10)
	leaq	(%rcx,%rcx,2), %rdi
	leaq	(%rbx,%rdi,8), %r14
	je	.L163
	movq	16(%r14), %r10
	movl	$16, %edi
	movq	%r9, -96(%rbp)
	movq	%r10, -88(%rbp)
	call	malloc@PLT
	movq	-88(%rbp), %r10
	movq	-104(%rbp), %rcx
	movq	-96(%rbp), %r9
	movq	%rax, 8(%r10)
.L104:
	movslq	%r15d, %rsi
	leaq	(%rcx,%rcx,2), %rcx
	movq	%rax, 16(%rbx,%rcx,8)
	movq	%r9, (%rax)
	movq	$0, 8(%rax)
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rbx,%rax,8), %r15
	cmpq	$0, -16(%r15)
	je	.L164
	leaq	(%r12,%r12,2), %rax
	movl	$16, %edi
	addl	$1, %r13d
	leaq	(%rbx,%rax,8), %r15
	movq	16(%r15), %r12
	call	malloc@PLT
	movq	%rax, 8(%r12)
	movq	%rax, 16(%r15)
	movq	%r14, (%rax)
	movq	$0, 8(%rax)
	cmpl	%r13d, -68(%rbp)
	jg	.L100
.L159:
	movq	-136(%rbp), %r12
.L107:
	movl	-72(%rbp), %ecx
	movl	$1, %r13d
	testl	%ecx, %ecx
	jle	.L102
	.p2align 4,,10
	.p2align 3
.L110:
	movslq	(%rbx), %rax
	movl	%r13d, %r15d
	addl	$1, %r13d
	leaq	(%r12,%rax,4), %rax
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L108
	movq	8(%rbx), %r14
	movl	%r15d, (%rax)
	testq	%r14, %r14
	je	.L108
.L109:
	movq	(%r14), %rsi
	movl	%r15d, %edx
	movq	%r12, %rdi
	call	func
	movq	8(%r14), %r14
	testq	%r14, %r14
	jne	.L109
	movl	-72(%rbp), %ecx
.L108:
	addq	$24, %rbx
	cmpl	%ecx, %r15d
	jl	.L110
	testl	%ecx, %ecx
	jle	.L102
	movq	-144(%rbp), %r9
	movq	-128(%rbp), %r10
	movl	%ecx, %edi
	xorl	%edx, %edx
	leal	-1(%rcx), %r8d
	.p2align 4,,10
	.p2align 3
.L111:
	movl	(%r9,%rdx,4), %eax
	movl	(%r12,%rdx,4), %esi
	addq	$1, %rdx
	subl	$1, %eax
	cltq
	movl	%esi, (%r10,%rax,4)
	cmpq	%rdi, %rdx
	jne	.L111
	cmpl	$2, %r8d
	jbe	.L129
	movl	%ecx, %edx
	movq	-128(%rbp), %rsi
	xorl	%eax, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L113:
	movdqu	(%rsi,%rax), %xmm1
	movdqu	(%r12,%rax), %xmm2
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L113
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %cl
	je	.L119
.L112:
	movslq	%esi, %rax
	xorl	%edi, %edi
	salq	$2, %rax
	addq	%rax, %r12
	addq	-128(%rbp), %rax
	movl	(%r12), %ebx
	cmpl	%ebx, (%rax)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%ecx, %edi
	jge	.L119
	movl	4(%r12), %ebx
	cmpl	%ebx, 4(%rax)
	jne	.L116
	addl	$1, %edx
.L116:
	addl	$2, %esi
	cmpl	%ecx, %esi
	jge	.L119
	movl	8(%r12), %esi
	cmpl	%esi, 8(%rax)
	jne	.L119
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L119:
	movq	-152(%rbp), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L165
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L164:
	.cfi_restore_state
	movl	$16, %edi
	addl	$1, %r13d
	call	malloc@PLT
	leaq	(%r12,%r12,2), %rdx
	movq	%rax, -16(%r15)
	movq	%r14, (%rax)
	movq	%rax, 16(%rbx,%rdx,8)
	movq	$0, 8(%rax)
	cmpl	-68(%rbp), %r13d
	jl	.L100
	jmp	.L159
	.p2align 4,,10
	.p2align 3
.L163:
	movl	$16, %edi
	movq	%r10, -96(%rbp)
	movq	%r9, -88(%rbp)
	call	malloc@PLT
	movq	-96(%rbp), %r10
	movq	-88(%rbp), %r9
	movq	-104(%rbp), %rcx
	movq	%rax, -16(%r10)
	jmp	.L104
.L102:
	xorl	%edx, %edx
	jmp	.L119
.L96:
	movq	%rsi, %rax
	movq	%rsp, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rdx
.L123:
	cmpq	%rdx, %rsp
	je	.L124
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L123
.L129:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L112
.L124:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L125
	orq	$0, -8(%rsp,%rax)
.L125:
	leaq	.LC1(%rip), %rax
	movq	%rsp, %r12
	movq	%rax, -152(%rbp)
	jmp	.L126
.L165:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE55:
	.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:

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

typedef struct node node;
typedef struct edge{
    node* target;
    struct edge* next;
}edge;
typedef struct node{
    int id;
    edge* fst;
    edge* lst;
}node;
void initNodeArray(node* p, int n){
    for(int i=0; i<n; i++){
        (p+i)->id = 0;
        (p+i)->fst = NULL;
        (p+i)->lst = NULL;
    }
}
void addEdge(node* p, node* target){
    if(p->fst == NULL){
        p->fst = (edge*)malloc(sizeof(edge));
        p->lst = p->fst;
    }else{
        p->lst->next = (edge*)malloc(sizeof(edge));
        p->lst = p->lst->next;
    }
    p->lst->target = target;
    p->lst->next = NULL;
}
void rmEdge(node* p, node* q){
    edge* e = p->fst;
    edge* pre = NULL;
    while(e != NULL){
        if(e->target == q){
            if(pre != NULL){
                pre->next = e->next;
            }
            if(e == p->fst){
                p->fst = e->next;
            }
            if(e == p->lst){
                p->lst = pre;
            }
            free(e);
            return;
        }
        pre = e;
        e = e->next;
    }
    return;
}

void func(int* group, node* a, int g){
    if(*(group + (a->id)) != 0){
        return;
    }
    *(group + (a->id)) = g;
    edge* e = a->fst;
    while(e != NULL){
        func(group, e->target, g);
        e = e->next;
    }
}

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int p[n], q[n];
    node a[n];
    initNodeArray(a, n);
    int group[n];
    rep(i, 0, n){
        scanf("%d", &p[i]);
        a[i].id = i;
        group[i] = 0;
    }
    rep(i, 0, m){
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;
        addEdge(&a[x], &a[y]);
        addEdge(&a[y], &a[x]);
    }
    int num = 1;
    rep(i, 0, n){
        func(group, &a[i], num++);
    }
    rep(i, 0, n){
        q[p[i]-1] = group[i];
    }
    int ans = 0;
    rep(i, 0, n){
        if(group[i] == q[i]){
            ans++;
        }
    }
    printf("%d", 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
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

typedef struct node node;
typedef struct edge{
    node* target;
    struct edge* next;
}edge;
typedef struct node{
    int id;
    edge* fst;
    edge* lst;
}node;
void initNodeArray(node* p, int n){
    for(int i=0; i<n; i++){
        (p+i)->id = 0;
        (p+i)->fst = NULL;
        (p+i)->lst = NULL;
    }
}
void addEdge(node* p, node* target){
    if(p->fst == NULL){
        p->fst = (edge*)malloc(sizeof(edge));
        p->lst = p->fst;
    }else{
        p->lst->next = (edge*)malloc(sizeof(edge));
        p->lst = p->lst->next;
    }
    p->lst->target = target;
    p->lst->next = NULL;
}
void rmEdge(node* p, node* q){
    edge* e = p->fst;
    edge* pre = NULL;
    while(e != NULL){
        if(e->target == q){
            if(pre != NULL){
                pre->next = e->next;
            }
            if(e == p->fst){
                p->fst = e->next;
            }
            if(e == p->lst){
                p->lst = pre;
            }
            free(e);
            return;
        }
        pre = e;
        e = e->next;
    }
    return;
}

void func(int* group, node* a, int g){
    if(*(group + (a->id)) != 0){
        return;
    }
    *(group + (a->id)) = g;
    edge* e = a->fst;
    while(e != NULL){
        func(group, e->target, g);
        e = e->next;
    }
}

int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int p[n], q[n];
    node a[n];
    initNodeArray(a, n);
    int group[n];
    rep(i, 0, n){
        scanf("%d", &p[i]);
        a[i].id = i;
        group[i] = 0;
    }
    rep(i, 0, m){
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;
        addEdge(&a[x], &a[y]);
        addEdge(&a[y], &a[x]);
    }
    int num = 1;
    rep(i, 0, n){
        func(group, &a[i], num++);
    }
    rep(i, 0, n){
        q[p[i]-1] = group[i];
    }
    int ans = 0;
    rep(i, 0, n){
        if(group[i] == q[i]){
            ans++;
        }
    }
    printf("%d", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	initNodeArray
	.type	initNodeArray, @function
initNodeArray:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 8(%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 16(%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	initNodeArray, .-initNodeArray
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB7:
	.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	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
	jmp	.L6
.L5:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rbx
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
.L6:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	$0, 8(%rax)
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	addEdge, .-addEdge
	.globl	rmEdge
	.type	rmEdge, @function
rmEdge:
.LFB8:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -8(%rbp)
	jmp	.L8
.L14:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, -32(%rbp)
	jne	.L9
	cmpq	$0, -8(%rbp)
	je	.L10
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
.L10:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L11
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L11:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L12
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L12:
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L7
.L9:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	cmpq	$0, -16(%rbp)
	jne	.L14
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	rmEdge, .-rmEdge
	.globl	func
	.type	func, @function
func:
.LFB9:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L18:
	cmpq	$0, -8(%rbp)
	jne	.L19
	jmp	.L15
.L20:
	nop
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	func, .-func
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-160(%rbp), %rdx
	leaq	-164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L22:
	cmpq	%rcx, %rsp
	je	.L23
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L22
.L23:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L24
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L24:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -112(%rbp)
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L25:
	cmpq	%rdx, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L25
.L26:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L27
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L27:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-164(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$192, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$192, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L28:
	cmpq	%rdx, %rsp
	je	.L29
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L28
.L29:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L30
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L30:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movl	-164(%rbp), %edx
	movq	-80(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	initNodeArray
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L31:
	cmpq	%rdx, %rsp
	je	.L32
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L31
.L32:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L33
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L33:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L34
.L35:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-148(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-64(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -148(%rbp)
.L34:
	movl	-164(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L35
	movl	$0, -144(%rbp)
	jmp	.L36
.L37:
	leaq	-152(%rbp), %rdx
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -156(%rbp)
	movl	-152(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -152(%rbp)
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-156(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	addl	$1, -144(%rbp)
.L36:
	movl	-160(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L37
	movl	$1, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L38
.L39:
	movl	-140(%rbp), %edx
	leal	1(%rdx), %eax
	movl	%eax, -140(%rbp)
	movl	-136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rax, %rcx
	movq	-64(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	addl	$1, -136(%rbp)
.L38:
	movl	-164(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L39
	movl	$0, -132(%rbp)
	jmp	.L40
.L41:
	movq	-112(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %esi
	movq	-64(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movslq	%esi, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -132(%rbp)
.L40:
	movl	-164(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L41
	movl	$0, -128(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L42
.L44:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L43
	addl	$1, -128(%rbp)
.L43:
	addl	$1, -124(%rbp)
.L42:
	movl	-164(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L44
	movl	-128(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	initNodeArray
	.type	initNodeArray, @function
initNodeArray:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 8(%rax)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, 16(%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	initNodeArray, .-initNodeArray
	.globl	addEdge
	.type	addEdge, @function
addEdge:
.LFB7:
	.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	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L5
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
	jmp	.L6
.L5:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rbx
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 16(%rax)
.L6:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	movq	$0, 8(%rax)
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	addEdge, .-addEdge
	.globl	rmEdge
	.type	rmEdge, @function
rmEdge:
.LFB8:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -8(%rbp)
	jmp	.L8
.L14:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, -32(%rbp)
	jne	.L9
	cmpq	$0, -8(%rbp)
	je	.L10
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
.L10:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L11
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L11:
	movq	-24(%rbp), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L12
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L12:
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L7
.L9:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	cmpq	$0, -16(%rbp)
	jne	.L14
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	rmEdge, .-rmEdge
	.globl	func
	.type	func, @function
func:
.LFB9:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L18
.L19:
	movq	-8(%rbp), %rax
	movq	(%rax), %rcx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L18:
	cmpq	$0, -8(%rbp)
	jne	.L19
	jmp	.L15
.L20:
	nop
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	func, .-func
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-160(%rbp), %rdx
	leaq	-164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L22:
	cmpq	%rcx, %rsp
	je	.L23
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L22
.L23:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L24
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L24:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -112(%rbp)
	movl	-164(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L25:
	cmpq	%rdx, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L25
.L26:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L27
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L27:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-164(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$192, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$192, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$192, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L28:
	cmpq	%rdx, %rsp
	je	.L29
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L28
.L29:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L30
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L30:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movl	-164(%rbp), %edx
	movq	-80(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	initNodeArray
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L31:
	cmpq	%rdx, %rsp
	je	.L32
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L31
.L32:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L33
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L33:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -148(%rbp)
	jmp	.L34
.L35:
	movl	-148(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-148(%rbp), %eax
	movl	%eax, (%rdx)
	movq	-64(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -148(%rbp)
.L34:
	movl	-164(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L35
	movl	$0, -144(%rbp)
	jmp	.L36
.L37:
	leaq	-152(%rbp), %rdx
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -156(%rbp)
	movl	-152(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -152(%rbp)
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-156(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rdx
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	addEdge
	addl	$1, -144(%rbp)
.L36:
	movl	-160(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L37
	movl	$1, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L38
.L39:
	movl	-140(%rbp), %edx
	leal	1(%rdx), %eax
	movl	%eax, -140(%rbp)
	movl	-136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	movq	-80(%rbp), %rcx
	addq	%rax, %rcx
	movq	-64(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	func
	addl	$1, -136(%rbp)
.L38:
	movl	-164(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L39
	movl	$0, -132(%rbp)
	jmp	.L40
.L41:
	movq	-112(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %esi
	movq	-64(%rbp), %rax
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movslq	%esi, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -132(%rbp)
.L40:
	movl	-164(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L41
	movl	$0, -128(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L42
.L44:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-96(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L43
	addl	$1, -128(%rbp)
.L43:
	addl	$1, -124(%rbp)
.L42:
	movl	-164(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L44
	movl	-128(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L46
	call	__stack_chk_fail@PLT
.L46:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
