// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movsd %xmm4, 0x28(%rsp)
movsd %xmm3, 0x20(%rsp)
movsd %xmm2, 0x10(%rsp)
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %r9d, %ebp
movl %r8d, %r13d
movl %ecx, %r12d
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, 0x30(%rsp)
movl $0x110, %edx            # imm = 0x110
xorl %esi, %esi
callq 0x20e0
movq %r14, (%rsp)
movq %r14, (%rbx)
movl %r12d, 0x34(%rbx)
movq 0x90(%rsp), %r12
movl %r13d, 0x30(%rbx)
movq 0x98(%rsp), %r13
movl %r15d, 0xa0(%rbx)
movl %ebp, 0x60(%rbx)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x50(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x40(%rbx)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x58(%rbx)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x48(%rbx)
movl 0x78(%rsp), %eax
movl %eax, 0xbc(%rbx)
movl 0x80(%rsp), %eax
movl %eax, 0xc0(%rbx)
movl 0x88(%rsp), %eax
movl %eax, 0xc4(%rbx)
movabsq $0x7a12000002710, %rax  # imm = 0x7A12000002710
movq %rax, 0xa4(%rbx)
movq %r12, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movl 0x70(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
movl %r15d, 0xb0(%rbx)
movl $0x4, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, 0x100(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, 0x18(%rbx)
movl $0x68, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, 0x20(%rbx)
cmpl $0x0, 0xb0(%rbx)
jle 0x1dd6cf
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0x39240
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
movslq 0xb0(%rbx), %rax
cmpq %rax, %r14
jl 0x1dd6aa
movq (%r12), %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 %r12, 0xc8(%rbx)
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x1dd710
movq %rax, 0x28(%rbx)
jmp 0x1dd740
cmpb $0x0, 0xa8(%rsp)
je 0x1dd740
leaq 0x30(%rsp), %r15
movq %r13, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x1f04d1
movq %rax, 0x28(%rbx)
movq (%r15), %rdi
callq 0x2220
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq