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

```c
#include<stdio.h>
#include<stdlib.h>
int *a;
int findRoot (int x){
	if (a[x]<0) return x;
	else return a[x]=findRoot(a[x]);
}
void unite(int k1,int k2){
	int q=findRoot(k1);
	int w=findRoot(k2);	
	if (w!=q) a[w]=q;
}
int ans(int *p,int n){
	int k=0;
	while (n) {
		if(p[n-1]<0) k++;
		n--;
	}
	return k;
}
int main(){
	int n,m,i;
	scanf("%d%d",&n,&m);
	a=(int*)malloc(n*sizeof(int));
	for (i=0;i<n;i++) a[i]=-1;
	while(m){
		int k1,k2;
		scanf("%d%d",&k1,&k2);
		k1--;
		k2--;
		unite (k1,k2);
		m--;
	}
	int q=ans(a,n);
	printf("%d\n",q-1);
	free(a);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.text
	.globl	findRoot
	.type	findRoot, @function
findRoot:
.LFB6:
	.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)
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movq	a(%rip), %rcx
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	%eax, %edi
	call	findRoot
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L3:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	findRoot, .-findRoot
	.globl	unite
	.type	unite, @function
unite:
.LFB7:
	.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	findRoot
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	findRoot
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L6
	movq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	unite, .-unite
	.globl	ans
	.type	ans, @function
ans:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L9
	addl	$1, -4(%rbp)
.L9:
	subl	$1, -28(%rbp)
.L8:
	cmpl	$0, -28(%rbp)
	jne	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ans, .-ans
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, a(%rip)
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movq	a(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	jmp	.L15
.L16:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	unite
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
.L15:
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	-32(%rbp), %edx
	movq	a(%rip), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	ans
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	a(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	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	findRoot
	.type	findRoot, @function
findRoot:
.LFB39:
	.cfi_startproc
	endbr64
	movq	a(%rip), %rcx
	movslq	%edi, %rdx
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdx, %rax
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	(%rcx,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L7
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rcx,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L8
.L3:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	(%rcx,%rdx,4), %r12
	movl	(%r12), %edi
	testl	%edi, %edi
	js	.L4
	call	findRoot
	movl	%eax, (%r12)
.L4:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L3
	.cfi_endproc
.LFE39:
	.size	findRoot, .-findRoot
	.p2align 4
	.globl	unite
	.type	unite, @function
unite:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rax, %r9
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	movq	a(%rip), %r10
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	jns	.L30
	movslq	%esi, %rax
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	jns	.L31
.L19:
	cmpl	%r9d, %esi
	je	.L9
	movslq	%esi, %rsi
	movl	%r9d, (%r10,%rsi,4)
.L9:
	addq	$8, %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
.L30:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r9
	movl	(%r9), %edx
	testl	%edx, %edx
	jns	.L32
.L11:
	movl	%eax, (%r8)
	movl	%eax, %r9d
	movslq	%esi, %rax
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	js	.L19
.L31:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jns	.L33
.L20:
	movl	%eax, (%r8)
	movl	%eax, %esi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r11
	movl	(%r11), %eax
	testl	%eax, %eax
	jns	.L34
.L12:
	movl	%edx, (%r9)
	movl	%edx, %eax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L33:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r11
	movl	(%r11), %eax
	testl	%eax, %eax
	jns	.L35
.L21:
	movl	%edx, (%rsi)
	movl	%edx, %eax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L36
.L13:
	movl	%eax, (%r11)
	movl	%eax, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L37
.L22:
	movl	%eax, (%r11)
	movl	%eax, %edx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L37:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L38
.L23:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L39
.L14:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r12
	movl	(%r12), %edx
	testl	%edx, %edx
	jns	.L40
.L24:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L39:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r12
	movl	(%r12), %edx
	testl	%edx, %edx
	jns	.L41
.L15:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L14
.L40:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r13
	movl	0(%r13), %eax
	testl	%eax, %eax
	jns	.L42
.L25:
	movl	%edx, (%r12)
	movl	%edx, %eax
	jmp	.L24
.L41:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r13
	movl	0(%r13), %eax
	testl	%eax, %eax
	jns	.L43
.L16:
	movl	%edx, (%r12)
	movl	%edx, %eax
	jmp	.L15
.L42:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r14
	movl	(%r14), %edx
	testl	%edx, %edx
	jns	.L44
.L26:
	movl	%eax, 0(%r13)
	movl	%eax, %edx
	jmp	.L25
.L43:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r14
	movl	(%r14), %edx
	testl	%edx, %edx
	jns	.L45
.L17:
	movl	%eax, 0(%r13)
	movl	%eax, %edx
	jmp	.L16
.L44:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r15
	movl	(%r15), %edi
	testl	%edi, %edi
	js	.L27
	call	findRoot
	movl	%eax, (%r15)
	movl	%eax, %edx
.L27:
	movl	%edx, (%r14)
	movl	%edx, %eax
	jmp	.L26
.L45:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r15
	movl	(%r15), %edi
	testl	%edi, %edi
	js	.L18
	call	findRoot
	movl	%eax, (%r15)
	movl	%eax, %edx
.L18:
	movl	%edx, (%r14)
	movl	%edx, %eax
	jmp	.L17
	.cfi_endproc
.LFE40:
	.size	unite, .-unite
	.p2align 4
	.globl	ans
	.type	ans, @function
ans:
.LFB41:
	.cfi_startproc
	endbr64
	movq	%rdi, %rcx
	testl	%esi, %esi
	je	.L56
	leal	-1(%rsi), %edx
	movl	%esi, %r9d
	cmpl	$2, %edx
	jbe	.L57
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	-16(%rdi,%rax,4), %rdx
	movl	%esi, %edi
	movdqa	%xmm0, %xmm3
	shrl	$2, %edi
	leaq	-16(%rdx), %rax
	leal	-1(%rdi), %r8d
	movq	%rax, %rdi
	salq	$4, %r8
	subq	%r8, %rdi
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L66:
	subq	$16, %rax
.L49:
	movdqu	(%rdx), %xmm1
	movdqa	%xmm3, %xmm2
	movq	%rax, %rdx
	pshufd	$27, %xmm1, %xmm1
	pcmpgtd	%xmm1, %xmm2
	psubd	%xmm2, %xmm0
	cmpq	%rax, %rdi
	jne	.L66
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	subl	%edx, %esi
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%edx, %r9d
	je	.L46
	leal	-1(%rsi), %edx
.L48:
	movslq	%esi, %rdi
	cmpl	$-2147483648, -4(%rcx,%rdi,4)
	sbbl	$-1, %eax
	testl	%edx, %edx
	je	.L46
	movslq	%edx, %rdx
	cmpl	$-2147483648, -4(%rcx,%rdx,4)
	sbbl	$-1, %eax
	subl	$2, %esi
	je	.L46
	movslq	%esi, %rsi
	cmpl	$-2147483648, -4(%rcx,%rsi,4)
	sbbl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L56:
	xorl	%eax, %eax
.L46:
	ret
.L57:
	xorl	%eax, %eax
	jmp	.L48
	.cfi_endproc
.LFE41:
	.size	ans, .-ans
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %r12
	movq	%r12, %rbp
	salq	$2, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, a(%rip)
	movq	%rax, %r13
	testl	%ebp, %ebp
	jle	.L71
	movq	%r12, %rdx
	movl	$255, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L71:
	movl	28(%rsp), %eax
	leaq	36(%rsp), %r12
	leaq	32(%rsp), %rbp
	testl	%eax, %eax
	je	.L70
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movq	a(%rip), %r13
	leal	-1(%rax), %r8d
	movl	36(%rsp), %eax
	movl	%r8d, 32(%rsp)
	leal	-1(%rax), %esi
	movslq	%r8d, %rax
	leaq	0(%r13,%rax,4), %r9
	movl	%esi, 36(%rsp)
	movl	(%r9), %eax
	testl	%eax, %eax
	jns	.L115
.L72:
	movslq	%esi, %rax
	leaq	0(%r13,%rax,4), %r9
	movl	(%r9), %eax
	testl	%eax, %eax
	jns	.L116
	cmpl	%r8d, %esi
	je	.L88
.L121:
	movslq	%esi, %rsi
	movl	%r8d, 0(%r13,%rsi,4)
	subl	$1, 28(%rsp)
	jne	.L69
.L70:
	movl	24(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L100
	leal	-1(%rcx), %eax
	movl	%ecx, %esi
	cmpl	$2, %eax
	jbe	.L101
	movl	%ecx, %edx
	movslq	%ecx, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leaq	-16(%r13,%rax,4), %rax
	movdqa	%xmm0, %xmm3
	subl	$1, %edx
	movq	%rax, %rdi
	salq	$4, %rdx
	subq	%rdx, %rdi
	leaq	-16(%rdi), %rdx
	.p2align 4,,10
	.p2align 3
.L92:
	movdqu	(%rax), %xmm4
	movdqa	%xmm3, %xmm2
	subq	$16, %rax
	pshufd	$27, %xmm4, %xmm1
	pcmpgtd	%xmm1, %xmm2
	psubd	%xmm2, %xmm0
	cmpq	%rax, %rdx
	jne	.L92
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	subl	%eax, %ecx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %eax
	je	.L90
	leal	-1(%rcx), %eax
.L91:
	movslq	%ecx, %rsi
	cmpl	$-2147483648, -4(%r13,%rsi,4)
	sbbl	$-1, %edx
	testl	%eax, %eax
	je	.L90
	cltq
	cmpl	$0, -4(%r13,%rax,4)
	js	.L117
.L96:
	subl	$2, %ecx
	je	.L90
	movslq	%ecx, %rcx
	cmpl	$0, -4(%r13,%rcx,4)
	js	.L118
.L90:
	subl	$1, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	a(%rip), %rdi
	call	free@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L119
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L116:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jns	.L120
.L81:
	movl	%eax, %esi
	movl	%eax, (%r9)
	cmpl	%r8d, %esi
	jne	.L121
.L88:
	subl	$1, 28(%rsp)
	jne	.L69
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L115:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r8
	movl	(%r8), %edx
	testl	%edx, %edx
	jns	.L122
.L73:
	movl	%eax, (%r9)
	movl	%eax, %r8d
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L120:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r10
	movl	(%r10), %eax
	testl	%eax, %eax
	jns	.L123
.L82:
	movl	%edx, (%rsi)
	movl	%edx, %eax
	jmp	.L81
	.p2align 4,,10
	.p2align 3
.L122:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r10
	movl	(%r10), %eax
	testl	%eax, %eax
	jns	.L124
.L74:
	movl	%edx, (%r8)
	movl	%edx, %eax
	jmp	.L73
.L123:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r11
	movl	(%r11), %edx
	testl	%edx, %edx
	jns	.L125
.L83:
	movl	%eax, (%r10)
	movl	%eax, %edx
	jmp	.L82
.L124:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r11
	movl	(%r11), %edx
	testl	%edx, %edx
	jns	.L126
.L75:
	movl	%eax, (%r10)
	movl	%eax, %edx
	jmp	.L74
.L117:
	addl	$1, %edx
	jmp	.L96
.L126:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jns	.L127
.L76:
	movl	%edx, (%r11)
	movl	%edx, %eax
	jmp	.L75
.L125:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jns	.L128
.L84:
	movl	%edx, (%r11)
	movl	%edx, %eax
	jmp	.L83
.L118:
	addl	$1, %edx
	jmp	.L90
.L128:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r15
	movl	(%r15), %edx
	testl	%edx, %edx
	jns	.L129
.L85:
	movl	%eax, (%r14)
	movl	%eax, %edx
	jmp	.L84
.L127:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r15
	movl	(%r15), %edx
	testl	%edx, %edx
	jns	.L130
.L77:
	movl	%eax, (%r14)
	movl	%eax, %edx
	jmp	.L76
.L100:
	xorl	%edx, %edx
	jmp	.L90
.L101:
	xorl	%edx, %edx
	jmp	.L91
.L129:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jns	.L131
.L86:
	movl	%edx, (%r15)
	movl	%edx, %eax
	jmp	.L85
.L130:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jns	.L132
.L78:
	movl	%edx, (%r15)
	movl	%edx, %eax
	jmp	.L77
.L131:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rdx
	movl	(%rdx), %edi
	movq	%rdx, 8(%rsp)
	testl	%edi, %edi
	js	.L87
	movq	%rcx, (%rsp)
	call	findRoot
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movl	%eax, (%rdx)
.L87:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L86
.L132:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rdx
	movl	(%rdx), %edi
	movq	%rdx, 8(%rsp)
	testl	%edi, %edi
	js	.L79
	movq	%rcx, (%rsp)
	call	findRoot
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movl	%eax, (%rdx)
.L79:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L78
.L119:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.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	findRoot
	.type	findRoot, @function
findRoot:
.LFB39:
	.cfi_startproc
	endbr64
	movq	a(%rip), %rcx
	movslq	%edi, %rdx
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdx, %rax
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	(%rcx,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L7
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rcx,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L8
.L3:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	(%rcx,%rdx,4), %r12
	movl	(%r12), %edi
	testl	%edi, %edi
	js	.L4
	call	findRoot
	movl	%eax, (%r12)
.L4:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L3
	.cfi_endproc
.LFE39:
	.size	findRoot, .-findRoot
	.p2align 4
	.globl	unite
	.type	unite, @function
unite:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rax, %r9
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	movq	a(%rip), %r10
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	jns	.L30
	movslq	%esi, %rax
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	jns	.L31
.L19:
	cmpl	%r9d, %esi
	je	.L9
	movslq	%esi, %rsi
	movl	%r9d, (%r10,%rsi,4)
.L9:
	addq	$8, %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
.L30:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r9
	movl	(%r9), %edx
	testl	%edx, %edx
	jns	.L32
.L11:
	movl	%eax, (%r8)
	movl	%eax, %r9d
	movslq	%esi, %rax
	leaq	(%r10,%rax,4), %r8
	movl	(%r8), %eax
	testl	%eax, %eax
	js	.L19
.L31:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jns	.L33
.L20:
	movl	%eax, (%r8)
	movl	%eax, %esi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r11
	movl	(%r11), %eax
	testl	%eax, %eax
	jns	.L34
.L12:
	movl	%edx, (%r9)
	movl	%edx, %eax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L33:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r11
	movl	(%r11), %eax
	testl	%eax, %eax
	jns	.L35
.L21:
	movl	%edx, (%rsi)
	movl	%edx, %eax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L36
.L13:
	movl	%eax, (%r11)
	movl	%eax, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %rbx
	movl	(%rbx), %edx
	testl	%edx, %edx
	jns	.L37
.L22:
	movl	%eax, (%r11)
	movl	%eax, %edx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L37:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L38
.L23:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %rbp
	movl	0(%rbp), %eax
	testl	%eax, %eax
	jns	.L39
.L14:
	movl	%edx, (%rbx)
	movl	%edx, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r12
	movl	(%r12), %edx
	testl	%edx, %edx
	jns	.L40
.L24:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L39:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r12
	movl	(%r12), %edx
	testl	%edx, %edx
	jns	.L41
.L15:
	movl	%eax, 0(%rbp)
	movl	%eax, %edx
	jmp	.L14
.L40:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r13
	movl	0(%r13), %eax
	testl	%eax, %eax
	jns	.L42
.L25:
	movl	%edx, (%r12)
	movl	%edx, %eax
	jmp	.L24
.L41:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r13
	movl	0(%r13), %eax
	testl	%eax, %eax
	jns	.L43
.L16:
	movl	%edx, (%r12)
	movl	%edx, %eax
	jmp	.L15
.L42:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r14
	movl	(%r14), %edx
	testl	%edx, %edx
	jns	.L44
.L26:
	movl	%eax, 0(%r13)
	movl	%eax, %edx
	jmp	.L25
.L43:
	movslq	%eax, %rdx
	leaq	(%r10,%rdx,4), %r14
	movl	(%r14), %edx
	testl	%edx, %edx
	jns	.L45
.L17:
	movl	%eax, 0(%r13)
	movl	%eax, %edx
	jmp	.L16
.L44:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r15
	movl	(%r15), %edi
	testl	%edi, %edi
	js	.L27
	call	findRoot
	movl	%eax, (%r15)
	movl	%eax, %edx
.L27:
	movl	%edx, (%r14)
	movl	%edx, %eax
	jmp	.L26
.L45:
	movslq	%edx, %rax
	leaq	(%r10,%rax,4), %r15
	movl	(%r15), %edi
	testl	%edi, %edi
	js	.L18
	call	findRoot
	movl	%eax, (%r15)
	movl	%eax, %edx
.L18:
	movl	%edx, (%r14)
	movl	%edx, %eax
	jmp	.L17
	.cfi_endproc
.LFE40:
	.size	unite, .-unite
	.p2align 4
	.globl	ans
	.type	ans, @function
ans:
.LFB41:
	.cfi_startproc
	endbr64
	movq	%rdi, %rcx
	testl	%esi, %esi
	je	.L56
	leal	-1(%rsi), %edx
	movl	%esi, %r9d
	cmpl	$2, %edx
	jbe	.L57
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	-16(%rdi,%rax,4), %rdx
	movl	%esi, %edi
	movdqa	%xmm0, %xmm3
	shrl	$2, %edi
	leaq	-16(%rdx), %rax
	leal	-1(%rdi), %r8d
	movq	%rax, %rdi
	salq	$4, %r8
	subq	%r8, %rdi
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L66:
	subq	$16, %rax
.L49:
	movdqu	(%rdx), %xmm1
	movdqa	%xmm3, %xmm2
	movq	%rax, %rdx
	pshufd	$27, %xmm1, %xmm1
	pcmpgtd	%xmm1, %xmm2
	psubd	%xmm2, %xmm0
	cmpq	%rax, %rdi
	jne	.L66
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	subl	%edx, %esi
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%edx, %r9d
	je	.L46
	leal	-1(%rsi), %edx
.L48:
	movslq	%esi, %rdi
	cmpl	$-2147483648, -4(%rcx,%rdi,4)
	sbbl	$-1, %eax
	testl	%edx, %edx
	je	.L46
	movslq	%edx, %rdx
	cmpl	$-2147483648, -4(%rcx,%rdx,4)
	sbbl	$-1, %eax
	subl	$2, %esi
	je	.L46
	movslq	%esi, %rsi
	cmpl	$-2147483648, -4(%rcx,%rsi,4)
	sbbl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L56:
	xorl	%eax, %eax
.L46:
	ret
.L57:
	xorl	%eax, %eax
	jmp	.L48
	.cfi_endproc
.LFE41:
	.size	ans, .-ans
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %r12
	movq	%r12, %rbp
	salq	$2, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, a(%rip)
	movq	%rax, %r13
	testl	%ebp, %ebp
	jle	.L71
	movq	%r12, %rdx
	movl	$255, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L71:
	movl	28(%rsp), %eax
	leaq	36(%rsp), %r12
	leaq	32(%rsp), %rbp
	testl	%eax, %eax
	je	.L70
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movq	a(%rip), %r13
	leal	-1(%rax), %r8d
	movl	36(%rsp), %eax
	movl	%r8d, 32(%rsp)
	leal	-1(%rax), %esi
	movslq	%r8d, %rax
	leaq	0(%r13,%rax,4), %r9
	movl	%esi, 36(%rsp)
	movl	(%r9), %eax
	testl	%eax, %eax
	jns	.L115
.L72:
	movslq	%esi, %rax
	leaq	0(%r13,%rax,4), %r9
	movl	(%r9), %eax
	testl	%eax, %eax
	jns	.L116
	cmpl	%r8d, %esi
	je	.L88
.L121:
	movslq	%esi, %rsi
	movl	%r8d, 0(%r13,%rsi,4)
	subl	$1, 28(%rsp)
	jne	.L69
.L70:
	movl	24(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L100
	leal	-1(%rcx), %eax
	movl	%ecx, %esi
	cmpl	$2, %eax
	jbe	.L101
	movl	%ecx, %edx
	movslq	%ecx, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leaq	-16(%r13,%rax,4), %rax
	movdqa	%xmm0, %xmm3
	subl	$1, %edx
	movq	%rax, %rdi
	salq	$4, %rdx
	subq	%rdx, %rdi
	leaq	-16(%rdi), %rdx
	.p2align 4,,10
	.p2align 3
.L92:
	movdqu	(%rax), %xmm4
	movdqa	%xmm3, %xmm2
	subq	$16, %rax
	pshufd	$27, %xmm4, %xmm1
	pcmpgtd	%xmm1, %xmm2
	psubd	%xmm2, %xmm0
	cmpq	%rax, %rdx
	jne	.L92
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	subl	%eax, %ecx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %eax
	je	.L90
	leal	-1(%rcx), %eax
.L91:
	movslq	%ecx, %rsi
	cmpl	$-2147483648, -4(%r13,%rsi,4)
	sbbl	$-1, %edx
	testl	%eax, %eax
	je	.L90
	cltq
	cmpl	$0, -4(%r13,%rax,4)
	js	.L117
.L96:
	subl	$2, %ecx
	je	.L90
	movslq	%ecx, %rcx
	cmpl	$0, -4(%r13,%rcx,4)
	js	.L118
.L90:
	subl	$1, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	a(%rip), %rdi
	call	free@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L119
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L116:
	.cfi_restore_state
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rsi
	movl	(%rsi), %edx
	testl	%edx, %edx
	jns	.L120
.L81:
	movl	%eax, %esi
	movl	%eax, (%r9)
	cmpl	%r8d, %esi
	jne	.L121
.L88:
	subl	$1, 28(%rsp)
	jne	.L69
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L115:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r8
	movl	(%r8), %edx
	testl	%edx, %edx
	jns	.L122
.L73:
	movl	%eax, (%r9)
	movl	%eax, %r8d
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L120:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r10
	movl	(%r10), %eax
	testl	%eax, %eax
	jns	.L123
.L82:
	movl	%edx, (%rsi)
	movl	%edx, %eax
	jmp	.L81
	.p2align 4,,10
	.p2align 3
.L122:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r10
	movl	(%r10), %eax
	testl	%eax, %eax
	jns	.L124
.L74:
	movl	%edx, (%r8)
	movl	%edx, %eax
	jmp	.L73
.L123:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r11
	movl	(%r11), %edx
	testl	%edx, %edx
	jns	.L125
.L83:
	movl	%eax, (%r10)
	movl	%eax, %edx
	jmp	.L82
.L124:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r11
	movl	(%r11), %edx
	testl	%edx, %edx
	jns	.L126
.L75:
	movl	%eax, (%r10)
	movl	%eax, %edx
	jmp	.L74
.L117:
	addl	$1, %edx
	jmp	.L96
.L126:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jns	.L127
.L76:
	movl	%edx, (%r11)
	movl	%edx, %eax
	jmp	.L75
.L125:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jns	.L128
.L84:
	movl	%edx, (%r11)
	movl	%edx, %eax
	jmp	.L83
.L118:
	addl	$1, %edx
	jmp	.L90
.L128:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r15
	movl	(%r15), %edx
	testl	%edx, %edx
	jns	.L129
.L85:
	movl	%eax, (%r14)
	movl	%eax, %edx
	jmp	.L84
.L127:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %r15
	movl	(%r15), %edx
	testl	%edx, %edx
	jns	.L130
.L77:
	movl	%eax, (%r14)
	movl	%eax, %edx
	jmp	.L76
.L100:
	xorl	%edx, %edx
	jmp	.L90
.L101:
	xorl	%edx, %edx
	jmp	.L91
.L129:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jns	.L131
.L86:
	movl	%edx, (%r15)
	movl	%edx, %eax
	jmp	.L85
.L130:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	movl	(%rcx), %eax
	testl	%eax, %eax
	jns	.L132
.L78:
	movl	%edx, (%r15)
	movl	%edx, %eax
	jmp	.L77
.L131:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rdx
	movl	(%rdx), %edi
	movq	%rdx, 8(%rsp)
	testl	%edi, %edi
	js	.L87
	movq	%rcx, (%rsp)
	call	findRoot
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movl	%eax, (%rdx)
.L87:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L86
.L132:
	movslq	%eax, %rdx
	leaq	0(%r13,%rdx,4), %rdx
	movl	(%rdx), %edi
	movq	%rdx, 8(%rsp)
	testl	%edi, %edi
	js	.L79
	movq	%rcx, (%rsp)
	call	findRoot
	movq	8(%rsp), %rdx
	movq	(%rsp), %rcx
	movl	%eax, (%rdx)
.L79:
	movl	%eax, (%rcx)
	movl	%eax, %edx
	jmp	.L78
.L119:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>
int *a;
int findRoot (int x){
	if (a[x]<0) return x;
	else return a[x]=findRoot(a[x]);
}
void unite(int k1,int k2){
	int q=findRoot(k1);
	int w=findRoot(k2);	
	if (w!=q) a[w]=q;
}
int ans(int *p,int n){
	int k=0;
	while (n) {
		if(p[n-1]<0) k++;
		n--;
	}
	return k;
}
int main(){
	int n,m,i;
	scanf("%d%d",&n,&m);
	a=(int*)malloc(n*sizeof(int));
	for (i=0;i<n;i++) a[i]=-1;
	while(m){
		int k1,k2;
		scanf("%d%d",&k1,&k2);
		k1--;
		k2--;
		unite (k1,k2);
		m--;
	}
	int q=ans(a,n);
	printf("%d\n",q-1);
	free(a);
	return 0;
}

3 1
1 1
 5 1
1 1
 6 1
1 1
 3 1
3 2
 5 1
3 2
 2 1
1 2
 9 1
1 2
 15 1
1 2
 10 1
1 2
 10 1
1 1

2
 4
 5
 1
 3
 0
 7
 13
 8
 9

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

```c
#include<stdio.h>
#include<stdlib.h>
int *a;
int findRoot (int x){
	if (a[x]<0) return x;
	else return a[x]=findRoot(a[x]);
}
void unite(int k1,int k2){
	int q=findRoot(k1);
	int w=findRoot(k2);	
	if (w!=q) a[w]=q;
}
int ans(int *p,int n){
	int k=0;
	while (n) {
		if(p[n-1]<0) k++;
		n--;
	}
	return k;
}
int main(){
	int n,m,i;
	scanf("%d%d",&n,&m);
	a=(int*)malloc(n*sizeof(int));
	for (i=0;i<n;i++) a[i]=-1;
	while(m){
		int k1,k2;
		scanf("%d%d",&k1,&k2);
		k1--;
		k2--;
		unite (k1,k2);
		m--;
	}
	int q=ans(a,n);
	printf("%d\n",q-1);
	free(a);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.text
	.globl	findRoot
	.type	findRoot, @function
findRoot:
.LFB6:
	.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)
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movq	a(%rip), %rcx
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	%eax, %edi
	call	findRoot
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L3:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	findRoot, .-findRoot
	.globl	unite
	.type	unite, @function
unite:
.LFB7:
	.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	findRoot
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	findRoot
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L6
	movq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	unite, .-unite
	.globl	ans
	.type	ans, @function
ans:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L9
	addl	$1, -4(%rbp)
.L9:
	subl	$1, -28(%rbp)
.L8:
	cmpl	$0, -28(%rbp)
	jne	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ans, .-ans
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, a(%rip)
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movq	a(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	jmp	.L15
.L16:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	unite
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
.L15:
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	-32(%rbp), %edx
	movq	a(%rip), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	ans
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	a(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	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	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.text
	.globl	findRoot
	.type	findRoot, @function
findRoot:
.LFB6:
	.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)
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movq	a(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movq	a(%rip), %rcx
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	%eax, %edi
	call	findRoot
	movl	%eax, (%rbx)
	movl	(%rbx), %eax
.L3:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	findRoot, .-findRoot
	.globl	unite
	.type	unite, @function
unite:
.LFB7:
	.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	findRoot
	movl	%eax, -8(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	findRoot
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	je	.L6
	movq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
.L6:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	unite, .-unite
	.globl	ans
	.type	ans, @function
ans:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L9
	addl	$1, -4(%rbp)
.L9:
	subl	$1, -28(%rbp)
.L8:
	cmpl	$0, -28(%rbp)
	jne	.L10
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ans, .-ans
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, a(%rip)
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movq	a(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	jmp	.L15
.L16:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	unite
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
.L15:
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	-32(%rbp), %edx
	movq	a(%rip), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	ans
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	a(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	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:
