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 <inttypes.h>

int N, M;
int A[114514], B[114514];

int uf_parent[114514];
int uf_saizu[114514];

void uf_init(void) {
	int i;
	for (i = 0; i <= N; i++) {
		uf_parent[i] = i;
		uf_saizu[i] = 1;
	}
}

int uf_root(int node) {
	if (uf_parent[node] == node) return node;
	return uf_parent[node] = uf_root(uf_parent[node]);
}

int uf_size(int node) {
	return uf_saizu[uf_root(node)];
}

int uf_issame(int a, int b) {
	return uf_root(a) == uf_root(b);
}

void uf_merge(int a, int b) {
	int ar = uf_root(a), br = uf_root(b);
	if (ar != br) {
		if (uf_saizu[ar] >= uf_saizu[br]) {
			uf_parent[br] = ar;
			uf_saizu[ar] += uf_saizu[br];
		} else {
			uf_parent[ar] = br;
			uf_saizu[br] += uf_saizu[ar];
		}
	}
}

int64_t gourikiayame[114514];

int main(void) {
	int i;
	int64_t maedaatuko;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &A[i], &B[i]) != 2) return 1;
	}
	maedaatuko = (int64_t)N * (N - 1) / 2;
	uf_init();
	for (i = M - 1; i >= 0; i--) {
		gourikiayame[i] = maedaatuko;
		if (!uf_issame(A[i], B[i])) {
			maedaatuko -= (int64_t)uf_size(A[i]) * uf_size(B[i]);
			uf_merge(A[i], B[i]);
		}
	}
	for (i = 0; i < M; i++) {
		printf("%" PRId64 "\n", gourikiayame[i]);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	uf_parent
	.align 32
	.type	uf_parent, @object
	.size	uf_parent, 458056
uf_parent:
	.zero	458056
	.globl	uf_saizu
	.align 32
	.type	uf_saizu, @object
	.size	uf_saizu, 458056
uf_saizu:
	.zero	458056
	.text
	.globl	uf_init
	.type	uf_init, @function
uf_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	uf_init, .-uf_init
	.globl	uf_root
	.type	uf_root, @function
uf_root:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L5
	movl	-4(%rbp), %eax
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_root
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	uf_root, .-uf_root
	.globl	uf_size
	.type	uf_size, @function
uf_size:
.LFB2:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	uf_size, .-uf_size
	.globl	uf_issame
	.type	uf_issame, @function
uf_issame:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	uf_issame, .-uf_issame
	.globl	uf_merge
	.type	uf_merge, @function
uf_merge:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L14
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_saizu(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	uf_merge, .-uf_merge
	.globl	gourikiayame
	.bss
	.align 32
	.type	gourikiayame, @object
	.size	gourikiayame, 916112
gourikiayame:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L17
.L16:
	movl	$0, -28(%rbp)
	jmp	.L18
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L17
.L19:
	addl	$1, -28(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L20
	movl	N(%rip), %eax
	movslq	%eax, %rdx
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -24(%rbp)
	call	uf_init
	movl	M(%rip), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	gourikiayame(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_issame
	testl	%eax, %eax
	jne	.L22
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	movslq	%eax, %rbx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	cltq
	imulq	%rbx, %rax
	subq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_merge
.L22:
	subl	$1, -28(%rbp)
.L21:
	cmpl	$0, -28(%rbp)
	jns	.L23
	movl	$0, -28(%rbp)
	jmp	.L24
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	gourikiayame(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L24:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	uf_init
	.type	uf_init, @function
uf_init:
.LFB23:
	.cfi_startproc
	endbr64
	movl	N(%rip), %edi
	testl	%edi, %edi
	js	.L1
	leal	1(%rdi), %r8d
	cmpl	$2, %edi
	jle	.L6
	movl	%r8d, %edx
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	shrl	$2, %edx
	movdqa	.LC2(%rip), %xmm2
	leaq	uf_parent(%rip), %rsi
	leaq	uf_saizu(%rip), %rcx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, (%rcx,%rax)
	paddd	%xmm3, %xmm0
	movaps	%xmm1, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L4
	movl	%r8d, %eax
	andl	$-4, %eax
	andl	$3, %r8d
	je	.L9
.L3:
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L1
	movslq	%edx, %r8
	addl	$2, %eax
	movl	%edx, (%rsi,%r8,4)
	movl	$1, (%rcx,%r8,4)
	cmpl	%eax, %edi
	jl	.L1
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	ret
.L6:
	xorl	%eax, %eax
	leaq	uf_parent(%rip), %rsi
	leaq	uf_saizu(%rip), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	uf_init, .-uf_init
	.p2align 4
	.globl	uf_root
	.type	uf_root, @function
uf_root:
.LFB24:
	.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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	uf_parent(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%rbp,4), %edx
	movl	%edx, %eax
	cmpl	%edi, %edx
	je	.L10
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	je	.L13
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %eax
	cmpl	%eax, %edx
	je	.L14
	movslq	%eax, %r15
	movl	(%rbx,%r15,4), %edx
	cmpl	%edx, %eax
	je	.L15
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	movq	%rcx, 8(%rsp)
	cmpl	%eax, %edx
	je	.L16
	movl	%eax, %edi
	call	uf_root
	movq	8(%rsp), %rcx
	movl	%eax, (%rbx,%rcx,4)
.L16:
	movl	%eax, (%rbx,%r15,4)
.L15:
	movl	%eax, (%rbx,%r14,4)
.L14:
	movl	%eax, (%rbx,%r13,4)
.L13:
	movl	%eax, (%rbx,%r12,4)
.L12:
	movl	%eax, (%rbx,%rbp,4)
.L10:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	uf_root, .-uf_root
	.p2align 4
	.globl	uf_size
	.type	uf_size, @function
uf_size:
.LFB25:
	.cfi_startproc
	endbr64
	leaq	uf_parent(%rip), %rsi
	movslq	%edi, %r9
	movslq	(%rsi,%r9,4), %r8
	cmpl	%r8d, %edi
	je	.L34
	movl	(%rsi,%r8,4), %edx
	movq	%r8, %rax
	cmpl	%edx, %r8d
	je	.L35
	movslq	%edx, %r10
	movl	(%rsi,%r10,4), %eax
	cmpl	%eax, %edx
	je	.L36
	movslq	%eax, %r11
	movl	(%rsi,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L37
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%edx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%rsi,%rbx,4), %eax
	cmpl	%eax, %edx
	je	.L27
	movslq	%eax, %rbp
	movl	(%rsi,%rbp,4), %edi
	cmpl	%edi, %eax
	je	.L28
	call	uf_root
	movl	%eax, (%rsi,%rbp,4)
.L28:
	movl	%eax, (%rsi,%rbx,4)
.L27:
	movl	%eax, (%rsi,%r11,4)
	movl	%eax, (%rsi,%r10,4)
	movl	%eax, (%rsi,%r8,4)
	movslq	%eax, %r8
	movl	%eax, (%rsi,%r9,4)
	leaq	uf_saizu(%rip), %rax
	movl	(%rax,%r8,4), %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore 3
	.cfi_restore 6
	movl	%eax, (%rsi,%r10,4)
.L36:
	movl	%eax, (%rsi,%r8,4)
	movslq	%eax, %r8
.L35:
	movl	%eax, (%rsi,%r9,4)
.L34:
	leaq	uf_saizu(%rip), %rax
	movl	(%rax,%r8,4), %eax
	ret
	.cfi_endproc
.LFE25:
	.size	uf_size, .-uf_size
	.p2align 4
	.globl	uf_issame
	.type	uf_issame, @function
uf_issame:
.LFB26:
	.cfi_startproc
	endbr64
	leaq	uf_parent(%rip), %r9
	movslq	%edi, %r10
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%esi, %r8d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	(%r9,%r10,4), %esi
	cmpl	%esi, %edi
	je	.L41
	movslq	%esi, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L42
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %esi
	cmpl	%esi, %eax
	je	.L43
	movslq	%esi, %rbp
	movl	(%r9,%rbp,4), %eax
	cmpl	%eax, %esi
	je	.L44
	movslq	%eax, %r12
	movl	(%r9,%r12,4), %esi
	cmpl	%esi, %eax
	je	.L45
	movl	%esi, %edi
	call	uf_root
	movl	%eax, (%r9,%r12,4)
	movl	%eax, %esi
.L45:
	movl	%esi, (%r9,%rbp,4)
.L44:
	movl	%esi, (%r9,%rbx,4)
.L43:
	movl	%esi, (%r9,%r11,4)
.L42:
	movl	%esi, (%r9,%r10,4)
.L41:
	movslq	%r8d, %r10
	movl	(%r9,%r10,4), %edi
	cmpl	%edi, %r8d
	je	.L46
	movslq	%edi, %r8
	movl	(%r9,%r8,4), %eax
	cmpl	%eax, %edi
	je	.L47
	movslq	%eax, %r11
	movl	(%r9,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L48
	movslq	%edi, %rbx
	movl	(%r9,%rbx,4), %eax
	cmpl	%eax, %edi
	je	.L49
	movslq	%eax, %rbp
	movl	(%r9,%rbp,4), %edi
	cmpl	%edi, %eax
	je	.L50
	call	uf_root
	movl	%eax, (%r9,%rbp,4)
	movl	%eax, %edi
.L50:
	movl	%edi, (%r9,%rbx,4)
.L49:
	movl	%edi, (%r9,%r11,4)
.L48:
	movl	%edi, (%r9,%r8,4)
.L47:
	movl	%edi, (%r9,%r10,4)
.L46:
	xorl	%eax, %eax
	cmpl	%esi, %edi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	sete	%al
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE26:
	.size	uf_issame, .-uf_issame
	.p2align 4
	.globl	uf_merge
	.type	uf_merge, @function
uf_merge:
.LFB27:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	uf_parent(%rip), %r9
	movslq	%edi, %r10
	movl	%esi, %r8d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r9,%r10,4), %esi
	cmpl	%esi, %edi
	je	.L57
	movslq	%esi, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L58
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %esi
	cmpl	%esi, %eax
	je	.L59
	movslq	%esi, %rbp
	movl	(%r9,%rbp,4), %edi
	cmpl	%edi, %esi
	je	.L60
	call	uf_root
	movl	%eax, (%r9,%rbp,4)
	movl	%eax, %esi
.L60:
	movl	%esi, (%r9,%rbx,4)
.L59:
	movl	%esi, (%r9,%r11,4)
.L58:
	movl	%esi, (%r9,%r10,4)
.L57:
	movslq	%r8d, %r10
	movl	(%r9,%r10,4), %eax
	cmpl	%eax, %r8d
	je	.L61
	movslq	%eax, %r8
	movl	(%r9,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L62
	movslq	%edx, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L63
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %edi
	cmpl	%edi, %eax
	je	.L64
	call	uf_root
	movl	%eax, (%r9,%rbx,4)
.L64:
	movl	%eax, (%r9,%r11,4)
.L63:
	movl	%eax, (%r9,%r8,4)
.L62:
	movl	%eax, (%r9,%r10,4)
.L61:
	cmpl	%esi, %eax
	je	.L56
	leaq	uf_saizu(%rip), %rdx
	movslq	%esi, %rdi
	movslq	%eax, %rcx
	movl	(%rdx,%rdi,4), %r10d
	movl	(%rdx,%rcx,4), %r8d
	leal	(%r10,%r8), %r11d
	cmpl	%r8d, %r10d
	jl	.L66
	movl	%esi, (%r9,%rcx,4)
	movl	%r11d, (%rdx,%rdi,4)
.L56:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	.cfi_restore_state
	movl	%eax, (%r9,%rdi,4)
	movl	%r11d, (%rdx,%rcx,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE27:
	.size	uf_merge, .-uf_merge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	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	.LC3(%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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L76
	movl	M(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L75
	leaq	A(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	B(%rip), %r13
	jmp	.L77
	.p2align 4,,10
	.p2align 3
.L111:
	movl	M(%rip), %ecx
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jle	.L110
.L77:
	xorl	%eax, %eax
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L111
.L76:
	movl	$1, %eax
.L72:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L110:
	.cfi_restore_state
	movslq	N(%rip), %rdx
	movl	$2, %esi
	leal	-1(%rdx), %eax
	movq	%rdx, %rdi
	cltq
	imulq	%rdx, %rax
	cqto
	idivq	%rsi
	movq	%rax, %rbp
	testl	%edi, %edi
	js	.L84
.L78:
	leal	1(%rdi), %r8d
	cmpl	$2, %edi
	jle	.L100
	movl	%r8d, %edx
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	shrl	$2, %edx
	movdqa	.LC2(%rip), %xmm2
	leaq	uf_parent(%rip), %rbx
	leaq	uf_saizu(%rip), %rsi
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L82:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, (%rsi,%rax)
	paddd	%xmm3, %xmm0
	movaps	%xmm1, (%rbx,%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L82
	movl	%r8d, %eax
	andl	$-4, %eax
	andb	$3, %r8b
	je	.L84
.L81:
	movslq	%eax, %rdx
	movl	%eax, (%rbx,%rdx,4)
	movl	$1, (%rsi,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L84
	movslq	%edx, %r8
	addl	$2, %eax
	movl	%edx, (%rbx,%r8,4)
	movl	$1, (%rsi,%r8,4)
	cmpl	%edi, %eax
	jg	.L84
	movslq	%eax, %rdx
	movl	%eax, (%rbx,%rdx,4)
	movl	$1, (%rsi,%rdx,4)
.L84:
	testl	%ecx, %ecx
	jle	.L80
	movslq	%ecx, %rax
	leaq	A(%rip), %rdx
	leaq	B(%rip), %r13
	leaq	0(,%rax,4), %r14
	leaq	gourikiayame(%rip), %r12
	addq	%r14, %r13
	addq	%rdx, %r14
	leal	-1(%rcx), %edx
	leaq	(%r12,%rax,8), %r12
	subq	%rdx, %rax
	leaq	-4+B(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	leaq	uf_parent(%rip), %rbx
	movq	%rax, 8(%rsp)
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L98:
	subq	$8, %r12
	subq	$4, %r13
	subq	$4, %r14
	cmpq	8(%rsp), %r13
	je	.L80
.L99:
	movslq	-4(%r14), %r10
	movl	-4(%r13), %r9d
	movq	%rbp, -8(%r12)
	movl	(%rbx,%r10,4), %esi
	cmpl	%esi, %r10d
	je	.L88
	movslq	%esi, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L89
	movslq	%eax, %r15
	movl	(%rbx,%r15,4), %esi
	cmpl	%esi, %eax
	je	.L90
	movslq	%esi, %r8
	movl	(%rbx,%r8,4), %edx
	cmpl	%edx, %esi
	je	.L91
	movslq	%edx, %rsi
	movl	(%rbx,%rsi,4), %edi
	cmpl	%edi, %edx
	je	.L92
	call	uf_root
	movl	%eax, (%rbx,%rsi,4)
	movl	%eax, %edi
.L92:
	movl	%edi, (%rbx,%r8,4)
	movl	%edi, %edx
.L91:
	movl	%edx, (%rbx,%r15,4)
	movl	%edx, %esi
.L90:
	movl	%esi, (%rbx,%r11,4)
.L89:
	movl	%esi, (%rbx,%r10,4)
.L88:
	movslq	%r9d, %r10
	movl	(%rbx,%r10,4), %edx
	cmpl	%edx, %r9d
	je	.L93
	movslq	%edx, %r9
	movl	(%rbx,%r9,4), %eax
	cmpl	%eax, %edx
	je	.L94
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L95
	movslq	%edx, %r15
	movl	(%rbx,%r15,4), %ecx
	cmpl	%ecx, %edx
	je	.L96
	movslq	%ecx, %r8
	movl	(%rbx,%r8,4), %edi
	cmpl	%edi, %ecx
	je	.L97
	call	uf_root
	movl	%eax, (%rbx,%r8,4)
	movl	%eax, %edi
.L97:
	movl	%edi, (%rbx,%r15,4)
	movl	%edi, %ecx
.L96:
	movl	%ecx, (%rbx,%r11,4)
	movl	%ecx, %edx
.L95:
	movl	%edx, (%rbx,%r9,4)
.L94:
	movl	%edx, (%rbx,%r10,4)
.L93:
	cmpl	%esi, %edx
	je	.L98
	movl	-4(%r14), %edi
	call	uf_size
	movl	-4(%r13), %edi
	movslq	%eax, %r15
	call	uf_size
	movl	-4(%r13), %esi
	movl	-4(%r14), %edi
	cltq
	imulq	%rax, %r15
	subq	%r15, %rbp
	call	uf_merge
	jmp	.L98
.L75:
	movslq	N(%rip), %rdx
	movl	$2, %esi
	leal	-1(%rdx), %eax
	movq	%rdx, %rdi
	cltq
	imulq	%rdx, %rax
	cqto
	idivq	%rsi
	movq	%rax, %rbp
	testl	%edi, %edi
	jns	.L78
.L80:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	gourikiayame(%rip), %r12
	leaq	.LC4(%rip), %rbp
	jle	.L87
	.p2align 4,,10
	.p2align 3
.L86:
	movq	(%r12,%rbx,8), %rdx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, M(%rip)
	jg	.L86
.L87:
	xorl	%eax, %eax
	jmp	.L72
.L100:
	xorl	%eax, %eax
	leaq	uf_parent(%rip), %rbx
	leaq	uf_saizu(%rip), %rsi
	jmp	.L81
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	gourikiayame
	.bss
	.align 32
	.type	gourikiayame, @object
	.size	gourikiayame, 916112
gourikiayame:
	.zero	916112
	.globl	uf_saizu
	.align 32
	.type	uf_saizu, @object
	.size	uf_saizu, 458056
uf_saizu:
	.zero	458056
	.globl	uf_parent
	.align 32
	.type	uf_parent, @object
	.size	uf_parent, 458056
uf_parent:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.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	uf_init
	.type	uf_init, @function
uf_init:
.LFB23:
	.cfi_startproc
	endbr64
	movl	N(%rip), %edi
	testl	%edi, %edi
	js	.L1
	leal	1(%rdi), %r8d
	cmpl	$2, %edi
	jle	.L6
	movl	%r8d, %edx
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	shrl	$2, %edx
	movdqa	.LC2(%rip), %xmm2
	leaq	uf_parent(%rip), %rsi
	leaq	uf_saizu(%rip), %rcx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, (%rcx,%rax)
	paddd	%xmm3, %xmm0
	movaps	%xmm1, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L4
	movl	%r8d, %eax
	andl	$-4, %eax
	andl	$3, %r8d
	je	.L9
.L3:
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L1
	movslq	%edx, %r8
	addl	$2, %eax
	movl	%edx, (%rsi,%r8,4)
	movl	$1, (%rcx,%r8,4)
	cmpl	%eax, %edi
	jl	.L1
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	ret
.L6:
	xorl	%eax, %eax
	leaq	uf_parent(%rip), %rsi
	leaq	uf_saizu(%rip), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	uf_init, .-uf_init
	.p2align 4
	.globl	uf_root
	.type	uf_root, @function
uf_root:
.LFB24:
	.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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	uf_parent(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%rbp,4), %edx
	movl	%edx, %eax
	cmpl	%edi, %edx
	je	.L10
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	je	.L13
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %eax
	cmpl	%eax, %edx
	je	.L14
	movslq	%eax, %r15
	movl	(%rbx,%r15,4), %edx
	cmpl	%edx, %eax
	je	.L15
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	movq	%rcx, 8(%rsp)
	cmpl	%eax, %edx
	je	.L16
	movl	%eax, %edi
	call	uf_root
	movq	8(%rsp), %rcx
	movl	%eax, (%rbx,%rcx,4)
.L16:
	movl	%eax, (%rbx,%r15,4)
.L15:
	movl	%eax, (%rbx,%r14,4)
.L14:
	movl	%eax, (%rbx,%r13,4)
.L13:
	movl	%eax, (%rbx,%r12,4)
.L12:
	movl	%eax, (%rbx,%rbp,4)
.L10:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	uf_root, .-uf_root
	.p2align 4
	.globl	uf_size
	.type	uf_size, @function
uf_size:
.LFB25:
	.cfi_startproc
	endbr64
	leaq	uf_parent(%rip), %rsi
	movslq	%edi, %r9
	movslq	(%rsi,%r9,4), %r8
	cmpl	%r8d, %edi
	je	.L34
	movl	(%rsi,%r8,4), %edx
	movq	%r8, %rax
	cmpl	%edx, %r8d
	je	.L35
	movslq	%edx, %r10
	movl	(%rsi,%r10,4), %eax
	cmpl	%eax, %edx
	je	.L36
	movslq	%eax, %r11
	movl	(%rsi,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L37
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%edx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%rsi,%rbx,4), %eax
	cmpl	%eax, %edx
	je	.L27
	movslq	%eax, %rbp
	movl	(%rsi,%rbp,4), %edi
	cmpl	%edi, %eax
	je	.L28
	call	uf_root
	movl	%eax, (%rsi,%rbp,4)
.L28:
	movl	%eax, (%rsi,%rbx,4)
.L27:
	movl	%eax, (%rsi,%r11,4)
	movl	%eax, (%rsi,%r10,4)
	movl	%eax, (%rsi,%r8,4)
	movslq	%eax, %r8
	movl	%eax, (%rsi,%r9,4)
	leaq	uf_saizu(%rip), %rax
	movl	(%rax,%r8,4), %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore 3
	.cfi_restore 6
	movl	%eax, (%rsi,%r10,4)
.L36:
	movl	%eax, (%rsi,%r8,4)
	movslq	%eax, %r8
.L35:
	movl	%eax, (%rsi,%r9,4)
.L34:
	leaq	uf_saizu(%rip), %rax
	movl	(%rax,%r8,4), %eax
	ret
	.cfi_endproc
.LFE25:
	.size	uf_size, .-uf_size
	.p2align 4
	.globl	uf_issame
	.type	uf_issame, @function
uf_issame:
.LFB26:
	.cfi_startproc
	endbr64
	leaq	uf_parent(%rip), %r9
	movslq	%edi, %r10
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%esi, %r8d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	(%r9,%r10,4), %esi
	cmpl	%esi, %edi
	je	.L41
	movslq	%esi, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L42
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %esi
	cmpl	%esi, %eax
	je	.L43
	movslq	%esi, %rbp
	movl	(%r9,%rbp,4), %eax
	cmpl	%eax, %esi
	je	.L44
	movslq	%eax, %r12
	movl	(%r9,%r12,4), %esi
	cmpl	%esi, %eax
	je	.L45
	movl	%esi, %edi
	call	uf_root
	movl	%eax, (%r9,%r12,4)
	movl	%eax, %esi
.L45:
	movl	%esi, (%r9,%rbp,4)
.L44:
	movl	%esi, (%r9,%rbx,4)
.L43:
	movl	%esi, (%r9,%r11,4)
.L42:
	movl	%esi, (%r9,%r10,4)
.L41:
	movslq	%r8d, %r10
	movl	(%r9,%r10,4), %edi
	cmpl	%edi, %r8d
	je	.L46
	movslq	%edi, %r8
	movl	(%r9,%r8,4), %eax
	cmpl	%eax, %edi
	je	.L47
	movslq	%eax, %r11
	movl	(%r9,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L48
	movslq	%edi, %rbx
	movl	(%r9,%rbx,4), %eax
	cmpl	%eax, %edi
	je	.L49
	movslq	%eax, %rbp
	movl	(%r9,%rbp,4), %edi
	cmpl	%edi, %eax
	je	.L50
	call	uf_root
	movl	%eax, (%r9,%rbp,4)
	movl	%eax, %edi
.L50:
	movl	%edi, (%r9,%rbx,4)
.L49:
	movl	%edi, (%r9,%r11,4)
.L48:
	movl	%edi, (%r9,%r8,4)
.L47:
	movl	%edi, (%r9,%r10,4)
.L46:
	xorl	%eax, %eax
	cmpl	%esi, %edi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	sete	%al
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE26:
	.size	uf_issame, .-uf_issame
	.p2align 4
	.globl	uf_merge
	.type	uf_merge, @function
uf_merge:
.LFB27:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	uf_parent(%rip), %r9
	movslq	%edi, %r10
	movl	%esi, %r8d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r9,%r10,4), %esi
	cmpl	%esi, %edi
	je	.L57
	movslq	%esi, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L58
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %esi
	cmpl	%esi, %eax
	je	.L59
	movslq	%esi, %rbp
	movl	(%r9,%rbp,4), %edi
	cmpl	%edi, %esi
	je	.L60
	call	uf_root
	movl	%eax, (%r9,%rbp,4)
	movl	%eax, %esi
.L60:
	movl	%esi, (%r9,%rbx,4)
.L59:
	movl	%esi, (%r9,%r11,4)
.L58:
	movl	%esi, (%r9,%r10,4)
.L57:
	movslq	%r8d, %r10
	movl	(%r9,%r10,4), %eax
	cmpl	%eax, %r8d
	je	.L61
	movslq	%eax, %r8
	movl	(%r9,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L62
	movslq	%edx, %r11
	movl	(%r9,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L63
	movslq	%eax, %rbx
	movl	(%r9,%rbx,4), %edi
	cmpl	%edi, %eax
	je	.L64
	call	uf_root
	movl	%eax, (%r9,%rbx,4)
.L64:
	movl	%eax, (%r9,%r11,4)
.L63:
	movl	%eax, (%r9,%r8,4)
.L62:
	movl	%eax, (%r9,%r10,4)
.L61:
	cmpl	%esi, %eax
	je	.L56
	leaq	uf_saizu(%rip), %rdx
	movslq	%esi, %rdi
	movslq	%eax, %rcx
	movl	(%rdx,%rdi,4), %r10d
	movl	(%rdx,%rcx,4), %r8d
	leal	(%r10,%r8), %r11d
	cmpl	%r8d, %r10d
	jl	.L66
	movl	%esi, (%r9,%rcx,4)
	movl	%r11d, (%rdx,%rdi,4)
.L56:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	.cfi_restore_state
	movl	%eax, (%r9,%rdi,4)
	movl	%r11d, (%rdx,%rcx,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE27:
	.size	uf_merge, .-uf_merge
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	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	.LC3(%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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L76
	movl	M(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L75
	leaq	A(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	B(%rip), %r13
	jmp	.L77
	.p2align 4,,10
	.p2align 3
.L111:
	movl	M(%rip), %ecx
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jle	.L110
.L77:
	xorl	%eax, %eax
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L111
.L76:
	movl	$1, %eax
.L72:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L110:
	.cfi_restore_state
	movslq	N(%rip), %rdx
	movl	$2, %esi
	leal	-1(%rdx), %eax
	movq	%rdx, %rdi
	cltq
	imulq	%rdx, %rax
	cqto
	idivq	%rsi
	movq	%rax, %rbp
	testl	%edi, %edi
	js	.L84
.L78:
	leal	1(%rdi), %r8d
	cmpl	$2, %edi
	jle	.L100
	movl	%r8d, %edx
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	shrl	$2, %edx
	movdqa	.LC2(%rip), %xmm2
	leaq	uf_parent(%rip), %rbx
	leaq	uf_saizu(%rip), %rsi
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L82:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, (%rsi,%rax)
	paddd	%xmm3, %xmm0
	movaps	%xmm1, (%rbx,%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L82
	movl	%r8d, %eax
	andl	$-4, %eax
	andb	$3, %r8b
	je	.L84
.L81:
	movslq	%eax, %rdx
	movl	%eax, (%rbx,%rdx,4)
	movl	$1, (%rsi,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L84
	movslq	%edx, %r8
	addl	$2, %eax
	movl	%edx, (%rbx,%r8,4)
	movl	$1, (%rsi,%r8,4)
	cmpl	%edi, %eax
	jg	.L84
	movslq	%eax, %rdx
	movl	%eax, (%rbx,%rdx,4)
	movl	$1, (%rsi,%rdx,4)
.L84:
	testl	%ecx, %ecx
	jle	.L80
	movslq	%ecx, %rax
	leaq	A(%rip), %rdx
	leaq	B(%rip), %r13
	leaq	0(,%rax,4), %r14
	leaq	gourikiayame(%rip), %r12
	addq	%r14, %r13
	addq	%rdx, %r14
	leal	-1(%rcx), %edx
	leaq	(%r12,%rax,8), %r12
	subq	%rdx, %rax
	leaq	-4+B(%rip), %rdx
	leaq	(%rdx,%rax,4), %rax
	leaq	uf_parent(%rip), %rbx
	movq	%rax, 8(%rsp)
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L98:
	subq	$8, %r12
	subq	$4, %r13
	subq	$4, %r14
	cmpq	8(%rsp), %r13
	je	.L80
.L99:
	movslq	-4(%r14), %r10
	movl	-4(%r13), %r9d
	movq	%rbp, -8(%r12)
	movl	(%rbx,%r10,4), %esi
	cmpl	%esi, %r10d
	je	.L88
	movslq	%esi, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %esi
	je	.L89
	movslq	%eax, %r15
	movl	(%rbx,%r15,4), %esi
	cmpl	%esi, %eax
	je	.L90
	movslq	%esi, %r8
	movl	(%rbx,%r8,4), %edx
	cmpl	%edx, %esi
	je	.L91
	movslq	%edx, %rsi
	movl	(%rbx,%rsi,4), %edi
	cmpl	%edi, %edx
	je	.L92
	call	uf_root
	movl	%eax, (%rbx,%rsi,4)
	movl	%eax, %edi
.L92:
	movl	%edi, (%rbx,%r8,4)
	movl	%edi, %edx
.L91:
	movl	%edx, (%rbx,%r15,4)
	movl	%edx, %esi
.L90:
	movl	%esi, (%rbx,%r11,4)
.L89:
	movl	%esi, (%rbx,%r10,4)
.L88:
	movslq	%r9d, %r10
	movl	(%rbx,%r10,4), %edx
	cmpl	%edx, %r9d
	je	.L93
	movslq	%edx, %r9
	movl	(%rbx,%r9,4), %eax
	cmpl	%eax, %edx
	je	.L94
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L95
	movslq	%edx, %r15
	movl	(%rbx,%r15,4), %ecx
	cmpl	%ecx, %edx
	je	.L96
	movslq	%ecx, %r8
	movl	(%rbx,%r8,4), %edi
	cmpl	%edi, %ecx
	je	.L97
	call	uf_root
	movl	%eax, (%rbx,%r8,4)
	movl	%eax, %edi
.L97:
	movl	%edi, (%rbx,%r15,4)
	movl	%edi, %ecx
.L96:
	movl	%ecx, (%rbx,%r11,4)
	movl	%ecx, %edx
.L95:
	movl	%edx, (%rbx,%r9,4)
.L94:
	movl	%edx, (%rbx,%r10,4)
.L93:
	cmpl	%esi, %edx
	je	.L98
	movl	-4(%r14), %edi
	call	uf_size
	movl	-4(%r13), %edi
	movslq	%eax, %r15
	call	uf_size
	movl	-4(%r13), %esi
	movl	-4(%r14), %edi
	cltq
	imulq	%rax, %r15
	subq	%r15, %rbp
	call	uf_merge
	jmp	.L98
.L75:
	movslq	N(%rip), %rdx
	movl	$2, %esi
	leal	-1(%rdx), %eax
	movq	%rdx, %rdi
	cltq
	imulq	%rdx, %rax
	cqto
	idivq	%rsi
	movq	%rax, %rbp
	testl	%edi, %edi
	jns	.L78
.L80:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	gourikiayame(%rip), %r12
	leaq	.LC4(%rip), %rbp
	jle	.L87
	.p2align 4,,10
	.p2align 3
.L86:
	movq	(%r12,%rbx,8), %rdx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, M(%rip)
	jg	.L86
.L87:
	xorl	%eax, %eax
	jmp	.L72
.L100:
	xorl	%eax, %eax
	leaq	uf_parent(%rip), %rbx
	leaq	uf_saizu(%rip), %rsi
	jmp	.L81
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	gourikiayame
	.bss
	.align 32
	.type	gourikiayame, @object
	.size	gourikiayame, 916112
gourikiayame:
	.zero	916112
	.globl	uf_saizu
	.align 32
	.type	uf_saizu, @object
	.size	uf_saizu, 458056
uf_saizu:
	.zero	458056
	.globl	uf_parent
	.align 32
	.type	uf_parent, @object
	.size	uf_parent, 458056
uf_parent:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 <inttypes.h>

int N, M;
int A[114514], B[114514];

int uf_parent[114514];
int uf_saizu[114514];

void uf_init(void) {
	int i;
	for (i = 0; i <= N; i++) {
		uf_parent[i] = i;
		uf_saizu[i] = 1;
	}
}

int uf_root(int node) {
	if (uf_parent[node] == node) return node;
	return uf_parent[node] = uf_root(uf_parent[node]);
}

int uf_size(int node) {
	return uf_saizu[uf_root(node)];
}

int uf_issame(int a, int b) {
	return uf_root(a) == uf_root(b);
}

void uf_merge(int a, int b) {
	int ar = uf_root(a), br = uf_root(b);
	if (ar != br) {
		if (uf_saizu[ar] >= uf_saizu[br]) {
			uf_parent[br] = ar;
			uf_saizu[ar] += uf_saizu[br];
		} else {
			uf_parent[ar] = br;
			uf_saizu[br] += uf_saizu[ar];
		}
	}
}

int64_t gourikiayame[114514];

int main(void) {
	int i;
	int64_t maedaatuko;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &A[i], &B[i]) != 2) return 1;
	}
	maedaatuko = (int64_t)N * (N - 1) / 2;
	uf_init();
	for (i = M - 1; i >= 0; i--) {
		gourikiayame[i] = maedaatuko;
		if (!uf_issame(A[i], B[i])) {
			maedaatuko -= (int64_t)uf_size(A[i]) * uf_size(B[i]);
			uf_merge(A[i], B[i]);
		}
	}
	for (i = 0; i < M; i++) {
		printf("%" PRId64 "\n", gourikiayame[i]);
	}
	return 0;
}

6 5
3 3
1 2
5 6
3 4
4 5
 4 5
1 2
3 4
1 3
3 3
1 4
 2 1
2 2
 6 5
3 3
1 2
5 6
3 4
2 5
 4 5
1 2
3 4
1 3
3 3
1 1
 6 5
2 3
1 2
5 6
3 4
4 3
 4 5
1 0
3 4
1 3
2 3
1 4
 6 5
3 3
1 1
5 6
3 4
4 5
 4 5
1 2
3 4
1 3
3 2
1 1
 4 1
1 3
3 4
1 3
3 3
1 1

8
9
12
14
15
 3
3
5
5
6
 1
 8
11
13
14
15
 3
5
6
6
6
 12
13
14
14
15
 0
0
4
5
6
 9
9
12
14
15
 0
3
5
6
6
 6

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 <inttypes.h>

int N, M;
int A[114514], B[114514];

int uf_parent[114514];
int uf_saizu[114514];

void uf_init(void) {
	int i;
	for (i = 0; i <= N; i++) {
		uf_parent[i] = i;
		uf_saizu[i] = 1;
	}
}

int uf_root(int node) {
	if (uf_parent[node] == node) return node;
	return uf_parent[node] = uf_root(uf_parent[node]);
}

int uf_size(int node) {
	return uf_saizu[uf_root(node)];
}

int uf_issame(int a, int b) {
	return uf_root(a) == uf_root(b);
}

void uf_merge(int a, int b) {
	int ar = uf_root(a), br = uf_root(b);
	if (ar != br) {
		if (uf_saizu[ar] >= uf_saizu[br]) {
			uf_parent[br] = ar;
			uf_saizu[ar] += uf_saizu[br];
		} else {
			uf_parent[ar] = br;
			uf_saizu[br] += uf_saizu[ar];
		}
	}
}

int64_t gourikiayame[114514];

int main(void) {
	int i;
	int64_t maedaatuko;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &A[i], &B[i]) != 2) return 1;
	}
	maedaatuko = (int64_t)N * (N - 1) / 2;
	uf_init();
	for (i = M - 1; i >= 0; i--) {
		gourikiayame[i] = maedaatuko;
		if (!uf_issame(A[i], B[i])) {
			maedaatuko -= (int64_t)uf_size(A[i]) * uf_size(B[i]);
			uf_merge(A[i], B[i]);
		}
	}
	for (i = 0; i < M; i++) {
		printf("%" PRId64 "\n", gourikiayame[i]);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	uf_parent
	.align 32
	.type	uf_parent, @object
	.size	uf_parent, 458056
uf_parent:
	.zero	458056
	.globl	uf_saizu
	.align 32
	.type	uf_saizu, @object
	.size	uf_saizu, 458056
uf_saizu:
	.zero	458056
	.text
	.globl	uf_init
	.type	uf_init, @function
uf_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	uf_init, .-uf_init
	.globl	uf_root
	.type	uf_root, @function
uf_root:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L5
	movl	-4(%rbp), %eax
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_root
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	uf_root, .-uf_root
	.globl	uf_size
	.type	uf_size, @function
uf_size:
.LFB2:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	uf_size, .-uf_size
	.globl	uf_issame
	.type	uf_issame, @function
uf_issame:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	uf_issame, .-uf_issame
	.globl	uf_merge
	.type	uf_merge, @function
uf_merge:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L14
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_saizu(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	uf_merge, .-uf_merge
	.globl	gourikiayame
	.bss
	.align 32
	.type	gourikiayame, @object
	.size	gourikiayame, 916112
gourikiayame:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L17
.L16:
	movl	$0, -28(%rbp)
	jmp	.L18
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L17
.L19:
	addl	$1, -28(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L20
	movl	N(%rip), %eax
	movslq	%eax, %rdx
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -24(%rbp)
	call	uf_init
	movl	M(%rip), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	gourikiayame(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_issame
	testl	%eax, %eax
	jne	.L22
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	movslq	%eax, %rbx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	cltq
	imulq	%rbx, %rax
	subq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_merge
.L22:
	subl	$1, -28(%rbp)
.L21:
	cmpl	$0, -28(%rbp)
	jns	.L23
	movl	$0, -28(%rbp)
	jmp	.L24
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	gourikiayame(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L24:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 458056
A:
	.zero	458056
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 458056
B:
	.zero	458056
	.globl	uf_parent
	.align 32
	.type	uf_parent, @object
	.size	uf_parent, 458056
uf_parent:
	.zero	458056
	.globl	uf_saizu
	.align 32
	.type	uf_saizu, @object
	.size	uf_saizu, 458056
uf_saizu:
	.zero	458056
	.text
	.globl	uf_init
	.type	uf_init, @function
uf_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	uf_init, .-uf_init
	.globl	uf_root
	.type	uf_root, @function
uf_root:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L5
	movl	-4(%rbp), %eax
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_root
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_parent(%rip), %rax
	movl	(%rdx,%rax), %eax
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	uf_root, .-uf_root
	.globl	uf_size
	.type	uf_size, @function
uf_size:
.LFB2:
	.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
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	uf_size, .-uf_size
	.globl	uf_issame
	.type	uf_issame, @function
uf_issame:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	uf_issame, .-uf_issame
	.globl	uf_merge
	.type	uf_merge, @function
uf_merge:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	uf_root
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L14
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_saizu(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	uf_parent(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	uf_saizu(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	uf_merge, .-uf_merge
	.globl	gourikiayame
	.bss
	.align 32
	.type	gourikiayame, @object
	.size	gourikiayame, 916112
gourikiayame:
	.zero	916112
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L17
.L16:
	movl	$0, -28(%rbp)
	jmp	.L18
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L19
	movl	$1, %eax
	jmp	.L17
.L19:
	addl	$1, -28(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L20
	movl	N(%rip), %eax
	movslq	%eax, %rdx
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -24(%rbp)
	call	uf_init
	movl	M(%rip), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	gourikiayame(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_issame
	testl	%eax, %eax
	jne	.L22
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	movslq	%eax, %rbx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	uf_size
	cltq
	imulq	%rbx, %rax
	subq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	uf_merge
.L22:
	subl	$1, -28(%rbp)
.L21:
	cmpl	$0, -28(%rbp)
	jns	.L23
	movl	$0, -28(%rbp)
	jmp	.L24
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	gourikiayame(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L24:
	movl	M(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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:
