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

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

typedef struct{
    int parent;
    long size; //根だったらその木のサイズを表す
}node;

//union-ford木のメモリを確保→初期化して出力(0からカウント)
node* build_union_ford(int N){
    node* T;
    NEW(T,N);
 
    //T[i]には、節iの親を入れる
    for(int i=0;i<N;i++){
        T[i].parent=i;
        T[i].size=1;
    }
    return T;
}
 
//節xを含む部分木の根を返す
int find_set(node* T, int x){
    if(T[x].parent==x){
        return x;
    }
    else{
        return T[x].parent=find_set(T,T[x].parent);
    }
}
 
//節xを含む部分木と節yを含む部分木を併合する
void union_set(node* T,int x, int y){
    x=find_set(T,x);
    y=find_set(T,y);
 
    if(x==y) return;
    else{
        T[x].parent=y;
        T[y].size+=T[x].size;
        return;
    }
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //p[0]~p[N-1]に格納する(添字0スタートに対応させる)
    int* p;
    NEW(p,N);
    for(int i=0;i<N;i++){
        scanf("%d",&p[i]);
        p[i]--;
    }

    //union-ford木の作成
    node* T=build_union_ford(N);

    for(int i=0;i<M;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        x--;
        y--;
        union_set(T,x,y);
    }

    int ans=0;
    for(int i=0;i<N;i++){
        if(find_set(T,i)==find_set(T,p[i])) ans++;
    }
    printf("%d\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"not enough memory"
	.text
	.globl	build_union_ford
	.type	build_union_ford, @function
build_union_ford:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	build_union_ford, .-build_union_ford
	.globl	find_set
	.type	find_set, @function
find_set:
.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L7
	movl	-28(%rbp), %eax
	jmp	.L8
.L7:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	(%rcx,%rax), %rbx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L12
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	movq	-8(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, 8(%rax)
	jmp	.L9
.L12:
	nop
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	union_set, .-union_set
	.section	.rodata
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L14
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	$0, -56(%rbp)
	jmp	.L15
.L16:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -56(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %edi
	call	build_union_ford
	movq	%rax, -32(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L17
.L18:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -64(%rbp)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -60(%rbp)
	movl	-60(%rbp), %edx
	movl	-64(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	union_set
	addl	$1, -52(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L18
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L19
.L21:
	movl	-44(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, %ebx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	cmpl	%eax, %ebx
	jne	.L20
	addl	$1, -48(%rbp)
.L20:
	addl	$1, -44(%rbp)
.L19:
	movl	-72(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L21
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"not enough memory"
	.text
	.p2align 4
	.globl	build_union_ford
	.type	build_union_ford, @function
build_union_ford:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%edi, %rdi
	movq	%rdi, %rbx
	salq	$4, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L2
	movq	%rax, %rcx
	xorl	%edx, %edx
	testl	%ebx, %ebx
	jle	.L1
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, (%rcx)
	addl	$1, %edx
	addq	$16, %rcx
	movq	$1, -8(%rcx)
	cmpl	%edx, %ebx
	jne	.L5
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE51:
	.size	build_union_ford, .-build_union_ford
	.p2align 4
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	movq	%rbx, %rax
	salq	$4, %rbx
	addq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%rbx), %edx
	cmpl	%eax, %edx
	jne	.L16
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movslq	%edx, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %edx
	cmpl	%edx, %eax
	jne	.L17
	movl	%edx, 0(%rbp)
	movl	%edx, %eax
.L12:
	movl	%eax, (%rbx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%edx, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %edx
	je	.L14
	call	find_set
	movl	%eax, 0(%r13)
	movl	%eax, %esi
.L14:
	movl	%esi, %edx
	movl	%esi, (%r12)
	movl	%edx, %eax
	movl	%edx, 0(%rbp)
	jmp	.L12
	.cfi_endproc
.LFE52:
	.size	find_set, .-find_set
	.p2align 4
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%esi, %r8
	movl	%edx, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	salq	$4, %r8
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	addq	%rdi, %r8
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	(%r8), %rcx
	cmpl	%ecx, %esi
	jne	.L37
.L19:
	movslq	%r9d, %r8
	salq	$4, %r8
	addq	%rdi, %r8
	movslq	(%r8), %rax
	cmpl	%eax, %r9d
	jne	.L38
.L27:
	cmpl	%ecx, %eax
	je	.L18
	salq	$4, %rcx
	addq	%rdi, %rcx
	movl	%eax, (%rcx)
	salq	$4, %rax
	movq	8(%rcx), %rdx
	addq	%rdx, 8(%rdi,%rax)
.L18:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	movslq	%ecx, %r10
	salq	$4, %r10
	addq	%rdi, %r10
	movl	(%r10), %eax
	cmpl	%eax, %ecx
	je	.L20
	movslq	%eax, %rcx
	salq	$4, %rcx
	addq	%rdi, %rcx
	movl	(%rcx), %edx
	cmpl	%edx, %eax
	jne	.L39
.L21:
	movl	%edx, (%r10)
	movl	%edx, %eax
.L20:
	movl	%eax, (%r8)
	movslq	%eax, %rcx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%eax, %r9
	salq	$4, %r9
	addq	%rdi, %r9
	movl	(%r9), %edx
	cmpl	%edx, %eax
	je	.L28
	movslq	%edx, %r10
	salq	$4, %r10
	addq	%rdi, %r10
	movl	(%r10), %eax
	cmpl	%eax, %edx
	jne	.L40
.L29:
	movl	%eax, (%r9)
	movl	%eax, %edx
.L28:
	movl	%edx, (%r8)
	movslq	%edx, %rax
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%eax, %r11
	salq	$4, %r11
	addq	%rdi, %r11
	movl	(%r11), %edx
	cmpl	%edx, %eax
	je	.L30
	movslq	%edx, %rbx
	salq	$4, %rbx
	addq	%rdi, %rbx
	movl	(%rbx), %eax
	cmpl	%eax, %edx
	jne	.L41
.L31:
	movl	%eax, (%r11)
	movl	%eax, %edx
.L30:
	movl	%edx, (%r10)
	movl	%edx, %eax
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L39:
	movslq	%edx, %r11
	salq	$4, %r11
	addq	%rdi, %r11
	movl	(%r11), %eax
	cmpl	%eax, %edx
	je	.L22
	movslq	%eax, %rbx
	salq	$4, %rbx
	addq	%rdi, %rbx
	movl	(%rbx), %edx
	cmpl	%edx, %eax
	jne	.L42
.L23:
	movl	%edx, (%r11)
	movl	%edx, %eax
.L22:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L42:
	movslq	%edx, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %eax
	cmpl	%eax, %edx
	je	.L24
	movslq	%eax, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %edx
	cmpl	%edx, %eax
	je	.L25
	movslq	%edx, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %edx
	je	.L26
	call	find_set
	movl	%eax, 0(%r13)
	movl	%eax, %esi
.L26:
	movl	%esi, (%r12)
	movl	%esi, %edx
.L25:
	movl	%edx, 0(%rbp)
	movl	%edx, %eax
.L24:
	movl	%eax, (%rbx)
	movl	%eax, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%eax, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %edx
	cmpl	%edx, %eax
	je	.L32
	movslq	%edx, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %esi
	cmpl	%esi, %edx
	je	.L33
	movslq	%esi, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %eax
	cmpl	%eax, %esi
	je	.L34
	movl	%eax, %esi
	call	find_set
	movl	%eax, 0(%r13)
.L34:
	movl	%eax, (%r12)
	movl	%eax, %esi
.L33:
	movl	%esi, 0(%rbp)
	movl	%esi, %edx
.L32:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L31
	.cfi_endproc
.LFE53:
	.size	union_set, .-union_set
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	56(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L44
	movq	%rax, %rbp
	movq	%rax, %rbx
	leaq	.LC2(%rip), %r15
	xorl	%r13d, %r13d
	testl	%r14d, %r14d
	jle	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %r14d
	subl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	%r13d, %r14d
	jg	.L47
.L46:
	movl	%r14d, %edi
	call	build_union_ford
	movl	60(%rsp), %edx
	movq	%rax, %rbx
	testl	%edx, %edx
	jle	.L48
	xorl	%r15d, %r15d
	leaq	68(%rsp), %r14
	leaq	64(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L49:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	movq	%rbx, %rdi
	addl	$1, %r15d
	leal	-1(%rax), %esi
	movl	68(%rsp), %eax
	movl	%esi, 64(%rsp)
	leal	-1(%rax), %edx
	movl	%edx, 68(%rsp)
	call	union_set
	cmpl	%r15d, 60(%rsp)
	jg	.L49
.L48:
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L73
	movq	%rbx, %r10
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%r10), %eax
	movl	%r8d, %r9d
	cmpl	%r8d, %eax
	je	.L51
	movslq	%eax, %rcx
	salq	$4, %rcx
	addq	%rbx, %rcx
	movl	(%rcx), %r9d
	cmpl	%r9d, %eax
	je	.L52
	movslq	%r9d, %r11
	salq	$4, %r11
	addq	%rbx, %r11
	movl	(%r11), %eax
	cmpl	%eax, %r9d
	je	.L53
	movslq	%eax, %r9
	salq	$4, %r9
	addq	%rbx, %r9
	movl	(%r9), %esi
	cmpl	%esi, %eax
	jne	.L82
.L54:
	movl	%eax, (%r11)
.L53:
	movl	%eax, (%rcx)
	movl	%eax, %r9d
.L52:
	movl	%r9d, (%r10)
.L51:
	movslq	0(%rbp,%r8,4), %rcx
	movq	%rcx, %rsi
	salq	$4, %rcx
	addq	%rbx, %rcx
	movl	(%rcx), %eax
	cmpl	%eax, %esi
	je	.L60
	movslq	%eax, %r11
	salq	$4, %r11
	addq	%rbx, %r11
	movl	(%r11), %esi
	cmpl	%esi, %eax
	je	.L61
	movslq	%esi, %r12
	salq	$4, %r12
	addq	%rbx, %r12
	movl	(%r12), %eax
	cmpl	%eax, %esi
	je	.L62
	movslq	%eax, %r13
	salq	$4, %r13
	addq	%rbx, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %eax
	jne	.L83
.L63:
	movl	%eax, (%r12)
.L62:
	movl	%eax, (%r11)
	movl	%eax, %esi
.L61:
	movl	%esi, (%rcx)
	movl	%esi, %eax
.L60:
	cmpl	%r9d, %eax
	sete	%al
	addq	$1, %r8
	addq	$16, %r10
	movzbl	%al, %eax
	addl	%eax, %edx
	cmpl	%r8d, 56(%rsp)
	jg	.L71
.L50:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L84
	addq	$88, %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
.L83:
	.cfi_restore_state
	movslq	%esi, %r14
	salq	$4, %r14
	addq	%rbx, %r14
	movl	(%r14), %eax
	cmpl	%eax, %esi
	je	.L64
	movslq	%eax, %r15
	salq	$4, %r15
	addq	%rbx, %r15
	movl	(%r15), %esi
	cmpl	%esi, %eax
	jne	.L85
.L65:
	movl	%esi, (%r14)
	movl	%esi, %eax
.L64:
	movl	%eax, 0(%r13)
	jmp	.L63
.L82:
	movslq	%esi, %r12
	salq	$4, %r12
	addq	%rbx, %r12
	movl	(%r12), %eax
	cmpl	%eax, %esi
	je	.L55
	movslq	%eax, %r13
	salq	$4, %r13
	addq	%rbx, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %eax
	jne	.L86
.L56:
	movl	%esi, (%r12)
	movl	%esi, %eax
.L55:
	movl	%eax, (%r9)
	jmp	.L54
.L86:
	movslq	%esi, %r14
	salq	$4, %r14
	addq	%rbx, %r14
	movl	(%r14), %eax
	cmpl	%eax, %esi
	je	.L57
	movslq	%eax, %r15
	salq	$4, %r15
	addq	%rbx, %r15
	movl	(%r15), %esi
	cmpl	%esi, %eax
	jne	.L87
.L58:
	movl	%esi, (%r14)
	movl	%esi, %eax
.L57:
	movl	%eax, 0(%r13)
	movl	%eax, %esi
	jmp	.L56
.L85:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 8(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L66
	movslq	%eax, %rsi
	salq	$4, %rsi
	leaq	(%rbx,%rsi), %rdi
	movl	(%rdi), %esi
	movq	%rdi, 16(%rsp)
	cmpl	%esi, %eax
	jne	.L88
.L67:
	movq	8(%rsp), %rax
	movl	%esi, (%rax)
	movl	%esi, %eax
.L66:
	movl	%eax, (%r15)
	movl	%eax, %esi
	jmp	.L65
.L73:
	xorl	%edx, %edx
	jmp	.L50
.L88:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 24(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L68
	movslq	%eax, %rsi
	salq	$4, %rsi
	leaq	(%rbx,%rsi), %rdi
	movl	(%rdi), %esi
	movq	%rdi, 32(%rsp)
	cmpl	%esi, %eax
	je	.L69
	movq	%rbx, %rdi
	movl	%edx, 44(%rsp)
	call	find_set
	movq	32(%rsp), %rdi
	movl	44(%rsp), %edx
	movl	%eax, %esi
	movl	%eax, (%rdi)
.L69:
	movq	24(%rsp), %rax
	movl	%esi, (%rax)
	movl	%esi, %eax
.L68:
	movq	16(%rsp), %rdi
	movl	%eax, %esi
	movl	%eax, (%rdi)
	jmp	.L67
.L87:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 8(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L59
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	%edx, 16(%rsp)
	call	find_set
	movq	8(%rsp), %rdi
	movl	16(%rsp), %edx
	movl	%eax, (%rdi)
.L59:
	movl	%eax, (%r15)
	movl	%eax, %esi
	jmp	.L58
.L44:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L84:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"not enough memory"
	.text
	.p2align 4
	.globl	build_union_ford
	.type	build_union_ford, @function
build_union_ford:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%edi, %rdi
	movq	%rdi, %rbx
	salq	$4, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L2
	movq	%rax, %rcx
	xorl	%edx, %edx
	testl	%ebx, %ebx
	jle	.L1
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, (%rcx)
	addl	$1, %edx
	addq	$16, %rcx
	movq	$1, -8(%rcx)
	cmpl	%edx, %ebx
	jne	.L5
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE51:
	.size	build_union_ford, .-build_union_ford
	.p2align 4
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	movq	%rbx, %rax
	salq	$4, %rbx
	addq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%rbx), %edx
	cmpl	%eax, %edx
	jne	.L16
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movslq	%edx, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %edx
	cmpl	%edx, %eax
	jne	.L17
	movl	%edx, 0(%rbp)
	movl	%edx, %eax
.L12:
	movl	%eax, (%rbx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%edx, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %edx
	je	.L14
	call	find_set
	movl	%eax, 0(%r13)
	movl	%eax, %esi
.L14:
	movl	%esi, %edx
	movl	%esi, (%r12)
	movl	%edx, %eax
	movl	%edx, 0(%rbp)
	jmp	.L12
	.cfi_endproc
.LFE52:
	.size	find_set, .-find_set
	.p2align 4
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%esi, %r8
	movl	%edx, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	salq	$4, %r8
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	addq	%rdi, %r8
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	(%r8), %rcx
	cmpl	%ecx, %esi
	jne	.L37
.L19:
	movslq	%r9d, %r8
	salq	$4, %r8
	addq	%rdi, %r8
	movslq	(%r8), %rax
	cmpl	%eax, %r9d
	jne	.L38
.L27:
	cmpl	%ecx, %eax
	je	.L18
	salq	$4, %rcx
	addq	%rdi, %rcx
	movl	%eax, (%rcx)
	salq	$4, %rax
	movq	8(%rcx), %rdx
	addq	%rdx, 8(%rdi,%rax)
.L18:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	movslq	%ecx, %r10
	salq	$4, %r10
	addq	%rdi, %r10
	movl	(%r10), %eax
	cmpl	%eax, %ecx
	je	.L20
	movslq	%eax, %rcx
	salq	$4, %rcx
	addq	%rdi, %rcx
	movl	(%rcx), %edx
	cmpl	%edx, %eax
	jne	.L39
.L21:
	movl	%edx, (%r10)
	movl	%edx, %eax
.L20:
	movl	%eax, (%r8)
	movslq	%eax, %rcx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%eax, %r9
	salq	$4, %r9
	addq	%rdi, %r9
	movl	(%r9), %edx
	cmpl	%edx, %eax
	je	.L28
	movslq	%edx, %r10
	salq	$4, %r10
	addq	%rdi, %r10
	movl	(%r10), %eax
	cmpl	%eax, %edx
	jne	.L40
.L29:
	movl	%eax, (%r9)
	movl	%eax, %edx
.L28:
	movl	%edx, (%r8)
	movslq	%edx, %rax
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%eax, %r11
	salq	$4, %r11
	addq	%rdi, %r11
	movl	(%r11), %edx
	cmpl	%edx, %eax
	je	.L30
	movslq	%edx, %rbx
	salq	$4, %rbx
	addq	%rdi, %rbx
	movl	(%rbx), %eax
	cmpl	%eax, %edx
	jne	.L41
.L31:
	movl	%eax, (%r11)
	movl	%eax, %edx
.L30:
	movl	%edx, (%r10)
	movl	%edx, %eax
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L39:
	movslq	%edx, %r11
	salq	$4, %r11
	addq	%rdi, %r11
	movl	(%r11), %eax
	cmpl	%eax, %edx
	je	.L22
	movslq	%eax, %rbx
	salq	$4, %rbx
	addq	%rdi, %rbx
	movl	(%rbx), %edx
	cmpl	%edx, %eax
	jne	.L42
.L23:
	movl	%edx, (%r11)
	movl	%edx, %eax
.L22:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L42:
	movslq	%edx, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %eax
	cmpl	%eax, %edx
	je	.L24
	movslq	%eax, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %edx
	cmpl	%edx, %eax
	je	.L25
	movslq	%edx, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %edx
	je	.L26
	call	find_set
	movl	%eax, 0(%r13)
	movl	%eax, %esi
.L26:
	movl	%esi, (%r12)
	movl	%esi, %edx
.L25:
	movl	%edx, 0(%rbp)
	movl	%edx, %eax
.L24:
	movl	%eax, (%rbx)
	movl	%eax, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%eax, %rbp
	salq	$4, %rbp
	addq	%rdi, %rbp
	movl	0(%rbp), %edx
	cmpl	%edx, %eax
	je	.L32
	movslq	%edx, %r12
	salq	$4, %r12
	addq	%rdi, %r12
	movl	(%r12), %esi
	cmpl	%esi, %edx
	je	.L33
	movslq	%esi, %r13
	salq	$4, %r13
	addq	%rdi, %r13
	movl	0(%r13), %eax
	cmpl	%eax, %esi
	je	.L34
	movl	%eax, %esi
	call	find_set
	movl	%eax, 0(%r13)
.L34:
	movl	%eax, (%r12)
	movl	%eax, %esi
.L33:
	movl	%esi, 0(%rbp)
	movl	%esi, %edx
.L32:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L31
	.cfi_endproc
.LFE53:
	.size	union_set, .-union_set
	.section	.rodata.str1.1
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	56(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L44
	movq	%rax, %rbp
	movq	%rax, %rbx
	leaq	.LC2(%rip), %r15
	xorl	%r13d, %r13d
	testl	%r14d, %r14d
	jle	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %r14d
	subl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	%r13d, %r14d
	jg	.L47
.L46:
	movl	%r14d, %edi
	call	build_union_ford
	movl	60(%rsp), %edx
	movq	%rax, %rbx
	testl	%edx, %edx
	jle	.L48
	xorl	%r15d, %r15d
	leaq	68(%rsp), %r14
	leaq	64(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L49:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	movq	%rbx, %rdi
	addl	$1, %r15d
	leal	-1(%rax), %esi
	movl	68(%rsp), %eax
	movl	%esi, 64(%rsp)
	leal	-1(%rax), %edx
	movl	%edx, 68(%rsp)
	call	union_set
	cmpl	%r15d, 60(%rsp)
	jg	.L49
.L48:
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L73
	movq	%rbx, %r10
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%r10), %eax
	movl	%r8d, %r9d
	cmpl	%r8d, %eax
	je	.L51
	movslq	%eax, %rcx
	salq	$4, %rcx
	addq	%rbx, %rcx
	movl	(%rcx), %r9d
	cmpl	%r9d, %eax
	je	.L52
	movslq	%r9d, %r11
	salq	$4, %r11
	addq	%rbx, %r11
	movl	(%r11), %eax
	cmpl	%eax, %r9d
	je	.L53
	movslq	%eax, %r9
	salq	$4, %r9
	addq	%rbx, %r9
	movl	(%r9), %esi
	cmpl	%esi, %eax
	jne	.L82
.L54:
	movl	%eax, (%r11)
.L53:
	movl	%eax, (%rcx)
	movl	%eax, %r9d
.L52:
	movl	%r9d, (%r10)
.L51:
	movslq	0(%rbp,%r8,4), %rcx
	movq	%rcx, %rsi
	salq	$4, %rcx
	addq	%rbx, %rcx
	movl	(%rcx), %eax
	cmpl	%eax, %esi
	je	.L60
	movslq	%eax, %r11
	salq	$4, %r11
	addq	%rbx, %r11
	movl	(%r11), %esi
	cmpl	%esi, %eax
	je	.L61
	movslq	%esi, %r12
	salq	$4, %r12
	addq	%rbx, %r12
	movl	(%r12), %eax
	cmpl	%eax, %esi
	je	.L62
	movslq	%eax, %r13
	salq	$4, %r13
	addq	%rbx, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %eax
	jne	.L83
.L63:
	movl	%eax, (%r12)
.L62:
	movl	%eax, (%r11)
	movl	%eax, %esi
.L61:
	movl	%esi, (%rcx)
	movl	%esi, %eax
.L60:
	cmpl	%r9d, %eax
	sete	%al
	addq	$1, %r8
	addq	$16, %r10
	movzbl	%al, %eax
	addl	%eax, %edx
	cmpl	%r8d, 56(%rsp)
	jg	.L71
.L50:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L84
	addq	$88, %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
.L83:
	.cfi_restore_state
	movslq	%esi, %r14
	salq	$4, %r14
	addq	%rbx, %r14
	movl	(%r14), %eax
	cmpl	%eax, %esi
	je	.L64
	movslq	%eax, %r15
	salq	$4, %r15
	addq	%rbx, %r15
	movl	(%r15), %esi
	cmpl	%esi, %eax
	jne	.L85
.L65:
	movl	%esi, (%r14)
	movl	%esi, %eax
.L64:
	movl	%eax, 0(%r13)
	jmp	.L63
.L82:
	movslq	%esi, %r12
	salq	$4, %r12
	addq	%rbx, %r12
	movl	(%r12), %eax
	cmpl	%eax, %esi
	je	.L55
	movslq	%eax, %r13
	salq	$4, %r13
	addq	%rbx, %r13
	movl	0(%r13), %esi
	cmpl	%esi, %eax
	jne	.L86
.L56:
	movl	%esi, (%r12)
	movl	%esi, %eax
.L55:
	movl	%eax, (%r9)
	jmp	.L54
.L86:
	movslq	%esi, %r14
	salq	$4, %r14
	addq	%rbx, %r14
	movl	(%r14), %eax
	cmpl	%eax, %esi
	je	.L57
	movslq	%eax, %r15
	salq	$4, %r15
	addq	%rbx, %r15
	movl	(%r15), %esi
	cmpl	%esi, %eax
	jne	.L87
.L58:
	movl	%esi, (%r14)
	movl	%esi, %eax
.L57:
	movl	%eax, 0(%r13)
	movl	%eax, %esi
	jmp	.L56
.L85:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 8(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L66
	movslq	%eax, %rsi
	salq	$4, %rsi
	leaq	(%rbx,%rsi), %rdi
	movl	(%rdi), %esi
	movq	%rdi, 16(%rsp)
	cmpl	%esi, %eax
	jne	.L88
.L67:
	movq	8(%rsp), %rax
	movl	%esi, (%rax)
	movl	%esi, %eax
.L66:
	movl	%eax, (%r15)
	movl	%eax, %esi
	jmp	.L65
.L73:
	xorl	%edx, %edx
	jmp	.L50
.L88:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 24(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L68
	movslq	%eax, %rsi
	salq	$4, %rsi
	leaq	(%rbx,%rsi), %rdi
	movl	(%rdi), %esi
	movq	%rdi, 32(%rsp)
	cmpl	%esi, %eax
	je	.L69
	movq	%rbx, %rdi
	movl	%edx, 44(%rsp)
	call	find_set
	movq	32(%rsp), %rdi
	movl	44(%rsp), %edx
	movl	%eax, %esi
	movl	%eax, (%rdi)
.L69:
	movq	24(%rsp), %rax
	movl	%esi, (%rax)
	movl	%esi, %eax
.L68:
	movq	16(%rsp), %rdi
	movl	%eax, %esi
	movl	%eax, (%rdi)
	jmp	.L67
.L87:
	movslq	%esi, %rax
	salq	$4, %rax
	addq	%rbx, %rax
	movq	%rax, 8(%rsp)
	movl	(%rax), %eax
	cmpl	%eax, %esi
	je	.L59
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	%edx, 16(%rsp)
	call	find_set
	movq	8(%rsp), %rdi
	movl	16(%rsp), %edx
	movl	%eax, (%rdi)
.L59:
	movl	%eax, (%r15)
	movl	%eax, %esi
	jmp	.L58
.L44:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L84:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.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<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

typedef struct{
    int parent;
    long size; //根だったらその木のサイズを表す
}node;

//union-ford木のメモリを確保→初期化して出力(0からカウント)
node* build_union_ford(int N){
    node* T;
    NEW(T,N);
 
    //T[i]には、節iの親を入れる
    for(int i=0;i<N;i++){
        T[i].parent=i;
        T[i].size=1;
    }
    return T;
}
 
//節xを含む部分木の根を返す
int find_set(node* T, int x){
    if(T[x].parent==x){
        return x;
    }
    else{
        return T[x].parent=find_set(T,T[x].parent);
    }
}
 
//節xを含む部分木と節yを含む部分木を併合する
void union_set(node* T,int x, int y){
    x=find_set(T,x);
    y=find_set(T,y);
 
    if(x==y) return;
    else{
        T[x].parent=y;
        T[y].size+=T[x].size;
        return;
    }
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //p[0]~p[N-1]に格納する(添字0スタートに対応させる)
    int* p;
    NEW(p,N);
    for(int i=0;i<N;i++){
        scanf("%d",&p[i]);
        p[i]--;
    }

    //union-ford木の作成
    node* T=build_union_ford(N);

    for(int i=0;i<M;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        x--;
        y--;
        union_set(T,x,y);
    }

    int ans=0;
    for(int i=0;i<N;i++){
        if(find_set(T,i)==find_set(T,p[i])) 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
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

typedef struct{
    int parent;
    long size; //根だったらその木のサイズを表す
}node;

//union-ford木のメモリを確保→初期化して出力(0からカウント)
node* build_union_ford(int N){
    node* T;
    NEW(T,N);
 
    //T[i]には、節iの親を入れる
    for(int i=0;i<N;i++){
        T[i].parent=i;
        T[i].size=1;
    }
    return T;
}
 
//節xを含む部分木の根を返す
int find_set(node* T, int x){
    if(T[x].parent==x){
        return x;
    }
    else{
        return T[x].parent=find_set(T,T[x].parent);
    }
}
 
//節xを含む部分木と節yを含む部分木を併合する
void union_set(node* T,int x, int y){
    x=find_set(T,x);
    y=find_set(T,y);
 
    if(x==y) return;
    else{
        T[x].parent=y;
        T[y].size+=T[x].size;
        return;
    }
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    //p[0]~p[N-1]に格納する(添字0スタートに対応させる)
    int* p;
    NEW(p,N);
    for(int i=0;i<N;i++){
        scanf("%d",&p[i]);
        p[i]--;
    }

    //union-ford木の作成
    node* T=build_union_ford(N);

    for(int i=0;i<M;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        x--;
        y--;
        union_set(T,x,y);
    }

    int ans=0;
    for(int i=0;i<N;i++){
        if(find_set(T,i)==find_set(T,p[i])) ans++;
    }
    printf("%d\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"not enough memory"
	.text
	.globl	build_union_ford
	.type	build_union_ford, @function
build_union_ford:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	build_union_ford, .-build_union_ford
	.globl	find_set
	.type	find_set, @function
find_set:
.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L7
	movl	-28(%rbp), %eax
	jmp	.L8
.L7:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	(%rcx,%rax), %rbx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L12
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	movq	-8(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, 8(%rax)
	jmp	.L9
.L12:
	nop
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	union_set, .-union_set
	.section	.rodata
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L14
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	$0, -56(%rbp)
	jmp	.L15
.L16:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -56(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %edi
	call	build_union_ford
	movq	%rax, -32(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L17
.L18:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -64(%rbp)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -60(%rbp)
	movl	-60(%rbp), %edx
	movl	-64(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	union_set
	addl	$1, -52(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L18
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L19
.L21:
	movl	-44(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, %ebx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	cmpl	%eax, %ebx
	jne	.L20
	addl	$1, -48(%rbp)
.L20:
	addl	$1, -44(%rbp)
.L19:
	movl	-72(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L21
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.section	.rodata
.LC0:
	.string	"not enough memory"
	.text
	.globl	build_union_ford
	.type	build_union_ford, @function
build_union_ford:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L3:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	build_union_ford, .-build_union_ford
	.globl	find_set
	.type	find_set, @function
find_set:
.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L7
	movl	-28(%rbp), %eax
	jmp	.L8
.L7:
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	(%rcx,%rax), %rbx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %edx
	movq	-8(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L12
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	8(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	movq	-8(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, 8(%rax)
	jmp	.L9
.L12:
	nop
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	union_set, .-union_set
	.section	.rodata
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L14
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	$0, -56(%rbp)
	jmp	.L15
.L16:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -56(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %edi
	call	build_union_ford
	movq	%rax, -32(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L17
.L18:
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -64(%rbp)
	movl	-60(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -60(%rbp)
	movl	-60(%rbp), %edx
	movl	-64(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	union_set
	addl	$1, -52(%rbp)
.L17:
	movl	-68(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L18
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L19
.L21:
	movl	-44(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	movl	%eax, %ebx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	find_set
	cmpl	%eax, %ebx
	jne	.L20
	addl	$1, -48(%rbp)
.L20:
	addl	$1, -44(%rbp)
.L19:
	movl	-72(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L21
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
