// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rdi, %rbx
movl 0x80(%rsp), %r13d
movq $0x0, 0x40(%rsp)
addq $0x28, %rdi
xorl %ebp, %ebp
movl $0xe8, %edx
xorl %esi, %esi
callq 0x20e0
movq %r12, 0x10(%rsp)
movq %r12, (%rbx)
movq 0xa8(%rsp), %r12
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 %r12, 0x10(%rbx)
cmpl $0x2, %r13d
movl $0x1, %eax
cmovll %eax, %r13d
movl %r13d, 0xb0(%rbx)
movl $0x4, %esi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x100(%rbx)
movl $0x8, %esi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x18(%rbx)
movl $0x68, %esi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x20(%rbx)
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0x387f4
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
movslq 0xb0(%rbx), %rax
cmpq %rax, %rbp
jl 0x1e8109
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 0x1e816e
movq %rax, 0x28(%rbx)
jmp 0x1e819f
cmpb $0x0, 0xb8(%rsp)
je 0x1e819f
leaq 0x40(%rsp), %r14
movq %r12, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x1fba56
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