// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: init_ug_trans_t(ug_trans_t*, ug_opt_t*, int, int, int, int, double, double, double, double, double, int, int, int, int, ma_ug_t*, asg_t*, bubble_type*, unsigned char)
void init_ug_trans_t(ug_trans_t *opt, ug_opt_t *uopt, int32_t is_HPC, int32_t k, int32_t w, int32_t max_n_chain, 
double bw_thres, double diff_ec_ul, double bw_thres_double, double diff_ec_ul_double, double sec_cutoff, int32_t n_thread, 
int32_t mini_cut, int32_t chain_cut, int32_t keep_unsymm_arc, ma_ug_t *ug, asg_t *sg, bubble_type *bub, uint8_t gen_bub)
{
    int64_t i; uint8_t *bf = NULL;
    memset(opt, 0, sizeof((*opt)));
	opt->uopt = uopt;
    opt->k = k; 
    opt->w = w;
    opt->is_HPC = is_HPC;
    opt->max_n_chain = max_n_chain;
    opt->bw_thres = bw_thres;
	opt->bw_thres_double = bw_thres_double;
    opt->diff_ec_ul = diff_ec_ul;
	opt->diff_ec_ul_double = diff_ec_ul_double;
	opt->sec_cutoff = sec_cutoff;
	opt->mini_cut = mini_cut;
	opt->chain_cut = chain_cut;
	opt->keep_unsymm_arc = keep_unsymm_arc;

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

	CALLOC(opt->free_cnt, opt->n_thread);
    CALLOC(opt->hab, opt->n_thread); 
	CALLOC(opt->ll, opt->n_thread);
    for (i = 0; i < opt->n_thread; ++i) {
        opt->hab[i] = ha_ovec_init(0, 0, 1); 
    }

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

	opt->udb.ug = ug;
	if(bub) {
		opt->bub = bub;
	} else if(gen_bub) {
		opt->bub = gen_bubble_chain(sg, ug, uopt, &bf, 0); free(bf);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movsd %xmm4, 0x38(%rsp)
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x20(%rsp)
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x18(%rsp)
movl %r9d, 0xc(%rsp)
movl %r8d, 0x8(%rsp)
movl %ecx, %r15d
movl %edx, %r14d
movq %rsi, %rbp
movq %rdi, %rbx
movl 0x80(%rsp), %r13d
andq $0x0, 0x40(%rsp)
addq $0x28, %rdi
xorl %r12d, %r12d
movl $0xe8, %edx
xorl %esi, %esi
callq 0x20e0
movq %rbp, 0x10(%rsp)
movq %rbp, (%rbx)
movl %r15d, 0x34(%rbx)
movq 0xa0(%rsp), %r15
movl 0x8(%rsp), %eax
movl %eax, 0x30(%rbx)
movl %r14d, 0xa0(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x60(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x50(%rbx)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x40(%rbx)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x58(%rbx)
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x48(%rbx)
movl 0x88(%rsp), %eax
movl %eax, 0xbc(%rbx)
movl 0x90(%rsp), %eax
movl %eax, 0xc0(%rbx)
movl 0x98(%rsp), %eax
movl %eax, 0xc4(%rbx)
movabsq $0x7a12000002710, %rax  # imm = 0x7A12000002710
movq %rax, 0xa4(%rbx)
movq %r15, 0x8(%rbx)
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rbx)
cmpl $0x2, %r13d
pushq $0x1
popq %rbp
cmovll %ebp, %r13d
movl %r13d, 0xb0(%rbx)
pushq $0x4
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x100(%rbx)
pushq $0x8
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x18(%rbx)
pushq $0x68
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x20(%rbx)
movslq %r13d, %rax
cmpq %rax, %r12
jge 0x19cbf9
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
callq 0xc44b
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movl 0xb0(%rbx), %r13d
jmp 0x19cbd2
movq (%r15), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x80(%rbx)
movq %rcx, 0x78(%rbx)
leaq 0x8(,%rax,8), %rdi
callq 0x2280
movq %rax, 0x88(%rbx)
movq %r15, 0xc8(%rbx)
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x19cc39
movq %rax, 0x28(%rbx)
jmp 0x19cc6f
cmpb $0x0, 0xb8(%rsp)
je 0x19cc6f
leaq 0x40(%rsp), %r14
movq 0xa8(%rsp), %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x1afe25
movq %rax, 0x28(%rbx)
movq (%r14), %rdi
callq 0x2220
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq