// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movq (%rax,%r12,8), %rbp
leaq 0xa8c74(%rip), %rax     # 0x28a758
movl 0x1bc(%rax), %eax
incl %eax
movl %eax, 0xc(%rsp)
movq 0x8(%rdi), %rax
movq 0x10(%rax), %rcx
leaq (%rsi,%rsi,4), %r13
movq 0x20(%rcx,%r13,8), %rdx
movl (%rcx,%r13,8), %r15d
cmpl $0x0, 0xb0(%rdi)
jne 0x1e1b26
cmpl $0x0, 0xac(%rbx)
je 0x1e1b26
movq 0x80(%rbx), %rcx
movq $0x0, (%rcx,%r14,8)
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax,%r14,8)
js 0x1e204f
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
testq %rdx, %rdx
jne 0x1e1b8f
cmpq %r15, 0x18(%rbp)
jge 0x1e1b5f
movq 0x8(%rbp), %rdi
movq %r15, %rsi
callq 0x2370
movq %rax, 0x8(%rbp)
movq %r15, 0x18(%rbp)
movq 0x8(%rbp), %rsi
movq 0x8(%rbx), %rax
shlq $0x3, %r13
addq 0x10(%rax), %r13
subq $0x8, %rsp
xorl %edi, %edi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x0
callq 0x36b0d
addq $0x10, %rsp
movq 0x8(%rbp), %rdx
cmpl $0x0, 0xb0(%rbx)
movq %rdx, 0x28(%rsp)
je 0x1e1e6d
movq 0x80(%rbx), %rax
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %r13
subq %rcx, %r13
movq 0xe8(%rbp), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
leaq 0xc0(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0xa0(%rbp), %rax
movq %rax, 0x30(%rsp)
leaq 0x48(%rbp), %rax
movq %rax, 0x38(%rsp)
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %eax
movq %rax, 0x20(%rsp)
leaq 0x121a0(%rbp), %rax
movq %rax, 0x18(%rsp)
leaq 0x12250(%rbp), %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
movq %r12, 0x68(%rsp)
movslq 0xb4(%rbx), %r12
movq %r15, %rcx
movq %r15, 0x48(%rsp)
movslq 0xb8(%rbx), %r15
subq $0x8, %rsp
movsd 0x43836(%rip), %xmm1    # 0x225480
movl %r14d, %esi
pushq %r15
pushq %r12
pushq %r11
pushq 0x90(%rbx)
pushq %r13
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 0xd0(%rsp), %r12
pushq %r12
movq 0xd0(%rsp), %r13
pushq %r13
movq 0xe8(%rsp), %r15
pushq %r15
callq 0x12e79d
addq $0xb0, %rsp
leaq 0x108(%rbp), %rdi
callq 0x48007
leaq 0x9330(%rbp), %rdi
callq 0x47f99
movsd 0x38(%rbx), %xmm1
movsd 0x43841(%rip), %xmm0    # 0x225520
divsd %xmm1, %xmm0
movsd %xmm1, 0x20(%rsp)
minsd 0x43837(%rip), %xmm0    # 0x225528
cvttsd2si %xmm0, %rax
movq %rax, 0x10(%rsp)
movq (%rbx), %rcx
leaq 0x28(%rbp), %rdx
movq %rdx, 0x58(%rsp)
leaq 0x2c0(%rbp), %r11
movq %r11, 0x18(%rsp)
addq $0x12268, %rbp          # imm = 0x12268
movslq 0x2c(%rbx), %rdx
movq %rdx, 0x50(%rsp)
movslq 0xb8(%rbx), %r10
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, 0x60(%rsp)
movq %r15, %r12
movq 0x28(%rsp), %r13
movq %r13, %r8
movq 0x48(%rsp), %r9
movapd %xmm1, %xmm0
movl $0x0, %r15d
pushq %r15
pushq %r10
pushq 0x60(%rsp)
pushq %r14
pushq %rax
pushq %r15
pushq %rbp
pushq %r11
movq 0x98(%rsp), %r14
pushq %r14
pushq %r15
callq 0x852da
addq $0x50, %rsp
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x1b3684
movq (%rbx), %rcx
movslq 0x2c(%rbx), %r10
movslq 0xb8(%rbx), %r11
movq %r15, %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
movq %r13, %r8
movq 0x48(%rsp), %r9
movsd 0x20(%rsp), %xmm0
xorl %r15d, %r15d
pushq %r15
pushq %r11
pushq %r10
movq 0x78(%rsp), %r13
pushq %r13
pushq 0x30(%rsp)
pushq %rax
pushq %rbp
pushq 0x50(%rsp)
pushq %r14
pushq %r15
callq 0x852da
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)
movq 0x48(%rax,%r12), %rcx
movq %rcx, (%r15)
movq 0x50(%rax,%r12), %rax
movq %rax, 0x8(%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 %r13, %r8
leaq (,%r13,2), %r10
addq %r13, %r10
shlq $0x3, %r10
addq (%rsi), %r10
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r15, %r9
pushq %r10
pushq %rax
callq 0x1c28e6
addq $0x10, %rsp
movq 0x10(%r15), %rax
movq 0x20(%rbx), %rcx
movq %rax, 0x58(%rcx,%r12)
movq (%r15), %rax
movq %rax, 0x48(%rcx,%r12)
movq 0x8(%r15), %rax
movq %rax, 0x50(%rcx,%r12)
jmp 0x1e204f
leaq 0xc0(%rbx), %rax
leaq 0x121a0(%rbp), %rcx
leaq 0x12250(%rbp), %rsi
cmpl $0x0, 0xac(%rbx)
movq 0xe8(%rbp), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %edx
movl 0x98(%rbx), %r10d
je 0x1e1f6c
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 %edx, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
movq %rax, (%rsp)
movl $0x3, 0x68(%rsp)
movsd 0x4353e(%rip), %xmm1    # 0x225480
movl %r14d, %esi
movq 0xd8(%rsp), %rdx
movq %r15, %rcx
callq 0x12e79d
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x1e204f
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 %edx, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
movq %rax, (%rsp)
movl $0x3, 0x68(%rsp)
movsd 0x43460(%rip), %xmm1    # 0x225480
movl %r14d, %esi
movq 0xd8(%rsp), %rdx
movq %r15, %rcx
callq 0x12e79d
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq 0x8(%rcx,%r14,8), %rdx
subq (%rcx,%r14,8), %rdx
cmpq %rdx, %rax
jne 0x1e2061
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x56f56(%rip), %rdi     # 0x238fbe
leaq 0x5191c(%rip), %rsi     # 0x23398b
leaq 0x57075(%rip), %rcx     # 0x2390eb
movl $0x30b8, %edx           # imm = 0x30B8
callq 0x2110