// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/inter.cpp
// Function: work_ul_gchains(uldat_t*)
uint64_t work_ul_gchains(uldat_t *sl)
{
	utepdat_t s; uint64_t i; memset(&s, 0, sizeof(s));
	s.id = 0; s.opt = sl->opt; s.ug = sl->ug; s.uopt = sl->uopt; s.rg = sl->rg; s.uu = sl->uu; 
	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_ul_gchains_alignment, &s, UL_INF.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 s.n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movl $0xd0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x10(%rbx), %rax
movq %rax, (%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r15)
movq 0x28(%rbx), %rax
movq %rax, 0x28(%r15)
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r15)
movq 0x30(%rbx), %rax
movq %rax, 0x30(%r15)
movq 0x58(%rbx), %r12
pushq $0x8
popq %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x2120
movq %rax, 0x80(%r15)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2120
movq %rax, 0x78(%r15)
pushq $0x68
popq %rsi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x88(%r15)
movl $0xc0, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x90(%r15)
pushq $0x10
popq %rsi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x60(%r15)
pushq $0x18
popq %rsi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x68(%r15)
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x2553b
xorl %ebp, %ebp
pushq $0x1
popq %r15
pushq $0x10
popq %r12
xorl %edi, %edi
xorl %esi, %esi
pushq $0x1
popq %rdx
callq 0x39240
movq 0x88(%rsp), %rcx
movq %rax, (%rcx,%rbp,8)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, %r13
callq 0x1e35d3
movq %rax, (%r13)
movq 0x80(%rsp), %rax
movq %r13, (%rax,%rbp,8)
incq %rbp
movq 0x58(%rbx), %rdi
cmpq %rdi, %rbp
jb 0x254f4
leaq 0x265dd6(%rip), %rax    # 0x28b318
movq 0x50(%rax), %rcx
leaq 0x1af7f1(%rip), %rsi    # 0x1d4d3e
leaq 0x8(%rsp), %rdx
callq 0x1047b4
cmpq $0x0, 0x58(%rbx)
je 0x255ff
xorl %r15d, %r15d
movq %r14, %r12
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x88(%rsp), %rax
movq (%rax,%rbp,8), %rdi
movl 0xf0(%rdi), %eax
addl %eax, 0x48(%rsp)
movl 0xf8(%rdi), %eax
addl %eax, 0x40(%rsp)
callq 0x395cd
movq 0x80(%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x196f11
movq 0x90(%rsp), %rdi
addq %r15, %rdi
callq 0x19912e
movq 0x98(%rsp), %rdi
addq %r13, %rdi
callq 0x19915c
movq 0x68(%rsp), %rax
movq (%rax,%r12), %rdi
callq 0x2220
movq 0x70(%rsp), %rax
movq (%rax,%r14,2), %rdi
callq 0x2220
incq %rbp
addq $0xc0, %r13
addq $0x68, %r15
addq $0x10, %r12
addq $0xc, %r14
cmpq 0x58(%rbx), %rbp
jb 0x2556d
movq 0x88(%rsp), %rdi
callq 0x2220
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0x90(%rsp), %rdi
callq 0x2220
movq 0x98(%rsp), %rdi
callq 0x2220
movq 0x68(%rsp), %rdi
callq 0x2220
movq 0x70(%rsp), %rdi
callq 0x2220
movq 0x264992(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
movl 0x40(%rsp), %r8d
movl 0x48(%rsp), %ecx
leaq 0x21222f(%rip), %rsi    # 0x237890
leaq 0x212247(%rip), %rdx    # 0x2378af
xorl %eax, %eax
callq 0x22b0
movslq 0x40(%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq