// File: chhylp123[P]hifiasm/inter.cpp
// Function: work_ul_gchains_consensus(uldat_t*)
uint64_t work_ul_gchains_consensus(uldat_t *sl)
{
	utepdat_t s; uint64_t i; memset(&s, 0, sizeof(s));
	s.id = 0; s.uopt = sl->uopt; s.rg = sl->rg; s.opt = sl->opt; ///s.ug = sl->ug; s.uu = sl->uu; 
	//  CALLOC(s.buf, sl->n_thread); CALLOC(s.gdp, sl->n_thread); CALLOC(s.mzs, sl->n_thread); 
	CALLOC(s.hab, sl->n_thread); CALLOC(s.ll, 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");

	//debug
    // overall_zdbg = init_mul_debug_prt_t(UL_INF.n);

	kt_for(sl->n_thread, worker_for_contain_consensus, &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;
		// hc_gdpchain_destroy(&(s.gdp[i])); kv_destroy(s.mzs[i]); mg_tbuf_destroy(s.buf[i]); 
		ha_ovec_destroy(s.hab[i]); hc_glchain_destroy(&(s.ll[i])); ///kv_destroy(s.sps[i]);
	}

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

// 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 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd8(%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 $0x68, %esi
callq 0x2140
movq %rax, -0x50(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x2edae6
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)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2edaa1
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, %edi
leaq 0xd78c1(%rip), %rax     # 0x3c53b8
movq 0x50(%rax), %rcx
leaq 0x10e(%rip), %rsi       # 0x2edc10
leaq -0xd8(%rbp), %rdx
callq 0x16d710
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x2edbb9
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 -0x50(%rbp), %rdi
imulq $0x68, -0xe0(%rbp), %rax
addq %rax, %rdi
callq 0x282c10
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2edb19
movq -0x58(%rbp), %rdi
callq 0x2210
movq -0x50(%rbp), %rdi
callq 0x2210
movq 0xd640e(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x98(%rbp), %ecx
movl -0xa0(%rbp), %r8d
leaq 0xa6b4b(%rip), %rsi     # 0x394734
leaq 0xa6c3e(%rip), %rdx     # 0x39482e
movb $0x0, %al
callq 0x22a0
movslq -0x98(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)