// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movsd %xmm2, 0xa8(%rsp)
movsd %xmm0, 0xb0(%rsp)
movq %r9, %rbx
movq %r8, 0x58(%rsp)
movq %rcx, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, %r12
movl 0x138(%rsp), %ebp
movsd %xmm1, 0xc0(%rsp)
movsd %xmm1, 0xb8(%rsp)
cmpq $0x1, %r9
je 0x1fa414
leaq -0x1(%rbx), %rax
movsd 0xc0(%rsp), %xmm1
subsd 0xb0(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0xb8(%rsp)
movq 0x120(%rsp), %r14
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %rax, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movl $0x7d0, 0x6c(%rsp)      # imm = 0x7D0
testl %ebp, %ebp
je 0x1fa492
movq 0x128(%rsp), %r9
movq 0x8(%r12), %rsi
movslq 0x44(%r12), %rdx
movslq 0x40(%r12), %rcx
leaq 0x9b2e1(%rip), %rax     # 0x295758
cvttss2si 0x158(%rax), %r8
movq 0x38(%rsp), %rdi
callq 0x1f9e2e
movq %rax, 0x90(%rsp)
leaq 0x9b2bf(%rip), %rax     # 0x295758
cmpq $0x0, 0x2a8(%rax)
je 0x1fa4f7
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
leaq 0x70(%rsp), %rsi
movss 0x4aff9(%rip), %xmm0    # 0x2454d4
xorpd %xmm1, %xmm1
movq 0x38(%rsp), %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1f369d
movq 0x130(%rsp), %r13
xorl %ecx, %ecx
testl %ebp, %ebp
movq 0x58(%rsp), %r8
movl $0x0, %eax
movq %rax, 0x60(%rsp)
cmoveq %rcx, %r8
movq 0x70(%r12), %r9
leaq 0x70(%rsp), %rdx
movq 0x38(%rsp), %rdi
movl %r14d, %esi
movl %ebp, %ecx
movq %r8, 0x98(%rsp)
callq 0x1efd32
testq %rbx, %rbx
jle 0x1fa9e4
xorps %xmm0, %xmm0
cvtsd2ss 0xa8(%rsp), %xmm0
movss %xmm0, 0x54(%rsp)
movq $0x0, 0x60(%rsp)
movsd 0xb0(%rsp), %xmm0
movq %rbx, 0xc8(%rsp)
movq 0x60(%rsp), %rax
movsd 0xc0(%rsp), %xmm1
minsd %xmm0, %xmm1
movsd 0x370da(%rip), %xmm0    # 0x231660
movsd %xmm1, 0xa0(%rsp)
ucomisd %xmm1, %xmm0
movl $0x3e8, %ecx            # imm = 0x3E8
movl $0x7d0, %edx            # imm = 0x7D0
cmovbl %edx, %ecx
testl %ebp, %ebp
cmovel %eax, %ecx
movq %rcx, 0x60(%rsp)
leaq 0x9b1a7(%rip), %rax     # 0x295758
cmpq $0x0, 0x2a8(%rax)
je 0x1fa643
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
xorpd %xmm1, %xmm1
movq 0x38(%rsp), %r15
movq %r15, %rdi
leaq 0x70(%rsp), %r14
movq %r14, %rsi
movq %r12, %rbx
movq 0x120(%rsp), %r12
movl %r12d, %edx
movss 0x4aec0(%rip), %xmm0    # 0x2454d4
movl %ebp, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1f369d
movq 0x70(%rbx), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %r12
movq %r14, %rdx
movl %ebp, %ecx
movq 0x98(%rsp), %r8
callq 0x1efd32
movl %ebp, %r14d
movl 0x148(%rsp), %ebp
testl %r14d, %r14d
jne 0x1fa67e
movq 0x70(%r12), %r9
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq 0x120(%rsp), %rcx
movl $0x1, %r8d
callq 0x1f88b1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0xa7e08
movq 0x70(%r12), %r8
movq %r15, %rdi
movq 0x40(%rsp), %rbx
movq %rbx, %rsi
leaq 0x70(%rsp), %rdx
movl %ebp, %ecx
callq 0x1f1164
movq 0x70(%r12), %r9
movq %r15, %rdi
movq %r13, %rbp
movq 0x120(%rsp), %rsi
leaq 0x70(%rsp), %r13
movq %r13, %rdx
movl %r14d, %ecx
movq 0x98(%rsp), %r8
callq 0x1efd32
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xa7e08
movq 0x60(%rsp), %rax
movl %eax, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq 0x120(%rsp), %r13
movl %r13d, %ecx
movl %r14d, %r8d
movl 0x140(%rsp), %r9d
movss 0x54(%rsp), %xmm0
callq 0x1f170f
movq 0x70(%r12), %r9
movq %r15, %rdi
movl %r13d, %esi
leaq 0x70(%rsp), %rdx
movl %r14d, %ecx
movq 0x98(%rsp), %rbx
movq %rbx, %r8
callq 0x1efd32
movq %r15, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0xa7e08
xorps %xmm0, %xmm0
cvtsd2ss 0xa0(%rsp), %xmm0
xorpd %xmm1, %xmm1
movupd %xmm1, 0x10(%rsp)
movq 0x60(%rsp), %rax
movl %eax, (%rsp)
leaq 0x70(%rsp), %r13
movq $0x0, 0x20(%rsp)
movl $0x1, 0x8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq 0x120(%rsp), %rbp
movl %ebp, %edx
movss 0x54(%rsp), %xmm1
movl %r14d, %ecx
movl 0x140(%rsp), %r8d
movl $0x1, %r9d
callq 0x1f2d6e
movq 0x70(%r12), %r9
movq %r15, %rdi
movl %ebp, %esi
movq %r13, %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0x1efd32
testl %r14d, %r14d
movl %r14d, %ebp
je 0x1fa8fc
movq 0x90(%rsp), %rdi
movq %r13, %rsi
leaq 0xd0(%rsp), %rdx
movq %r12, %r13
movq 0x58(%rsp), %r12
movq %r12, %rcx
movss 0x54(%rsp), %xmm0
xorl %r8d, %r8d
callq 0x1f6bb4
movq %r15, %rdi
movq 0x130(%rsp), %r14
movq %r14, %rsi
movl $0x1, %edx
callq 0xa7e08
leaq 0x9af3d(%rip), %rax     # 0x295758
movq 0x188(%rax), %rcx
movl %ebp, %ebx
movq 0x120(%rsp), %rbp
movl %ebp, (%rsp)
movq %r15, %rdi
leaq 0x70(%rsp), %rbp
movq %rbp, %rsi
movss 0x4ac96(%rip), %xmm0    # 0x2454d8
movss 0x4ac92(%rip), %xmm1    # 0x2454dc
movss 0x4ac8e(%rip), %xmm2    # 0x2454e0
movl %ebx, %edx
movq 0x48(%rsp), %r8
movq %r12, %r9
callq 0x1f7374
movq %r15, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa7e08
movq %r15, %rdi
movq %rbp, %rsi
movss 0x4ac59(%rip), %xmm0    # 0x2454d8
movss 0x4ac59(%rip), %xmm1    # 0x2454e0
movl %ebx, %edx
movq %r14, %rcx
callq 0x1f7b41
movq 0x70(%r13), %r9
movq %r15, %rdi
movq 0x120(%rsp), %rsi
movq %rbp, %rdx
movl %ebx, %ecx
movq %r12, %r8
movq %r13, %r12
callq 0x1efd32
movq %r13, %rdi
movq %r15, %rsi
callq 0x27ad8
testq %rax, %rax
movl %ebx, %ebp
jne 0x1fa9d0
movq %r12, %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x278e8
testl %eax, %eax
movq 0xc8(%rsp), %rbx
je 0x1fa9ab
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x2a96e
jmp 0x1fa9ab
movq %r15, %rdi
movq 0x130(%rsp), %r14
movq %r14, %rsi
movl $0x1, %edx
callq 0xa7e08
leaq 0x9ae3d(%rip), %rax     # 0x295758
movq 0x188(%rax), %rcx
movq 0x120(%rsp), %rbx
movl %ebx, (%rsp)
movq %r15, %rdi
movq %r13, %rsi
movss 0x4ab9d(%rip), %xmm0    # 0x2454d8
movss 0x4ab99(%rip), %xmm1    # 0x2454dc
movss 0x4ab95(%rip), %xmm2    # 0x2454e0
xorl %edx, %edx
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r9
callq 0x1f7374
movq %r15, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xa7e08
movq %r15, %rdi
movq %r13, %rsi
movss 0x4ab5e(%rip), %xmm0    # 0x2454d8
movss 0x4ab5e(%rip), %xmm1    # 0x2454e0
xorl %edx, %edx
movq %r14, %rcx
callq 0x1f7b41
movq 0x70(%r12), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1efd32
movq 0xc8(%rsp), %rbx
movsd 0xa0(%rsp), %xmm0
addsd 0xb8(%rsp), %xmm0
decq %rbx
movq 0x130(%rsp), %r13
jne 0x1fa564
jmp 0x1fa9e4
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x2a96e
jmp 0x1fa8c6
movq %r12, %r14
leaq 0x9ad6a(%rip), %rax     # 0x295758
cmpq $0x0, 0x2a8(%rax)
je 0x1faa76
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x8(%rsp)
movl $0x10, (%rsp)
leaq 0x70(%rsp), %rbx
movss 0x4aaa4(%rip), %xmm0    # 0x2454d4
xorpd %xmm1, %xmm1
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq 0x120(%rsp), %r12
movl %r12d, %edx
movl %ebp, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1f369d
movq 0x70(%r14), %r9
movq %r15, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movl %ebp, %ecx
movq 0x98(%rsp), %r8
callq 0x1efd32
testl %ebp, %ebp
jne 0x1facb9
movq 0x70(%r14), %r9
leaq 0x70(%rsp), %r12
movq %r14, %rbp
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq 0x40(%rsp), %rsi
movq %r12, %rdx
movq 0x120(%rsp), %r13
movl %r13d, %ecx
movl $0x1, %r8d
callq 0x1f88b1
movq %r15, %rdi
movq 0x130(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0xa7e08
movss 0x4aa13(%rip), %xmm0    # 0x2454e0
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %ecx, %ecx
movq 0x60(%rsp), %rbx
movl %ebx, %r8d
callq 0x1f893e
movq 0x70(%rbp), %r9
movq %r15, %rdi
movl %r13d, %esi
movq %r12, %rdx
movq %r12, %r13
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1efd32
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xa7e08
xorps %xmm1, %xmm1
cvtsd2ss 0xa8(%rsp), %xmm1
movss %xmm1, 0xa0(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %r12
movq %r12, 0x18(%rsp)
movq 0x48(%rsp), %r14
movq %r14, 0x10(%rsp)
movl $0x1, %eax
movl %eax, 0x8(%rsp)
movl %ebx, (%rsp)
movss 0x4a994(%rip), %xmm0    # 0x2454e4
movq %r15, %rdi
movq %r13, %rsi
movq 0x120(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1f2d6e
movq 0x70(%rbp), %r9
movq %r15, %rdi
movq 0x120(%rsp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1efd32
movq %r15, %rdi
movq 0x130(%rsp), %rsi
xorl %edx, %edx
callq 0xa7e08
xorps %xmm0, %xmm0
cvtsd2ss 0xb0(%rsp), %xmm0
leaq 0x6c(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, 0x18(%rsp)
movq %r14, 0x10(%rsp)
movl $0x1, %eax
movl %eax, 0x8(%rsp)
movl %ebx, (%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq 0x120(%rsp), %rdx
movss 0xa0(%rsp), %xmm1
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1f2d6e
movq 0x70(%rbp), %r9
movq %r15, %rdi
movq 0x120(%rsp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x1efd32
movq %r15, %rdi
movl $0x64, %esi
movl $0x1, %edx
callq 0x1f81cd
movq 0x150(%rsp), %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movq %rax, (%rsp)
movq %rbp, %rdi
movq %r15, %rsi
movq 0x40(%rsp), %rbx
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
movq 0x130(%rsp), %r9
callq 0x1fa1bd
movq %rbp, %rdi
movq %r15, %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x1faec1
movq (%rbp), %rsi
movl 0x40(%rbp), %r9d
movl 0x44(%rbp), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq 0x158(%rsp), %rdx
movq %rbx, %rcx
movq %r12, %r8
callq 0x7d17
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x104183
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0xe0(%rsp), %rdi
callq 0x2220
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
cvtsd2ss 0xa8(%rsp), %xmm0
leaq 0x70(%rsp), %rbx
leaq 0xd0(%rsp), %r13
movq 0x90(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq 0x58(%rsp), %rbp
movq %rbp, %rcx
xorl %r8d, %r8d
callq 0x1f6bb4
movss 0x3feb5(%rip), %xmm0    # 0x23abb0
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movl $0x1, %r8d
callq 0x1f6bb4
movq %r14, %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x278e8
testl %eax, %eax
je 0x1fad37
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x2a96e
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq 0x130(%rsp), %rsi
xorl %edx, %edx
callq 0xa7e08
leaq 0x70(%rsp), %r12
movss 0x4a785(%rip), %xmm0    # 0x2454e0
movq %r15, %rdi
movq %r12, %rsi
movq 0x120(%rsp), %rbx
movl %ebx, %edx
movl 0x138(%rsp), %ebp
movl %ebp, %ecx
movl $0x7d0, %r8d            # imm = 0x7D0
callq 0x1f893e
movq 0x70(%r14), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %ebp, %ecx
movq %r14, %r13
movq 0x58(%rsp), %r12
movq %r12, %r8
callq 0x1efd32
leaq 0x6c(%rsp), %r14
movl $0x1770, (%r14)         # imm = 0x1770
movq %r15, %rdi
movq 0x130(%rsp), %rsi
xorl %edx, %edx
callq 0xa7e08
movq %r14, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl $0x8, 0x8(%rsp)
movl $0x7d0, (%rsp)          # imm = 0x7D0
movss 0x44de9(%rip), %xmm0    # 0x23fbc8
movss 0x3afcd(%rip), %xmm1    # 0x235db4
movq %r15, %rdi
leaq 0x70(%rsp), %r14
movq %r14, %rsi
movl %ebx, %edx
movl %ebp, %ecx
movl 0x140(%rsp), %r8d
movl $0x1, %r9d
callq 0x1f2d6e
movq 0x70(%r13), %r9
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
movl %ebp, %ecx
movq %r12, %r8
callq 0x1efd32
movslq %ebp, %rax
movq 0x150(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq %rax, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq 0x40(%rsp), %rbx
movq %rbx, %rdx
movq 0x48(%rsp), %rcx
movq %r12, %r8
movq 0x130(%rsp), %r9
callq 0x1fa1bd
movq %r13, %rdi
movq %r15, %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x1faec1
movq (%r13), %rsi
movl 0x40(%r13), %r9d
movl 0x44(%r13), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq 0x158(%rsp), %rdx
movq %rbx, %rcx
movq %r12, %r8
callq 0x7d17
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x104183
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2a96e
movq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x1f9eb3
movq %rbx, %rdi
callq 0x2220
jmp 0x1fac8d