// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/inter.cpp
// Function: worker_for_ul_scall_alignment(void*, long, int)
static void worker_for_ul_scall_alignment(void *data, long i, int tid) // callback for kt_for()
{
    utepdat_t *s = (utepdat_t*)data;
	ha_ovec_buf_t *b = s->hab[tid];
	glchain_t *bl = &(s->ll[tid]);
	int64_t /**rid = s->id+i,**/ winLen = MIN((((double)THRESHOLD_MAX_SIZE)/s->opt->diff_ec_ul), WINDOW), cha_idx;
	uint32_t high_occ = 2; overlap_region *aux_o = NULL;
	// if(s->id+i != 901) return;
	// if(s->id+i != 1052) return;
	// fprintf(stderr, "[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);
	// if (memcmp(UL_INF.nid.a[s->id+i].a, "d0aab024-b3a7-40fb-83cc-22c3d6d951f8", UL_INF.nid.a[s->id+i].n-1)) return;
	// fprintf(stderr, "[M::%s::] ==> len: %lu\n", __func__, s->len[i]);
	// ha_get_ul_candidates_interface(b->abl, i, s->seq[i], s->len[i], s->opt->w, s->opt->k, s->uu, &b->olist, &b->olist_hp, &b->clist, s->opt->bw_thres, 
	// 	s->opt->max_n_chain, 1, NULL/**&(b->k_flag)**/, &b->r_buf, &(b->tmp_region), NULL, &(b->sp), asm_opt.hom_cov, km);
	ul_map_lchain(b->abl, (uint32_t)-1, s->seq[i], s->len[i], s->opt->w, s->opt->k, s->uu, &b->olist, &b->clist, s->opt->bw_thres, 
            s->opt->max_n_chain, 1, NULL, &(b->tmp_region), NULL, &(b->sp), &high_occ, NULL, 0, 1, 0.2/**0.75**/, 2, 3);
			
	clear_Cigar_record(&b->cigar1);
	clear_Round2_alignment(&b->round2);
	
	ul_rid_lalign_adv(&b->olist, &b->clist, s->uu, s->uopt, s->seq[i], s->len[i], &b->self_read, &b->ovlp_read, 
		&b->exz, NULL, s->opt->diff_ec_ul, winLen, NULL, NULL, NULL, s->id+i, s->opt->k, NULL);

	aux_o = gen_aux_ovlp(&b->olist);///must be here
	cha_idx = bl->tk.n;

	ul_rid_lalign_adv(&b->olist, &b->clist, s->uu, s->uopt, s->seq[i], s->len[i], &b->self_read, &b->ovlp_read, 
		&b->exz, aux_o, s->opt->diff_ec_ul, winLen, &(bl->tk), &(bl->lo), &(bl->tc), s->id+i, s->opt->k, NULL);

	// bl->lo.n = bl->tk.n = 0;
	gen_rid_raw_chain(&b->olist, bl, cha_idx, &(b->clist.chainDP), s->uu, s->opt->diff_ec_ul, s->len[i], s->uopt, s->seq[i], &b->ovlp_read, &b->exz, i, s->id+i, b, s->opt->max_n_chain);
	/**
	// gl_chain_refine(&b->olist, &b->correct, &b->hap, bl, s->uu, s->opt->diff_ec_ul, winLen, s->len[i], km);
	gl_chain_refine_advance(&b->olist, &b->correct, &b->hap, bl, &(s->sps[tid]), s->uu, s->opt->diff_ec_ul, winLen, s->len[i], s->uopt, s->id+i, km);
	align = kv_ul_ov_t_statistics(&(bl->tk), i, &(b->num_recorrect_base));
	if(align == s->len[i]) {
		free(s->seq[i]); s->seq[i] = NULL;
	}
	b->num_correct_base += align;
	**/
	// fprintf(stderr, "[1M::%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);

	// fprintf(stderr, "[M::%s] rid:%ld, dd:%u\n", __func__, s->id+i, UL_INF.a[s->id+i].dd);
    // int64_t mem[6], mem_hab[6];
    // if(get_utepdat_t_mem_tid(s, tid, mem, mem_hab)>((int64_t)5*(int64_t)1073741824)) {
    //     fprintf(stderr, "[M::%s::tid->%d::rid->%ld] buffer[0]: %.3fGB(%.3fGB::%.3fGB::%.3fGB::%.3fGB::%.3fGB), buffer[1]: %.3fGB, buffer[2]: %.3fGB, buffer[3]: %.3fGB, buffer[4]: %.3fGB, buffer[5]: %.3fGB\n", 
    //             __func__, tid, i, mem[0]/1073741824.0, 
    //          mem_hab[0]/1073741824.0, mem_hab[1]/1073741824.0, mem_hab[2]/1073741824.0, 
    //          mem_hab[3]/1073741824.0, mem_hab[4]/1073741824.0,
    //          mem[1]/1073741824.0, mem[2]/1073741824.0,
    //             mem[3]/1073741824.0, mem[4]/1073741824.0, mem[5]/1073741824.0);
    // }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r13
movq %rdi, %r14
movq (%rdi), %rax
movq 0x80(%rdi), %rcx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %r15
movq 0x88(%rdi), %rsi
movq %rsi, 0x50(%rsp)
movsd 0x430f7(%rip), %xmm0    # 0x225520
divsd 0x68(%rax), %xmm0
minsd 0x430f2(%rip), %xmm0    # 0x225528
cvttsd2si %xmm0, %rcx
movq %rcx, 0x48(%rsp)
imulq $0x68, %rdx, %rcx
movq %rcx, 0x58(%rsp)
addq %rsi, %rcx
movq %rcx, 0x60(%rsp)
movl $0x2, %edx
leaq 0x14(%rsp), %rcx
movl %edx, (%rcx)
movq 0xe8(%r15), %rdi
movq 0x58(%r14), %rcx
movq (%rcx,%r13,8), %rdx
movq 0x48(%r14), %rcx
movq (%rcx,%r13,8), %rcx
movslq (%rax), %r8
movslq 0x4(%rax), %r9
movsd 0x60(%rax), %xmm0
movl 0x80(%rax), %eax
movq %rax, 0x8(%rsp)
leaq 0xa0(%r15), %r12
leaq 0x48(%r15), %rbx
leaq 0x121a0(%r15), %rbp
leaq 0x12250(%r15), %r10
subq $0x8, %rsp
xorl %r11d, %r11d
movsd 0x42fcd(%rip), %xmm1    # 0x225480
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
pushq $0x3
movl $0x2, %eax
pushq %rax
movl $0x1, %eax
pushq %rax
pushq $0x0
pushq %r11
leaq 0x44(%rsp), %rax
pushq %rax
pushq %r10
pushq %r11
pushq %rbp
pushq %r11
movl $0x1, %eax
pushq %rax
pushq 0x68(%rsp)
movq %rbx, 0x80(%rsp)
pushq %rbx
pushq %r12
pushq 0x30(%r14)
callq 0x129aff
addq $0x80, %rsp
leaq 0x108(%r15), %rdi
callq 0x48007
leaq 0x9330(%r15), %rdi
callq 0x47f99
movq 0x30(%r14), %rdx
movq (%r14), %rax
movq 0x28(%r14), %rcx
movq %rcx, 0x8(%rsp)
movq 0x58(%r14), %rsi
movq (%rsi,%r13,8), %r8
movq 0x48(%r14), %rsi
movq (%rsi,%r13,8), %r9
leaq 0x8(%r15), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x28(%r15), %r10
movq %r10, 0x38(%rsp)
leaq 0x12268(%r15), %r11
movq %r11, 0x30(%rsp)
movsd 0x68(%rax), %xmm0
movq 0x50(%r14), %rsi
addq %r13, %rsi
movslq 0x4(%rax), %rax
subq $0x60, %rsp
xorl %edi, %edi
movq %rdi, 0x50(%rsp)
movq %rax, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x28(%rsp)
movq 0xa8(%rsp), %rbp
movq %rbp, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x8(%rsp)
movq %rcx, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq 0x68(%rsp), %rcx
callq 0x83705
addq $0x60, %rsp
movq %r12, %rdi
movq %r12, 0x28(%rsp)
callq 0x1b3684
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %r11
leaq (%rax,%r11), %r10
addq $0x18, %r10
movq 0x8(%r10), %rcx
movq %rcx, 0x8(%rsp)
movq 0x30(%r14), %rdx
movq (%r14), %rsi
movq 0x28(%r14), %rcx
movq 0x58(%r14), %rdi
movq (%rdi,%r13,8), %r8
movq 0x48(%r14), %rdi
movq (%rdi,%r13,8), %r9
movsd 0x68(%rsi), %xmm0
leaq (%rax,%r11), %rbx
addq $0x30, %rbx
movq 0x50(%r14), %r11
addq %r13, %r11
movslq 0x4(%rsi), %rax
subq $0x8, %rsp
movq %r12, %rdi
movq 0x20(%rsp), %rsi
xorl %r12d, %r12d
pushq %r12
pushq %rax
pushq %r11
pushq %rbx
movq 0x88(%rsp), %r12
pushq %r12
pushq %r10
pushq %rbp
pushq 0x60(%rsp)
movq 0x78(%rsp), %rbp
pushq %rbp
movq 0x88(%rsp), %rbx
pushq %rbx
pushq 0x98(%rsp)
callq 0x83705
addq $0x60, %rsp
leaq 0x60(%r15), %rcx
movq 0x30(%r14), %r8
movq (%r14), %rax
movq 0x28(%r14), %rdx
movsd 0x68(%rax), %xmm0
movq 0x48(%r14), %rsi
movq (%rsi,%r13,8), %r9
movq 0x58(%r14), %rsi
movq (%rsi,%r13,8), %rsi
movslq 0x80(%rax), %rax
subq $0x40, %rsp
movq %rax, 0x38(%rsp)
movq %r15, 0x30(%rsp)
movq %r13, 0x20(%rsp)
movq %rbp, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdx, (%rsp)
movq 0x68(%rsp), %rdi
movq %r12, %rsi
movq 0x48(%rsp), %rdx
callq 0x1b979e
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq