// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %r12
xorl %r14d, %r14d
movl $0xc0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x18(%rbx), %rax
movl (%rax), %edi
callq 0xbadd
andq $0x0, 0x48(%r12)
movq 0x10(%rbx), %rcx
movq %rcx, -0x8(%r12)
movq 0x18(%rbx), %rcx
movq %rcx, 0x8(%rsp)
movq %rcx, 0x10(%r12)
movups 0x20(%rbx), %xmm0
movups %xmm0, 0x18(%r12)
movq 0x30(%rbx), %rcx
movq %rcx, 0x28(%r12)
movq %rax, 0x10(%rsp)
movq %rax, 0xc0(%r12)
movq %rbx, (%rsp)
movq 0x58(%rbx), %rbp
pushq $0x8
popq %r15
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, %r13
movq %rax, 0x78(%r12)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, %rbx
movq %rax, 0x70(%r12)
pushq $0x68
popq %rsi
movq %rbp, %rdi
callq 0x2120
movq %rax, 0x80(%r12)
movl $0xc0, %esi
movq %rbp, %rdi
callq 0x2120
movq %rax, 0x88(%r12)
pushq $0x10
popq %rsi
movq %rbp, %rdi
callq 0x2120
movq %rax, 0x58(%r12)
pushq $0x18
popq %rsi
movq %rbp, %rdi
callq 0x2120
movq %rax, 0x60(%r12)
pushq $0x1
popq %r12
cmpq %rbp, %r14
jae 0x1913fa
xorl %edi, %edi
xorl %esi, %esi
movl %r12d, %edx
callq 0xc44b
movq %rax, (%r13,%r14,8)
callq 0x1588bc
movq %rax, (%rbx,%r14,8)
incq %r14
movq (%rsp), %rax
movq 0x58(%rax), %rbp
jmp 0x1913ce
movq 0x8(%rsp), %rax
movq (%rax), %rcx
leaq 0x137(%rip), %rsi       # 0x191540
leaq 0x18(%rsp), %rdx
movl %ebp, %edi
callq 0xc67c0
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r15, %r12
xorl %r13d, %r13d
movq 0x98(%rsp), %rdi
movq (%rsp), %rax
cmpq 0x58(%rax), %r13
jae 0x1914be
movq (%rdi,%r13,8), %rdi
movl 0xf0(%rdi), %eax
addl %eax, 0x58(%rsp)
movl 0xf8(%rdi), %eax
addl %eax, 0x50(%rsp)
callq 0xc5d1
movq 0x90(%rsp), %rax
movq (%rax,%r13,8), %rdi
callq 0x1588d8
movq 0xa0(%rsp), %rdi
addq %r14, %rdi
callq 0x15a8d7
movq 0xa8(%rsp), %rdi
addq %rbx, %rdi
callq 0x15a905
movq 0x78(%rsp), %rax
movq (%rax,%r15), %rdi
callq 0x2220
movq 0x80(%rsp), %rax
movq (%rax,%r12,2), %rdi
callq 0x2220
incq %r13
addq $0xc, %r12
addq $0x10, %r15
addq $0x68, %r14
addq $0xc0, %rbx
jmp 0x191420
callq 0x2220
movq 0x90(%rsp), %rdi
callq 0x2220
movq 0xa0(%rsp), %rdi
callq 0x2220
movq 0xa8(%rsp), %rdi
callq 0x2220
movq 0x78(%rsp), %rdi
callq 0x2220
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0xc1ad8(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
movl 0x50(%rsp), %r8d
movl 0x58(%rsp), %ecx
leaq 0x6450d(%rip), %rsi     # 0x1f5a28
leaq 0x64535(%rip), %rdx     # 0x1f5a57
xorl %eax, %eax
callq 0x22b0
movq 0x10(%rsp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq