// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ul_clean_gfa(ug_opt_t*, asg_t*, ma_hit_t_alloc*, ma_hit_t_alloc*, R_to_U*, long, double, double, double, long, long, bub_label_t*, int, int, unsigned int, unsigned char*, char*)
void ul_clean_gfa(ug_opt_t *uopt, asg_t *sg, ma_hit_t_alloc *src, ma_hit_t_alloc *rev, R_to_U* rI, int64_t clean_round, double min_ovlp_drop_ratio, double max_ovlp_drop_ratio, 
double ou_drop_rate, int64_t max_tip, int64_t gap_fuzz, bub_label_t *b_mask_t, int32_t is_ou, int32_t is_trio, uint32_t ou_thres, uint8_t *cmk, char *o_file)
{
    #define HARD_OU_DROP 0.75
    #define HARD_OL_DROP 0.6
    #define HARD_OL_SEC_DROP 0.85
    #define HARD_ORTHOLOGY_DROP 0.4
    double step = 
        (clean_round==1?max_ovlp_drop_ratio:((max_ovlp_drop_ratio-min_ovlp_drop_ratio)/(clean_round-1)));
    double drop = min_ovlp_drop_ratio;
    int64_t i; asg64_v bu = {0,0,0}, ba = {0,0,0}; uint32_t l_drop = 2000; flex_asg_t *fg = NULL; uint32_t min_diff = 0, step_diff = 2000;
    if(is_ou) fg = init_flex_asg_t(sg, uopt->sources, uopt->min_ovlp, uopt->max_hang, asm_opt.max_hang_rate, gap_fuzz);
    // if(is_ou) update_sg_uo(sg, src);///do not do it here
    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);
    // exit(1);
    // print_raw_u2rgfa_seq(&UL_INF, rI, 1);
    // exit(1);
    // fprintf(stderr, "%.*s\tid::%u\tis_c::%u\n", 
    //                 (int)Get_NAME_LENGTH(R_INF, 10785), Get_NAME(R_INF, 10785), 10785, is_contain_r((*rI), 10785));
    // fprintf(stderr, "%.*s\tid::%u\tis_c::%u\n", 
    //             (int)Get_NAME_LENGTH(R_INF, 10790), Get_NAME(R_INF, 10790), 10790, is_contain_r((*rI), 10790));
    // fprintf(stderr, "%.*s\tid::%u\tis_c::%u\n", 
    //         (int)Get_NAME_LENGTH(R_INF, 10805), Get_NAME(R_INF, 10805), 10805, is_contain_r((*rI), 10805));
    // fprintf(stderr, "%.*s\tid::%u\tis_c::%u\n", 
    //         (int)Get_NAME_LENGTH(R_INF, 10809), Get_NAME(R_INF, 10809), 10809, is_contain_r((*rI), 10809));
    // fprintf(stderr, "%.*s\tid::%u\tis_c::%u\n", 
    //         (int)Get_NAME_LENGTH(R_INF, 10819), Get_NAME(R_INF, 10819), 10819, is_contain_r((*rI), 10819));
    // debug_info_of_specfic_node("m64011_190830_220126/47516220/ccs", sg, rI, "beg-0");
    // debug_info_of_specfic_node("bcb40bcc-d9cf-48e6-88ee-47ac3dde22ff", sg, rI, "beg-0");

    if(asm_opt.is_ont) asg_arc_cut_weak(sg, &bu, max_tip, 0.975, 0, is_ou, 0, 1, 16, UL_COV_THRES-1, 0, rev, NULL, NULL);

	asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);///p_telo
    // fprintf(stderr, "[M::%s] count_edges_v_w(sg, 49778, 49847)->%ld\n", __func__, count_edges_v_w(sg, 49778, 49847));
    // if(is_ou) dedup_contain_g(uopt, sg);
    for (i = 0; i < clean_round; i++, drop += step) {
        if(drop > max_ovlp_drop_ratio) drop = max_ovlp_drop_ratio;
        if(is_ou) {
            if(drop <= 0.500001) min_diff = step_diff>>1;
            else min_diff = step_diff;
        }

        if(asm_opt.is_ont) {
            asg_arc_cut_weak(sg, &bu, max_tip, 0.975, 0, is_ou, 0, 1, 16, UL_COV_THRES-1, 0, rev, NULL, NULL);
            asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
        }
        // fprintf(stderr, "(0):i->%ld, drop->%f\n", i, drop);
        // prt_specfic_sge(sg, 10531, 10519, "--0--");

        // print_vw_edge(sg, 34156, 34090, "0");
        // stats_chimeric(sg, src, &bu);
        if(!is_ou) asg_iterative_semi_circ(sg, src, &bu, max_tip, 1, uopt->te);///p_telo
        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 1);
        asg_arc_cut_chimeric(sg, src, &bu, is_ou?ou_thres:(uint32_t)-1, uopt->te);///p_telo

        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
        // prt_specfic_sge(sg, 10531, 10519, "--1--");
        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
        asg_arc_cut_inexact(sg, src, &bu, max_tip, is_ou, is_trio, min_diff, ou_drop_rate/**, NULL**//**&dbg**/);
        // debug_edges(&dbg, d, 2);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
        // prt_specfic_sge(sg, 10531, 10519, "--2--");

        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 1);
        asg_arc_cut_length(sg, &bu, max_tip, drop, ou_drop_rate, is_ou, is_trio, 1, min_diff, 1, NULL, NULL, NULL);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);

        // prt_specfic_sge(sg, 10531, 10519, "--3--");
        // if(is_ou) asg_arc_cut_contain(fg, &bu, &ba, rI, ((i+1)<clean_round)?ou_drop_rate:-1);
        if(is_ou) {
            asg_arc_cut_contain(fg, &bu, &ba, rI, ou_drop_rate, 0);
            // dedup_contain_g(uopt, sg);
        }

        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 1);
        asg_arc_cut_bub_links(sg, &bu, HARD_OL_DROP, HARD_OL_SEC_DROP, HARD_OU_DROP, is_ou, asm_opt.large_pop_bubble_size, rev, rI, max_tip);
        // prt_specfic_sge(sg, 10531, 10519, "--4--");

        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 1);
        asg_arc_cut_complex_bub_links(sg, &bu, HARD_OL_DROP, HARD_OU_DROP, is_ou, b_mask_t);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
        // prt_specfic_sge(sg, 10531, 10519, "--5--");

        // if(i == 3) {
        //     print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty3.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);
        //     // exit(1);
        // }
        /**
        if(cmk && asm_opt.chemical_cov > FORCE_CUT) {
            asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
            asg_arc_cut_chimeric_cmk(sg, &bu, max_tip, 1.1, 1.1, is_ou, 1, 1, 1, cmk, asm_opt.chemical_cov);
            asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
        }
        **/


        if(is_ou) {
            if(ul_refine_alignment(uopt, sg)) update_sg_uo(sg, src);
            if(clean_contain_g(uopt, sg, 1)) update_sg_uo(sg, src);
        }
    }

    if(asm_opt.is_ont) {
        asg_arc_cut_weak(sg, &bu, max_tip, 0.975, 0, is_ou, 0, 1, 16, UL_COV_THRES-1, 0, rev, NULL, NULL);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
    }

    if(is_ou) min_diff = step_diff;
    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty4.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);
    // debug_info_of_specfic_node("m64012_190921_234837/111673711/ccs", sg, rI, "end");
    // debug_info_of_specfic_node("m64011_190830_220126/95028102/ccs", sg, rI, "end");
    if(is_ou) {
        asg_arc_cut_contain(fg, &bu, &ba, rI, ou_drop_rate, 0);
        asg_arc_cut_contain(fg, &bu, &ba, rI, -1, 1);
        // dedup_contain_g(uopt, sg);
        if(clean_contain_g(uopt, sg, 1)) update_sg_uo(sg, src);
    }
    if(!is_ou) asg_iterative_semi_circ(sg, src, &bu, max_tip, 1, uopt->te);

    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty5.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);

    asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
    asg_cut_large_indel(sg, &bu, max_tip, HARD_OU_DROP, is_ou, min_diff);///shoule we ignore ou here?
    asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);

    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty6.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);

    if(!is_ou) {
        ///asg_arc_del_triangular_directly might be unnecessary
        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
        asg_arc_cut_length(sg, &bu, max_tip, HARD_ORTHOLOGY_DROP/**min_ovlp_drop_ratio**/, ou_drop_rate, is_ou, 0/**is_trio**/, is_ou?1:0, min_diff, 1, rev, rI, NULL);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);

        // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty7.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);

        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
        asg_arc_cut_length(sg, &bu, max_tip, min_ovlp_drop_ratio, ou_drop_rate, is_ou, 0/**is_trio**/, is_ou?1:0, min_diff, 1, rev, rI, &l_drop);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
    } else {
        min_diff = step_diff; l_drop = 6000;
        asg_arc_identify_simple_bubbles_multi(sg, b_mask_t, 0);
        asg_arc_cut_length(sg, &bu, max_tip, 0.3, 0.9, is_ou, is_trio, 1, min_diff, 8, NULL, NULL, &l_drop);
        asg_arc_cut_tips(sg, max_tip, &bu, is_ou, is_ou?rI:NULL, uopt->te);
    }

    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.dirty8.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);

    if(!is_ou) asg_cut_semi_circ(sg, LIM_LEN, 1);
    /**
    rescue_contained_reads_aggressive(NULL, sg, src, uopt->coverage_cut, rI, uopt->max_hang, uopt->min_ovlp, 10, 1, 0, NULL, NULL, b_mask_t);
    rescue_missing_overlaps_aggressive(NULL, sg, src, uopt->coverage_cut, rI, uopt->max_hang, uopt->min_ovlp, 1, 0, NULL, b_mask_t);
    rescue_missing_overlaps_backward(NULL, sg, src, uopt->coverage_cut, rI, uopt->max_hang, uopt->min_ovlp, 10, 1, 0, b_mask_t);
    // rescue_wrong_overlaps_to_unitigs(NULL, sg, sources, reverse_sources, coverage_cut, ruIndex, 
    // max_hang_length, mini_overlap_length, bubble_dist, NULL);
    // rescue_no_coverage_aggressive(sg, sources, reverse_sources, &coverage_cut, ruIndex, max_hang_length, 
    // mini_overlap_length, bubble_dist, 10);
    set_hom_global_coverage(&asm_opt, sg, uopt->coverage_cut, src, rev, rI, uopt->max_hang, uopt->min_ovlp);
    rescue_bubble_by_chain(sg, uopt->coverage_cut, src, rev, (asm_opt.max_short_tip*2), 0.15, 3, rI, 0.05, 0.9, uopt->max_hang, uopt->min_ovlp, 10, uopt->gap_fuzz, b_mask_t);
    **/
    post_rescue(uopt, sg, src, rev, rI, b_mask_t, is_ou, cmk);
    
    ug_ext_gfa(uopt, sg, ug_ext_len);

    // if(is_ou) dedup_contain_g(uopt, sg);
    // exit(1)

    output_unitig_graph(sg, uopt->coverage_cut, o_file, src, rI, uopt->max_hang, uopt->min_ovlp);
    // exit(1);
    // flat_bubbles(sg, ruIndex->is_het); free(ruIndex->is_het); ruIndex->is_het = NULL;
    flat_soma_v(sg, src, rI);

    ///note: although the above functions will not change the UL part, but it will change the read graph
    ///so it is necessary to run update_sg_uo
    if(is_ou) {
        update_sg_uo(sg, src);
    }
    if(is_ou) {
        des_flex_asg_t(fg); free(fg);
    }
    // print_debug_gfa(sg, NULL, uopt->coverage_cut, "UL.debug", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 1, 0, 0);
    // exit(1);
    // print_node(sg, 17078); //print_node(sg, 8311); print_node(sg, 8294);
    
    free(bu.a); free(ba.a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movsd %xmm2, 0x98(%rsp)
movsd %xmm0, 0xa0(%rsp)
movq %r9, %r13
movq %r8, %r14
movq %rcx, 0x40(%rsp)
movq %rdx, 0x50(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %rbp
movl 0x128(%rsp), %ecx
movsd %xmm1, 0xb0(%rsp)
movsd %xmm1, 0xa8(%rsp)
cmpq $0x1, %r9
je 0x1ef0ee
leaq -0x1(%r13), %rax
movsd 0xb0(%rsp), %xmm1
subsd 0xa0(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0xa8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%rsp)
movq $0x0, 0x88(%rsp)
movq %rax, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
movl $0x7d0, 0x6c(%rsp)      # imm = 0x7D0
testl %ecx, %ecx
je 0x1ef168
movq 0x118(%rsp), %r9
movq 0x8(%rbp), %rsi
movslq 0x44(%rbp), %rdx
movslq 0x40(%rbp), %rcx
leaq 0x9b612(%rip), %rax     # 0x28a758
cvttss2si 0x158(%rax), %r8
movq 0x30(%rsp), %rdi
callq 0x1eeb02
movl 0x128(%rsp), %ecx
movq %rax, 0x88(%rsp)
movq 0x110(%rsp), %rbx
leaq 0x9b5e1(%rip), %rax     # 0x28a758
cmpq $0x0, 0x2a8(%rax)
je 0x1ef1d9
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
leaq 0x70(%rsp), %rsi
movss 0x4a04b(%rip), %xmm0    # 0x239204
xorpd %xmm1, %xmm1
movq 0x30(%rsp), %rdi
movl %ebx, %edx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1e8bb5
movl 0x128(%rsp), %ecx
xorl %edx, %edx
testl %ecx, %ecx
movq %r14, %r12
movl $0x0, %eax
movq %rax, 0x60(%rsp)
cmoveq %rdx, %r12
movq 0x70(%rbp), %r9
leaq 0x70(%rsp), %rdx
movq 0x30(%rsp), %rdi
movl %ebx, %esi
movq %r12, %r8
callq 0x1e5333
xorps %xmm0, %xmm0
cvtsd2ss 0x98(%rsp), %xmm0
movss %xmm0, 0x3c(%rsp)
testq %r13, %r13
movq %rbp, 0x58(%rsp)
movq %r14, 0x48(%rsp)
movq %r12, 0x90(%rsp)
jle 0x1ef6c8
movq $0x0, 0x60(%rsp)
movsd 0xa0(%rsp), %xmm0
movq %r13, 0xb8(%rsp)
movq 0x60(%rsp), %rax
movsd 0xb0(%rsp), %xmm1
minsd %xmm0, %xmm1
movsd 0x362f9(%rip), %xmm0    # 0x225560
movsd %xmm1, 0x98(%rsp)
ucomisd %xmm1, %xmm0
movl $0x3e8, %ecx            # imm = 0x3E8
movl $0x7d0, %edx            # imm = 0x7D0
cmovbl %edx, %ecx
movl 0x128(%rsp), %r13d
testl %r13d, %r13d
cmovel %eax, %ecx
movq %rcx, 0x60(%rsp)
leaq 0x9b4bd(%rip), %rax     # 0x28a758
cmpq $0x0, 0x2a8(%rax)
je 0x1ef32a
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
xorpd %xmm1, %xmm1
movq 0x30(%rsp), %r15
movq %r15, %rdi
leaq 0x70(%rsp), %r13
movq %r13, %rsi
movl %ebx, %edx
movss 0x49f12(%rip), %xmm0    # 0x239204
movl 0x128(%rsp), %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1e8bb5
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r13, %rdx
movl 0x128(%rsp), %ecx
movq %r12, %r8
callq 0x1e5333
movl 0x128(%rsp), %r13d
movq 0x30(%rsp), %r15
movl 0x138(%rsp), %ebp
testl %r13d, %r13d
jne 0x1ef363
movq 0x58(%rsp), %rax
movq 0x70(%rax), %r9
movq %r15, %rdi
movq 0x50(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movl %ebx, %ecx
movl $0x1, %r8d
callq 0x1edaa3
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rdi
movq 0x120(%rsp), %rsi
movl $0x1, %edx
callq 0xa6dbe
movq 0x58(%rsp), %rax
movq 0x70(%rax), %r8
movq %r15, %rdi
movq 0x50(%rsp), %r12
movq %r12, %rsi
leaq 0x70(%rsp), %r14
movq %r14, %rdx
movl %ebp, %ecx
movq %rax, %rbp
callq 0x1e65c1
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
movl %r13d, %ecx
movq 0x90(%rsp), %rbp
movq %rbp, %r8
callq 0x1e5333
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
movq 0x60(%rsp), %rax
movl %eax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
leaq 0x70(%rsp), %rdx
movq %rdx, %r12
movl %ebx, %ecx
movl %r13d, %r8d
movl 0x130(%rsp), %r9d
movss 0x3c(%rsp), %xmm0
callq 0x1e6b5c
movq 0x58(%rsp), %r14
movq 0x70(%r14), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r13d, %ecx
movq %rbp, %r8
callq 0x1e5333
movq %r15, %rdi
movq 0x120(%rsp), %rsi
movl $0x1, %edx
callq 0xa6dbe
xorps %xmm0, %xmm0
cvtsd2ss 0x98(%rsp), %xmm0
xorpd %xmm1, %xmm1
movupd %xmm1, 0x10(%rsp)
movq 0x60(%rsp), %rax
movl %eax, (%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movl %ebx, %edx
movss 0x3c(%rsp), %xmm1
movl %r13d, %ecx
movl 0x130(%rsp), %r8d
movl $0x1, %r9d
callq 0x1e8276
movq 0x70(%r14), %r9
movq %r15, %rdi
movq %rbx, %r14
movl %ebx, %esi
movq %r12, %rdx
movl %r13d, %ecx
movq %rbp, %r8
callq 0x1e5333
testl %r13d, %r13d
je 0x1ef5d9
movq 0x88(%rsp), %rdi
movq %r12, %rsi
leaq 0xc0(%rsp), %rdx
movq 0x120(%rsp), %rbp
movl %r13d, %r15d
movq 0x48(%rsp), %r13
movq %r13, %rcx
movss 0x3c(%rsp), %xmm0
xorl %r8d, %r8d
callq 0x1ebd4b
movq 0x30(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0xa6dbe
leaq 0x9b264(%rip), %rax     # 0x28a758
movq 0x188(%rax), %rcx
movq %r14, %rbx
movq %r13, %r14
movl %ebx, (%rsp)
movq %r12, %rdi
leaq 0x70(%rsp), %r13
movq %r13, %rsi
movss 0x49cf1(%rip), %xmm0    # 0x239208
movss 0x49ced(%rip), %xmm1    # 0x23920c
movss 0x49ce9(%rip), %xmm2    # 0x239210
movl %r15d, %edx
movq 0x40(%rsp), %r8
movq %r14, %r9
callq 0x1ec4fc
movq %r12, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0xa6dbe
movq %r12, %rdi
movq %r13, %rsi
movss 0x49cb3(%rip), %xmm0    # 0x239208
movss 0x49cb3(%rip), %xmm1    # 0x239210
movl %r15d, %edx
movq %rbp, %rcx
callq 0x1ecd10
movq 0x58(%rsp), %rbp
movq 0x70(%rbp), %r9
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
movl %r15d, %ecx
movq 0x90(%rsp), %r15
movq %r15, %r8
callq 0x1e5333
movq %rbp, %rdi
movq %r12, %rsi
callq 0x28514
testq %rax, %rax
movq %r15, %r12
jne 0x1ef6b4
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x28306
testl %eax, %eax
movq 0xb8(%rsp), %r13
je 0x1ef697
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2b3f3
jmp 0x1ef697
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq 0x120(%rsp), %rbp
movq %rbp, %rsi
movl $0x1, %edx
callq 0xa6dbe
leaq 0x9b15b(%rip), %rax     # 0x28a758
movq 0x188(%rax), %rcx
movq %r14, %rbx
movl %ebx, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movss 0x49bf0(%rip), %xmm0    # 0x239208
movss 0x49bec(%rip), %xmm1    # 0x23920c
movss 0x49be8(%rip), %xmm2    # 0x239210
movl %r13d, %edx
movq 0x40(%rsp), %r8
movq 0x48(%rsp), %r9
callq 0x1ec4fc
movq %r15, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0xa6dbe
movq %r15, %rdi
movq %r12, %rsi
movss 0x49bb0(%rip), %xmm0    # 0x239208
movss 0x49bb0(%rip), %xmm1    # 0x239210
movl %r13d, %edx
movq %rbp, %rcx
callq 0x1ecd10
movq 0x58(%rsp), %rbp
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r13d, %ecx
movq 0x90(%rsp), %r12
movq %r12, %r8
callq 0x1e5333
movq 0xb8(%rsp), %r13
movsd 0x98(%rsp), %xmm0
addsd 0xa8(%rsp), %xmm0
decq %r13
jne 0x1ef245
jmp 0x1ef6c8
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2b3f3
jmp 0x1ef5a3
leaq 0x9b089(%rip), %rax     # 0x28a758
cmpq $0x0, 0x2a8(%rax)
movl 0x128(%rsp), %r13d
je 0x1ef760
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
leaq 0x70(%rsp), %r14
movss 0x49aed(%rip), %xmm0    # 0x239204
xorpd %xmm1, %xmm1
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
movl 0x128(%rsp), %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1e8bb5
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
movl 0x128(%rsp), %ecx
movq %r12, %r8
callq 0x1e5333
movl 0x128(%rsp), %r13d
movl $0x7d0, %r14d           # imm = 0x7D0
testl %r13d, %r13d
cmovel 0x60(%rsp), %r14d
je 0x1ef8d1
leaq 0x70(%rsp), %r13
leaq 0xc0(%rsp), %rbp
movq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq 0x48(%rsp), %r15
movq %r15, %rcx
movss 0x3c(%rsp), %xmm0
xorl %r8d, %r8d
callq 0x1ebd4b
movss 0x3f1ef(%rip), %xmm0    # 0x22e9a0
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq 0x58(%rsp), %rbp
movq %r15, %rcx
movl $0x1, %r8d
callq 0x1ebd4b
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x28306
testl %eax, %eax
jne 0x1efba2
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
leaq 0x70(%rsp), %rbx
movss 0x49a05(%rip), %xmm0    # 0x239210
movq %r15, %rdi
movq %rbx, %rsi
movq 0x110(%rsp), %r12
movl %r12d, %edx
movl 0x128(%rsp), %r13d
movl %r13d, %ecx
movl %r14d, %r8d
callq 0x1edb30
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %rbx, %r14
movl %r13d, %ecx
movq 0x90(%rsp), %r8
callq 0x1e5333
leaq 0x6c(%rsp), %rbx
movl $0x1770, (%rbx)         # imm = 0x1770
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
movq %rbx, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl $0x8, 0x8(%rsp)
movl $0x7d0, (%rsp)          # imm = 0x7D0
movss 0x44068(%rip), %xmm0    # 0x2338f8
movss 0x3a324(%rip), %xmm1    # 0x229bbc
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
movl %r13d, %ecx
movl 0x130(%rsp), %r8d
movl $0x1, %r9d
callq 0x1e8276
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %r14, %rdx
movl %r13d, %ecx
movq 0x48(%rsp), %r8
jmp 0x1efa32
movq 0x70(%rbp), %r9
leaq 0x70(%rsp), %rdx
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq 0x50(%rsp), %rsi
movl %ebx, %ecx
movl $0x1, %r8d
callq 0x1edaa3
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
movss 0x49902(%rip), %xmm0    # 0x239210
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
movl %ebx, %edx
movl %r13d, %ecx
movl %r14d, %r8d
callq 0x1edb30
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %ebx, %esi
leaq 0x70(%rsp), %rdx
movl %r13d, %ecx
movq %r12, %r8
callq 0x1e5333
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
movq %rbx, %r12
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %eax
movl %eax, 0x8(%rsp)
movl %r14d, (%rsp)
movq $0x0, 0x20(%rsp)
movss 0x49891(%rip), %xmm0    # 0x239214
movq %r15, %rdi
leaq 0x70(%rsp), %rbx
movq %rbx, %rsi
movl %r12d, %edx
movss 0x3c(%rsp), %xmm1
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1e8276
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1e5333
movq %r15, %rdi
movq 0x120(%rsp), %rsi
xorl %edx, %edx
callq 0xa6dbe
xorps %xmm0, %xmm0
cvtsd2ss 0xa0(%rsp), %xmm0
leaq 0x6c(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %eax
movl %eax, 0x8(%rsp)
movl %r14d, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movss 0x3c(%rsp), %xmm1
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1e8276
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1e5333
movq 0x148(%rsp), %rbx
movq 0x140(%rsp), %r14
testl %r13d, %r13d
jne 0x1efb04
movq 0x30(%rsp), %r15
movq %r15, %rdi
movl $0x64, %esi
movl $0x1, %edx
callq 0x1ed416
movl %r13d, %eax
movq %r14, 0x8(%rsp)
movq %rax, (%rsp)
movq %rbp, %rdi
movq %r15, %rsi
movq 0x50(%rsp), %r14
movq %r14, %rdx
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r12
movq %r12, %r8
movq 0x120(%rsp), %r9
callq 0x1eee99
movq %rbp, %rdi
movq %r15, %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x1efbb6
movq (%rbp), %rsi
movl 0x40(%rbp), %r9d
movl 0x44(%rbp), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x7c45
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xffe28
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0xd0(%rsp), %rdi
callq 0x2220
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %r13d, %rax
movq %r14, 0x8(%rsp)
movq %rax, (%rsp)
movq %rbp, %rdi
movq 0x30(%rsp), %r15
movq %r15, %rsi
movq 0x50(%rsp), %r14
movq %r14, %rdx
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r12
movq %r12, %r8
movq 0x120(%rsp), %r9
callq 0x1eee99
movq %rbp, %rdi
movq %r15, %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x1efbb6
movq (%rbp), %rsi
movl 0x40(%rbp), %r9d
movl 0x44(%rbp), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x7c45
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xffe28
movq %r15, %rdi
movq %r14, %rsi
callq 0x2b3f3
movq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x1eeb87
movq %rbx, %rdi
callq 0x2220
jmp 0x1efad8
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x2b3f3
jmp 0x1ef7e7