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

```c
#include <stdio.h>
#include <string.h>
#define NMAX 100000

int ufpar[NMAX], ufw[NMAX];

int UF_find(int);
int UF_weight(int);
int UF_union(int, int, int);
int UF_diff(int*, int, int);
int main(void)
{
  int i, n, m, l, r, d;
  scanf("%d %d", &n, &m);
  memset(ufpar, -1, sizeof(ufpar));
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &l, &r, &d);
    if (!UF_union(l - 1, r - 1, d)) {
      if (ufw[l-1] != ufw[r-1] + d) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
}

int UF_find(int a)
{
  int p;
  if (ufpar[a] < 0) return a;
  p = UF_find(ufpar[a]);
  ufw[a] += ufw[ufpar[a]];
  return ufpar[a] = p;
}

int UF_weight(int a)
{
  UF_find(a);
  return ufw[a];
}

int UF_union(int x, int y, int w)
{
  w -= UF_weight(x);
  w += UF_weight(y);
  x = UF_find(x);
  y = UF_find(y);
  if (x == y) return 0;
  if (ufpar[x] > ufpar[y]) {
    ufpar[y] += ufpar[x];
    ufpar[x] = y;
    ufw[x] = w;
  } else {
    ufpar[x] += ufpar[y];
    ufpar[y] = x;
    ufw[y] = -w;
  }
  return 1;
}

int UF_diff(int *ans, int x, int y)
{
  if (UF_find(x) != UF_find(y)) return 0;
  else {
    *ans = ufw[x] - ufw[y];
    return 1;
  }
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ufpar
	.bss
	.align 32
	.type	ufpar, @object
	.size	ufpar, 400000
ufpar:
	.zero	400000
	.globl	ufw
	.align 32
	.type	ufw, @object
	.size	ufw, 400000
ufw:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	$400000, %edx
	movl	$-1, %esi
	leaq	ufpar(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	-20(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-24(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	%eax, %edx
	movl	%ecx, %edi
	call	UF_union
	testl	%eax, %eax
	jne	.L3
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	movl	-16(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	je	.L3
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -12(%rbp)
.L2:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	UF_find
	.type	UF_find, @function
UF_find:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L8
	movl	-20(%rbp), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	UF_find, .-UF_find
	.globl	UF_weight
	.type	UF_weight, @function
UF_weight:
.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_find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	UF_weight, .-UF_weight
	.globl	UF_union
	.type	UF_union, @function
UF_union:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	subl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	addl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	negl	%eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L16:
	movl	$1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	UF_union, .-UF_union
	.globl	UF_diff
	.type	UF_diff, @function
UF_diff:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	cmpl	%eax, %ebx
	je	.L18
	movl	$0, %eax
	jmp	.L19
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	UF_diff, .-UF_diff
	.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_find
	.type	UF_find, @function
UF_find:
.LFB36:
	.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
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	ufpar(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%r12,4), %eax
	testl	%eax, %eax
	js	.L7
	movslq	%eax, %r13
	movslq	%eax, %rdx
	leaq	ufw(%rip), %rbp
	movl	(%rbx,%r13,4), %ecx
	testl	%ecx, %ecx
	js	.L3
	movslq	%ecx, %r14
	movl	%ecx, %eax
	movl	(%rbx,%r14,4), %edx
	testl	%edx, %edx
	js	.L4
	movslq	%edx, %r15
	movl	%edx, %eax
	movl	(%rbx,%r15,4), %ecx
	testl	%ecx, %ecx
	js	.L5
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	(%rbx,%rdx,4), %edi
	testl	%edi, %edi
	js	.L6
	movq	%rdx, 8(%rsp)
	call	UF_find
	movq	8(%rsp), %rdx
	movslq	(%rbx,%rdx,4), %rcx
	movl	%eax, (%rbx,%rdx,4)
	movl	0(%rbp,%rcx,4), %ecx
	addl	%ecx, 0(%rbp,%rdx,4)
	movslq	(%rbx,%r15,4), %rdx
.L6:
	movl	%eax, (%rbx,%r15,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r15,4)
	movslq	(%rbx,%r14,4), %r15
.L5:
	movl	%eax, (%rbx,%r14,4)
	movl	0(%rbp,%r15,4), %edx
	addl	%edx, 0(%rbp,%r14,4)
	movslq	(%rbx,%r13,4), %r14
.L4:
	movl	0(%rbp,%r14,4), %edx
	movl	%eax, (%rbx,%r13,4)
	addl	%edx, 0(%rbp,%r13,4)
	movslq	(%rbx,%r12,4), %rdx
.L3:
	movl	%eax, (%rbx,%r12,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r12,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
.L7:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movl	%edi, %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
	.cfi_endproc
.LFE36:
	.size	UF_find, .-UF_find
	.p2align 4
	.globl	UF_weight
	.type	UF_weight, @function
UF_weight:
.LFB37:
	.cfi_startproc
	endbr64
	leaq	ufpar(%rip), %r10
	movslq	%edi, %rsi
	movl	(%r10,%rsi,4), %edx
	testl	%edx, %edx
	js	.L31
	movslq	%edx, %r9
	movslq	%edx, %rax
	leaq	ufw(%rip), %r8
	movl	(%r10,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L27
	movslq	%ecx, %r11
	movl	%ecx, %edx
	movl	(%r10,%r11,4), %eax
	testl	%eax, %eax
	js	.L28
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%eax, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%eax, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r10,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L19
	movslq	%ecx, %rbp
	movl	%ecx, %edx
	movl	(%r10,%rbp,4), %edi
	testl	%edi, %edi
	js	.L20
	call	UF_find
	movl	%eax, %edx
	movslq	(%r10,%rbp,4), %rax
	movl	%edx, (%r10,%rbp,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%rbp,4)
	movslq	(%r10,%rbx,4), %rbp
.L20:
	movl	%edx, (%r10,%rbx,4)
	movl	(%r8,%rbp,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movslq	(%r10,%r11,4), %rbx
.L19:
	movl	(%r8,%rbx,4), %eax
	movl	%edx, (%r10,%r11,4)
	addl	%eax, (%r8,%r11,4)
	movslq	(%r10,%r9,4), %r11
	movl	%edx, (%r10,%r9,4)
	movl	(%r8,%r11,4), %eax
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
	movl	%edx, (%r10,%rsi,4)
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%eax, (%r8,%rsi,4)
	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
.L28:
	.cfi_restore 3
	.cfi_restore 6
	movl	(%r8,%r11,4), %eax
	movl	%ecx, (%r10,%r9,4)
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
.L27:
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%edx, (%r10,%rsi,4)
	movl	%eax, (%r8,%rsi,4)
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	ufw(%rip), %rax
	movl	(%rax,%rsi,4), %eax
	ret
	.cfi_endproc
.LFE37:
	.size	UF_weight, .-UF_weight
	.p2align 4
	.globl	UF_union
	.type	UF_union, @function
UF_union:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edx, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	leaq	ufpar(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	movq	%rbx, %r12
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L65
	movslq	%edx, %r11
	movl	(%rsi,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L36
	movslq	%r9d, %r13
	movslq	%r9d, %rdx
	leaq	ufw(%rip), %r8
	movl	(%rsi,%r13,4), %edi
	testl	%edi, %edi
	js	.L37
	call	UF_find
	movl	%eax, %r9d
	movslq	(%rsi,%r13,4), %rax
	movl	%r9d, (%rsi,%r13,4)
	movslq	(%rsi,%r11,4), %rdx
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r13,4)
.L37:
	movl	%r9d, (%rsi,%r11,4)
	movl	(%r8,%rdx,4), %eax
	movslq	(%rsi,%rbx,4), %rdx
	addl	%eax, (%r8,%r11,4)
	movslq	%ebp, %r11
	movl	(%r8,%rbx,4), %eax
	movl	%r9d, (%rsi,%rbx,4)
	addl	(%r8,%rdx,4), %eax
	movl	%eax, (%r8,%rbx,4)
	subl	%eax, %r10d
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L38
.L35:
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	js	.L39
	movslq	%edx, %r13
	movslq	%edx, %rcx
	movl	(%rsi,%r13,4), %edi
	testl	%edi, %edi
	js	.L40
	call	UF_find
	movl	%eax, %edx
	movslq	(%rsi,%r13,4), %rax
	movl	%edx, (%rsi,%r13,4)
	movslq	(%rsi,%r9,4), %rcx
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r13,4)
.L40:
	movl	(%r8,%rcx,4), %eax
	movl	%edx, (%rsi,%r9,4)
	movslq	(%rsi,%r11,4), %rcx
	addl	%eax, (%r8,%r9,4)
	movl	%edx, (%rsi,%r11,4)
	movl	(%rsi,%rbx,4), %r9d
	movl	(%r8,%r11,4), %eax
	addl	(%r8,%rcx,4), %eax
	movl	%eax, (%r8,%r11,4)
	addl	%eax, %r10d
	testl	%r9d, %r9d
	js	.L56
.L49:
	movslq	%r9d, %r12
	movslq	%r9d, %rdx
	movl	(%rsi,%r12,4), %eax
	testl	%eax, %eax
	js	.L42
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edi
	testl	%edi, %edi
	js	.L43
	call	UF_find
	movslq	(%rsi,%r9,4), %rdx
	movl	%eax, (%rsi,%r9,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r9,4)
	movslq	(%rsi,%r12,4), %r9
.L43:
	movl	(%r8,%r9,4), %edx
	movl	%eax, (%rsi,%r12,4)
	movl	%eax, %r9d
	addl	%edx, (%r8,%r12,4)
	movslq	(%rsi,%rbx,4), %rdx
.L42:
	movl	(%r8,%rdx,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movl	%r9d, (%rsi,%rbx,4)
	movl	(%rsi,%r11,4), %edx
.L41:
	testl	%edx, %edx
	js	.L44
.L50:
	movslq	%edx, %rbx
	movslq	%edx, %rcx
	movl	(%rsi,%rbx,4), %eax
	testl	%eax, %eax
	js	.L45
	movslq	%eax, %rbp
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L46
	call	UF_find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L46:
	movl	%eax, (%rsi,%rbx,4)
	movslq	(%rsi,%r11,4), %rcx
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movl	%eax, %edx
.L45:
	movl	(%r8,%rcx,4), %eax
	addl	%eax, (%r8,%r11,4)
	movl	%edx, %ebp
	movl	%edx, (%rsi,%r11,4)
.L44:
	xorl	%eax, %eax
	cmpl	%r9d, %ebp
	je	.L32
	movslq	%r9d, %rdx
	movslq	%ebp, %rax
	movl	(%rsi,%rdx,4), %edi
	movl	(%rsi,%rax,4), %ecx
	leal	(%rdi,%rcx), %r11d
	cmpl	%ecx, %edi
	jle	.L48
	movl	%r11d, (%rsi,%rax,4)
	movl	$1, %eax
	movl	%ebp, (%rsi,%rdx,4)
	movl	%r10d, (%r8,%rdx,4)
.L32:
	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
.L36:
	.cfi_restore_state
	leaq	ufw(%rip), %r8
	movl	(%r8,%rbx,4), %eax
	addl	(%r8,%r11,4), %eax
	movslq	%ebp, %r11
	movl	%eax, (%r8,%rbx,4)
	subl	%eax, %r10d
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	jns	.L35
	addl	(%r8,%r11,4), %r10d
	movl	%edx, %r9d
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	%ebp, %r11
	leaq	ufw(%rip), %r8
	movl	(%rsi,%r11,4), %eax
	subl	(%r8,%rbx,4), %r10d
	testl	%eax, %eax
	jns	.L35
	addl	(%r8,%r11,4), %r10d
	movl	%ebx, %r9d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L48:
	negl	%r10d
	movl	%r11d, (%rsi,%rdx,4)
	movl	%r10d, (%r8,%rax,4)
	movl	%r9d, (%rsi,%rax,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	$1, %eax
	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
.L39:
	.cfi_restore_state
	movl	(%r8,%r11,4), %edx
	addl	(%r8,%r9,4), %edx
	movl	%eax, (%rsi,%r11,4)
	movl	(%rsi,%rbx,4), %r9d
	movl	%edx, (%r8,%r11,4)
	addl	%edx, %r10d
	testl	%r9d, %r9d
	jns	.L49
	movl	%eax, %edx
	movl	%r12d, %r9d
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L38:
	addl	(%r8,%r11,4), %r10d
	testl	%r9d, %r9d
	jns	.L49
	movl	%r12d, %r9d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%r12d, %r9d
	jmp	.L41
	.cfi_endproc
.LFE38:
	.size	UF_union, .-UF_union
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$400000, %edx
	movl	$-1, %esi
	leaq	ufpar(%rip), %rdi
	call	memset@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L67
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r13
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %rbp
	leaq	.LC1(%rip), %rbx
	leaq	ufw(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%r13, %rcx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	movl	20(%rsp), %edx
	leal	-1(%rax), %esi
	movl	12(%rsp), %eax
	leal	-1(%rax), %edi
	call	UF_union
	testl	%eax, %eax
	jne	.L68
	movl	16(%rsp), %ecx
	movl	12(%rsp), %eax
	leal	-1(%rcx), %edx
	subl	$1, %eax
	movl	20(%rsp), %ecx
	movslq	%edx, %rdx
	cltq
	addl	(%r14,%rdx,4), %ecx
	cmpl	%ecx, (%r14,%rax,4)
	jne	.L74
.L68:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L70
.L67:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L69:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	addq	$40, %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
.L74:
	.cfi_restore_state
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L69
.L75:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	UF_diff
	.type	UF_diff, @function
UF_diff:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	ufpar(%rip), %r8
	movslq	%esi, %r11
	movl	%edx, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r8,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L86
	movslq	%r9d, %rbp
	movslq	%r9d, %rax
	leaq	ufw(%rip), %rsi
	movl	(%r8,%rbp,4), %edx
	testl	%edx, %edx
	js	.L78
	movslq	%edx, %r9
	movl	(%r8,%r9,4), %eax
	testl	%eax, %eax
	js	.L79
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%r8,%r12,4), %edi
	testl	%edi, %edi
	js	.L80
	call	UF_find
	movl	%eax, %edx
	movslq	(%r8,%r12,4), %rax
	movl	%edx, (%r8,%r12,4)
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r12,4)
	movslq	(%r8,%r9,4), %r12
.L80:
	movl	%edx, (%r8,%r9,4)
	movl	(%rsi,%r12,4), %eax
	addl	%eax, (%rsi,%r9,4)
	movslq	(%r8,%rbp,4), %r9
.L79:
	movl	(%rsi,%r9,4), %eax
	movl	%edx, (%r8,%rbp,4)
	movl	%edx, %r9d
	addl	%eax, (%rsi,%rbp,4)
	movslq	(%r8,%r11,4), %rax
.L78:
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r11,4)
	movl	%r9d, (%r8,%r11,4)
.L77:
	movslq	%r10d, %rbp
	movl	(%r8,%rbp,4), %eax
	testl	%eax, %eax
	js	.L90
	movslq	%eax, %r10
	movslq	%eax, %rdx
	leaq	ufw(%rip), %rsi
	movl	(%r8,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L82
	movslq	%ecx, %r12
	movl	%ecx, %eax
	movl	(%r8,%r12,4), %edx
	testl	%edx, %edx
	js	.L83
	movslq	%edx, %r13
	movl	%edx, %eax
	movl	(%r8,%r13,4), %edi
	testl	%edi, %edi
	js	.L84
	call	UF_find
	movslq	(%r8,%r13,4), %rdx
	movl	%eax, (%r8,%r13,4)
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r13,4)
	movslq	(%r8,%r12,4), %r13
.L84:
	movl	%eax, (%r8,%r12,4)
	movl	(%rsi,%r13,4), %edx
	addl	%edx, (%rsi,%r12,4)
	movslq	(%r8,%r10,4), %r12
.L83:
	movl	(%rsi,%r12,4), %edx
	movl	%eax, (%r8,%r10,4)
	addl	%edx, (%rsi,%r10,4)
	movslq	(%r8,%rbp,4), %rdx
.L82:
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%rbp,4)
	movl	%eax, (%r8,%rbp,4)
.L81:
	xorl	%r8d, %r8d
	cmpl	%r9d, %eax
	jne	.L76
	leaq	ufw(%rip), %rdx
	movl	$1, %r8d
	movl	(%rdx,%r11,4), %eax
	subl	(%rdx,%rbp,4), %eax
	movl	%eax, (%rbx)
.L76:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r8d, %eax
	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
.L90:
	.cfi_restore_state
	movl	%r10d, %eax
	jmp	.L81
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%esi, %r9d
	jmp	.L77
	.cfi_endproc
.LFE39:
	.size	UF_diff, .-UF_diff
	.globl	ufw
	.bss
	.align 32
	.type	ufw, @object
	.size	ufw, 400000
ufw:
	.zero	400000
	.globl	ufpar
	.align 32
	.type	ufpar, @object
	.size	ufpar, 400000
ufpar:
	.zero	400000
	.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_find
	.type	UF_find, @function
UF_find:
.LFB36:
	.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
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	ufpar(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%r12,4), %eax
	testl	%eax, %eax
	js	.L7
	movslq	%eax, %r13
	movslq	%eax, %rdx
	leaq	ufw(%rip), %rbp
	movl	(%rbx,%r13,4), %ecx
	testl	%ecx, %ecx
	js	.L3
	movslq	%ecx, %r14
	movl	%ecx, %eax
	movl	(%rbx,%r14,4), %edx
	testl	%edx, %edx
	js	.L4
	movslq	%edx, %r15
	movl	%edx, %eax
	movl	(%rbx,%r15,4), %ecx
	testl	%ecx, %ecx
	js	.L5
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	(%rbx,%rdx,4), %edi
	testl	%edi, %edi
	js	.L6
	movq	%rdx, 8(%rsp)
	call	UF_find
	movq	8(%rsp), %rdx
	movslq	(%rbx,%rdx,4), %rcx
	movl	%eax, (%rbx,%rdx,4)
	movl	0(%rbp,%rcx,4), %ecx
	addl	%ecx, 0(%rbp,%rdx,4)
	movslq	(%rbx,%r15,4), %rdx
.L6:
	movl	%eax, (%rbx,%r15,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r15,4)
	movslq	(%rbx,%r14,4), %r15
.L5:
	movl	%eax, (%rbx,%r14,4)
	movl	0(%rbp,%r15,4), %edx
	addl	%edx, 0(%rbp,%r14,4)
	movslq	(%rbx,%r13,4), %r14
.L4:
	movl	0(%rbp,%r14,4), %edx
	movl	%eax, (%rbx,%r13,4)
	addl	%edx, 0(%rbp,%r13,4)
	movslq	(%rbx,%r12,4), %rdx
.L3:
	movl	%eax, (%rbx,%r12,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r12,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
.L7:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movl	%edi, %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
	.cfi_endproc
.LFE36:
	.size	UF_find, .-UF_find
	.p2align 4
	.globl	UF_weight
	.type	UF_weight, @function
UF_weight:
.LFB37:
	.cfi_startproc
	endbr64
	leaq	ufpar(%rip), %r10
	movslq	%edi, %rsi
	movl	(%r10,%rsi,4), %edx
	testl	%edx, %edx
	js	.L31
	movslq	%edx, %r9
	movslq	%edx, %rax
	leaq	ufw(%rip), %r8
	movl	(%r10,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L27
	movslq	%ecx, %r11
	movl	%ecx, %edx
	movl	(%r10,%r11,4), %eax
	testl	%eax, %eax
	js	.L28
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%eax, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%eax, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r10,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L19
	movslq	%ecx, %rbp
	movl	%ecx, %edx
	movl	(%r10,%rbp,4), %edi
	testl	%edi, %edi
	js	.L20
	call	UF_find
	movl	%eax, %edx
	movslq	(%r10,%rbp,4), %rax
	movl	%edx, (%r10,%rbp,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%rbp,4)
	movslq	(%r10,%rbx,4), %rbp
.L20:
	movl	%edx, (%r10,%rbx,4)
	movl	(%r8,%rbp,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movslq	(%r10,%r11,4), %rbx
.L19:
	movl	(%r8,%rbx,4), %eax
	movl	%edx, (%r10,%r11,4)
	addl	%eax, (%r8,%r11,4)
	movslq	(%r10,%r9,4), %r11
	movl	%edx, (%r10,%r9,4)
	movl	(%r8,%r11,4), %eax
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
	movl	%edx, (%r10,%rsi,4)
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%eax, (%r8,%rsi,4)
	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
.L28:
	.cfi_restore 3
	.cfi_restore 6
	movl	(%r8,%r11,4), %eax
	movl	%ecx, (%r10,%r9,4)
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
.L27:
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%edx, (%r10,%rsi,4)
	movl	%eax, (%r8,%rsi,4)
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	ufw(%rip), %rax
	movl	(%rax,%rsi,4), %eax
	ret
	.cfi_endproc
.LFE37:
	.size	UF_weight, .-UF_weight
	.p2align 4
	.globl	UF_union
	.type	UF_union, @function
UF_union:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edx, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	leaq	ufpar(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	movq	%rbx, %r12
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L65
	movslq	%edx, %r11
	movl	(%rsi,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L36
	movslq	%r9d, %r13
	movslq	%r9d, %rdx
	leaq	ufw(%rip), %r8
	movl	(%rsi,%r13,4), %edi
	testl	%edi, %edi
	js	.L37
	call	UF_find
	movl	%eax, %r9d
	movslq	(%rsi,%r13,4), %rax
	movl	%r9d, (%rsi,%r13,4)
	movslq	(%rsi,%r11,4), %rdx
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r13,4)
.L37:
	movl	%r9d, (%rsi,%r11,4)
	movl	(%r8,%rdx,4), %eax
	movslq	(%rsi,%rbx,4), %rdx
	addl	%eax, (%r8,%r11,4)
	movslq	%ebp, %r11
	movl	(%r8,%rbx,4), %eax
	movl	%r9d, (%rsi,%rbx,4)
	addl	(%r8,%rdx,4), %eax
	movl	%eax, (%r8,%rbx,4)
	subl	%eax, %r10d
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L38
.L35:
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	js	.L39
	movslq	%edx, %r13
	movslq	%edx, %rcx
	movl	(%rsi,%r13,4), %edi
	testl	%edi, %edi
	js	.L40
	call	UF_find
	movl	%eax, %edx
	movslq	(%rsi,%r13,4), %rax
	movl	%edx, (%rsi,%r13,4)
	movslq	(%rsi,%r9,4), %rcx
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r13,4)
.L40:
	movl	(%r8,%rcx,4), %eax
	movl	%edx, (%rsi,%r9,4)
	movslq	(%rsi,%r11,4), %rcx
	addl	%eax, (%r8,%r9,4)
	movl	%edx, (%rsi,%r11,4)
	movl	(%rsi,%rbx,4), %r9d
	movl	(%r8,%r11,4), %eax
	addl	(%r8,%rcx,4), %eax
	movl	%eax, (%r8,%r11,4)
	addl	%eax, %r10d
	testl	%r9d, %r9d
	js	.L56
.L49:
	movslq	%r9d, %r12
	movslq	%r9d, %rdx
	movl	(%rsi,%r12,4), %eax
	testl	%eax, %eax
	js	.L42
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edi
	testl	%edi, %edi
	js	.L43
	call	UF_find
	movslq	(%rsi,%r9,4), %rdx
	movl	%eax, (%rsi,%r9,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r9,4)
	movslq	(%rsi,%r12,4), %r9
.L43:
	movl	(%r8,%r9,4), %edx
	movl	%eax, (%rsi,%r12,4)
	movl	%eax, %r9d
	addl	%edx, (%r8,%r12,4)
	movslq	(%rsi,%rbx,4), %rdx
.L42:
	movl	(%r8,%rdx,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movl	%r9d, (%rsi,%rbx,4)
	movl	(%rsi,%r11,4), %edx
.L41:
	testl	%edx, %edx
	js	.L44
.L50:
	movslq	%edx, %rbx
	movslq	%edx, %rcx
	movl	(%rsi,%rbx,4), %eax
	testl	%eax, %eax
	js	.L45
	movslq	%eax, %rbp
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L46
	call	UF_find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L46:
	movl	%eax, (%rsi,%rbx,4)
	movslq	(%rsi,%r11,4), %rcx
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movl	%eax, %edx
.L45:
	movl	(%r8,%rcx,4), %eax
	addl	%eax, (%r8,%r11,4)
	movl	%edx, %ebp
	movl	%edx, (%rsi,%r11,4)
.L44:
	xorl	%eax, %eax
	cmpl	%r9d, %ebp
	je	.L32
	movslq	%r9d, %rdx
	movslq	%ebp, %rax
	movl	(%rsi,%rdx,4), %edi
	movl	(%rsi,%rax,4), %ecx
	leal	(%rdi,%rcx), %r11d
	cmpl	%ecx, %edi
	jle	.L48
	movl	%r11d, (%rsi,%rax,4)
	movl	$1, %eax
	movl	%ebp, (%rsi,%rdx,4)
	movl	%r10d, (%r8,%rdx,4)
.L32:
	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
.L36:
	.cfi_restore_state
	leaq	ufw(%rip), %r8
	movl	(%r8,%rbx,4), %eax
	addl	(%r8,%r11,4), %eax
	movslq	%ebp, %r11
	movl	%eax, (%r8,%rbx,4)
	subl	%eax, %r10d
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	jns	.L35
	addl	(%r8,%r11,4), %r10d
	movl	%edx, %r9d
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	%ebp, %r11
	leaq	ufw(%rip), %r8
	movl	(%rsi,%r11,4), %eax
	subl	(%r8,%rbx,4), %r10d
	testl	%eax, %eax
	jns	.L35
	addl	(%r8,%r11,4), %r10d
	movl	%ebx, %r9d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L48:
	negl	%r10d
	movl	%r11d, (%rsi,%rdx,4)
	movl	%r10d, (%r8,%rax,4)
	movl	%r9d, (%rsi,%rax,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	$1, %eax
	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
.L39:
	.cfi_restore_state
	movl	(%r8,%r11,4), %edx
	addl	(%r8,%r9,4), %edx
	movl	%eax, (%rsi,%r11,4)
	movl	(%rsi,%rbx,4), %r9d
	movl	%edx, (%r8,%r11,4)
	addl	%edx, %r10d
	testl	%r9d, %r9d
	jns	.L49
	movl	%eax, %edx
	movl	%r12d, %r9d
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L38:
	addl	(%r8,%r11,4), %r10d
	testl	%r9d, %r9d
	jns	.L49
	movl	%r12d, %r9d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%r12d, %r9d
	jmp	.L41
	.cfi_endproc
.LFE38:
	.size	UF_union, .-UF_union
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$400000, %edx
	movl	$-1, %esi
	leaq	ufpar(%rip), %rdi
	call	memset@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L67
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r13
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %rbp
	leaq	.LC1(%rip), %rbx
	leaq	ufw(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%r13, %rcx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	movl	20(%rsp), %edx
	leal	-1(%rax), %esi
	movl	12(%rsp), %eax
	leal	-1(%rax), %edi
	call	UF_union
	testl	%eax, %eax
	jne	.L68
	movl	16(%rsp), %ecx
	movl	12(%rsp), %eax
	leal	-1(%rcx), %edx
	subl	$1, %eax
	movl	20(%rsp), %ecx
	movslq	%edx, %rdx
	cltq
	addl	(%r14,%rdx,4), %ecx
	cmpl	%ecx, (%r14,%rax,4)
	jne	.L74
.L68:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L70
.L67:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L69:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	addq	$40, %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
.L74:
	.cfi_restore_state
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L69
.L75:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	UF_diff
	.type	UF_diff, @function
UF_diff:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	ufpar(%rip), %r8
	movslq	%esi, %r11
	movl	%edx, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r8,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L86
	movslq	%r9d, %rbp
	movslq	%r9d, %rax
	leaq	ufw(%rip), %rsi
	movl	(%r8,%rbp,4), %edx
	testl	%edx, %edx
	js	.L78
	movslq	%edx, %r9
	movl	(%r8,%r9,4), %eax
	testl	%eax, %eax
	js	.L79
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%r8,%r12,4), %edi
	testl	%edi, %edi
	js	.L80
	call	UF_find
	movl	%eax, %edx
	movslq	(%r8,%r12,4), %rax
	movl	%edx, (%r8,%r12,4)
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r12,4)
	movslq	(%r8,%r9,4), %r12
.L80:
	movl	%edx, (%r8,%r9,4)
	movl	(%rsi,%r12,4), %eax
	addl	%eax, (%rsi,%r9,4)
	movslq	(%r8,%rbp,4), %r9
.L79:
	movl	(%rsi,%r9,4), %eax
	movl	%edx, (%r8,%rbp,4)
	movl	%edx, %r9d
	addl	%eax, (%rsi,%rbp,4)
	movslq	(%r8,%r11,4), %rax
.L78:
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r11,4)
	movl	%r9d, (%r8,%r11,4)
.L77:
	movslq	%r10d, %rbp
	movl	(%r8,%rbp,4), %eax
	testl	%eax, %eax
	js	.L90
	movslq	%eax, %r10
	movslq	%eax, %rdx
	leaq	ufw(%rip), %rsi
	movl	(%r8,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L82
	movslq	%ecx, %r12
	movl	%ecx, %eax
	movl	(%r8,%r12,4), %edx
	testl	%edx, %edx
	js	.L83
	movslq	%edx, %r13
	movl	%edx, %eax
	movl	(%r8,%r13,4), %edi
	testl	%edi, %edi
	js	.L84
	call	UF_find
	movslq	(%r8,%r13,4), %rdx
	movl	%eax, (%r8,%r13,4)
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r13,4)
	movslq	(%r8,%r12,4), %r13
.L84:
	movl	%eax, (%r8,%r12,4)
	movl	(%rsi,%r13,4), %edx
	addl	%edx, (%rsi,%r12,4)
	movslq	(%r8,%r10,4), %r12
.L83:
	movl	(%rsi,%r12,4), %edx
	movl	%eax, (%r8,%r10,4)
	addl	%edx, (%rsi,%r10,4)
	movslq	(%r8,%rbp,4), %rdx
.L82:
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%rbp,4)
	movl	%eax, (%r8,%rbp,4)
.L81:
	xorl	%r8d, %r8d
	cmpl	%r9d, %eax
	jne	.L76
	leaq	ufw(%rip), %rdx
	movl	$1, %r8d
	movl	(%rdx,%r11,4), %eax
	subl	(%rdx,%rbp,4), %eax
	movl	%eax, (%rbx)
.L76:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r8d, %eax
	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
.L90:
	.cfi_restore_state
	movl	%r10d, %eax
	jmp	.L81
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%esi, %r9d
	jmp	.L77
	.cfi_endproc
.LFE39:
	.size	UF_diff, .-UF_diff
	.globl	ufw
	.bss
	.align 32
	.type	ufw, @object
	.size	ufw, 400000
ufw:
	.zero	400000
	.globl	ufpar
	.align 32
	.type	ufpar, @object
	.size	ufpar, 400000
ufpar:
	.zero	400000
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
#define NMAX 100000

int ufpar[NMAX], ufw[NMAX];

int UF_find(int);
int UF_weight(int);
int UF_union(int, int, int);
int UF_diff(int*, int, int);
int main(void)
{
  int i, n, m, l, r, d;
  scanf("%d %d", &n, &m);
  memset(ufpar, -1, sizeof(ufpar));
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &l, &r, &d);
    if (!UF_union(l - 1, r - 1, d)) {
      if (ufw[l-1] != ufw[r-1] + d) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
}

int UF_find(int a)
{
  int p;
  if (ufpar[a] < 0) return a;
  p = UF_find(ufpar[a]);
  ufw[a] += ufw[ufpar[a]];
  return ufpar[a] = p;
}

int UF_weight(int a)
{
  UF_find(a);
  return ufw[a];
}

int UF_union(int x, int y, int w)
{
  w -= UF_weight(x);
  w += UF_weight(y);
  x = UF_find(x);
  y = UF_find(y);
  if (x == y) return 0;
  if (ufpar[x] > ufpar[y]) {
    ufpar[y] += ufpar[x];
    ufpar[x] = y;
    ufw[x] = w;
  } else {
    ufpar[x] += ufpar[y];
    ufpar[y] = x;
    ufw[y] = -w;
  }
  return 1;
}

int UF_diff(int *ans, int x, int y)
{
  if (UF_find(x) != UF_find(y)) return 0;
  else {
    *ans = ufw[x] - ufw[y];
    return 1;
  }
}
000 0
 10 3
8 7 000
7 9 100
9 8 100
 4 3
2 1 1
2 3 3
3 4 2
 10 3
8 7 000
7 9 110
9 8 100
 4 3
1 1 1
2 3 3
3 4 2
 10 3
9 7 000
7 9 110
9 8 100
 4 3
1 1 1
2 3 3
4 4 2
 10 3
9 2 000
7 9 110
9 8 100
 4 3
1 1 1
2 3 3
4 4 1
 10 0
9 2 000
7 9 110
9 8 100

Yes
 No
 Yes
 No
 No
 No
 No
 Yes
 No
 Yes

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

```c
#include <stdio.h>
#include <string.h>
#define NMAX 100000

int ufpar[NMAX], ufw[NMAX];

int UF_find(int);
int UF_weight(int);
int UF_union(int, int, int);
int UF_diff(int*, int, int);
int main(void)
{
  int i, n, m, l, r, d;
  scanf("%d %d", &n, &m);
  memset(ufpar, -1, sizeof(ufpar));
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &l, &r, &d);
    if (!UF_union(l - 1, r - 1, d)) {
      if (ufw[l-1] != ufw[r-1] + d) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
}

int UF_find(int a)
{
  int p;
  if (ufpar[a] < 0) return a;
  p = UF_find(ufpar[a]);
  ufw[a] += ufw[ufpar[a]];
  return ufpar[a] = p;
}

int UF_weight(int a)
{
  UF_find(a);
  return ufw[a];
}

int UF_union(int x, int y, int w)
{
  w -= UF_weight(x);
  w += UF_weight(y);
  x = UF_find(x);
  y = UF_find(y);
  if (x == y) return 0;
  if (ufpar[x] > ufpar[y]) {
    ufpar[y] += ufpar[x];
    ufpar[x] = y;
    ufw[x] = w;
  } else {
    ufpar[x] += ufpar[y];
    ufpar[y] = x;
    ufw[y] = -w;
  }
  return 1;
}

int UF_diff(int *ans, int x, int y)
{
  if (UF_find(x) != UF_find(y)) return 0;
  else {
    *ans = ufw[x] - ufw[y];
    return 1;
  }
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ufpar
	.bss
	.align 32
	.type	ufpar, @object
	.size	ufpar, 400000
ufpar:
	.zero	400000
	.globl	ufw
	.align 32
	.type	ufw, @object
	.size	ufw, 400000
ufw:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	$400000, %edx
	movl	$-1, %esi
	leaq	ufpar(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	-20(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-24(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	%eax, %edx
	movl	%ecx, %edi
	call	UF_union
	testl	%eax, %eax
	jne	.L3
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	movl	-16(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	je	.L3
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -12(%rbp)
.L2:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	UF_find
	.type	UF_find, @function
UF_find:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L8
	movl	-20(%rbp), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	UF_find, .-UF_find
	.globl	UF_weight
	.type	UF_weight, @function
UF_weight:
.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_find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	UF_weight, .-UF_weight
	.globl	UF_union
	.type	UF_union, @function
UF_union:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	subl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	addl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	negl	%eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L16:
	movl	$1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	UF_union, .-UF_union
	.globl	UF_diff
	.type	UF_diff, @function
UF_diff:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	cmpl	%eax, %ebx
	je	.L18
	movl	$0, %eax
	jmp	.L19
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	UF_diff, .-UF_diff
	.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	ufpar
	.bss
	.align 32
	.type	ufpar, @object
	.size	ufpar, 400000
ufpar:
	.zero	400000
	.globl	ufw
	.align 32
	.type	ufw, @object
	.size	ufw, 400000
ufw:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	$400000, %edx
	movl	$-1, %esi
	leaq	ufpar(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	-20(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-24(%rbp), %edx
	leal	-1(%rdx), %ecx
	movl	%eax, %edx
	movl	%ecx, %edi
	call	UF_union
	testl	%eax, %eax
	jne	.L3
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	movl	-16(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	je	.L3
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -12(%rbp)
.L2:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L4:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	UF_find
	.type	UF_find, @function
UF_find:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L8
	movl	-20(%rbp), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	UF_find, .-UF_find
	.globl	UF_weight
	.type	UF_weight, @function
UF_weight:
.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_find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	UF_weight, .-UF_weight
	.globl	UF_union
	.type	UF_union, @function
UF_union:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	subl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_weight
	addl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufpar(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ufpar(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	negl	%eax
	movl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L16:
	movl	$1, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	UF_union, .-UF_union
	.globl	UF_diff
	.type	UF_diff, @function
UF_diff:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	UF_find
	cmpl	%eax, %ebx
	je	.L18
	movl	$0, %eax
	jmp	.L19
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ufw(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ufw(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	UF_diff, .-UF_diff
	.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:
