// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: init_ug_bin_t(ug_bin_t*, ug_opt_t const*, int, int, int, int, double, double, double, unsigned long, unsigned long, int, int, int, int, ma_ug_t*, asg_t*)
void init_ug_bin_t(ug_bin_t *sl, const ug_opt_t *uopt, int32_t is_HPC, int32_t k, int32_t w, int32_t max_n_chain, 
double bw_thres, double diff_ov, double diff_bin, uint64_t max_diff, uint64_t min_bin_len, int32_t n_thread, 
int32_t mini_cut, int32_t chain_cut, int32_t keep_unsymm_arc, ma_ug_t *ug, asg_t *sg)
{
    int64_t i; 
    memset(sl, 0, sizeof((*sl)));
	sl->uopt = uopt;
    sl->k = k; 
    sl->w = w;
    sl->is_HPC = is_HPC;
    sl->max_n_chain = max_n_chain;
    sl->bw_thres = bw_thres;
    sl->diff_ov = diff_ov;
	sl->diff_bin = diff_bin;
	sl->max_diff = max_diff;
	sl->min_bin_len = min_bin_len;
	sl->mini_cut = mini_cut;
	sl->chain_cut = chain_cut;
	sl->keep_unsymm_arc = keep_unsymm_arc;

    sl->bw = 10000;///2000 in minigraph
    sl->max_gap = 500000;///5000 in minigraph
    sl->ug = ug;
    sl->rg = sg;
    sl->n_thread = ((n_thread>=1)?n_thread:1);

	CALLOC(sl->mk, sl->n_thread);
    CALLOC(sl->hab, sl->n_thread); 
	CALLOC(sl->ll, sl->n_thread);
    for (i = 0; i < sl->n_thread; ++i) sl->hab[i] = ha_ovec_init(0, 0, 1); 

	sl->idx_n.n = sl->idx_n.m = ug->u.n+1;
	MALLOC(sl->idx_n.a, sl->idx_n.n);

	sl->udb.ug = ug;
	// CALLOC(sl->bm, sl->n_thread);
	// for (i = 0; i < sl->n_thread; ++i) {
	// 	sl->bm[i].n = ((sl->udb.ug->g->n_seq<<1)>>3) + (!!((sl->udb.ug->g->n_seq<<1)&((uint32_t)7)));
	// 	CALLOC(sl->bm[i].a, sl->bm[i].n);
	// }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movsd %xmm2, 0x20(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %r9d, 0xc(%rsp)
movl %r8d, 0x8(%rsp)
movl %ecx, %r12d
movl %edx, %r13d
movq %rsi, %rbp
movq %rdi, %rbx
movl 0x70(%rsp), %r14d
addq $0x58, %rdi
xorl %r15d, %r15d
movl $0xa8, %edx
xorl %esi, %esi
callq 0x20e0
movq %rbp, (%rbx)
movl %r12d, 0x2c(%rbx)
movq 0x90(%rsp), %r12
movl 0x8(%rsp), %eax
movl %eax, 0x28(%rbx)
movl %r13d, 0x98(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x58(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x40(%rbx)
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rbx)
movq 0x68(%rsp), %rax
movq %rax, 0x48(%rbx)
movl 0x78(%rsp), %eax
movl %eax, 0xb4(%rbx)
movl 0x80(%rsp), %eax
movl %eax, 0xb8(%rbx)
movl 0x88(%rsp), %eax
movl %eax, 0xbc(%rbx)
movabsq $0x7a12000002710, %rax  # imm = 0x7A12000002710
movq %rax, 0x9c(%rbx)
movq %r12, 0x8(%rbx)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rbx)
cmpl $0x2, %r14d
pushq $0x1
popq %rbp
cmovll %ebp, %r14d
movl %r14d, 0xa8(%rbx)
pushq $0x30
popq %rsi
movq %r14, %rdi
callq 0x2120
movq %rax, 0xf0(%rbx)
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x18(%rbx)
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x20(%rbx)
movslq %r14d, %rax
cmpq %rax, %r15
jge 0x1a05af
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
callq 0xc44b
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movl 0xa8(%rbx), %r14d
jmp 0x1a0588
movq (%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x78(%rbx)
movq %rcx, 0x70(%rbx)
leaq 0x8(,%rax,8), %rdi
callq 0x2280
movq %rax, 0x80(%rbx)
movq %r12, 0xc0(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq