// File: chhylp123[P]hifiasm/inter.cpp
// Function: work_ctg_path_gchains(uldat_t*)
scaf_res_t *work_ctg_path_gchains(uldat_t *sl)
{
	utepdat_t s; uint64_t i; memset(&s, 0, sizeof(s)); scaf_res_t *res = init_scaf_res_t(sl->ug->u.n);
	s.id = 0; s.opt = sl->opt; s.ug = sl->ug; s.uopt = sl->uopt; s.rg = sl->rg; s.uu = sl->uu; s.rsc = res;
	CALLOC(s.hab, sl->n_thread); CALLOC(s.buf, sl->n_thread); CALLOC(s.ll, sl->n_thread); 
	CALLOC(s.gdp, sl->n_thread); CALLOC(s.mzs, sl->n_thread); CALLOC(s.sps, sl->n_thread); 

	for (i = 0; i < sl->n_thread; ++i) {
		s.hab[i] = ha_ovec_init(0, 0, 1); s.buf[i] = mg_tbuf_init();
	}

	// detect_outlier_len("+++work_ul_gchains");

	kt_for(sl->n_thread, worker_for_ctg_gchains_alignment, &s, s.ug->u.n);

	// detect_outlier_len("---work_ul_gchains");

	for (i = 0; i < sl->n_thread; ++i) {
		s.sum_len += s.hab[i]->num_read_base; s.n += s.hab[i]->num_correct_base;
		ha_ovec_destroy(s.hab[i]); mg_tbuf_destroy(s.buf[i]); hc_glchain_destroy(&(s.ll[i]));
		hc_gdpchain_destroy(&(s.gdp[i])); kv_destroy(s.mzs[i]); kv_destroy(s.sps[i]);
	}

	free(s.hab); free(s.buf); free(s.ll); free(s.gdp); free(s.mzs); free(s.sps);
	fprintf(stderr, "[M::%s::] # try:%d, # done:%d\n", __func__, s.sum_len, s.n); 
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x2100
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl %eax, %edi
callq 0x13bf0
movq %rax, -0xe8(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x68, %esi
callq 0x2140
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0xc0, %esi
callq 0x2140
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x10, %esi
callq 0x2140
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x18, %esi
callq 0x2140
movq %rax, -0x70(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x2ec427
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x14c90
movq %rax, %rdx
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x27e560
movq %rax, %rdx
movq -0x60(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2ec3cb
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, %edi
movq -0xc0(%rbp), %rax
movq (%rax), %rcx
leaq 0x18e(%rip), %rsi       # 0x2ec5d0
leaq -0xd8(%rbp), %rdx
callq 0x16d710
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x2ec557
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xf0(%rax), %rcx
movslq -0x98(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xf8(%rax), %rcx
movslq -0xa0(%rbp), %rax
addq %rcx, %rax
movl %eax, -0xa0(%rbp)
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x14f00
movq -0x60(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x27e5a0
movq -0x50(%rbp), %rdi
imulq $0x68, -0xe0(%rbp), %rax
addq %rax, %rdi
callq 0x282c10
movq -0x48(%rbp), %rdi
imulq $0xc0, -0xe0(%rbp), %rax
addq %rax, %rdi
callq 0x282c60
movq -0x78(%rbp), %rax
movq -0xe0(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2210
movq -0x70(%rbp), %rax
imulq $0x18, -0xe0(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x2210
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2ec459
movq -0x58(%rbp), %rdi
callq 0x2210
movq -0x60(%rbp), %rdi
callq 0x2210
movq -0x50(%rbp), %rdi
callq 0x2210
movq -0x48(%rbp), %rdi
callq 0x2210
movq -0x78(%rbp), %rdi
callq 0x2210
movq -0x70(%rbp), %rdi
callq 0x2210
movq 0xd7a4c(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x98(%rbp), %ecx
movl -0xa0(%rbp), %r8d
leaq 0xa8189(%rip), %rsi     # 0x394734
leaq 0xa81b1(%rip), %rdx     # 0x394763
movb $0x0, %al
callq 0x22a0
movq -0xe8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)