// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movsd %xmm1, -0x30(%rbp)
movsd %xmm2, -0x38(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2100
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x98(%rax)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x58(%rax)
movsd -0x28(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movsd -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movsd -0x38(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, 0x40(%rax)
movq 0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movq 0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movl 0x28(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xb4(%rax)
movl 0x30(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xb8(%rax)
movl 0x38(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xbc(%rax)
movq -0x8(%rbp), %rax
movl $0x2710, 0x9c(%rax)     # imm = 0x2710
movq -0x8(%rbp), %rax
movl $0x7a120, 0xa0(%rax)    # imm = 0x7A120
movq 0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpl $0x1, 0x20(%rbp)
jl 0x307b1a
movl 0x20(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x307b24
movl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x307b24
movl -0x44(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xa8(%rax)
movq -0x8(%rbp), %rax
movslq 0xa8(%rax), %rdi
movl $0x30, %esi
callq 0x2140
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x8(%rbp), %rax
movslq 0xa8(%rax), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movslq 0xa8(%rax), %rdi
movl $0x68, %esi
callq 0x2140
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq 0xa8(%rcx), %rcx
cmpq %rcx, %rax
jge 0x307bdf
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x14c90
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x307b9c
movq 0x40(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movq 0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc0(%rax)
addq $0x50, %rsp
popq %rbp
retq
nop