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

```c
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HUMAN_MAX		100000									// 最大人数

// 内部構造体 - 人情報
typedef struct Human {
	int miDNo;													// 代表グループ番号 1～
	int miLen;													// 代表からの距離
} Human;

// 内部変数
static Human sz1Human[D_HUMAN_MAX + 5];							// 人情報

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 代表グループ番号取得
int
fGetDNo(
	int piHNo					// <I> 人番号 1～
)
{
	// 代表番号
	int liDNo = sz1Human[piHNo].miDNo;

	// 本当に代表かチェック
	if (sz1Human[liDNo].miLen == 0) {
		return liDNo;
	}

	// 下位へ
	int liNNo = fGetDNo(liDNo);

	// 情報更新
	sz1Human[piHNo].miDNo = liNNo;						// 代表グループ番号
	sz1Human[piHNo].miLen += sz1Human[liDNo].miLen;		// 代表からの距離

	return liNNo;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, liRet, liWork;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人情報初期化
	for (i = 1; i <= D_HUMAN_MAX; i++) {
		sz1Human[i].miDNo = i;
		sz1Human[i].miLen = 0;
	}

	// 情報数取得
	int liICnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d", &liWork, &liICnt);

	// 情報数でループ
	liRet = 0;
	for (i = 0; i < liICnt; i++) {

		// 情報取得
		int liNo1, liNo2, liLen;
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d%d", &liNo1, &liNo2, &liLen);

		// 代表グループ番号取得
		int liGNo1 = fGetDNo(liNo1);
		int liGNo2 = fGetDNo(liNo2);

		// 比較
		if (liGNo1 == liGNo2) {																// 一致
			int liDF = sz1Human[liNo2].miLen - sz1Human[liNo1].miLen;							// 差
			if (liDF != liLen) {																// 情報不一致
				liRet = -1;
				break;
			}
		}
		else {																				// 不一致
			sz1Human[liGNo2].miDNo = liGNo1;													// 代表変更
			sz1Human[liGNo2].miLen = liLen - sz1Human[liNo2].miLen + sz1Human[liNo1].miLen;		// 距離セット
		}
	}

	// 結果セット
	if (liRet == 0) {
		sprintf(lc1Out, "Yes\n");
	}
	else {
		sprintf(lc1Out, "No\n");
	}

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.local	sz1Human
	.comm	sz1Human,800040,32
	.globl	fGetDNo
	.type	fGetDNo, @function
fGetDNo:
.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,8), %rdx
	leaq	sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-8(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	fGetDNo, .-fGetDNo
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"Yes\n"
.LC3:
	.string	"No\n"
.LC4:
	.string	"%s"
	.text
	.globl	fMain
	.type	fMain, @function
fMain:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$2128, %rsp
	movl	%edi, -2116(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -2084(%rbp)
	jmp	.L5
.L6:
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2084(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -2084(%rbp)
.L5:
	cmpl	$100000, -2084(%rbp)
	jle	.L6
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2100(%rbp), %rcx
	leaq	-2104(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, -2080(%rbp)
	movl	$0, -2084(%rbp)
	jmp	.L7
.L12:
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2088(%rbp), %rsi
	leaq	-2092(%rbp), %rcx
	leaq	-2096(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-2096(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2076(%rbp)
	movl	-2092(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2072(%rbp)
	movl	-2076(%rbp), %eax
	cmpl	-2072(%rbp), %eax
	jne	.L8
	movl	-2092(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-2096(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -2068(%rbp)
	movl	-2088(%rbp), %eax
	cmpl	%eax, -2068(%rbp)
	je	.L9
	movl	$-1, -2080(%rbp)
	jmp	.L11
.L8:
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2076(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2088(%rbp), %eax
	movl	-2092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-2096(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L9:
	addl	$1, -2084(%rbp)
.L7:
	movl	-2100(%rbp), %eax
	cmpl	%eax, -2084(%rbp)
	jl	.L12
.L11:
	cmpl	$0, -2080(%rbp)
	jne	.L13
	leaq	-1040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	jmp	.L14
.L13:
	leaq	-1040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
.L14:
	leaq	-1040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fMain, .-fMain
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, %edi
	call	fMain
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	fGetDNo
	.type	fGetDNo, @function
fGetDNo:
.LFB51:
	.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	sz1Human(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movslq	(%rbx,%rbp,8), %r12
	movl	4(%rbx,%r12,8), %edi
	movq	%r12, %rax
	testl	%edi, %edi
	jne	.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
.L9:
	.cfi_restore_state
	movslq	(%rbx,%r12,8), %r13
	movl	4(%rbx,%r13,8), %esi
	movq	%r13, %rax
	testl	%esi, %esi
	je	.L3
	movslq	(%rbx,%r13,8), %r14
	movl	4(%rbx,%r14,8), %ecx
	movq	%r14, %rax
	testl	%ecx, %ecx
	jne	.L10
.L4:
	movl	4(%rbx,%r13,8), %edx
	addl	4(%rbx,%r12,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm2
	punpckldq	%xmm2, %xmm0
	movq	%xmm0, (%rbx,%r12,8)
.L3:
	movl	4(%rbx,%r12,8), %edx
	addl	4(%rbx,%rbp,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rbx,%rbp,8)
	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
.L10:
	.cfi_restore_state
	movslq	(%rbx,%r14,8), %r15
	movl	4(%rbx,%r15,8), %edx
	movq	%r15, %rax
	testl	%edx, %edx
	je	.L5
	movl	%r15d, %edi
	call	fGetDNo
	movl	4(%rbx,%r15,8), %edx
	addl	4(%rbx,%r14,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm4
	punpckldq	%xmm4, %xmm0
	movq	%xmm0, (%rbx,%r14,8)
.L5:
	movl	4(%rbx,%r14,8), %edx
	addl	4(%rbx,%r13,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm3
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, (%rbx,%r13,8)
	jmp	.L4
	.cfi_endproc
.LFE51:
	.size	fGetDNo, .-fGetDNo
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d%d%d"
.LC4:
	.string	"%s"
	.text
	.p2align 4
	.globl	fMain
	.type	fMain, @function
fMain:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm2, %xmm2
	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	$2152, %rsp
	.cfi_def_cfa_offset 2208
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC1(%rip), %xmm4
	movq	%fs:40, %rax
	movq	%rax, 2136(%rsp)
	leaq	8+sz1Human(%rip), %rax
	leaq	800000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	%xmm1, %xmm0
	addq	$32, %rax
	paddd	%xmm4, %xmm1
	movdqa	%xmm0, %xmm3
	punpckhdq	%xmm2, %xmm0
	punpckldq	%xmm2, %xmm3
	movups	%xmm0, -16(%rax)
	movups	%xmm3, -32(%rax)
	cmpq	%rdx, %rax
	jne	.L12
	movq	stdin(%rip), %rdx
	leaq	80(%rsp), %rbp
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rbp, %rdi
	leaq	64(%rsp), %rcx
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	.LC2(%rip), %rsi
	call	__isoc99_sscanf@PLT
	movl	64(%rsp), %edi
	testl	%edi, %edi
	jle	.L29
	leaq	68(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	76(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	72(%rsp), %r12
	leaq	.LC3(%rip), %r15
	leaq	sz1Human(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	stdin(%rip), %rdx
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	8(%rsp), %rdx
	movq	%r13, %r8
	movq	%r15, %rsi
	movq	%r12, %rcx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	movslq	68(%rsp), %r9
	movslq	(%rbx,%r9,8), %r8
	movl	4(%rbx,%r8,8), %esi
	movq	%r8, %r10
	testl	%esi, %esi
	je	.L15
	movslq	(%rbx,%r8,8), %r10
	movl	4(%rbx,%r10,8), %ecx
	movq	%r10, %rax
	testl	%ecx, %ecx
	je	.L16
	movslq	(%rbx,%r10,8), %r11
	movl	4(%rbx,%r11,8), %edx
	movq	%r11, %rax
	testl	%edx, %edx
	je	.L17
	movslq	(%rbx,%r11,8), %rdx
	movl	4(%rbx,%rdx,8), %edi
	movq	%rdx, %rax
	testl	%edi, %edi
	je	.L18
	movslq	(%rbx,%rdx,8), %rcx
	movl	4(%rbx,%rcx,8), %esi
	movq	%rcx, %rax
	testl	%esi, %esi
	jne	.L40
.L19:
	movl	4(%rbx,%rdx,8), %edx
	addl	4(%rbx,%r11,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r11,8)
.L18:
	movl	4(%rbx,%r11,8), %edx
	addl	4(%rbx,%r10,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%r10,8)
.L17:
	movl	4(%rbx,%r10,8), %edx
	addl	4(%rbx,%r8,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r8,8)
.L16:
	movl	4(%rbx,%r8,8), %edx
	addl	4(%rbx,%r9,8), %edx
	movd	%eax, %xmm0
	movl	%eax, %r10d
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r9,8)
.L15:
	movslq	72(%rsp), %r8
	movslq	(%rbx,%r8,8), %r9
	movq	%r8, %rax
	movl	4(%rbx,%r9,8), %r11d
	movq	%r9, %rdx
	testl	%r11d, %r11d
	je	.L21
	movslq	(%rbx,%r9,8), %r11
	movl	4(%rbx,%r11,8), %edi
	movq	%r11, %rdx
	testl	%edi, %edi
	je	.L22
	movslq	(%rbx,%r11,8), %rdx
	movl	4(%rbx,%rdx,8), %esi
	movq	%rdx, %rcx
	testl	%esi, %esi
	je	.L23
	movslq	(%rbx,%rdx,8), %rcx
	movl	4(%rbx,%rcx,8), %edi
	movq	%rcx, %rsi
	testl	%edi, %edi
	je	.L24
	movslq	(%rbx,%rcx,8), %rsi
	cmpl	$0, 4(%rbx,%rsi,8)
	movq	%rsi, 16(%rsp)
	movq	%rsi, %rdi
	jne	.L41
.L25:
	movl	4(%rbx,%rcx,8), %ecx
	addl	4(%rbx,%rdx,8), %ecx
	movd	%edi, %xmm0
	movl	%edi, %esi
	movd	%ecx, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
.L24:
	movl	4(%rbx,%rdx,8), %edx
	addl	4(%rbx,%r11,8), %edx
	movd	%esi, %xmm0
	movl	%esi, %ecx
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r11,8)
.L23:
	movl	4(%rbx,%r11,8), %edx
	addl	4(%rbx,%r9,8), %edx
	movd	%ecx, %xmm0
	movd	%edx, %xmm7
	movslq	%ecx, %rdx
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r9,8)
.L22:
	movl	4(%rbx,%r9,8), %ecx
	addl	4(%rbx,%r8,8), %ecx
	movd	%edx, %xmm0
	movd	%ecx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r8,8)
	movslq	%eax, %r8
.L21:
	movl	76(%rsp), %eax
	movslq	68(%rsp), %rcx
	cmpl	%r10d, %edx
	je	.L42
	subl	4(%rbx,%r8,8), %eax
	addl	4(%rbx,%rcx,8), %eax
	movd	%r10d, %xmm0
	movd	%eax, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
.L28:
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L13
.L29:
	movl	$175334745, 1104(%rsp)
	movb	$0, 1108(%rsp)
.L14:
	xorl	%eax, %eax
	leaq	1104(%rsp), %rdx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	2136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$2152, %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
.L42:
	.cfi_restore_state
	movl	4(%rbx,%r8,8), %edx
	subl	4(%rbx,%rcx,8), %edx
	cmpl	%eax, %edx
	je	.L28
	movl	$683854, 1104(%rsp)
	jmp	.L14
.L41:
	movslq	(%rbx,%rsi,8), %rsi
	movq	%rsi, 24(%rsp)
	movq	%rsi, %rdi
	movl	4(%rbx,%rsi,8), %esi
	testl	%esi, %esi
	jne	.L44
.L26:
	movq	16(%rsp), %rsi
	movd	%edi, %xmm0
	movl	4(%rbx,%rsi,8), %esi
	addl	4(%rbx,%rcx,8), %esi
	movd	%esi, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	jmp	.L25
.L40:
	movslq	(%rbx,%rcx,8), %rsi
	movl	4(%rbx,%rsi,8), %edi
	movq	%rsi, 16(%rsp)
	movq	%rsi, %rax
	testl	%edi, %edi
	jne	.L45
.L20:
	movl	4(%rbx,%rcx,8), %ecx
	addl	4(%rbx,%rdx,8), %ecx
	movd	%eax, %xmm0
	movd	%ecx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
	jmp	.L19
.L45:
	movl	%esi, %edi
	movq	%rcx, 32(%rsp)
	movq	%rdx, 24(%rsp)
	call	fGetDNo
	movq	32(%rsp), %rcx
	movq	16(%rsp), %rsi
	movd	%eax, %xmm0
	movq	24(%rsp), %rdx
	movl	4(%rbx,%rsi,8), %esi
	addl	4(%rbx,%rcx,8), %esi
	movd	%esi, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	jmp	.L20
.L44:
	movq	%rdx, 40(%rsp)
	movq	%rcx, 32(%rsp)
	call	fGetDNo
	movq	24(%rsp), %rsi
	movq	40(%rsp), %rdx
	movl	%eax, %edi
	movq	32(%rsp), %rcx
	movl	4(%rbx,%rsi,8), %eax
	movq	16(%rsp), %rsi
	movd	%edi, %xmm0
	addl	4(%rbx,%rsi,8), %eax
	movd	%eax, %xmm7
	movl	72(%rsp), %eax
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rsi,8)
	jmp	.L26
.L43:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fMain, .-fMain
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	call	fMain
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.local	sz1Human
	.comm	sz1Human,800040,32
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC1:
	.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	fGetDNo
	.type	fGetDNo, @function
fGetDNo:
.LFB51:
	.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	sz1Human(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movslq	(%rbx,%rbp,8), %r12
	movl	4(%rbx,%r12,8), %edi
	movq	%r12, %rax
	testl	%edi, %edi
	jne	.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
.L9:
	.cfi_restore_state
	movslq	(%rbx,%r12,8), %r13
	movl	4(%rbx,%r13,8), %esi
	movq	%r13, %rax
	testl	%esi, %esi
	je	.L3
	movslq	(%rbx,%r13,8), %r14
	movl	4(%rbx,%r14,8), %ecx
	movq	%r14, %rax
	testl	%ecx, %ecx
	jne	.L10
.L4:
	movl	4(%rbx,%r13,8), %edx
	addl	4(%rbx,%r12,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm2
	punpckldq	%xmm2, %xmm0
	movq	%xmm0, (%rbx,%r12,8)
.L3:
	movl	4(%rbx,%r12,8), %edx
	addl	4(%rbx,%rbp,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rbx,%rbp,8)
	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
.L10:
	.cfi_restore_state
	movslq	(%rbx,%r14,8), %r15
	movl	4(%rbx,%r15,8), %edx
	movq	%r15, %rax
	testl	%edx, %edx
	je	.L5
	movl	%r15d, %edi
	call	fGetDNo
	movl	4(%rbx,%r15,8), %edx
	addl	4(%rbx,%r14,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm4
	punpckldq	%xmm4, %xmm0
	movq	%xmm0, (%rbx,%r14,8)
.L5:
	movl	4(%rbx,%r14,8), %edx
	addl	4(%rbx,%r13,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm3
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, (%rbx,%r13,8)
	jmp	.L4
	.cfi_endproc
.LFE51:
	.size	fGetDNo, .-fGetDNo
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d%d%d"
.LC4:
	.string	"%s"
	.text
	.p2align 4
	.globl	fMain
	.type	fMain, @function
fMain:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm2, %xmm2
	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	$2152, %rsp
	.cfi_def_cfa_offset 2208
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC1(%rip), %xmm4
	movq	%fs:40, %rax
	movq	%rax, 2136(%rsp)
	leaq	8+sz1Human(%rip), %rax
	leaq	800000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	%xmm1, %xmm0
	addq	$32, %rax
	paddd	%xmm4, %xmm1
	movdqa	%xmm0, %xmm3
	punpckhdq	%xmm2, %xmm0
	punpckldq	%xmm2, %xmm3
	movups	%xmm0, -16(%rax)
	movups	%xmm3, -32(%rax)
	cmpq	%rdx, %rax
	jne	.L12
	movq	stdin(%rip), %rdx
	leaq	80(%rsp), %rbp
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	%rbp, %rdi
	leaq	64(%rsp), %rcx
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	.LC2(%rip), %rsi
	call	__isoc99_sscanf@PLT
	movl	64(%rsp), %edi
	testl	%edi, %edi
	jle	.L29
	leaq	68(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	76(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	72(%rsp), %r12
	leaq	.LC3(%rip), %r15
	leaq	sz1Human(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	stdin(%rip), %rdx
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movq	8(%rsp), %rdx
	movq	%r13, %r8
	movq	%r15, %rsi
	movq	%r12, %rcx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_sscanf@PLT
	movslq	68(%rsp), %r9
	movslq	(%rbx,%r9,8), %r8
	movl	4(%rbx,%r8,8), %esi
	movq	%r8, %r10
	testl	%esi, %esi
	je	.L15
	movslq	(%rbx,%r8,8), %r10
	movl	4(%rbx,%r10,8), %ecx
	movq	%r10, %rax
	testl	%ecx, %ecx
	je	.L16
	movslq	(%rbx,%r10,8), %r11
	movl	4(%rbx,%r11,8), %edx
	movq	%r11, %rax
	testl	%edx, %edx
	je	.L17
	movslq	(%rbx,%r11,8), %rdx
	movl	4(%rbx,%rdx,8), %edi
	movq	%rdx, %rax
	testl	%edi, %edi
	je	.L18
	movslq	(%rbx,%rdx,8), %rcx
	movl	4(%rbx,%rcx,8), %esi
	movq	%rcx, %rax
	testl	%esi, %esi
	jne	.L40
.L19:
	movl	4(%rbx,%rdx,8), %edx
	addl	4(%rbx,%r11,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r11,8)
.L18:
	movl	4(%rbx,%r11,8), %edx
	addl	4(%rbx,%r10,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%r10,8)
.L17:
	movl	4(%rbx,%r10,8), %edx
	addl	4(%rbx,%r8,8), %edx
	movd	%eax, %xmm0
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r8,8)
.L16:
	movl	4(%rbx,%r8,8), %edx
	addl	4(%rbx,%r9,8), %edx
	movd	%eax, %xmm0
	movl	%eax, %r10d
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r9,8)
.L15:
	movslq	72(%rsp), %r8
	movslq	(%rbx,%r8,8), %r9
	movq	%r8, %rax
	movl	4(%rbx,%r9,8), %r11d
	movq	%r9, %rdx
	testl	%r11d, %r11d
	je	.L21
	movslq	(%rbx,%r9,8), %r11
	movl	4(%rbx,%r11,8), %edi
	movq	%r11, %rdx
	testl	%edi, %edi
	je	.L22
	movslq	(%rbx,%r11,8), %rdx
	movl	4(%rbx,%rdx,8), %esi
	movq	%rdx, %rcx
	testl	%esi, %esi
	je	.L23
	movslq	(%rbx,%rdx,8), %rcx
	movl	4(%rbx,%rcx,8), %edi
	movq	%rcx, %rsi
	testl	%edi, %edi
	je	.L24
	movslq	(%rbx,%rcx,8), %rsi
	cmpl	$0, 4(%rbx,%rsi,8)
	movq	%rsi, 16(%rsp)
	movq	%rsi, %rdi
	jne	.L41
.L25:
	movl	4(%rbx,%rcx,8), %ecx
	addl	4(%rbx,%rdx,8), %ecx
	movd	%edi, %xmm0
	movl	%edi, %esi
	movd	%ecx, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
.L24:
	movl	4(%rbx,%rdx,8), %edx
	addl	4(%rbx,%r11,8), %edx
	movd	%esi, %xmm0
	movl	%esi, %ecx
	movd	%edx, %xmm6
	punpckldq	%xmm6, %xmm0
	movq	%xmm0, (%rbx,%r11,8)
.L23:
	movl	4(%rbx,%r11,8), %edx
	addl	4(%rbx,%r9,8), %edx
	movd	%ecx, %xmm0
	movd	%edx, %xmm7
	movslq	%ecx, %rdx
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r9,8)
.L22:
	movl	4(%rbx,%r9,8), %ecx
	addl	4(%rbx,%r8,8), %ecx
	movd	%edx, %xmm0
	movd	%ecx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%r8,8)
	movslq	%eax, %r8
.L21:
	movl	76(%rsp), %eax
	movslq	68(%rsp), %rcx
	cmpl	%r10d, %edx
	je	.L42
	subl	4(%rbx,%r8,8), %eax
	addl	4(%rbx,%rcx,8), %eax
	movd	%r10d, %xmm0
	movd	%eax, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
.L28:
	addl	$1, %r14d
	cmpl	%r14d, 64(%rsp)
	jg	.L13
.L29:
	movl	$175334745, 1104(%rsp)
	movb	$0, 1108(%rsp)
.L14:
	xorl	%eax, %eax
	leaq	1104(%rsp), %rdx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	2136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$2152, %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
.L42:
	.cfi_restore_state
	movl	4(%rbx,%r8,8), %edx
	subl	4(%rbx,%rcx,8), %edx
	cmpl	%eax, %edx
	je	.L28
	movl	$683854, 1104(%rsp)
	jmp	.L14
.L41:
	movslq	(%rbx,%rsi,8), %rsi
	movq	%rsi, 24(%rsp)
	movq	%rsi, %rdi
	movl	4(%rbx,%rsi,8), %esi
	testl	%esi, %esi
	jne	.L44
.L26:
	movq	16(%rsp), %rsi
	movd	%edi, %xmm0
	movl	4(%rbx,%rsi,8), %esi
	addl	4(%rbx,%rcx,8), %esi
	movd	%esi, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	jmp	.L25
.L40:
	movslq	(%rbx,%rcx,8), %rsi
	movl	4(%rbx,%rsi,8), %edi
	movq	%rsi, 16(%rsp)
	movq	%rsi, %rax
	testl	%edi, %edi
	jne	.L45
.L20:
	movl	4(%rbx,%rcx,8), %ecx
	addl	4(%rbx,%rdx,8), %ecx
	movd	%eax, %xmm0
	movd	%ecx, %xmm7
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rdx,8)
	jmp	.L19
.L45:
	movl	%esi, %edi
	movq	%rcx, 32(%rsp)
	movq	%rdx, 24(%rsp)
	call	fGetDNo
	movq	32(%rsp), %rcx
	movq	16(%rsp), %rsi
	movd	%eax, %xmm0
	movq	24(%rsp), %rdx
	movl	4(%rbx,%rsi,8), %esi
	addl	4(%rbx,%rcx,8), %esi
	movd	%esi, %xmm5
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	jmp	.L20
.L44:
	movq	%rdx, 40(%rsp)
	movq	%rcx, 32(%rsp)
	call	fGetDNo
	movq	24(%rsp), %rsi
	movq	40(%rsp), %rdx
	movl	%eax, %edi
	movq	32(%rsp), %rcx
	movl	4(%rbx,%rsi,8), %eax
	movq	16(%rsp), %rsi
	movd	%edi, %xmm0
	addl	4(%rbx,%rsi,8), %eax
	movd	%eax, %xmm7
	movl	72(%rsp), %eax
	punpckldq	%xmm7, %xmm0
	movq	%xmm0, (%rbx,%rsi,8)
	jmp	.L26
.L43:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	fMain, .-fMain
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%edi, %edi
	call	fMain
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.local	sz1Human
	.comm	sz1Human,800040,32
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC1:
	.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 <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HUMAN_MAX		100000									// 最大人数

// 内部構造体 - 人情報
typedef struct Human {
	int miDNo;													// 代表グループ番号 1～
	int miLen;													// 代表からの距離
} Human;

// 内部変数
static Human sz1Human[D_HUMAN_MAX + 5];							// 人情報

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 代表グループ番号取得
int
fGetDNo(
	int piHNo					// <I> 人番号 1～
)
{
	// 代表番号
	int liDNo = sz1Human[piHNo].miDNo;

	// 本当に代表かチェック
	if (sz1Human[liDNo].miLen == 0) {
		return liDNo;
	}

	// 下位へ
	int liNNo = fGetDNo(liDNo);

	// 情報更新
	sz1Human[piHNo].miDNo = liNNo;						// 代表グループ番号
	sz1Human[piHNo].miLen += sz1Human[liDNo].miLen;		// 代表からの距離

	return liNNo;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, liRet, liWork;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人情報初期化
	for (i = 1; i <= D_HUMAN_MAX; i++) {
		sz1Human[i].miDNo = i;
		sz1Human[i].miLen = 0;
	}

	// 情報数取得
	int liICnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d", &liWork, &liICnt);

	// 情報数でループ
	liRet = 0;
	for (i = 0; i < liICnt; i++) {

		// 情報取得
		int liNo1, liNo2, liLen;
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d%d", &liNo1, &liNo2, &liLen);

		// 代表グループ番号取得
		int liGNo1 = fGetDNo(liNo1);
		int liGNo2 = fGetDNo(liNo2);

		// 比較
		if (liGNo1 == liGNo2) {																// 一致
			int liDF = sz1Human[liNo2].miLen - sz1Human[liNo1].miLen;							// 差
			if (liDF != liLen) {																// 情報不一致
				liRet = -1;
				break;
			}
		}
		else {																				// 不一致
			sz1Human[liGNo2].miDNo = liGNo1;													// 代表変更
			sz1Human[liGNo2].miLen = liLen - sz1Human[liNo2].miLen + sz1Human[liNo1].miLen;		// 距離セット
		}
	}

	// 結果セット
	if (liRet == 0) {
		sprintf(lc1Out, "Yes\n");
	}
	else {
		sprintf(lc1Out, "No\n");
	}

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}


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 <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_HUMAN_MAX		100000									// 最大人数

// 内部構造体 - 人情報
typedef struct Human {
	int miDNo;													// 代表グループ番号 1～
	int miLen;													// 代表からの距離
} Human;

// 内部変数
static Human sz1Human[D_HUMAN_MAX + 5];							// 人情報

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 代表グループ番号取得
int
fGetDNo(
	int piHNo					// <I> 人番号 1～
)
{
	// 代表番号
	int liDNo = sz1Human[piHNo].miDNo;

	// 本当に代表かチェック
	if (sz1Human[liDNo].miLen == 0) {
		return liDNo;
	}

	// 下位へ
	int liNNo = fGetDNo(liDNo);

	// 情報更新
	sz1Human[piHNo].miDNo = liNNo;						// 代表グループ番号
	sz1Human[piHNo].miLen += sz1Human[liDNo].miLen;		// 代表からの距離

	return liNNo;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, liRet, liWork;
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人情報初期化
	for (i = 1; i <= D_HUMAN_MAX; i++) {
		sz1Human[i].miDNo = i;
		sz1Human[i].miLen = 0;
	}

	// 情報数取得
	int liICnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d", &liWork, &liICnt);

	// 情報数でループ
	liRet = 0;
	for (i = 0; i < liICnt; i++) {

		// 情報取得
		int liNo1, liNo2, liLen;
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d%d", &liNo1, &liNo2, &liLen);

		// 代表グループ番号取得
		int liGNo1 = fGetDNo(liNo1);
		int liGNo2 = fGetDNo(liNo2);

		// 比較
		if (liGNo1 == liGNo2) {																// 一致
			int liDF = sz1Human[liNo2].miLen - sz1Human[liNo1].miLen;							// 差
			if (liDF != liLen) {																// 情報不一致
				liRet = -1;
				break;
			}
		}
		else {																				// 不一致
			sz1Human[liGNo2].miDNo = liGNo1;													// 代表変更
			sz1Human[liGNo2].miLen = liLen - sz1Human[liNo2].miLen + sz1Human[liNo1].miLen;		// 距離セット
		}
	}

	// 結果セット
	if (liRet == 0) {
		sprintf(lc1Out, "Yes\n");
	}
	else {
		sprintf(lc1Out, "No\n");
	}

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.local	sz1Human
	.comm	sz1Human,800040,32
	.globl	fGetDNo
	.type	fGetDNo, @function
fGetDNo:
.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,8), %rdx
	leaq	sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-8(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	fGetDNo, .-fGetDNo
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"Yes\n"
.LC3:
	.string	"No\n"
.LC4:
	.string	"%s"
	.text
	.globl	fMain
	.type	fMain, @function
fMain:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$2128, %rsp
	movl	%edi, -2116(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -2084(%rbp)
	jmp	.L5
.L6:
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2084(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -2084(%rbp)
.L5:
	cmpl	$100000, -2084(%rbp)
	jle	.L6
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2100(%rbp), %rcx
	leaq	-2104(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, -2080(%rbp)
	movl	$0, -2084(%rbp)
	jmp	.L7
.L12:
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2088(%rbp), %rsi
	leaq	-2092(%rbp), %rcx
	leaq	-2096(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-2096(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2076(%rbp)
	movl	-2092(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2072(%rbp)
	movl	-2076(%rbp), %eax
	cmpl	-2072(%rbp), %eax
	jne	.L8
	movl	-2092(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-2096(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -2068(%rbp)
	movl	-2088(%rbp), %eax
	cmpl	%eax, -2068(%rbp)
	je	.L9
	movl	$-1, -2080(%rbp)
	jmp	.L11
.L8:
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2076(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2088(%rbp), %eax
	movl	-2092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-2096(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L9:
	addl	$1, -2084(%rbp)
.L7:
	movl	-2100(%rbp), %eax
	cmpl	%eax, -2084(%rbp)
	jl	.L12
.L11:
	cmpl	$0, -2080(%rbp)
	jne	.L13
	leaq	-1040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	jmp	.L14
.L13:
	leaq	-1040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
.L14:
	leaq	-1040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fMain, .-fMain
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, %edi
	call	fMain
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.local	sz1Human
	.comm	sz1Human,800040,32
	.globl	fGetDNo
	.type	fGetDNo, @function
fGetDNo:
.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,8), %rdx
	leaq	sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-8(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	fGetDNo, .-fGetDNo
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"Yes\n"
.LC3:
	.string	"No\n"
.LC4:
	.string	"%s"
	.text
	.globl	fMain
	.type	fMain, @function
fMain:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$2128, %rsp
	movl	%edi, -2116(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -2084(%rbp)
	jmp	.L5
.L6:
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2084(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -2084(%rbp)
.L5:
	cmpl	$100000, -2084(%rbp)
	jle	.L6
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2100(%rbp), %rcx
	leaq	-2104(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	$0, -2080(%rbp)
	movl	$0, -2084(%rbp)
	jmp	.L7
.L12:
	movq	stdin(%rip), %rdx
	leaq	-2064(%rbp), %rax
	movl	$1024, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-2088(%rbp), %rsi
	leaq	-2092(%rbp), %rcx
	leaq	-2096(%rbp), %rdx
	leaq	-2064(%rbp), %rax
	movq	%rsi, %r8
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-2096(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2076(%rbp)
	movl	-2092(%rbp), %eax
	movl	%eax, %edi
	call	fGetDNo
	movl	%eax, -2072(%rbp)
	movl	-2076(%rbp), %eax
	cmpl	-2072(%rbp), %eax
	jne	.L8
	movl	-2092(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-2096(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -2068(%rbp)
	movl	-2088(%rbp), %eax
	cmpl	%eax, -2068(%rbp)
	je	.L9
	movl	$-1, -2080(%rbp)
	jmp	.L11
.L8:
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	sz1Human(%rip), %rdx
	movl	-2076(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-2088(%rbp), %eax
	movl	-2092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+sz1Human(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-2096(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-2072(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+sz1Human(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L9:
	addl	$1, -2084(%rbp)
.L7:
	movl	-2100(%rbp), %eax
	cmpl	%eax, -2084(%rbp)
	jl	.L12
.L11:
	cmpl	$0, -2080(%rbp)
	jne	.L13
	leaq	-1040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	jmp	.L14
.L13:
	leaq	-1040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
.L14:
	leaq	-1040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fMain, .-fMain
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, %edi
	call	fMain
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
