// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: worker_for_graph_bin(void*, long, int)
static void worker_for_graph_bin(void *data, long i, int tid) // callback for kt_for()
{
    ug_bin_t *s = (ug_bin_t*)data; double erate; int64_t wl; overlap_region *aux_o;
    ha_ovec_buf_t *b = s->hab[tid]; asg64_v b0; 
	uint32_t high_occ = asm_opt.polyploidy + 1; uint64_t cnt; 
	char *seq = s->ug->u.a[i].s; int64_t len = s->ug->u.a[i].len;
	if((!s->is_ovlp) && (s->is_cnt)) s->idx_n.a[i] = 0;
	if(s->ug->g->seq[i].del) return;
	if(!seq) {
		resize_UC_Read(&(b->self_read), len);
		retrieve_u_seq(NULL, b->self_read.seq, &(s->ug->u.a[i]), 0, 0, len, NULL);
		seq = b->self_read.seq;
	}

	// if(i!=77960) return;

	// asprintf(&as, "\n[M::%s] rid::%ld, len::%lu, name::%.*s\n", __func__, s->id+i, s->len[i], (int32_t)UL_INF.nid.a[s->id+i].n, UL_INF.nid.a[s->id+i].a);
    // push_vlog(&(overall_zdbg->a[s->id+i]), as); free(as); as = NULL;

	if(!s->is_ovlp) {
		if(s->is_cnt) {
			// s->idx_n.a[i] = ug_map_lchain(b->abl, i, seq, len, s->w, s->k, &(s->udb), NULL, NULL, s->bw_thres, s->bw_thres_double,
            // 	s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 0, 1, 0.2, 3, s->is_HPC, NULL, 0, NULL, 0, s->mini_cut, s->chain_cut, NULL);
			s->idx_n.a[i] = ug_map_lchain_simple(b->abl, i, seq, len, s->w, s->k, &(s->udb), NULL, NULL, s->bw_thres, 
				s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 1, 1, 0.2, 3, s->is_HPC, NULL, 0, NULL, 0, s->mini_cut, s->chain_cut);
		} else {
			// cnt = ug_map_lchain(b->abl, i, seq, len, s->w, s->k, &(s->udb), NULL, NULL, s->bw_thres, s->bw_thres_double,
			// 	s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 0, 1, 0.2, 3, s->is_HPC, s->idx_a.a + s->idx_n.a[i], 0, NULL, 0, s->mini_cut, s->chain_cut, NULL);
			cnt = ug_map_lchain_simple(b->abl, i, seq, len, s->w, s->k, &(s->udb), NULL, NULL, s->bw_thres,
				s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 1, 1, 0.2, 3, s->is_HPC, s->idx_a.a + s->idx_n.a[i], 0, NULL, 0, s->mini_cut, s->chain_cut);
			assert(cnt == ((s->idx_n.a[i+1]-s->idx_n.a[i])));
		}
		return;
	} 

	// if(i == 160) {
	// 	fprintf(stderr, "\n-1-[M::%s] utg%.6u%c, rid::%ld, is_ovlp::%d, is_cnt::%d, len::%ld, str::%u\n", 
	// 		__func__, (uint32_t)i+1, "lc"[s->ug->u.a[i].circ], i, s->is_ovlp, s->is_cnt, len, (uint32_t)(!!seq));
	// }

	
	// ug_map_lchain(b->abl, rid, seq, len, s->w, s->k, &(s->udb), &b->olist, &b->clist, bw_low, bw_high,
    //         s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 0, 1, 0.2, 3, 
    //         s->is_HPC, s->idx_a.a + s->idx_n.a[rid], cnt, s->srt_a.a, s->srt_a.n, s->mini_cut, s->chain_cut, fi);
	cnt = ((s->idx_n.a[i+1]-s->idx_n.a[i]));
	ug_map_lchain_simple(b->abl, i, seq, len, s->w, s->k, &(s->udb), &b->olist, &b->clist, s->bw_thres, 
		s->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 1, 1, 0.2, 3, s->is_HPC, s->idx_a.a + s->idx_n.a[i], cnt, s->srt_a.a, s->srt_a.n, s->mini_cut, s->chain_cut);
	clear_Cigar_record(&b->cigar1); clear_Round2_alignment(&b->round2); 

	erate = s->diff_ov; wl = MIN((((double)THRESHOLD_MAX_SIZE)/erate), WINDOW); aux_o = NULL;
	ug_lalign(&b->olist, &b->clist, &(s->udb), s->uopt, seq, len, NULL/**&b->self_read**/, &b->ovlp_read, 
	&b->correct, &b->exz, aux_o, erate, wl, i, s->k, s->chain_cut, NULL);
    aux_o = gen_aux_ovlp(&b->olist);///must be here
	ug_lalign(&b->olist, &b->clist, &(s->udb), s->uopt, seq, len, NULL/**&b->self_read**/, &b->ovlp_read, 
	&b->correct, &b->exz, aux_o, erate, wl, i, s->k, s->chain_cut, NULL);

	copy_asg_arr(b0, s->ll[tid].srt.a); 
	push_graph_bin(&b->olist, &(s->udb), s->diff_bin, s->max_diff, s->min_bin_len, i, &b0, &(s->mk[tid]), &(s->mm->a[i]));
	copy_asg_arr(s->ll[tid].srt.a, b0); 
	// if(!gen_trans_adaptive_aln(s, i, b, bl, seq, len, s->filter, s->diff_ec_ul, s->diff_ec_ul_double, s->bw_thres, s->bw_thres_double)) {
	// 	gen_trans_adaptive_aln(s, i, b, bl, seq, len, NULL, s->diff_ec_ul_double, s->diff_ec_ul_double, s->bw_thres_double, s->bw_thres_double);
	// }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movslq %edx, %rbp
movq (%rax,%rbp,8), %r13
leaq 0xa91b8(%rip), %rax     # 0x295758
movl 0x1bc(%rax), %eax
incl %eax
movl %eax, 0xc(%rsp)
movq 0x8(%rdi), %rdi
movq 0x10(%rdi), %rax
leaq (%rsi,%rsi,4), %r12
movq 0x20(%rax,%r12,8), %rdx
movl (%rax,%r12,8), %r15d
movl 0xb0(%rbx), %ecx
testl %ecx, %ecx
jne 0x1ec5e3
cmpl $0x0, 0xac(%rbx)
je 0x1ec5e3
movq 0x80(%rbx), %rsi
movq $0x0, (%rsi,%r14,8)
movq 0x18(%rdi), %rsi
movq 0x20(%rsi), %rsi
cmpl $0x0, (%rsi,%r14,8)
js 0x1ecaed
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
testq %rdx, %rdx
jne 0x1ec651
movq 0x8(%r13), %rsi
cmpq %r15, 0x18(%r13)
jge 0x1ec62a
movq %rsi, %rdi
movq %r15, %rsi
callq 0x2370
movq %rax, %rsi
movq %rax, 0x8(%r13)
movq %r15, 0x18(%r13)
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
leaq (%rax,%r12,8), %rdx
subq $0x8, %rsp
xorl %edi, %edi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x0
callq 0x36049
addq $0x10, %rsp
movq 0x8(%r13), %rdx
movl 0xb0(%rbx), %ecx
testl %ecx, %ecx
je 0x1ec91b
movq 0x80(%rbx), %rax
movq (%rax,%r14,8), %rcx
movq %rdx, 0x40(%rsp)
movq %rbp, 0x68(%rsp)
movq 0x8(%rax,%r14,8), %rbp
subq %rcx, %rbp
movq 0xe8(%r13), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
leaq 0xc0(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0xa0(%r13), %rax
movq %rax, 0x28(%rsp)
leaq 0x48(%r13), %rax
movq %rax, 0x30(%rsp)
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %eax
movq %rax, 0x20(%rsp)
leaq 0x121a0(%r13), %rax
movq %rax, 0x18(%rsp)
leaq 0x12250(%r13), %rax
movq %rax, 0x10(%rsp)
leaq (%rcx,%rcx,2), %rax
shlq $0x3, %rax
addq 0x68(%rbx), %rax
movl 0x98(%rbx), %r10d
movl 0x88(%rbx), %r11d
movslq 0xb4(%rbx), %r12
movq %r15, %rcx
movq %r15, 0x60(%rsp)
movslq 0xb8(%rbx), %r15
subq $0x8, %rsp
movsd 0x44e79(%rip), %xmm1    # 0x231580
movl %r14d, %esi
pushq %r15
pushq %r12
pushq %r11
pushq 0x90(%rbx)
pushq %rbp
pushq %rax
pushq %r10
pushq $0x3
movl $0x1, %eax
pushq %rax
pushq %rax
movl $0x1, %r10d
movl $0x0, %eax
pushq %rax
leaq 0x6c(%rsp), %r11
pushq %r11
pushq 0x78(%rsp)
pushq %rax
pushq 0x90(%rsp)
pushq %rax
pushq %r10
pushq 0xb0(%rsp)
movq 0xc8(%rsp), %rbp
pushq %rbp
movq 0xc8(%rsp), %r12
pushq %r12
movq 0xe0(%rsp), %r15
pushq %r15
callq 0x1349ac
addq $0xb0, %rsp
leaq 0x108(%r13), %rdi
callq 0x475fb
leaq 0x9330(%r13), %rdi
callq 0x4758d
movsd 0x38(%rbx), %xmm1
movsd 0x44e86(%rip), %xmm0    # 0x231620
divsd %xmm1, %xmm0
movsd %xmm1, 0x20(%rsp)
minsd 0x44e7c(%rip), %xmm0    # 0x231628
cvttsd2si %xmm0, %rax
movq %rax, 0x10(%rsp)
movq (%rbx), %rcx
leaq 0x28(%r13), %rdx
movq %rdx, 0x50(%rsp)
leaq 0x2c0(%r13), %r11
movq %r11, 0x18(%rsp)
addq $0x12268, %r13          # imm = 0x12268
movslq 0x2c(%rbx), %rdx
movq %rdx, 0x48(%rsp)
movslq 0xb8(%rbx), %r10
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, 0x58(%rsp)
movq %r15, %r12
movq 0x40(%rsp), %r8
movq 0x60(%rsp), %rbp
movq %rbp, %r9
movapd %xmm1, %xmm0
movl $0x0, %r15d
pushq %r15
pushq %r10
pushq 0x58(%rsp)
pushq %r14
pushq %rax
pushq %r15
pushq %r13
pushq %r11
movq 0x90(%rsp), %r14
pushq %r14
pushq %r15
callq 0x849d9
addq $0x50, %rsp
movq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x1bce5f
movq (%rbx), %rcx
movslq 0x2c(%rbx), %r10
movslq 0xb8(%rbx), %r11
movq %r15, %rdi
movq 0x30(%rsp), %rsi
movq %r12, %rdx
movq 0x40(%rsp), %r8
movq %rbp, %r9
movsd 0x20(%rsp), %xmm0
xorl %r15d, %r15d
pushq %r15
pushq %r11
pushq %r10
movq 0x70(%rsp), %rbp
pushq %rbp
pushq 0x30(%rsp)
pushq %rax
pushq %r13
pushq 0x50(%rsp)
pushq %r14
pushq %r15
callq 0x849d9
addq $0x50, %rsp
movq 0x20(%rbx), %rax
movq 0x68(%rsp), %rsi
imulq $0x68, %rsi, %r12
movq 0x58(%rax,%r12), %rcx
leaq 0x70(%rsp), %r15
movq %rcx, 0x10(%r15)
movups 0x48(%rax,%r12), %xmm0
movaps %xmm0, (%r15)
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rdx
leaq (%rsi,%rsi,2), %rax
shlq $0x4, %rax
addq 0xf0(%rbx), %rax
movq 0xf8(%rbx), %rsi
movq %rbp, %r8
leaq (,%rbp,2), %r10
addq %rbp, %r10
shlq $0x3, %r10
addq (%rsi), %r10
movq 0x28(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %r15, %r9
pushq %r10
pushq %rax
callq 0x1cc8d2
addq $0x10, %rsp
movq 0x10(%r15), %rax
movq 0x20(%rbx), %rcx
movq %rax, 0x58(%rcx,%r12)
movaps (%r15), %xmm0
movups %xmm0, 0x48(%rcx,%r12)
jmp 0x1ecaed
leaq 0xc0(%rbx), %rax
leaq 0x121a0(%r13), %rcx
leaq 0x12250(%r13), %rsi
cmpl $0x0, 0xac(%rbx)
movq 0xe8(%r13), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %ebp
movl 0x98(%rbx), %r10d
je 0x1eca12
movslq 0xb4(%rbx), %r11
movslq 0xb8(%rbx), %r12
subq $0xb0, %rsp
movq %r12, 0xa0(%rsp)
movq %r11, 0x98(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x88(%rsp)
movups %xmm1, 0x78(%rsp)
movl %r10d, 0x70(%rsp)
movl $0x1, %r10d
movl %r10d, 0x60(%rsp)
movl %r10d, 0x58(%rsp)
xorl %r11d, %r11d
movq %r11, 0x50(%rsp)
leaq 0xbc(%rsp), %r12
movq %r12, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %r11, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r11, 0x28(%rsp)
movl %r10d, 0x20(%rsp)
movl %ebp, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
movq %rax, (%rsp)
movl $0x3, 0x68(%rsp)
movsd 0x44b90(%rip), %xmm1    # 0x231580
movl %r14d, %esi
movq %r15, %rcx
callq 0x1349ac
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x1ecaed
movq 0x80(%rbx), %r11
movq (%r11,%r14,8), %r11
leaq (%r11,%r11,2), %r11
shlq $0x3, %r11
addq 0x68(%rbx), %r11
movslq 0xb4(%rbx), %r12
movslq 0xb8(%rbx), %r13
subq $0xb0, %rsp
movq %r13, 0xa0(%rsp)
movq %r12, 0x98(%rsp)
xorl %r12d, %r12d
movq %r12, 0x90(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x80(%rsp)
movq %r11, 0x78(%rsp)
movl %r10d, 0x70(%rsp)
movl $0x1, %r10d
movl %r10d, 0x60(%rsp)
movl %r10d, 0x58(%rsp)
movq %r12, 0x50(%rsp)
leaq 0xbc(%rsp), %r11
movq %r11, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %r12, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r12, 0x28(%rsp)
movl %r10d, 0x20(%rsp)
movl %ebp, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
movq %rax, (%rsp)
movl $0x3, 0x68(%rsp)
movsd 0x44aba(%rip), %xmm1    # 0x231580
movl %r14d, %esi
movq %r15, %rcx
callq 0x1349ac
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq 0x8(%rcx,%r14,8), %rdx
subq (%rcx,%r14,8), %rdx
cmpq %rdx, %rax
jne 0x1ecaff
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58788(%rip), %rdi     # 0x24528e
leaq 0x5314e(%rip), %rsi     # 0x23fc5b
leaq 0x588a7(%rip), %rcx     # 0x2453bb
movl $0x30b8, %edx           # imm = 0x30B8
callq 0x2110