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 g[100001];
int di[100001];

int dfs(int i){
    if(g[i]!=i){
        int r = dfs(g[i]);
        di[i]+=di[g[i]];
        //printf("di[%d]=%d\n",i,di[i]);
        return g[i]=r;
    }else{
        return i;
    }
}
int main(){
    int i,j;
    int N,M;
    scanf("%d %d",&N,&M);
    for(i=1;i<=N;i++)g[i]=i;
    for(i=0;i<M;i++){
        int l,r,d;
        scanf("%d %d %d",&l,&r,&d);
        int g1=dfs(l);
        int g2=dfs(r);
        if(g1!=g2){
            g[g2]=l;
            di[g2]=d-di[r];
        }  else{
            //printf("di[%d](%d)-di[%d](%d)!=%d\n",r,di[r],l,di[l],d);
            if(di[r]-di[l]!=d){
                printf("No\n");
                return 0;
            }
        }
    }
    //printf("%d %d %d\n",di[1],di[2],di[3]);
    printf("Yes\n");
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 400004
g:
	.zero	400004
	.globl	di
	.align 32
	.type	di, @object
	.size	di, 400004
di:
	.zero	400004
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB6:
	.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	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	je	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L6
	movl	$0, -20(%rbp)
	jmp	.L7
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L8
	movl	-32(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	g(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	je	.L9
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L10
.L9:
	addl	$1, -20(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L10:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	dfs
	.type	dfs, @function
dfs:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	g(%rip), %rbx
	movq	%rbp, %rax
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L13
	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
.L13:
	.cfi_restore_state
	movslq	%edx, %r13
	leaq	di(%rip), %r12
	movl	(%rbx,%r13,4), %eax
	movslq	%eax, %rcx
	cmpl	%eax, %edx
	je	.L3
	movslq	%eax, %r14
	movslq	(%rbx,%r14,4), %rdx
	cmpl	%edx, %eax
	jne	.L14
.L4:
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r13,4)
	movl	%eax, (%rbx,%r13,4)
	movslq	(%rbx,%rbp,4), %rcx
.L3:
	movl	%eax, (%rbx,%rbp,4)
	movl	(%r12,%rcx,4), %edx
	addl	%edx, (%r12,%rbp,4)
	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
.L14:
	.cfi_restore_state
	movslq	%edx, %r15
	movslq	(%rbx,%r15,4), %rdi
	movl	%edi, %eax
	cmpl	%edi, %edx
	je	.L5
	call	dfs
	movslq	(%rbx,%r15,4), %rdx
	movl	%eax, (%rbx,%r15,4)
	movslq	(%rbx,%r14,4), %rdi
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r15,4)
.L5:
	movl	(%r12,%rdi,4), %edx
	movl	%eax, (%rbx,%r14,4)
	addl	%edx, (%r12,%r14,4)
	movslq	(%rbx,%r13,4), %rdx
	jmp	.L4
	.cfi_endproc
.LFE39:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d"
.LC3:
	.string	"Yes"
.LC4:
	.string	"%d %d %d"
.LC5:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L22
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L41
	movl	%ecx, %edx
	leaq	4+g(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edx
	leaq	16(%rax), %rsi
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L20:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L20
	movl	%ecx, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %ecx
	je	.L22
.L19:
	movslq	%eax, %rdx
	leaq	g(%rip), %rbp
	movl	%eax, 0(%rbp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jg	.L22
	movslq	%edx, %rsi
	addl	$2, %eax
	movl	%edx, 0(%rbp,%rsi,4)
	cmpl	%eax, %ecx
	jl	.L22
	movslq	%eax, %rdx
	movl	%eax, 0(%rbp,%rdx,4)
.L22:
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	xorl	%r14d, %r14d
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	g(%rip), %rbp
	leaq	28(%rsp), %r15
	leaq	di(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%r15, %rsi
	movq	%r13, %rcx
	movq	%r12, %rdx
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rdi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %r8
	movl	0(%rbp,%r8,4), %esi
	cmpl	%esi, %r8d
	je	.L25
	movslq	%esi, %r9
	movl	0(%rbp,%r9,4), %eax
	movslq	%eax, %rdx
	cmpl	%eax, %esi
	je	.L26
	movslq	%eax, %rsi
	movslq	0(%rbp,%rsi,4), %rdx
	cmpl	%edx, %eax
	je	.L27
	movslq	%edx, %r10
	movslq	0(%rbp,%r10,4), %rcx
	movl	%ecx, %eax
	cmpl	%ecx, %edx
	je	.L28
	movslq	%ecx, %r11
	movl	0(%rbp,%r11,4), %eax
	cmpl	%eax, %ecx
	jne	.L52
.L29:
	movslq	0(%rbp,%r10,4), %rdx
	movl	%eax, 0(%rbp,%r10,4)
	movslq	0(%rbp,%rsi,4), %rcx
	movl	(%rbx,%rdx,4), %edx
	addl	%edx, (%rbx,%r10,4)
.L28:
	movl	(%rbx,%rcx,4), %edx
	movl	%eax, 0(%rbp,%rsi,4)
	addl	%edx, (%rbx,%rsi,4)
	movslq	0(%rbp,%r9,4), %rdx
.L27:
	movl	(%rbx,%rdx,4), %edx
	movl	%eax, 0(%rbp,%r9,4)
	addl	%edx, (%rbx,%r9,4)
	movslq	0(%rbp,%r8,4), %rdx
.L26:
	movl	(%rbx,%rdx,4), %edx
	addl	%edx, (%rbx,%r8,4)
	movl	%eax, %esi
	movl	%eax, 0(%rbp,%r8,4)
.L25:
	movslq	32(%rsp), %r8
	movslq	0(%rbp,%r8,4), %rax
	movq	%r8, %rdx
	movslq	%eax, %rdi
	cmpl	%eax, %r8d
	je	.L31
	movslq	%eax, %r9
	movl	0(%rbp,%r9,4), %ecx
	cmpl	%ecx, %eax
	je	.L46
	movslq	%ecx, %r10
	movslq	%r8d, %rax
	movslq	0(%rbp,%r10,4), %rdi
	cmpl	%edi, %ecx
	je	.L33
	movslq	%edi, %rcx
	movslq	0(%rbp,%rcx,4), %r11
	movq	%rcx, (%rsp)
	movl	%r11d, %ecx
	cmpl	%r11d, %edi
	je	.L34
	movslq	%r11d, %rax
	movl	0(%rbp,%rax,4), %ecx
	movq	%rax, 8(%rsp)
	cmpl	%ecx, %r11d
	jne	.L53
.L35:
	movq	(%rsp), %rdi
	movslq	0(%rbp,%rdi,4), %rax
	movl	%ecx, 0(%rbp,%rdi,4)
	movslq	0(%rbp,%r10,4), %r11
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rdi,4)
	movslq	%edx, %rax
.L34:
	movl	(%rbx,%r11,4), %edx
	addl	%edx, (%rbx,%r10,4)
	movl	%ecx, 0(%rbp,%r10,4)
	movslq	0(%rbp,%r9,4), %rdi
.L33:
	movl	(%rbx,%rdi,4), %edx
	addl	%edx, (%rbx,%r9,4)
	movl	%ecx, 0(%rbp,%r9,4)
	movslq	0(%rbp,%r8,4), %rdi
.L32:
	movl	(%rbx,%rdi,4), %edx
	addl	%edx, (%rbx,%r8,4)
	movslq	%ecx, %rdi
	movl	%ecx, 0(%rbp,%r8,4)
.L31:
	movl	(%rbx,%rax,4), %edx
	movslq	28(%rsp), %rcx
	movl	36(%rsp), %eax
	cmpl	%esi, %edi
	je	.L37
	subl	%edx, %eax
	movl	%ecx, 0(%rbp,%rdi,4)
	movl	%eax, (%rbx,%rdi,4)
.L38:
	addl	$1, %r14d
	cmpl	%r14d, 24(%rsp)
	jg	.L17
.L18:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L24:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	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
.L37:
	.cfi_restore_state
	subl	(%rbx,%rcx,4), %edx
	cmpl	%eax, %edx
	je	.L38
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%r8d, %rax
	jmp	.L32
.L53:
	movslq	%ecx, %r11
	movl	0(%rbp,%r11,4), %edi
	cmpl	%edi, %ecx
	jne	.L55
.L36:
	movq	8(%rsp), %rcx
	movslq	0(%rbp,%rcx,4), %rax
	movl	%edi, 0(%rbp,%rcx,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rcx,4)
	movl	%edi, %ecx
	jmp	.L35
.L52:
	movslq	%eax, %rdx
	movl	0(%rbp,%rdx,4), %edi
	movq	%rdx, (%rsp)
	cmpl	%edi, %eax
	jne	.L56
.L30:
	movslq	0(%rbp,%r11,4), %rax
	movl	%edi, 0(%rbp,%r11,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%r11,4)
	movl	%edi, %eax
	jmp	.L29
.L56:
	call	dfs
	movq	(%rsp), %rdx
	movl	%eax, %edi
	movslq	0(%rbp,%rdx,4), %rax
	movl	%edi, 0(%rbp,%rdx,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L30
.L55:
	call	dfs
	movl	32(%rsp), %edx
	movl	%eax, %edi
	movslq	0(%rbp,%r11,4), %rax
	movl	%edi, 0(%rbp,%r11,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%r11,4)
	jmp	.L36
.L41:
	movl	$1, %eax
	jmp	.L19
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	di
	.bss
	.align 32
	.type	di, @object
	.size	di, 400004
di:
	.zero	400004
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 400004
g:
	.zero	400004
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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	dfs
	.type	dfs, @function
dfs:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	g(%rip), %rbx
	movq	%rbp, %rax
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L13
	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
.L13:
	.cfi_restore_state
	movslq	%edx, %r13
	leaq	di(%rip), %r12
	movl	(%rbx,%r13,4), %eax
	movslq	%eax, %rcx
	cmpl	%eax, %edx
	je	.L3
	movslq	%eax, %r14
	movslq	(%rbx,%r14,4), %rdx
	cmpl	%edx, %eax
	jne	.L14
.L4:
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r13,4)
	movl	%eax, (%rbx,%r13,4)
	movslq	(%rbx,%rbp,4), %rcx
.L3:
	movl	%eax, (%rbx,%rbp,4)
	movl	(%r12,%rcx,4), %edx
	addl	%edx, (%r12,%rbp,4)
	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
.L14:
	.cfi_restore_state
	movslq	%edx, %r15
	movslq	(%rbx,%r15,4), %rdi
	movl	%edi, %eax
	cmpl	%edi, %edx
	je	.L5
	call	dfs
	movslq	(%rbx,%r15,4), %rdx
	movl	%eax, (%rbx,%r15,4)
	movslq	(%rbx,%r14,4), %rdi
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r15,4)
.L5:
	movl	(%r12,%rdi,4), %edx
	movl	%eax, (%rbx,%r14,4)
	addl	%edx, (%r12,%r14,4)
	movslq	(%rbx,%r13,4), %rdx
	jmp	.L4
	.cfi_endproc
.LFE39:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d"
.LC3:
	.string	"Yes"
.LC4:
	.string	"%d %d %d"
.LC5:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L22
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L41
	movl	%ecx, %edx
	leaq	4+g(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edx
	leaq	16(%rax), %rsi
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L20:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L20
	movl	%ecx, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %ecx
	je	.L22
.L19:
	movslq	%eax, %rdx
	leaq	g(%rip), %rbp
	movl	%eax, 0(%rbp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jg	.L22
	movslq	%edx, %rsi
	addl	$2, %eax
	movl	%edx, 0(%rbp,%rsi,4)
	cmpl	%eax, %ecx
	jl	.L22
	movslq	%eax, %rdx
	movl	%eax, 0(%rbp,%rdx,4)
.L22:
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	xorl	%r14d, %r14d
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	g(%rip), %rbp
	leaq	28(%rsp), %r15
	leaq	di(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%r15, %rsi
	movq	%r13, %rcx
	movq	%r12, %rdx
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rdi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %r8
	movl	0(%rbp,%r8,4), %esi
	cmpl	%esi, %r8d
	je	.L25
	movslq	%esi, %r9
	movl	0(%rbp,%r9,4), %eax
	movslq	%eax, %rdx
	cmpl	%eax, %esi
	je	.L26
	movslq	%eax, %rsi
	movslq	0(%rbp,%rsi,4), %rdx
	cmpl	%edx, %eax
	je	.L27
	movslq	%edx, %r10
	movslq	0(%rbp,%r10,4), %rcx
	movl	%ecx, %eax
	cmpl	%ecx, %edx
	je	.L28
	movslq	%ecx, %r11
	movl	0(%rbp,%r11,4), %eax
	cmpl	%eax, %ecx
	jne	.L52
.L29:
	movslq	0(%rbp,%r10,4), %rdx
	movl	%eax, 0(%rbp,%r10,4)
	movslq	0(%rbp,%rsi,4), %rcx
	movl	(%rbx,%rdx,4), %edx
	addl	%edx, (%rbx,%r10,4)
.L28:
	movl	(%rbx,%rcx,4), %edx
	movl	%eax, 0(%rbp,%rsi,4)
	addl	%edx, (%rbx,%rsi,4)
	movslq	0(%rbp,%r9,4), %rdx
.L27:
	movl	(%rbx,%rdx,4), %edx
	movl	%eax, 0(%rbp,%r9,4)
	addl	%edx, (%rbx,%r9,4)
	movslq	0(%rbp,%r8,4), %rdx
.L26:
	movl	(%rbx,%rdx,4), %edx
	addl	%edx, (%rbx,%r8,4)
	movl	%eax, %esi
	movl	%eax, 0(%rbp,%r8,4)
.L25:
	movslq	32(%rsp), %r8
	movslq	0(%rbp,%r8,4), %rax
	movq	%r8, %rdx
	movslq	%eax, %rdi
	cmpl	%eax, %r8d
	je	.L31
	movslq	%eax, %r9
	movl	0(%rbp,%r9,4), %ecx
	cmpl	%ecx, %eax
	je	.L46
	movslq	%ecx, %r10
	movslq	%r8d, %rax
	movslq	0(%rbp,%r10,4), %rdi
	cmpl	%edi, %ecx
	je	.L33
	movslq	%edi, %rcx
	movslq	0(%rbp,%rcx,4), %r11
	movq	%rcx, (%rsp)
	movl	%r11d, %ecx
	cmpl	%r11d, %edi
	je	.L34
	movslq	%r11d, %rax
	movl	0(%rbp,%rax,4), %ecx
	movq	%rax, 8(%rsp)
	cmpl	%ecx, %r11d
	jne	.L53
.L35:
	movq	(%rsp), %rdi
	movslq	0(%rbp,%rdi,4), %rax
	movl	%ecx, 0(%rbp,%rdi,4)
	movslq	0(%rbp,%r10,4), %r11
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rdi,4)
	movslq	%edx, %rax
.L34:
	movl	(%rbx,%r11,4), %edx
	addl	%edx, (%rbx,%r10,4)
	movl	%ecx, 0(%rbp,%r10,4)
	movslq	0(%rbp,%r9,4), %rdi
.L33:
	movl	(%rbx,%rdi,4), %edx
	addl	%edx, (%rbx,%r9,4)
	movl	%ecx, 0(%rbp,%r9,4)
	movslq	0(%rbp,%r8,4), %rdi
.L32:
	movl	(%rbx,%rdi,4), %edx
	addl	%edx, (%rbx,%r8,4)
	movslq	%ecx, %rdi
	movl	%ecx, 0(%rbp,%r8,4)
.L31:
	movl	(%rbx,%rax,4), %edx
	movslq	28(%rsp), %rcx
	movl	36(%rsp), %eax
	cmpl	%esi, %edi
	je	.L37
	subl	%edx, %eax
	movl	%ecx, 0(%rbp,%rdi,4)
	movl	%eax, (%rbx,%rdi,4)
.L38:
	addl	$1, %r14d
	cmpl	%r14d, 24(%rsp)
	jg	.L17
.L18:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L24:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	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
.L37:
	.cfi_restore_state
	subl	(%rbx,%rcx,4), %edx
	cmpl	%eax, %edx
	je	.L38
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%r8d, %rax
	jmp	.L32
.L53:
	movslq	%ecx, %r11
	movl	0(%rbp,%r11,4), %edi
	cmpl	%edi, %ecx
	jne	.L55
.L36:
	movq	8(%rsp), %rcx
	movslq	0(%rbp,%rcx,4), %rax
	movl	%edi, 0(%rbp,%rcx,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rcx,4)
	movl	%edi, %ecx
	jmp	.L35
.L52:
	movslq	%eax, %rdx
	movl	0(%rbp,%rdx,4), %edi
	movq	%rdx, (%rsp)
	cmpl	%edi, %eax
	jne	.L56
.L30:
	movslq	0(%rbp,%r11,4), %rax
	movl	%edi, 0(%rbp,%r11,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%r11,4)
	movl	%edi, %eax
	jmp	.L29
.L56:
	call	dfs
	movq	(%rsp), %rdx
	movl	%eax, %edi
	movslq	0(%rbp,%rdx,4), %rax
	movl	%edi, 0(%rbp,%rdx,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L30
.L55:
	call	dfs
	movl	32(%rsp), %edx
	movl	%eax, %edi
	movslq	0(%rbp,%r11,4), %rax
	movl	%edi, 0(%rbp,%r11,4)
	movl	(%rbx,%rax,4), %eax
	addl	%eax, (%rbx,%r11,4)
	jmp	.L36
.L41:
	movl	$1, %eax
	jmp	.L19
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	di
	.bss
	.align 32
	.type	di, @object
	.size	di, 400004
di:
	.zero	400004
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 400004
g:
	.zero	400004
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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 g[100001];
int di[100001];

int dfs(int i){
    if(g[i]!=i){
        int r = dfs(g[i]);
        di[i]+=di[g[i]];
        //printf("di[%d]=%d\n",i,di[i]);
        return g[i]=r;
    }else{
        return i;
    }
}
int main(){
    int i,j;
    int N,M;
    scanf("%d %d",&N,&M);
    for(i=1;i<=N;i++)g[i]=i;
    for(i=0;i<M;i++){
        int l,r,d;
        scanf("%d %d %d",&l,&r,&d);
        int g1=dfs(l);
        int g2=dfs(r);
        if(g1!=g2){
            g[g2]=l;
            di[g2]=d-di[r];
        }  else{
            //printf("di[%d](%d)-di[%d](%d)!=%d\n",r,di[r],l,di[l],d);
            if(di[r]-di[l]!=d){
                printf("No\n");
                return 0;
            }
        }
    }
    //printf("%d %d %d\n",di[1],di[2],di[3]);
    printf("Yes\n");
}

3 3
1 2 1
2 3 1
1 3 2

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 <stdlib.h>
int g[100001];
int di[100001];

int dfs(int i){
    if(g[i]!=i){
        int r = dfs(g[i]);
        di[i]+=di[g[i]];
        //printf("di[%d]=%d\n",i,di[i]);
        return g[i]=r;
    }else{
        return i;
    }
}
int main(){
    int i,j;
    int N,M;
    scanf("%d %d",&N,&M);
    for(i=1;i<=N;i++)g[i]=i;
    for(i=0;i<M;i++){
        int l,r,d;
        scanf("%d %d %d",&l,&r,&d);
        int g1=dfs(l);
        int g2=dfs(r);
        if(g1!=g2){
            g[g2]=l;
            di[g2]=d-di[r];
        }  else{
            //printf("di[%d](%d)-di[%d](%d)!=%d\n",r,di[r],l,di[l],d);
            if(di[r]-di[l]!=d){
                printf("No\n");
                return 0;
            }
        }
    }
    //printf("%d %d %d\n",di[1],di[2],di[3]);
    printf("Yes\n");
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 400004
g:
	.zero	400004
	.globl	di
	.align 32
	.type	di, @object
	.size	di, 400004
di:
	.zero	400004
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB6:
	.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	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	je	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L6
	movl	$0, -20(%rbp)
	jmp	.L7
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L8
	movl	-32(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	g(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	je	.L9
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L10
.L9:
	addl	$1, -20(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L10:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 400004
g:
	.zero	400004
	.globl	di
	.align 32
	.type	di, @object
	.size	di, 400004
di:
	.zero	400004
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB6:
	.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	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -20(%rbp)
	je	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L6
	movl	$0, -20(%rbp)
	jmp	.L7
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L8
	movl	-32(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	g(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	di(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	di(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	je	.L9
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L10
.L9:
	addl	$1, -20(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L10:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
