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>

/* https://ncode.syosetu.com/n2267be/ */
#define RIZERO return 0

int N, M;
int p[114514];
int x[114514], y[114514];

int miyukichi[114514];
int emirinn[114514];

void yukinnko(void) {
	int i;
	for (i = 0; i <= N; i++) {
		miyukichi[i] = i;
		emirinn[i] = 1;
	}
}

int tomatu(int sumipe) {
	return miyukichi[sumipe] == sumipe ? sumipe : (miyukichi[sumipe] = tomatu(miyukichi[sumipe]));
}

void hayaminn(int asumi, int iguti) {
	int kana = tomatu(asumi);
	int yuka = tomatu(iguti);
	if (kana != yuka) {
		if (emirinn[kana] >= emirinn[yuka]) {
			miyukichi[yuka] = kana;
			emirinn[kana] += emirinn[yuka];
		} else {
			miyukichi[kana] = yuka;
			emirinn[yuka] += emirinn[kana];
		}
	}
}

int main(void) {
	int i;
	int mizuhasu = 0;

	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &p[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
	}

	yukinnko();
	for (i = 0; i < M; i++) {
		hayaminn(x[i], y[i]);
	}
	for (i = 1; i <= N; i++) {
		if (tomatu(i) == tomatu(p[i])) mizuhasu++;
	}
	printf("%d\n", mizuhasu);

	RIZERO ;
}
```

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	p
	.align 32
	.type	p, @object
	.size	p, 458056
p:
	.zero	458056
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 458056
x:
	.zero	458056
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 458056
y:
	.zero	458056
	.globl	miyukichi
	.align 32
	.type	miyukichi, @object
	.size	miyukichi, 458056
miyukichi:
	.zero	458056
	.globl	emirinn
	.align 32
	.type	emirinn, @object
	.size	emirinn, 458056
emirinn:
	.zero	458056
	.text
	.globl	yukinnko
	.type	yukinnko, @function
yukinnko:
.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	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%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	yukinnko, .-yukinnko
	.globl	tomatu
	.type	tomatu, @function
tomatu:
.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	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L5:
	movl	-4(%rbp), %eax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	tomatu, .-tomatu
	.globl	hayaminn
	.type	hayaminn, @function
hayaminn:
.LFB2:
	.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	tomatu
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L11
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	emirinn(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L11
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hayaminn, .-hayaminn
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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	$0, -20(%rbp)
	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	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$1, -24(%rbp)
	jmp	.L15
.L17:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -24(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L17
	movl	$0, -24(%rbp)
	jmp	.L18
.L20:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%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	.L14
.L19:
	addl	$1, -24(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L20
	call	yukinnko
	movl	$0, -24(%rbp)
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hayaminn
	addl	$1, -24(%rbp)
.L21:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L22
	movl	$1, -24(%rbp)
	jmp	.L23
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	cmpl	%eax, %ebx
	jne	.L24
	addl	$1, -20(%rbp)
.L24:
	addl	$1, -24(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	yukinnko
	.type	yukinnko, @function
yukinnko:
.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	miyukichi(%rip), %rsi
	leaq	emirinn(%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	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	yukinnko, .-yukinnko
	.p2align 4
	.globl	tomatu
	.type	tomatu, @function
tomatu:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	miyukichi(%rip), %rbx
	movq	%rbp, %rax
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L17
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	jne	.L18
.L13:
	movl	%edx, (%rbx,%r12,4)
	movl	%edx, %eax
.L12:
	movl	%eax, (%rbx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %edi
	cmpl	%edi, %edx
	je	.L14
	call	tomatu
	movl	%eax, (%rbx,%r14,4)
	movl	%eax, %edi
.L14:
	movl	%edi, (%rbx,%r13,4)
	movl	%edi, %edx
	jmp	.L13
	.cfi_endproc
.LFE24:
	.size	tomatu, .-tomatu
	.p2align 4
	.globl	hayaminn
	.type	hayaminn, @function
hayaminn:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	miyukichi(%rip), %rcx
	movslq	%edi, %r9
	movl	%esi, %r8d
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rcx,%r9,4), %esi
	cmpl	%esi, %edi
	jne	.L47
.L20:
	movslq	%r8d, %r9
	movl	(%rcx,%r9,4), %eax
	cmpl	%eax, %r8d
	jne	.L48
.L31:
	cmpl	%esi, %eax
	je	.L19
	leaq	emirinn(%rip), %rdx
	movslq	%esi, %r8
	movslq	%eax, %rdi
	movl	(%rdx,%r8,4), %r10d
	movl	(%rdx,%rdi,4), %r9d
	leal	(%r10,%r9), %r11d
	cmpl	%r9d, %r10d
	jl	.L43
	movl	%esi, (%rcx,%rdi,4)
	movl	%r11d, (%rdx,%r8,4)
.L19:
	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
	.p2align 4,,10
	.p2align 3
.L43:
	.cfi_restore_state
	movl	%eax, (%rcx,%r8,4)
	movl	%r11d, (%rdx,%rdi,4)
	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
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L32
	movslq	%edx, %r10
	movl	(%rcx,%r10,4), %eax
	cmpl	%eax, %edx
	jne	.L49
.L33:
	movl	%eax, (%rcx,%r8,4)
	movl	%eax, %edx
.L32:
	movl	%edx, (%rcx,%r9,4)
	movl	%edx, %eax
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%esi, %r10
	movl	(%rcx,%r10,4), %eax
	cmpl	%eax, %esi
	je	.L21
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %edx
	cmpl	%edx, %eax
	jne	.L50
.L22:
	movl	%edx, (%rcx,%r10,4)
	movl	%edx, %eax
.L21:
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %esi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L50:
	movslq	%edx, %r11
	movl	(%rcx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L23
	movslq	%eax, %rbx
	movl	(%rcx,%rbx,4), %edx
	cmpl	%edx, %eax
	jne	.L51
.L24:
	movl	%edx, (%rcx,%r11,4)
	movl	%edx, %eax
.L23:
	movl	%eax, (%rcx,%rsi,4)
	movl	%eax, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L49:
	movslq	%eax, %r11
	movl	(%rcx,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L34
	movslq	%edx, %rbx
	movl	(%rcx,%rbx,4), %eax
	cmpl	%eax, %edx
	jne	.L52
.L35:
	movl	%eax, (%rcx,%r11,4)
	movl	%eax, %edx
.L34:
	movl	%edx, (%rcx,%r10,4)
	movl	%edx, %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L52:
	movslq	%eax, %rbp
	movl	(%rcx,%rbp,4), %edx
	cmpl	%edx, %eax
	je	.L36
	movslq	%edx, %r12
	movl	(%rcx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L37
	movslq	%eax, %r13
	movl	(%rcx,%r13,4), %edx
	cmpl	%edx, %eax
	je	.L38
	movslq	%edx, %r14
	movl	(%rcx,%r14,4), %eax
	cmpl	%eax, %edx
	je	.L39
	movslq	%eax, %r15
	movl	(%rcx,%r15,4), %edi
	cmpl	%edi, %eax
	je	.L45
	movslq	%edi, %rdx
	movl	(%rcx,%rdx,4), %eax
	movq	%rdx, 8(%rsp)
	cmpl	%eax, %edi
	je	.L41
	movl	%eax, %edi
	call	tomatu
	movq	8(%rsp), %rdx
	movl	%eax, (%rcx,%rdx,4)
.L41:
	movl	%eax, (%rcx,%r15,4)
.L40:
	movl	%eax, (%rcx,%r14,4)
.L39:
	movl	%eax, (%rcx,%r13,4)
	movl	%eax, %edx
.L38:
	movl	%edx, (%rcx,%r12,4)
	movl	%edx, %eax
.L37:
	movl	%eax, (%rcx,%rbp,4)
	movl	%eax, %edx
.L36:
	movl	%edx, (%rcx,%rbx,4)
	movl	%edx, %eax
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L51:
	movslq	%edx, %rbp
	movl	(%rcx,%rbp,4), %eax
	cmpl	%eax, %edx
	je	.L25
	movslq	%eax, %r12
	movl	(%rcx,%r12,4), %edx
	cmpl	%edx, %eax
	je	.L26
	movslq	%edx, %r13
	movl	(%rcx,%r13,4), %eax
	cmpl	%eax, %edx
	je	.L27
	movslq	%eax, %r14
	movl	(%rcx,%r14,4), %edx
	cmpl	%edx, %eax
	je	.L28
	movslq	%edx, %r15
	movl	(%rcx,%r15,4), %eax
	cmpl	%eax, %edx
	je	.L44
	movslq	%eax, %rdx
	movl	(%rcx,%rdx,4), %edi
	movq	%rdx, 8(%rsp)
	cmpl	%edi, %eax
	je	.L30
	call	tomatu
	movq	8(%rsp), %rdx
	movl	%eax, %edi
	movl	%eax, (%rcx,%rdx,4)
.L30:
	movl	%edi, (%rcx,%r15,4)
	movl	%edi, %edx
.L29:
	movl	%edx, (%rcx,%r14,4)
.L28:
	movl	%edx, (%rcx,%r13,4)
	movl	%edx, %eax
.L27:
	movl	%eax, (%rcx,%r12,4)
	movl	%eax, %edx
.L26:
	movl	%edx, (%rcx,%rbp,4)
	movl	%edx, %eax
.L25:
	movl	%eax, (%rcx,%rbx,4)
	movl	%eax, %edx
	jmp	.L24
.L44:
	movl	%eax, %edx
	jmp	.L29
.L45:
	movl	%edi, %eax
	jmp	.L40
	.cfi_endproc
.LFE25:
	.size	hayaminn, .-hayaminn
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L59
	cmpl	$0, N(%rip)
	leaq	4+p(%rip), %rbx
	movl	$1, %ebp
	leaq	.LC4(%rip), %r13
	jg	.L60
.L61:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	x(%rip), %rbp
	leaq	y(%rip), %r13
	jg	.L62
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L91:
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, M(%rip)
	jle	.L90
.L62:
	xorl	%eax, %eax
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L91
	.p2align 4,,10
	.p2align 3
.L59:
	movl	$1, %eax
.L53:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L92:
	.cfi_restore_state
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jl	.L61
.L60:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L92
	jmp	.L59
.L90:
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	js	.L69
.L63:
	leal	1(%r8), %r9d
	cmpl	$2, %r8d
	jle	.L77
	movl	%r9d, %edi
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edi
	leaq	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
.L67:
	movq	%rax, %rdx
	movdqa	%xmm0, %xmm1
	paddd	%xmm3, %xmm0
	addq	$1, %rax
	salq	$4, %rdx
	movaps	%xmm1, (%rsi,%rdx)
	movaps	%xmm2, (%rcx,%rdx)
	cmpl	%eax, %edi
	ja	.L67
	movl	%r9d, %eax
	andl	$-4, %eax
	andb	$3, %r9b
	je	.L69
.L66:
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L69
	movslq	%edx, %rdi
	addl	$2, %eax
	movl	%edx, (%rsi,%rdi,4)
	movl	$1, (%rcx,%rdi,4)
	cmpl	%eax, %r8d
	jl	.L69
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
.L69:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	x(%rip), %rbp
	leaq	y(%rip), %r13
	jle	.L65
	.p2align 4,,10
	.p2align 3
.L64:
	movl	0(%r13,%rbx,4), %esi
	movl	0(%rbp,%rbx,4), %edi
	addq	$1, %rbx
	call	hayaminn
	cmpl	%ebx, M(%rip)
	jg	.L64
.L65:
	xorl	%r10d, %r10d
	cmpl	$0, N(%rip)
	jle	.L72
	movl	$1, %ecx
	xorl	%r10d, %r10d
	leaq	miyukichi(%rip), %rsi
	leaq	p(%rip), %r11
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%rsi,%rcx,4), %edi
	movl	%ecx, %r8d
	cmpl	%ecx, %edi
	je	.L73
	call	tomatu
	movl	%eax, (%rsi,%rcx,4)
	movl	%eax, %r8d
.L73:
	movslq	(%r11,%rcx,4), %r9
	movl	(%rsi,%r9,4), %edi
	cmpl	%edi, %r9d
	je	.L74
	call	tomatu
	movl	%eax, (%rsi,%r9,4)
	movl	%eax, %edi
.L74:
	xorl	%eax, %eax
	cmpl	%r8d, %edi
	sete	%al
	addq	$1, %rcx
	addl	%eax, %r10d
	cmpl	%ecx, N(%rip)
	jge	.L71
.L72:
	movl	%r10d, %edx
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L53
.L89:
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jns	.L63
	jmp	.L65
.L77:
	xorl	%eax, %eax
	leaq	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
	jmp	.L66
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	emirinn
	.bss
	.align 32
	.type	emirinn, @object
	.size	emirinn, 458056
emirinn:
	.zero	458056
	.globl	miyukichi
	.align 32
	.type	miyukichi, @object
	.size	miyukichi, 458056
miyukichi:
	.zero	458056
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 458056
y:
	.zero	458056
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 458056
x:
	.zero	458056
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 458056
p:
	.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	yukinnko
	.type	yukinnko, @function
yukinnko:
.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	miyukichi(%rip), %rsi
	leaq	emirinn(%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	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	yukinnko, .-yukinnko
	.p2align 4
	.globl	tomatu
	.type	tomatu, @function
tomatu:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	miyukichi(%rip), %rbx
	movq	%rbp, %rax
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L17
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L12
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	jne	.L18
.L13:
	movl	%edx, (%rbx,%r12,4)
	movl	%edx, %eax
.L12:
	movl	%eax, (%rbx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %edi
	cmpl	%edi, %edx
	je	.L14
	call	tomatu
	movl	%eax, (%rbx,%r14,4)
	movl	%eax, %edi
.L14:
	movl	%edi, (%rbx,%r13,4)
	movl	%edi, %edx
	jmp	.L13
	.cfi_endproc
.LFE24:
	.size	tomatu, .-tomatu
	.p2align 4
	.globl	hayaminn
	.type	hayaminn, @function
hayaminn:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	miyukichi(%rip), %rcx
	movslq	%edi, %r9
	movl	%esi, %r8d
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rcx,%r9,4), %esi
	cmpl	%esi, %edi
	jne	.L47
.L20:
	movslq	%r8d, %r9
	movl	(%rcx,%r9,4), %eax
	cmpl	%eax, %r8d
	jne	.L48
.L31:
	cmpl	%esi, %eax
	je	.L19
	leaq	emirinn(%rip), %rdx
	movslq	%esi, %r8
	movslq	%eax, %rdi
	movl	(%rdx,%r8,4), %r10d
	movl	(%rdx,%rdi,4), %r9d
	leal	(%r10,%r9), %r11d
	cmpl	%r9d, %r10d
	jl	.L43
	movl	%esi, (%rcx,%rdi,4)
	movl	%r11d, (%rdx,%r8,4)
.L19:
	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
	.p2align 4,,10
	.p2align 3
.L43:
	.cfi_restore_state
	movl	%eax, (%rcx,%r8,4)
	movl	%r11d, (%rdx,%rdi,4)
	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
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L32
	movslq	%edx, %r10
	movl	(%rcx,%r10,4), %eax
	cmpl	%eax, %edx
	jne	.L49
.L33:
	movl	%eax, (%rcx,%r8,4)
	movl	%eax, %edx
.L32:
	movl	%edx, (%rcx,%r9,4)
	movl	%edx, %eax
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%esi, %r10
	movl	(%rcx,%r10,4), %eax
	cmpl	%eax, %esi
	je	.L21
	movslq	%eax, %rsi
	movl	(%rcx,%rsi,4), %edx
	cmpl	%edx, %eax
	jne	.L50
.L22:
	movl	%edx, (%rcx,%r10,4)
	movl	%edx, %eax
.L21:
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %esi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L50:
	movslq	%edx, %r11
	movl	(%rcx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L23
	movslq	%eax, %rbx
	movl	(%rcx,%rbx,4), %edx
	cmpl	%edx, %eax
	jne	.L51
.L24:
	movl	%edx, (%rcx,%r11,4)
	movl	%edx, %eax
.L23:
	movl	%eax, (%rcx,%rsi,4)
	movl	%eax, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L49:
	movslq	%eax, %r11
	movl	(%rcx,%r11,4), %edx
	cmpl	%edx, %eax
	je	.L34
	movslq	%edx, %rbx
	movl	(%rcx,%rbx,4), %eax
	cmpl	%eax, %edx
	jne	.L52
.L35:
	movl	%eax, (%rcx,%r11,4)
	movl	%eax, %edx
.L34:
	movl	%edx, (%rcx,%r10,4)
	movl	%edx, %eax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L52:
	movslq	%eax, %rbp
	movl	(%rcx,%rbp,4), %edx
	cmpl	%edx, %eax
	je	.L36
	movslq	%edx, %r12
	movl	(%rcx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L37
	movslq	%eax, %r13
	movl	(%rcx,%r13,4), %edx
	cmpl	%edx, %eax
	je	.L38
	movslq	%edx, %r14
	movl	(%rcx,%r14,4), %eax
	cmpl	%eax, %edx
	je	.L39
	movslq	%eax, %r15
	movl	(%rcx,%r15,4), %edi
	cmpl	%edi, %eax
	je	.L45
	movslq	%edi, %rdx
	movl	(%rcx,%rdx,4), %eax
	movq	%rdx, 8(%rsp)
	cmpl	%eax, %edi
	je	.L41
	movl	%eax, %edi
	call	tomatu
	movq	8(%rsp), %rdx
	movl	%eax, (%rcx,%rdx,4)
.L41:
	movl	%eax, (%rcx,%r15,4)
.L40:
	movl	%eax, (%rcx,%r14,4)
.L39:
	movl	%eax, (%rcx,%r13,4)
	movl	%eax, %edx
.L38:
	movl	%edx, (%rcx,%r12,4)
	movl	%edx, %eax
.L37:
	movl	%eax, (%rcx,%rbp,4)
	movl	%eax, %edx
.L36:
	movl	%edx, (%rcx,%rbx,4)
	movl	%edx, %eax
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L51:
	movslq	%edx, %rbp
	movl	(%rcx,%rbp,4), %eax
	cmpl	%eax, %edx
	je	.L25
	movslq	%eax, %r12
	movl	(%rcx,%r12,4), %edx
	cmpl	%edx, %eax
	je	.L26
	movslq	%edx, %r13
	movl	(%rcx,%r13,4), %eax
	cmpl	%eax, %edx
	je	.L27
	movslq	%eax, %r14
	movl	(%rcx,%r14,4), %edx
	cmpl	%edx, %eax
	je	.L28
	movslq	%edx, %r15
	movl	(%rcx,%r15,4), %eax
	cmpl	%eax, %edx
	je	.L44
	movslq	%eax, %rdx
	movl	(%rcx,%rdx,4), %edi
	movq	%rdx, 8(%rsp)
	cmpl	%edi, %eax
	je	.L30
	call	tomatu
	movq	8(%rsp), %rdx
	movl	%eax, %edi
	movl	%eax, (%rcx,%rdx,4)
.L30:
	movl	%edi, (%rcx,%r15,4)
	movl	%edi, %edx
.L29:
	movl	%edx, (%rcx,%r14,4)
.L28:
	movl	%edx, (%rcx,%r13,4)
	movl	%edx, %eax
.L27:
	movl	%eax, (%rcx,%r12,4)
	movl	%eax, %edx
.L26:
	movl	%edx, (%rcx,%rbp,4)
	movl	%edx, %eax
.L25:
	movl	%eax, (%rcx,%rbx,4)
	movl	%eax, %edx
	jmp	.L24
.L44:
	movl	%eax, %edx
	jmp	.L29
.L45:
	movl	%edi, %eax
	jmp	.L40
	.cfi_endproc
.LFE25:
	.size	hayaminn, .-hayaminn
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L59
	cmpl	$0, N(%rip)
	leaq	4+p(%rip), %rbx
	movl	$1, %ebp
	leaq	.LC4(%rip), %r13
	jg	.L60
.L61:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	x(%rip), %rbp
	leaq	y(%rip), %r13
	jg	.L62
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L91:
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, M(%rip)
	jle	.L90
.L62:
	xorl	%eax, %eax
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L91
	.p2align 4,,10
	.p2align 3
.L59:
	movl	$1, %eax
.L53:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L92:
	.cfi_restore_state
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jl	.L61
.L60:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L92
	jmp	.L59
.L90:
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	js	.L69
.L63:
	leal	1(%r8), %r9d
	cmpl	$2, %r8d
	jle	.L77
	movl	%r9d, %edi
	movdqa	.LC0(%rip), %xmm0
	xorl	%eax, %eax
	movdqa	.LC1(%rip), %xmm3
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edi
	leaq	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
.L67:
	movq	%rax, %rdx
	movdqa	%xmm0, %xmm1
	paddd	%xmm3, %xmm0
	addq	$1, %rax
	salq	$4, %rdx
	movaps	%xmm1, (%rsi,%rdx)
	movaps	%xmm2, (%rcx,%rdx)
	cmpl	%eax, %edi
	ja	.L67
	movl	%r9d, %eax
	andl	$-4, %eax
	andb	$3, %r9b
	je	.L69
.L66:
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L69
	movslq	%edx, %rdi
	addl	$2, %eax
	movl	%edx, (%rsi,%rdi,4)
	movl	$1, (%rcx,%rdi,4)
	cmpl	%eax, %r8d
	jl	.L69
	movslq	%eax, %rdx
	movl	%eax, (%rsi,%rdx,4)
	movl	$1, (%rcx,%rdx,4)
.L69:
	xorl	%ebx, %ebx
	cmpl	$0, M(%rip)
	leaq	x(%rip), %rbp
	leaq	y(%rip), %r13
	jle	.L65
	.p2align 4,,10
	.p2align 3
.L64:
	movl	0(%r13,%rbx,4), %esi
	movl	0(%rbp,%rbx,4), %edi
	addq	$1, %rbx
	call	hayaminn
	cmpl	%ebx, M(%rip)
	jg	.L64
.L65:
	xorl	%r10d, %r10d
	cmpl	$0, N(%rip)
	jle	.L72
	movl	$1, %ecx
	xorl	%r10d, %r10d
	leaq	miyukichi(%rip), %rsi
	leaq	p(%rip), %r11
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%rsi,%rcx,4), %edi
	movl	%ecx, %r8d
	cmpl	%ecx, %edi
	je	.L73
	call	tomatu
	movl	%eax, (%rsi,%rcx,4)
	movl	%eax, %r8d
.L73:
	movslq	(%r11,%rcx,4), %r9
	movl	(%rsi,%r9,4), %edi
	cmpl	%edi, %r9d
	je	.L74
	call	tomatu
	movl	%eax, (%rsi,%r9,4)
	movl	%eax, %edi
.L74:
	xorl	%eax, %eax
	cmpl	%r8d, %edi
	sete	%al
	addq	$1, %rcx
	addl	%eax, %r10d
	cmpl	%ecx, N(%rip)
	jge	.L71
.L72:
	movl	%r10d, %edx
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L53
.L89:
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jns	.L63
	jmp	.L65
.L77:
	xorl	%eax, %eax
	leaq	miyukichi(%rip), %rsi
	leaq	emirinn(%rip), %rcx
	jmp	.L66
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	emirinn
	.bss
	.align 32
	.type	emirinn, @object
	.size	emirinn, 458056
emirinn:
	.zero	458056
	.globl	miyukichi
	.align 32
	.type	miyukichi, @object
	.size	miyukichi, 458056
miyukichi:
	.zero	458056
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 458056
y:
	.zero	458056
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 458056
x:
	.zero	458056
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 458056
p:
	.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>

/* https://ncode.syosetu.com/n2267be/ */
#define RIZERO return 0

int N, M;
int p[114514];
int x[114514], y[114514];

int miyukichi[114514];
int emirinn[114514];

void yukinnko(void) {
	int i;
	for (i = 0; i <= N; i++) {
		miyukichi[i] = i;
		emirinn[i] = 1;
	}
}

int tomatu(int sumipe) {
	return miyukichi[sumipe] == sumipe ? sumipe : (miyukichi[sumipe] = tomatu(miyukichi[sumipe]));
}

void hayaminn(int asumi, int iguti) {
	int kana = tomatu(asumi);
	int yuka = tomatu(iguti);
	if (kana != yuka) {
		if (emirinn[kana] >= emirinn[yuka]) {
			miyukichi[yuka] = kana;
			emirinn[kana] += emirinn[yuka];
		} else {
			miyukichi[kana] = yuka;
			emirinn[yuka] += emirinn[kana];
		}
	}
}

int main(void) {
	int i;
	int mizuhasu = 0;

	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &p[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
	}

	yukinnko();
	for (i = 0; i < M; i++) {
		hayaminn(x[i], y[i]);
	}
	for (i = 1; i <= N; i++) {
		if (tomatu(i) == tomatu(p[i])) mizuhasu++;
	}
	printf("%d\n", mizuhasu);

	RIZERO ;
}

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

3
 2
 8
 1
 7
 6
 4
 5
 0
 8

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

```c
#include <stdio.h>

/* https://ncode.syosetu.com/n2267be/ */
#define RIZERO return 0

int N, M;
int p[114514];
int x[114514], y[114514];

int miyukichi[114514];
int emirinn[114514];

void yukinnko(void) {
	int i;
	for (i = 0; i <= N; i++) {
		miyukichi[i] = i;
		emirinn[i] = 1;
	}
}

int tomatu(int sumipe) {
	return miyukichi[sumipe] == sumipe ? sumipe : (miyukichi[sumipe] = tomatu(miyukichi[sumipe]));
}

void hayaminn(int asumi, int iguti) {
	int kana = tomatu(asumi);
	int yuka = tomatu(iguti);
	if (kana != yuka) {
		if (emirinn[kana] >= emirinn[yuka]) {
			miyukichi[yuka] = kana;
			emirinn[kana] += emirinn[yuka];
		} else {
			miyukichi[kana] = yuka;
			emirinn[yuka] += emirinn[kana];
		}
	}
}

int main(void) {
	int i;
	int mizuhasu = 0;

	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 1; i <= N; i++) {
		if (scanf("%d", &p[i]) != 1) return 1;
	}
	for (i = 0; i < M; i++) {
		if (scanf("%d%d", &x[i], &y[i]) != 2) return 1;
	}

	yukinnko();
	for (i = 0; i < M; i++) {
		hayaminn(x[i], y[i]);
	}
	for (i = 1; i <= N; i++) {
		if (tomatu(i) == tomatu(p[i])) mizuhasu++;
	}
	printf("%d\n", mizuhasu);

	RIZERO ;
}
```

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	p
	.align 32
	.type	p, @object
	.size	p, 458056
p:
	.zero	458056
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 458056
x:
	.zero	458056
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 458056
y:
	.zero	458056
	.globl	miyukichi
	.align 32
	.type	miyukichi, @object
	.size	miyukichi, 458056
miyukichi:
	.zero	458056
	.globl	emirinn
	.align 32
	.type	emirinn, @object
	.size	emirinn, 458056
emirinn:
	.zero	458056
	.text
	.globl	yukinnko
	.type	yukinnko, @function
yukinnko:
.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	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%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	yukinnko, .-yukinnko
	.globl	tomatu
	.type	tomatu, @function
tomatu:
.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	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L5:
	movl	-4(%rbp), %eax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	tomatu, .-tomatu
	.globl	hayaminn
	.type	hayaminn, @function
hayaminn:
.LFB2:
	.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	tomatu
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L11
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	emirinn(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L11
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hayaminn, .-hayaminn
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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	$0, -20(%rbp)
	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	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$1, -24(%rbp)
	jmp	.L15
.L17:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -24(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L17
	movl	$0, -24(%rbp)
	jmp	.L18
.L20:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%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	.L14
.L19:
	addl	$1, -24(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L20
	call	yukinnko
	movl	$0, -24(%rbp)
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hayaminn
	addl	$1, -24(%rbp)
.L21:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L22
	movl	$1, -24(%rbp)
	jmp	.L23
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	cmpl	%eax, %ebx
	jne	.L24
	addl	$1, -20(%rbp)
.L24:
	addl	$1, -24(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	p
	.align 32
	.type	p, @object
	.size	p, 458056
p:
	.zero	458056
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 458056
x:
	.zero	458056
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 458056
y:
	.zero	458056
	.globl	miyukichi
	.align 32
	.type	miyukichi, @object
	.size	miyukichi, 458056
miyukichi:
	.zero	458056
	.globl	emirinn
	.align 32
	.type	emirinn, @object
	.size	emirinn, 458056
emirinn:
	.zero	458056
	.text
	.globl	yukinnko
	.type	yukinnko, @function
yukinnko:
.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	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%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	yukinnko, .-yukinnko
	.globl	tomatu
	.type	tomatu, @function
tomatu:
.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	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	miyukichi(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L5:
	movl	-4(%rbp), %eax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	tomatu, .-tomatu
	.globl	hayaminn
	.type	hayaminn, @function
hayaminn:
.LFB2:
	.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	tomatu
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	je	.L11
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	emirinn(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L11
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	miyukichi(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	emirinn(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	hayaminn, .-hayaminn
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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	$0, -20(%rbp)
	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	.L13
	movl	$1, %eax
	jmp	.L14
.L13:
	movl	$1, -24(%rbp)
	jmp	.L15
.L17:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L16
	movl	$1, %eax
	jmp	.L14
.L16:
	addl	$1, -24(%rbp)
.L15:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L17
	movl	$0, -24(%rbp)
	jmp	.L18
.L20:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%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	.L14
.L19:
	addl	$1, -24(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L20
	call	yukinnko
	movl	$0, -24(%rbp)
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	hayaminn
	addl	$1, -24(%rbp)
.L21:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L22
	movl	$1, -24(%rbp)
	jmp	.L23
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	tomatu
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	tomatu
	cmpl	%eax, %ebx
	jne	.L24
	addl	$1, -20(%rbp)
.L24:
	addl	$1, -24(%rbp)
.L23:
	movl	N(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
