// File: 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
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x2100
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 -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 0x2ebf23
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 0x2ebec7
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, %edi
leaq 0xd9484(%rip), %rax     # 0x3c53b8
movq 0x50(%rax), %rcx
leaq 0x191(%rip), %rsi       # 0x2ec0d0
leaq -0xd8(%rbp), %rdx
callq 0x16d710
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x2ec054
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 0x2ebf56
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 0xd7f4f(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x98(%rbp), %ecx
movl -0xa0(%rbp), %r8d
leaq 0xa868c(%rip), %rsi     # 0x394734
leaq 0xa86a4(%rip), %rdx     # 0x394753
movb $0x0, %al
callq 0x22a0
movslq -0xa0(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)