// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movslq %edx, %rbp
movq (%rax,%rbp,8), %r12
leaq 0xb23ea(%rip), %rax     # 0x253758
movl 0x1bc(%rax), %eax
incl %eax
movl %eax, 0xc(%rsp)
movq 0x8(%rdi), %rcx
movq 0x10(%rcx), %rax
movq %rsi, %r14
imulq $0x28, %rsi, %r13
movq 0x20(%rax,%r13), %rdx
movl (%rax,%r13), %r15d
movl 0xb0(%rdi), %eax
testl %eax, %eax
jne 0x1a13b1
cmpl $0x0, 0xac(%rbx)
je 0x1a13b1
movq 0x80(%rbx), %rsi
andq $0x0, (%rsi,%r14,8)
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
cmpl $0x0, (%rcx,%r14,8)
js 0x1a187b
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
testq %rdx, %rdx
jne 0x1a1412
leaq 0x8(%r12), %rdi
movq %r15, %rsi
callq 0x562fa
movq 0x8(%r12), %rsi
movq 0x8(%rbx), %rax
addq 0x10(%rax), %r13
subq $0x10, %rsp
andq $0x0, (%rsp)
xorl %edi, %edi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
callq 0x9f29
popq %rax
popq %rcx
movq 0x8(%r12), %rdx
movl 0xb0(%rbx), %eax
testl %eax, %eax
je 0x1a16b0
movq 0x80(%rbx), %rax
movq (%rax,%r14,8), %rcx
movq %rdx, 0x50(%rsp)
movq %rbp, 0x58(%rsp)
movq 0x8(%rax,%r14,8), %rbp
movq %r14, %rsi
movq %r14, 0x30(%rsp)
subq %rcx, %rbp
movq 0xe8(%r12), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
leaq 0xc0(%rbx), %rax
movq %rax, 0x48(%rsp)
leaq 0xa0(%r12), %rax
movq %rax, 0x28(%rsp)
leaq 0x48(%r12), %r14
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %eax
movq %rax, 0x10(%rsp)
leaq 0x121a0(%r12), %rax
movq %rax, 0x20(%rsp)
leaq 0x12250(%r12), %rax
movq %rax, 0x18(%rsp)
imulq $0x18, %rcx, %rax
addq 0x68(%rbx), %rax
movl 0x98(%rbx), %r10d
movl 0x88(%rbx), %r11d
movslq 0xb4(%rbx), %r13
movq %r15, %rcx
movq %r15, 0x38(%rsp)
movslq 0xb8(%rbx), %r15
subq $0x8, %rsp
movsd 0x42004(%rip), %xmm1    # 0x1e34d0
pushq %r15
pushq %r13
pushq %r11
pushq 0x90(%rbx)
pushq %rbp
pushq %rax
pushq %r10
pushq $0x3
pushq $0x1
popq %rax
pushq %rax
pushq %rax
pushq $0x0
leaq 0x6c(%rsp), %r10
pushq %r10
pushq 0x80(%rsp)
pushq $0x0
pushq 0x98(%rsp)
pushq $0x0
pushq %rax
pushq 0xa0(%rsp)
movq %r14, %rbp
movq %r14, 0xd8(%rsp)
pushq %r14
movq 0xc8(%rsp), %r13
pushq %r13
movq 0xf0(%rsp), %r15
pushq %r15
callq 0xee257
addq $0xb0, %rsp
leaq 0x108(%r12), %rdi
callq 0x1b25d
leaq 0x9330(%r12), %rdi
callq 0x1b1e8
movsd 0x38(%rbx), %xmm1
movsd 0x42016(%rip), %xmm0    # 0x1e3570
divsd %xmm1, %xmm0
movsd %xmm1, 0x18(%rsp)
minsd 0x4200c(%rip), %xmm0    # 0x1e3578
cvttsd2si %xmm0, %r14
movq %r14, 0x20(%rsp)
movq (%rbx), %rcx
leaq 0x28(%r12), %rax
movq %rax, 0x10(%rsp)
leaq 0x2c0(%r12), %rax
addq $0x12268, %r12          # imm = 0x12268
movslq 0x2c(%rbx), %r11
movslq 0xb8(%rbx), %r10
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r15, %r13
movq 0x50(%rsp), %rbp
movq %rbp, %r8
movq 0x38(%rsp), %r9
movapd %xmm1, %xmm0
pushq $0x0
pushq %r10
pushq %r11
pushq 0x48(%rsp)
pushq %r14
pushq $0x0
pushq %r12
pushq %rax
movq %rax, %r15
pushq 0x50(%rsp)
pushq $0x0
callq 0x5128a
addq $0x50, %rsp
movq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x172830
movq (%rbx), %rcx
movslq 0x2c(%rbx), %r10
movslq 0xb8(%rbx), %r11
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %r8
movq 0x38(%rsp), %r9
movsd 0x18(%rsp), %xmm0
pushq $0x0
pushq %r11
pushq %r10
movq 0x48(%rsp), %r14
pushq %r14
pushq 0x40(%rsp)
pushq %rax
pushq %r12
pushq %r15
pushq 0x50(%rsp)
pushq $0x0
callq 0x5128a
addq $0x50, %rsp
movq 0x20(%rbx), %rax
movq 0x58(%rsp), %rsi
imulq $0x68, %rsi, %r12
movq 0x58(%rax,%r12), %rcx
leaq 0x60(%rsp), %r15
movq %rcx, 0x10(%r15)
movups 0x48(%rax,%r12), %xmm0
movaps %xmm0, (%r15)
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rdx
imulq $0x30, %rsi, %rax
addq 0xf0(%rbx), %rax
movq 0xf8(%rbx), %rsi
movq %r14, %r8
imulq $0x18, %r14, %r10
addq (%rsi), %r10
movq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %r15, %r9
pushq %r10
pushq %rax
callq 0x180d56
popq %rax
popq %rcx
movq 0x10(%r15), %rax
movq 0x20(%rbx), %rcx
movq %rax, 0x58(%rcx,%r12)
movaps (%r15), %xmm0
movups %xmm0, 0x48(%rcx,%r12)
jmp 0x1a187b
leaq 0xc0(%rbx), %rax
leaq 0x121a0(%r12), %rcx
leaq 0x12250(%r12), %rbp
cmpl $0x0, 0xac(%rbx)
movq 0xe8(%r12), %rdi
movslq 0x28(%rbx), %r8
movslq 0x2c(%rbx), %r9
movsd 0x30(%rbx), %xmm0
movl 0x58(%rbx), %esi
movl 0x98(%rbx), %r10d
je 0x1a17a8
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)
pushq $0x1
popq %r10
movl %r10d, 0x60(%rsp)
movl %r10d, 0x58(%rsp)
leaq 0xbc(%rsp), %r11
movq %r11, 0x48(%rsp)
movq %rbp, 0x40(%rsp)
movq %rcx, 0x30(%rsp)
movl %r10d, 0x20(%rsp)
movl %esi, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
movq %rax, (%rsp)
andq $0x0, 0x50(%rsp)
movl $0x3, 0x68(%rsp)
andq $0x0, 0x38(%rsp)
andq $0x0, 0x28(%rsp)
movsd 0x41d4a(%rip), %xmm1    # 0x1e34d0
movl %r14d, %esi
movq %r15, %rcx
callq 0xee257
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x1a187b
movq 0x80(%rbx), %r11
imulq $0x18, (%r11,%r14,8), %r11
addq 0x68(%rbx), %r11
movslq 0xb4(%rbx), %r12
movslq 0xb8(%rbx), %r13
subq $0xb0, %rsp
movq %r13, 0xa0(%rsp)
movq %r12, 0x98(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x80(%rsp)
movq %r11, 0x78(%rsp)
movl %r10d, 0x70(%rsp)
pushq $0x1
popq %r10
movl %r10d, 0x60(%rsp)
movl %r10d, 0x58(%rsp)
leaq 0xbc(%rsp), %r11
movq %r11, 0x48(%rsp)
movq %rbp, 0x40(%rsp)
movq %rcx, 0x30(%rsp)
movl %r10d, 0x20(%rsp)
movl %esi, 0x18(%rsp)
movups %xmm1, 0x8(%rsp)
andq $0x0, 0x90(%rsp)
movq %rax, (%rsp)
andq $0x0, 0x50(%rsp)
movl $0x3, 0x68(%rsp)
andq $0x0, 0x38(%rsp)
andq $0x0, 0x28(%rsp)
movsd 0x41c7c(%rip), %xmm1    # 0x1e34d0
movl %r14d, %esi
movq %r15, %rcx
callq 0xee257
addq $0xb0, %rsp
movq 0x80(%rbx), %rcx
movq 0x8(%rcx,%r14,8), %rdx
subq (%rcx,%r14,8), %rdx
cmpq %rdx, %rax
jne 0x1a188a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x558c5(%rip), %rdi     # 0x1f7156
leaq 0x5028b(%rip), %rsi     # 0x1f1b23
leaq 0x559e4(%rip), %rcx     # 0x1f7283
movl $0x30b8, %edx           # imm = 0x30B8
callq 0x2110