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 <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define PEOPLE_MAX 100000

struct ufind {
    int parent;
    int depth;
    int cnt;
};


struct ufind *create_union_find(int ps) {
    static struct ufind ufind[PEOPLE_MAX];
    int i;
    for(i = 0; i < ps; i++) {
        struct ufind *elem = &ufind[i];
        elem->parent = i;
        elem->depth = 1;
        elem->cnt = 1;
    }
    return ufind;
}

int get_root(struct ufind *ufind, int v) {
    struct ufind *uv = &ufind[v];
    int base = v;
    while(base != uv->parent) {
        base = uv->parent;
        uv = &ufind[base];
    }
    return base;
}

void connect(struct ufind *ufind, int v1, int v2) {
    int b1 = get_root(ufind, v1);
    int b2 = get_root(ufind, v2);
    // already connected
    if(b1==b2) return;
    struct ufind *ub1 = &ufind[b1];
    struct ufind *ub2 = &ufind[b2];
    ub2->cnt = ub1->cnt = ub1->cnt + ub2->cnt;
    if(ub1->depth >= ub2->depth) { // ub1 <- ub2
        if(ub1->depth == ub2->depth) ub1->depth++;
        ub2->parent = b1;
        ub2->depth = ub1->depth;
    } else {
        ub1->parent = b2;
        ub1->depth = ub2->depth;
    }
    return;
}

int get_links(struct ufind *ufind, int v) {
    struct ufind *res = &ufind[get_root(ufind, v)];
    return res->cnt;
}

int is_same(struct ufind *ufind, int v1, int v2) {
    return get_root(ufind, v1) == get_root(ufind, v2);
}

int main(void) {
    int ps, fs, bs;
    int i;
    get_int3(&ps, &fs, &bs);
    static int exclude_map[PEOPLE_MAX];
    struct ufind *ufind = create_union_find(ps);

    for(i = 0; i < fs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        exclude_map[v1]++; exclude_map[v2]++;
        connect(ufind, v1, v2);
    }

    for(i = 0; i < bs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        // v1 and v2 are both links and blocks -> not a "friend candidate"
        if(is_same(ufind, v1, v2)) {
            exclude_map[v1]++;
            exclude_map[v2]++;
        }
    }
    // print
    for(i = 0; i < ps; i++) {
        printf("%d%c", get_links(ufind, i)-1 - exclude_map[i], i==(ps-1) ? '\n' : ' ');
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	get_str
	.type	get_str, @function
get_str:
.LFB6:
	.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)
	movq	stdin(%rip), %rdx
	movl	-12(%rbp), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_str, .-get_str
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L5
	movl	$0, %eax
	jmp	.L7
.L5:
	leaq	-52(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-52(%rbp), %eax
.L7:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L10
	movl	$-1, %eax
	jmp	.L12
.L10:
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	get_int3
	.type	get_int3, @function
get_int3:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L15
	movl	$-1, %eax
	jmp	.L17
.L15:
	movq	-72(%rbp), %rsi
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_int3, .-get_int3
	.globl	create_union_find
	.type	create_union_find, @function
create_union_find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	ufind.1(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-12(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	$1, 4(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L21
	leaq	ufind.1(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	create_union_find, .-create_union_find
	.globl	get_root
	.type	get_root, @function
get_root:
.LFB11:
	.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	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L25
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	get_root, .-get_root
	.globl	connect
	.type	connect, @function
connect:
.LFB12:
	.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, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L33
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jl	.L30
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L31
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	leal	1(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
.L31:
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L30:
	movq	-16(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L33:
	nop
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	connect, .-connect
	.globl	get_links
	.type	get_links, @function
get_links:
.LFB13:
	.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	get_links, .-get_links
	.globl	is_same
	.type	is_same, @function
is_same:
.LFB14:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -16(%rbp)
	movl	%esi, -20(%rbp)
	movl	%edx, -24(%rbp)
	movl	-20(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, %ebx
	movl	-24(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	is_same, .-is_same
	.section	.rodata
.LC3:
	.string	"%d%c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rcx
	leaq	-56(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	get_int3
	movl	-56(%rbp), %eax
	movl	%eax, %edi
	call	create_union_find
	movq	%rax, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L39
.L40:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	connect
	addl	$1, -36(%rbp)
.L39:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L40
	movl	$0, -36(%rbp)
	jmp	.L41
.L43:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	is_same
	testl	%eax, %eax
	je	.L42
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L42:
	addl	$1, -36(%rbp)
.L41:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L43
	movl	$0, -36(%rbp)
	jmp	.L44
.L47:
	movl	-56(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -36(%rbp)
	jne	.L45
	movl	$10, %ebx
	jmp	.L46
.L45:
	movl	$32, %ebx
.L46:
	movl	-36(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_links
	leal	-1(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%ebx, %edx
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L44:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L47
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L49
	call	__stack_chk_fail@PLT
.L49:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.size	main, .-main
	.local	ufind.1
	.comm	ufind.1,1200000,32
	.local	exclude_map.0
	.comm	exclude_map.0,400000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	get_str
	.type	get_str, @function
get_str:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	stdin(%rip), %rcx
	movl	%esi, %edx
	movq	$-1, %rsi
	call	__fgets_chk@PLT
	cmpq	$1, %rax
	sbbl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_str, .-get_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$30, %esi
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rax, %r8
	xorl	%eax, %eax
	testq	%r8, %r8
	je	.L4
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_sscanf@PLT
	movl	12(%rsp), %eax
.L4:
	movq	56(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L10
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	get_int, .-get_int
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	movl	$30, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L14
	movq	%r13, %rcx
	movq	%r12, %rdx
	leaq	.LC1(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	xorl	%eax, %eax
.L11:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L16
	addq	$48, %rsp
	.cfi_remember_state
	.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
.L14:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L11
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	get_int2, .-get_int2
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d %d"
	.text
	.p2align 4
	.globl	get_int3
	.type	get_int3, @function
get_int3:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	movl	$30, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdx, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L20
	movq	%rbx, %r8
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rdi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	xorl	%eax, %eax
.L17:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L22
	addq	$56, %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
.L20:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L17
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	get_int3, .-get_int3
	.p2align 4
	.globl	create_union_find
	.type	create_union_find, @function
create_union_find:
.LFB55:
	.cfi_startproc
	endbr64
	leaq	ufind.1(%rip), %r8
	testl	%edi, %edi
	jle	.L24
	movq	%r8, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%edx, (%rax)
	addl	$1, %edx
	addq	$12, %rax
	movl	$1, -8(%rax)
	movl	$1, -4(%rax)
	cmpl	%edx, %edi
	jne	.L25
.L24:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	create_union_find, .-create_union_find
	.p2align 4
	.globl	get_root
	.type	get_root, @function
get_root:
.LFB56:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %edx
	cmpl	%edx, %esi
	je	.L31
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%edx, %rdx
	movq	%rdx, %rax
	leaq	(%rdx,%rdx,2), %rdx
	movl	(%rdi,%rdx,4), %edx
	cmpl	%eax, %edx
	jne	.L30
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	get_root, .-get_root
	.p2align 4
	.globl	connect
	.type	connect, @function
connect:
.LFB57:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %ecx
	cmpl	%ecx, %esi
	je	.L41
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%eax, %ecx
	jne	.L35
.L34:
	movslq	%edx, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%ecx, %edx
	je	.L36
	.p2align 4,,10
	.p2align 3
.L37:
	movslq	%ecx, %rcx
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L37
.L36:
	cmpl	%edx, %eax
	je	.L33
	movslq	%eax, %rcx
	movd	%edx, %xmm0
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rdi,%rcx,4), %rsi
	movslq	%edx, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rdi,%rcx,4), %rdi
	movd	4(%rdi), %xmm1
	movl	8(%rdi), %ecx
	addl	8(%rsi), %ecx
	movl	%ecx, 8(%rsi)
	punpckldq	%xmm1, %xmm0
	movl	%ecx, 8(%rdi)
	movl	4(%rsi), %ecx
	cmpl	4(%rdi), %ecx
	jl	.L39
	jne	.L40
	addl	$1, %ecx
	movl	%ecx, 4(%rsi)
.L40:
	movd	%eax, %xmm0
	movd	%ecx, %xmm2
	punpckldq	%xmm2, %xmm0
	movq	%xmm0, (%rdi)
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%xmm0, (%rsi)
.L33:
	ret
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%esi, %eax
	jmp	.L34
	.cfi_endproc
.LFE57:
	.size	connect, .-connect
	.p2align 4
	.globl	get_links
	.type	get_links, @function
get_links:
.LFB58:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	leaq	(%rdi,%rax,4), %rdx
	movl	(%rdx), %eax
	cmpl	%eax, %esi
	je	.L48
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rdi,%rdx,4), %rdx
	movl	(%rdx), %eax
	cmpl	%ecx, %eax
	jne	.L47
.L48:
	movl	8(%rdx), %eax
	ret
	.cfi_endproc
.LFE58:
	.size	get_links, .-get_links
	.p2align 4
	.globl	is_same
	.type	is_same, @function
is_same:
.LFB59:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	movq	%rdi, %rcx
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %eax
	cmpl	%eax, %esi
	je	.L51
	.p2align 4,,10
	.p2align 3
.L52:
	cltq
	movq	%rax, %rsi
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%esi, %eax
	jne	.L52
.L51:
	movslq	%edx, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L53
	.p2align 4,,10
	.p2align 3
.L54:
	cltq
	movq	%rax, %rdx
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L54
.L53:
	xorl	%eax, %eax
	cmpl	%esi, %edx
	sete	%al
	ret
	.cfi_endproc
.LFE59:
	.size	is_same, .-is_same
	.section	.rodata.str1.1
.LC3:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	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	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	get_int3
	movl	12(%rsp), %ecx
	leaq	ufind.1(%rip), %rax
	xorl	%edx, %edx
	testl	%ecx, %ecx
	jle	.L64
	.p2align 4,,10
	.p2align 3
.L63:
	movl	%edx, (%rax)
	addl	$1, %edx
	addq	$12, %rax
	movl	$1, -8(%rax)
	movl	$1, -4(%rax)
	cmpl	%edx, %ecx
	jne	.L63
.L64:
	movl	16(%rsp), %edx
	xorl	%r12d, %r12d
	leaq	ufind.1(%rip), %r15
	leaq	32(%rsp), %rbx
	leaq	exclude_map.0(%rip), %rbp
	leaq	.LC1(%rip), %r13
	testl	%edx, %edx
	jle	.L62
	.p2align 4,,10
	.p2align 3
.L61:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbx, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L67
	leaq	28(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
.L67:
	movl	24(%rsp), %eax
	movq	%r15, %rdi
	addl	$1, %r12d
	leal	-1(%rax), %esi
	movl	28(%rsp), %eax
	movl	%esi, 24(%rsp)
	leal	-1(%rax), %edx
	movslq	%esi, %rax
	addl	$1, 0(%rbp,%rax,4)
	movslq	%edx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	%edx, 28(%rsp)
	call	connect
	cmpl	%r12d, 16(%rsp)
	jg	.L61
.L62:
	movl	20(%rsp), %eax
	xorl	%ebp, %ebp
	leaq	32(%rsp), %rbx
	leaq	28(%rsp), %r12
	leaq	ufind.1(%rip), %r15
	leaq	24(%rsp), %r14
	leaq	.LC1(%rip), %r13
	testl	%eax, %eax
	jle	.L66
	.p2align 4,,10
	.p2align 3
.L65:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbx, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L70
	movq	%r12, %rcx
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
.L70:
	movl	24(%rsp), %eax
	leal	-1(%rax), %edx
	movl	28(%rsp), %eax
	movslq	%edx, %rsi
	leaq	(%rsi,%rsi,2), %rcx
	subl	$1, %eax
	movl	(%r15,%rcx,4), %ecx
	movl	%eax, 28(%rsp)
	cmpl	%ecx, %edx
	je	.L71
	.p2align 4,,10
	.p2align 3
.L72:
	movslq	%ecx, %rcx
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L72
.L71:
	movslq	%eax, %rdi
	leaq	(%rdi,%rdi,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%ecx, %eax
	je	.L73
	.p2align 4,,10
	.p2align 3
.L74:
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%eax, %ecx
	jne	.L74
.L73:
	cmpl	%eax, %edx
	je	.L106
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jg	.L65
.L66:
	movl	12(%rsp), %eax
	xorl	%r13d, %r13d
	leaq	ufind.1(%rip), %r15
	leaq	exclude_map.0(%rip), %rbp
	movq	%r15, %r14
	leaq	.LC3(%rip), %r12
	movl	$10, %ebx
	testl	%eax, %eax
	jle	.L69
	.p2align 4,,10
	.p2align 3
.L80:
	subl	$1, %eax
	movl	$32, %r9d
	movq	%r14, %rdx
	cmpl	%r13d, %eax
	movl	(%r14), %eax
	cmove	%ebx, %r9d
	cmpl	%r13d, %eax
	je	.L78
	.p2align 4,,10
	.p2align 3
.L79:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%r15,%rdx,4), %rdx
	movl	(%rdx), %eax
	cmpl	%ecx, %eax
	jne	.L79
.L78:
	movl	8(%rdx), %edx
	movl	%r9d, %ecx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$12, %r14
	subl	$1, %edx
	subl	0(%rbp,%r13,4), %edx
	addq	$1, %r13
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%r13d, %eax
	jg	.L80
.L69:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L107
	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
	.p2align 4,,10
	.p2align 3
.L106:
	.cfi_restore_state
	leaq	exclude_map.0(%rip), %rax
	addl	$1, %ebp
	addl	$1, (%rax,%rsi,4)
	addl	$1, (%rax,%rdi,4)
	cmpl	20(%rsp), %ebp
	jl	.L65
	jmp	.L66
.L107:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.local	exclude_map.0
	.comm	exclude_map.0,400000,32
	.local	ufind.1
	.comm	ufind.1,1200000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	get_str
	.type	get_str, @function
get_str:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	stdin(%rip), %rcx
	movl	%esi, %edx
	movq	$-1, %rsi
	call	__fgets_chk@PLT
	cmpq	$1, %rax
	sbbl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	get_str, .-get_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$30, %esi
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rax, %r8
	xorl	%eax, %eax
	testq	%r8, %r8
	je	.L4
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_sscanf@PLT
	movl	12(%rsp), %eax
.L4:
	movq	56(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L10
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	get_int, .-get_int
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
	.text
	.p2align 4
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	movl	$30, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L14
	movq	%r13, %rcx
	movq	%r12, %rdx
	leaq	.LC1(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	xorl	%eax, %eax
.L11:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L16
	addq	$48, %rsp
	.cfi_remember_state
	.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
.L14:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L11
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	get_int2, .-get_int2
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d %d"
	.text
	.p2align 4
	.globl	get_int3
	.type	get_int3, @function
get_int3:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	movl	$30, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdx, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L20
	movq	%rbx, %r8
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rdi
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	xorl	%eax, %eax
.L17:
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L22
	addq	$56, %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
.L20:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L17
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	get_int3, .-get_int3
	.p2align 4
	.globl	create_union_find
	.type	create_union_find, @function
create_union_find:
.LFB55:
	.cfi_startproc
	endbr64
	leaq	ufind.1(%rip), %r8
	testl	%edi, %edi
	jle	.L24
	movq	%r8, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%edx, (%rax)
	addl	$1, %edx
	addq	$12, %rax
	movl	$1, -8(%rax)
	movl	$1, -4(%rax)
	cmpl	%edx, %edi
	jne	.L25
.L24:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	create_union_find, .-create_union_find
	.p2align 4
	.globl	get_root
	.type	get_root, @function
get_root:
.LFB56:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %edx
	cmpl	%edx, %esi
	je	.L31
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%edx, %rdx
	movq	%rdx, %rax
	leaq	(%rdx,%rdx,2), %rdx
	movl	(%rdi,%rdx,4), %edx
	cmpl	%eax, %edx
	jne	.L30
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	get_root, .-get_root
	.p2align 4
	.globl	connect
	.type	connect, @function
connect:
.LFB57:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %ecx
	cmpl	%ecx, %esi
	je	.L41
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%eax, %ecx
	jne	.L35
.L34:
	movslq	%edx, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%ecx, %edx
	je	.L36
	.p2align 4,,10
	.p2align 3
.L37:
	movslq	%ecx, %rcx
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rdi,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L37
.L36:
	cmpl	%edx, %eax
	je	.L33
	movslq	%eax, %rcx
	movd	%edx, %xmm0
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rdi,%rcx,4), %rsi
	movslq	%edx, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rdi,%rcx,4), %rdi
	movd	4(%rdi), %xmm1
	movl	8(%rdi), %ecx
	addl	8(%rsi), %ecx
	movl	%ecx, 8(%rsi)
	punpckldq	%xmm1, %xmm0
	movl	%ecx, 8(%rdi)
	movl	4(%rsi), %ecx
	cmpl	4(%rdi), %ecx
	jl	.L39
	jne	.L40
	addl	$1, %ecx
	movl	%ecx, 4(%rsi)
.L40:
	movd	%eax, %xmm0
	movd	%ecx, %xmm2
	punpckldq	%xmm2, %xmm0
	movq	%xmm0, (%rdi)
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%xmm0, (%rsi)
.L33:
	ret
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%esi, %eax
	jmp	.L34
	.cfi_endproc
.LFE57:
	.size	connect, .-connect
	.p2align 4
	.globl	get_links
	.type	get_links, @function
get_links:
.LFB58:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %rax
	leaq	(%rdi,%rax,4), %rdx
	movl	(%rdx), %eax
	cmpl	%eax, %esi
	je	.L48
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rdi,%rdx,4), %rdx
	movl	(%rdx), %eax
	cmpl	%ecx, %eax
	jne	.L47
.L48:
	movl	8(%rdx), %eax
	ret
	.cfi_endproc
.LFE58:
	.size	get_links, .-get_links
	.p2align 4
	.globl	is_same
	.type	is_same, @function
is_same:
.LFB59:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	movq	%rdi, %rcx
	leaq	(%rax,%rax,2), %rax
	movl	(%rdi,%rax,4), %eax
	cmpl	%eax, %esi
	je	.L51
	.p2align 4,,10
	.p2align 3
.L52:
	cltq
	movq	%rax, %rsi
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%esi, %eax
	jne	.L52
.L51:
	movslq	%edx, %rax
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L53
	.p2align 4,,10
	.p2align 3
.L54:
	cltq
	movq	%rax, %rdx
	leaq	(%rax,%rax,2), %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L54
.L53:
	xorl	%eax, %eax
	cmpl	%esi, %edx
	sete	%al
	ret
	.cfi_endproc
.LFE59:
	.size	is_same, .-is_same
	.section	.rodata.str1.1
.LC3:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	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	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	get_int3
	movl	12(%rsp), %ecx
	leaq	ufind.1(%rip), %rax
	xorl	%edx, %edx
	testl	%ecx, %ecx
	jle	.L64
	.p2align 4,,10
	.p2align 3
.L63:
	movl	%edx, (%rax)
	addl	$1, %edx
	addq	$12, %rax
	movl	$1, -8(%rax)
	movl	$1, -4(%rax)
	cmpl	%edx, %ecx
	jne	.L63
.L64:
	movl	16(%rsp), %edx
	xorl	%r12d, %r12d
	leaq	ufind.1(%rip), %r15
	leaq	32(%rsp), %rbx
	leaq	exclude_map.0(%rip), %rbp
	leaq	.LC1(%rip), %r13
	testl	%edx, %edx
	jle	.L62
	.p2align 4,,10
	.p2align 3
.L61:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbx, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L67
	leaq	28(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
.L67:
	movl	24(%rsp), %eax
	movq	%r15, %rdi
	addl	$1, %r12d
	leal	-1(%rax), %esi
	movl	28(%rsp), %eax
	movl	%esi, 24(%rsp)
	leal	-1(%rax), %edx
	movslq	%esi, %rax
	addl	$1, 0(%rbp,%rax,4)
	movslq	%edx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	%edx, 28(%rsp)
	call	connect
	cmpl	%r12d, 16(%rsp)
	jg	.L61
.L62:
	movl	20(%rsp), %eax
	xorl	%ebp, %ebp
	leaq	32(%rsp), %rbx
	leaq	28(%rsp), %r12
	leaq	ufind.1(%rip), %r15
	leaq	24(%rsp), %r14
	leaq	.LC1(%rip), %r13
	testl	%eax, %eax
	jle	.L66
	.p2align 4,,10
	.p2align 3
.L65:
	movq	stdin(%rip), %rdx
	movl	$30, %esi
	movq	%rbx, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L70
	movq	%r12, %rcx
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
.L70:
	movl	24(%rsp), %eax
	leal	-1(%rax), %edx
	movl	28(%rsp), %eax
	movslq	%edx, %rsi
	leaq	(%rsi,%rsi,2), %rcx
	subl	$1, %eax
	movl	(%r15,%rcx,4), %ecx
	movl	%eax, 28(%rsp)
	cmpl	%ecx, %edx
	je	.L71
	.p2align 4,,10
	.p2align 3
.L72:
	movslq	%ecx, %rcx
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L72
.L71:
	movslq	%eax, %rdi
	leaq	(%rdi,%rdi,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%ecx, %eax
	je	.L73
	.p2align 4,,10
	.p2align 3
.L74:
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	cmpl	%eax, %ecx
	jne	.L74
.L73:
	cmpl	%eax, %edx
	je	.L106
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jg	.L65
.L66:
	movl	12(%rsp), %eax
	xorl	%r13d, %r13d
	leaq	ufind.1(%rip), %r15
	leaq	exclude_map.0(%rip), %rbp
	movq	%r15, %r14
	leaq	.LC3(%rip), %r12
	movl	$10, %ebx
	testl	%eax, %eax
	jle	.L69
	.p2align 4,,10
	.p2align 3
.L80:
	subl	$1, %eax
	movl	$32, %r9d
	movq	%r14, %rdx
	cmpl	%r13d, %eax
	movl	(%r14), %eax
	cmove	%ebx, %r9d
	cmpl	%r13d, %eax
	je	.L78
	.p2align 4,,10
	.p2align 3
.L79:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%r15,%rdx,4), %rdx
	movl	(%rdx), %eax
	cmpl	%ecx, %eax
	jne	.L79
.L78:
	movl	8(%rdx), %edx
	movl	%r9d, %ecx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$12, %r14
	subl	$1, %edx
	subl	0(%rbp,%r13,4), %edx
	addq	$1, %r13
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%r13d, %eax
	jg	.L80
.L69:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L107
	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
	.p2align 4,,10
	.p2align 3
.L106:
	.cfi_restore_state
	leaq	exclude_map.0(%rip), %rax
	addl	$1, %ebp
	addl	$1, (%rax,%rsi,4)
	addl	$1, (%rax,%rdi,4)
	cmpl	20(%rsp), %ebp
	jl	.L65
	jmp	.L66
.L107:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.local	exclude_map.0
	.comm	exclude_map.0,400000,32
	.local	ufind.1
	.comm	ufind.1,1200000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define PEOPLE_MAX 100000

struct ufind {
    int parent;
    int depth;
    int cnt;
};


struct ufind *create_union_find(int ps) {
    static struct ufind ufind[PEOPLE_MAX];
    int i;
    for(i = 0; i < ps; i++) {
        struct ufind *elem = &ufind[i];
        elem->parent = i;
        elem->depth = 1;
        elem->cnt = 1;
    }
    return ufind;
}

int get_root(struct ufind *ufind, int v) {
    struct ufind *uv = &ufind[v];
    int base = v;
    while(base != uv->parent) {
        base = uv->parent;
        uv = &ufind[base];
    }
    return base;
}

void connect(struct ufind *ufind, int v1, int v2) {
    int b1 = get_root(ufind, v1);
    int b2 = get_root(ufind, v2);
    // already connected
    if(b1==b2) return;
    struct ufind *ub1 = &ufind[b1];
    struct ufind *ub2 = &ufind[b2];
    ub2->cnt = ub1->cnt = ub1->cnt + ub2->cnt;
    if(ub1->depth >= ub2->depth) { // ub1 <- ub2
        if(ub1->depth == ub2->depth) ub1->depth++;
        ub2->parent = b1;
        ub2->depth = ub1->depth;
    } else {
        ub1->parent = b2;
        ub1->depth = ub2->depth;
    }
    return;
}

int get_links(struct ufind *ufind, int v) {
    struct ufind *res = &ufind[get_root(ufind, v)];
    return res->cnt;
}

int is_same(struct ufind *ufind, int v1, int v2) {
    return get_root(ufind, v1) == get_root(ufind, v2);
}

int main(void) {
    int ps, fs, bs;
    int i;
    get_int3(&ps, &fs, &bs);
    static int exclude_map[PEOPLE_MAX];
    struct ufind *ufind = create_union_find(ps);

    for(i = 0; i < fs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        exclude_map[v1]++; exclude_map[v2]++;
        connect(ufind, v1, v2);
    }

    for(i = 0; i < bs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        // v1 and v2 are both links and blocks -> not a "friend candidate"
        if(is_same(ufind, v1, v2)) {
            exclude_map[v1]++;
            exclude_map[v2]++;
        }
    }
    // print
    for(i = 0; i < ps; i++) {
        printf("%d%c", get_links(ufind, i)-1 - exclude_map[i], i==(ps-1) ? '\n' : ' ');
    }
    return 0;
}
5 10 0
1 2
1 3
1 4
1 5
3 2
2 4
2 5
4 3
1 3
4 5
 5 10 0
1 2
1 3
2 4
1 5
3 2
2 4
2 5
4 3
1 3
4 5
 5 10 0
1 2
1 3
2 4
1 5
3 2
2 4
2 5
4 1
1 3
4 5
 5 10 0
1 2
1 3
2 5
1 5
3 2
2 4
2 5
4 1
1 3
4 5
 5 10 0
1 2
1 3
2 5
1 5
3 2
2 4
2 3
4 1
1 3
4 5
 5 10 0
1 2
1 3
1 4
1 5
3 2
2 4
2 5
4 3
5 3
4 3
 10 9 3
10 1
6 6
8 2
2 5
8 4
7 3
10 9
6 4
5 8
2 6
7 5
3 1
 5 10 0
1 2
1 3
2 4
1 5
3 2
2 4
2 5
4 1
1 2
4 5
 5 10 0
1 2
1 3
2 5
1 5
3 2
2 4
2 5
4 1
1 0
4 5
 10 9 3
10 1
10 6
8 2
2 5
8 4
7 3
10 9
6 4
5 8
2 6
7 5
3 1

-1 0 0 0 1
 0 -1 0 0 1
 -1 -1 1 0 1
 -1 -1 1 1 0
 -1 -1 0 1 1
 0 0 -1 0 1
 1 1 0 2 2 0 0 1 1 0
 -1 -2 2 0 1
 -1 -1 2 1 0
 6 4 0 5 5 4 0 4 6 4

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 <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define PEOPLE_MAX 100000

struct ufind {
    int parent;
    int depth;
    int cnt;
};


struct ufind *create_union_find(int ps) {
    static struct ufind ufind[PEOPLE_MAX];
    int i;
    for(i = 0; i < ps; i++) {
        struct ufind *elem = &ufind[i];
        elem->parent = i;
        elem->depth = 1;
        elem->cnt = 1;
    }
    return ufind;
}

int get_root(struct ufind *ufind, int v) {
    struct ufind *uv = &ufind[v];
    int base = v;
    while(base != uv->parent) {
        base = uv->parent;
        uv = &ufind[base];
    }
    return base;
}

void connect(struct ufind *ufind, int v1, int v2) {
    int b1 = get_root(ufind, v1);
    int b2 = get_root(ufind, v2);
    // already connected
    if(b1==b2) return;
    struct ufind *ub1 = &ufind[b1];
    struct ufind *ub2 = &ufind[b2];
    ub2->cnt = ub1->cnt = ub1->cnt + ub2->cnt;
    if(ub1->depth >= ub2->depth) { // ub1 <- ub2
        if(ub1->depth == ub2->depth) ub1->depth++;
        ub2->parent = b1;
        ub2->depth = ub1->depth;
    } else {
        ub1->parent = b2;
        ub1->depth = ub2->depth;
    }
    return;
}

int get_links(struct ufind *ufind, int v) {
    struct ufind *res = &ufind[get_root(ufind, v)];
    return res->cnt;
}

int is_same(struct ufind *ufind, int v1, int v2) {
    return get_root(ufind, v1) == get_root(ufind, v2);
}

int main(void) {
    int ps, fs, bs;
    int i;
    get_int3(&ps, &fs, &bs);
    static int exclude_map[PEOPLE_MAX];
    struct ufind *ufind = create_union_find(ps);

    for(i = 0; i < fs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        exclude_map[v1]++; exclude_map[v2]++;
        connect(ufind, v1, v2);
    }

    for(i = 0; i < bs; i++) {
        int v1, v2;
        get_int2(&v1, &v2);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        // v1 and v2 are both links and blocks -> not a "friend candidate"
        if(is_same(ufind, v1, v2)) {
            exclude_map[v1]++;
            exclude_map[v2]++;
        }
    }
    // print
    for(i = 0; i < ps; i++) {
        printf("%d%c", get_links(ufind, i)-1 - exclude_map[i], i==(ps-1) ? '\n' : ' ');
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	get_str
	.type	get_str, @function
get_str:
.LFB6:
	.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)
	movq	stdin(%rip), %rdx
	movl	-12(%rbp), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_str, .-get_str
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L5
	movl	$0, %eax
	jmp	.L7
.L5:
	leaq	-52(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-52(%rbp), %eax
.L7:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L10
	movl	$-1, %eax
	jmp	.L12
.L10:
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	get_int3
	.type	get_int3, @function
get_int3:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L15
	movl	$-1, %eax
	jmp	.L17
.L15:
	movq	-72(%rbp), %rsi
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_int3, .-get_int3
	.globl	create_union_find
	.type	create_union_find, @function
create_union_find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	ufind.1(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-12(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	$1, 4(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L21
	leaq	ufind.1(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	create_union_find, .-create_union_find
	.globl	get_root
	.type	get_root, @function
get_root:
.LFB11:
	.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	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L25
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	get_root, .-get_root
	.globl	connect
	.type	connect, @function
connect:
.LFB12:
	.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, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L33
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jl	.L30
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L31
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	leal	1(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
.L31:
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L30:
	movq	-16(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L33:
	nop
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	connect, .-connect
	.globl	get_links
	.type	get_links, @function
get_links:
.LFB13:
	.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	get_links, .-get_links
	.globl	is_same
	.type	is_same, @function
is_same:
.LFB14:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -16(%rbp)
	movl	%esi, -20(%rbp)
	movl	%edx, -24(%rbp)
	movl	-20(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, %ebx
	movl	-24(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	is_same, .-is_same
	.section	.rodata
.LC3:
	.string	"%d%c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rcx
	leaq	-56(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	get_int3
	movl	-56(%rbp), %eax
	movl	%eax, %edi
	call	create_union_find
	movq	%rax, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L39
.L40:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	connect
	addl	$1, -36(%rbp)
.L39:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L40
	movl	$0, -36(%rbp)
	jmp	.L41
.L43:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	is_same
	testl	%eax, %eax
	je	.L42
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L42:
	addl	$1, -36(%rbp)
.L41:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L43
	movl	$0, -36(%rbp)
	jmp	.L44
.L47:
	movl	-56(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -36(%rbp)
	jne	.L45
	movl	$10, %ebx
	jmp	.L46
.L45:
	movl	$32, %ebx
.L46:
	movl	-36(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_links
	leal	-1(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%ebx, %edx
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L44:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L47
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L49
	call	__stack_chk_fail@PLT
.L49:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.size	main, .-main
	.local	ufind.1
	.comm	ufind.1,1200000,32
	.local	exclude_map.0
	.comm	exclude_map.0,400000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	get_str
	.type	get_str, @function
get_str:
.LFB6:
	.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)
	movq	stdin(%rip), %rdx
	movl	-12(%rbp), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_str, .-get_str
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	get_int
	.type	get_int, @function
get_int:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L5
	movl	$0, %eax
	jmp	.L7
.L5:
	leaq	-52(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-52(%rbp), %eax
.L7:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	get_int, .-get_int
	.section	.rodata
.LC1:
	.string	"%d %d"
	.text
	.globl	get_int2
	.type	get_int2, @function
get_int2:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L10
	movl	$-1, %eax
	jmp	.L12
.L10:
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	get_int2, .-get_int2
	.section	.rodata
.LC2:
	.string	"%d %d %d"
	.text
	.globl	get_int3
	.type	get_int3, @function
get_int3:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-48(%rbp), %rax
	movl	$30, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	jne	.L15
	movl	$-1, %eax
	jmp	.L17
.L15:
	movq	-72(%rbp), %rsi
	movq	-64(%rbp), %rcx
	movq	-56(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	get_int3, .-get_int3
	.globl	create_union_find
	.type	create_union_find, @function
create_union_find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	ufind.1(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-12(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	$1, 4(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 8(%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L21
	leaq	ufind.1(%rip), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	create_union_find, .-create_union_find
	.globl	get_root
	.type	get_root, @function
get_root:
.LFB11:
	.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	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L25:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L24:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L25
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	get_root, .-get_root
	.globl	connect
	.type	connect, @function
connect:
.LFB12:
	.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, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L33
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jl	.L30
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jne	.L31
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	leal	1(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
.L31:
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movl	4(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L30:
	movq	-16(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, (%rax)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	%edx, 4(%rax)
	jmp	.L27
.L33:
	nop
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	connect, .-connect
	.globl	get_links
	.type	get_links, @function
get_links:
.LFB13:
	.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)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	get_links, .-get_links
	.globl	is_same
	.type	is_same, @function
is_same:
.LFB14:
	.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	$16, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -16(%rbp)
	movl	%esi, -20(%rbp)
	movl	%edx, -24(%rbp)
	movl	-20(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	movl	%eax, %ebx
	movl	-24(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	is_same, .-is_same
	.section	.rodata
.LC3:
	.string	"%d%c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rcx
	leaq	-56(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	get_int3
	movl	-56(%rbp), %eax
	movl	%eax, %edi
	call	create_union_find
	movq	%rax, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L39
.L40:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	connect
	addl	$1, -36(%rbp)
.L39:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L40
	movl	$0, -36(%rbp)
	jmp	.L41
.L43:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	get_int2
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	is_same
	testl	%eax, %eax
	je	.L42
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	exclude_map.0(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L42:
	addl	$1, -36(%rbp)
.L41:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L43
	movl	$0, -36(%rbp)
	jmp	.L44
.L47:
	movl	-56(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -36(%rbp)
	jne	.L45
	movl	$10, %ebx
	jmp	.L46
.L45:
	movl	$32, %ebx
.L46:
	movl	-36(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	get_links
	leal	-1(%rax), %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	exclude_map.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%ebx, %edx
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L44:
	movl	-56(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L47
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L49
	call	__stack_chk_fail@PLT
.L49:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.size	main, .-main
	.local	ufind.1
	.comm	ufind.1,1200000,32
	.local	exclude_map.0
	.comm	exclude_map.0,400000,32
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
