// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: resolve_bubble_chain_by_hic(ha_ug_index*, kv_u_trans_t*, bubble_type*)
void resolve_bubble_chain_by_hic(ha_ug_index *idx, kv_u_trans_t *ta, bubble_type* bub)
{   
    // double index_time = yak_realtime();
    ma_ug_t* ug = idx->ug;
    ma_ug_t *bs_ug = bub->b_ug;
    uint32_t v, u, i, max_i, nv, rv, n_vx, root, flag_pri = 1, flag_aux = 2, flag_ava = 4, occ;
    double w, cutoff = 2;
    uint32_t max_w_occ = 4;
    asg_arc_t *av = NULL;
    n_vx = bs_ug->g->n_seq << 1;
    uint8_t *vis = NULL; CALLOC(vis, ug->g->n_seq<<1);
    uint8_t *is_vis = NULL; CALLOC(is_vis, ug->g->n_seq<<1);
    uint8_t *is_used = NULL; CALLOC(is_used, n_vx);
    uint8_t *dedup = NULL; CALLOC(dedup, ug->g->n_seq<<1);
    uint8_t *is_tangle = NULL; CALLOC(is_tangle, ug->g->n_seq);
    buf_t b; memset(&b, 0, sizeof(buf_t));
    kvec_t_u32_warp stack, result, res_utg;
    kv_init(stack.a); kv_init(result.a); kv_init(res_utg.a);
    double *e_w = NULL; MALLOC(e_w, bs_ug->g->n_arc);
    uint32_t *e_occ = NULL, *a_occ = NULL; CALLOC(e_occ, bs_ug->g->n_arc);
    double *aw = NULL, max_w = 0;
    kvec_asg_arc_t_warp edges; kv_init(edges.a);
    ma_ug_t *back_bs_ug = copy_untig_graph(bs_ug);

    for (i = 0; i < bs_ug->g->n_arc; i++)///weight of bs_ug's edges
    {
        e_w[i] = -1;
    }

    for (i = 0; i < bs_ug->g->n_seq; i++)///init all chain with flag_aux 
    {
        set_b_utg_weight_flag(bub, &b, i<<1, vis, flag_aux, NULL);
    }


    for (v = 0; v < n_vx; v++)
    {
        av = asg_arc_a(bs_ug->g, v);
        nv = asg_arc_n(bs_ug->g, v);
        aw = (&e_w[bs_ug->g->idx[v]>>32]);
        a_occ = (&e_occ[bs_ug->g->idx[v]>>32]);
        if(nv <= 1 || get_real_length(bs_ug->g, v, NULL) <= 1) continue;
        set_b_utg_weight_flag_xor(bub, bs_ug, &b, v^1, vis, flag_pri, NULL);

        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            w = get_chain_weight_hic(bub, bs_ug, &b, av[i].v, v, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, NULL, &occ);
            aw[i] = w;
            a_occ[i] = occ;
        }

        set_b_utg_weight_flag_xor(bub, bs_ug, &b, v^1, vis, flag_pri, NULL);
    }


    for (v = 0; v < n_vx; v++)
    {
        av = asg_arc_a(bs_ug->g, v);
        nv = asg_arc_n(bs_ug->g, v);
        aw = (&e_w[bs_ug->g->idx[v]>>32]);
        a_occ = (&e_occ[bs_ug->g->idx[v]>>32]);
        if(nv <= 1 || get_real_length(bs_ug->g, v, NULL) <= 1) continue;

        for (i = rv = 0, max_i = (uint32_t)-1; i < nv; i++)
        {
            if(av[i].del) continue;
            if(max_i == (uint32_t)-1)
            {
                max_i = i;
                max_w = aw[i];
            }
            else if(max_w < aw[i])
            {
                max_i = i;
                max_w = aw[i];
            }
            rv++;
        }

        if(max_i == (uint32_t)-1) continue;
        ///if(max_w <= max_w_cutoff) continue; //must be <=
        if(a_occ[max_i] <= max_w_occ) continue; //must be <=
        if(rv < 2) continue;

        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            if(i == max_i) continue;
            ///if((av[i].v>>1) == (v>>1) && aw[i] <= max_w_cutoff) continue; ///might be not reasonable
            if((av[i].v>>1) == (v>>1) && a_occ[i] <= max_w_occ) continue; ///might be not reasonable
            if(aw[i]*cutoff < max_w && double_check_bub_branch(&av[i], bs_ug, e_w, e_occ, cutoff, max_w_occ))
            {
                av[i].del = 1; asg_arc_del(bs_ug->g, (av[i].v)^1, (av[i].ul>>32)^1, 1);
            }
        }
    }

    uint32_t rId_0, ori_0, rId_1, ori_1, root_0, root_1;
    for (v = 0; v < n_vx; v++)
    {
        av = asg_arc_a(bs_ug->g, v);
        nv = asg_arc_n(bs_ug->g, v);
        rv = get_real_length(bs_ug->g, v, NULL);
        if(nv == rv) continue;///no edge drop
        if(rv != 1 || nv <= 1) continue;
        get_real_length(bs_ug->g, v, &u);
        u ^= 1;
        if(get_real_length(bs_ug->g, u, NULL) != 1) continue;
        drop_g_edges_by_utg(bub, bub->b_g, bs_ug, NULL, v, u);
        if(is_used[v] || is_used[u]) continue;

        is_used[v] = is_used[u] = 1;
        root = get_utg_end_from_btg(bub, bs_ug, v);
        rId_0 = root>>1;
        ori_0 = root&1;
        get_bubbles(bub, rId_0, ori_0 == 1?&root_0:NULL, ori_0 == 0?&root_0:NULL, NULL, NULL, NULL);

        root = get_utg_end_from_btg(bub, bs_ug, u);
        rId_1 = root>>1;
        ori_1 = root&1;
        get_bubbles(bub, rId_1, ori_1 == 1?&root_1:NULL, ori_1 == 0?&root_1:NULL, NULL, NULL, NULL);

        res_utg.a.n = 0;
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, u^1, v, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        for (i = 0; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 1;

        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, v^1, u, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        for (; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 2;

        for (i = 0; i < res_utg.a.n; i++)
        {
            if(dedup[res_utg.a.a[i]>>1] == 3)
            {
                is_tangle[res_utg.a.a[i]>>1] = 3;
            }
            else
            {
                if(is_tangle[res_utg.a.a[i]>>1] != 3)
                {
                    is_tangle[res_utg.a.a[i]>>1] = 1;
                }
            }
            dedup[res_utg.a.a[i]>>1] = 0;
        }
    }

    /*******************************for debug************************************/
    // for (i = 0; i < ug->g->n_seq; i++)
    // {
    //     if(is_tangle[i] == 1)
    //     {
    //         fprintf(stderr, "*****tangle-utg%.6ul\n", i+1);
    //     }
    // }
    /*******************************for debug************************************/
    memset(is_used, 0, n_vx);
    for (v = 0; v < n_vx; v++)
    {
        av = asg_arc_a(bs_ug->g, v);
        nv = asg_arc_n(bs_ug->g, v);
        rv = get_real_length(bs_ug->g, v, NULL);
        if(nv == rv) continue;///no edge drop
        if(rv != 1 || nv <= 1) continue;
        get_real_length(bs_ug->g, v, &u);
        u ^= 1;
        if(get_real_length(bs_ug->g, u, NULL) != 1) continue;
        drop_g_edges_by_utg(bub, bub->b_g, bs_ug, NULL, v, u);
        if(is_used[v] || is_used[u]) continue;

        is_used[v] = is_used[u] = 1;
        root = get_utg_end_from_btg(bub, bs_ug, v);
        rId_0 = root>>1;
        ori_0 = root&1;
        get_bubbles(bub, rId_0, ori_0 == 1?&root_0:NULL, ori_0 == 0?&root_0:NULL, NULL, NULL, NULL);

        root = get_utg_end_from_btg(bub, bs_ug, u);
        rId_1 = root>>1;
        ori_1 = root&1;
        get_bubbles(bub, rId_1, ori_1 == 1?&root_1:NULL, ori_1 == 0?&root_1:NULL, NULL, NULL, NULL);

        res_utg.a.n = 0;
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, u^1, v, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        for (i = 0; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 1;

        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, v^1, u, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        for (; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 2;


        /*******************************for debug************************************/
        // fprintf(stderr, "\nres_utg.a.n: %u, beg-utg%.6ul, sink-utg%.6ul\n", 
        //             (uint32_t)res_utg.a.n, (root_0>>1)+1, (root_1>>1)+1);
        // for (i = 0; i < res_utg.a.n; i++)
        // {
        //     if(dedup[res_utg.a.a[i]>>1] == 3)
        //     {
        //         fprintf(stderr, "share-utg%.6ul\n", (res_utg.a.a[i]>>1)+1);
        //     }
        // }
        // for (i = 0; i < res_utg.a.n; i++)
        // {
        //     if(dedup[res_utg.a.a[i]>>1] == 1)
        //     {
        //         fprintf(stderr, "1-utg%.6ul\n", (res_utg.a.a[i]>>1)+1);
        //     }
        // }
        // for (i = 0; i < res_utg.a.n; i++)
        // {
        //     if(dedup[res_utg.a.a[i]>>1] == 2)
        //     {
        //         fprintf(stderr, "2-utg%.6ul\n", (res_utg.a.a[i]>>1)+1);
        //     }
        // }
        /*******************************for debug************************************/

        clean_sub_tangle(bub, vis, &res_utg, dedup, is_tangle, NULL, flag_pri, v>>1, u>>1);

        for (i = 0; i < res_utg.a.n; i++)
        {
            dedup[res_utg.a.a[i]>>1] = 0;
        }
    }


    edges.a.n = 0;
    memset(is_used, 0, n_vx);
    for (v = 0; v < n_vx; v++)
    {
        av = asg_arc_a(bs_ug->g, v);
        nv = asg_arc_n(bs_ug->g, v);
        rv = get_real_length(bs_ug->g, v, NULL);
        if(nv == rv) continue;///no edge drop
        if(rv != 1 || nv <= 1) continue;
        get_real_length(bs_ug->g, v, &u);
        u ^= 1;
        if(get_real_length(bs_ug->g, u, NULL) != 1) continue;
        drop_g_edges_by_utg(bub, bub->b_g, bs_ug, NULL, v, u);
        if(is_used[v] || is_used[u]) continue;

        is_used[v] = is_used[u] = 1;
        root = get_utg_end_from_btg(bub, bs_ug, v);
        rId_0 = root>>1;
        ori_0 = root&1;
        get_bubbles(bub, rId_0, ori_0 == 1?&root_0:NULL, ori_0 == 0?&root_0:NULL, NULL, NULL, NULL);

        root = get_utg_end_from_btg(bub, bs_ug, u);
        rId_1 = root>>1;
        ori_1 = root&1;
        get_bubbles(bub, rId_1, ori_1 == 1?&root_1:NULL, ori_1 == 0?&root_1:NULL, NULL, NULL, NULL);

        res_utg.a.n = 0;
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, u^1, v, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, v^1, vis, flag_pri, NULL);
        for (i = 0; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 1;

        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        get_chain_weight_hic(bub, back_bs_ug, &b, v^1, u, ta, vis, is_vis, ug, &stack, &result, flag_pri, flag_ava, &res_utg, NULL);
        set_b_utg_weight_flag_xor(bub, back_bs_ug, &b, u^1, vis, flag_pri, NULL);
        for (; i < res_utg.a.n; i++) dedup[res_utg.a.a[i]>>1] |= 2;

        clean_sub_tangle(bub, vis, &res_utg, dedup, is_tangle, &edges, flag_pri, v>>1, u>>1);

        for (i = 0; i < res_utg.a.n; i++)
        {
            dedup[res_utg.a.a[i]>>1] = 0;
        }
    }


    /*******************************for debug************************************/
    // for (i = 0; i < ug->g->n_seq; i++)
    // {
    //     if(is_tangle[i] == 1)
    //     {
    //         fprintf(stderr, "####tangle-utg%.6ul\n", i+1);
    //     }
    // }

    // for (i = 0; i < edges.a.n; i++)
    // {
    //     fprintf(stderr, "s-utg%.6lul<------>d-utg%.6ul\n", (edges.a.a[i].ul>>33) + 1, (edges.a.a[i].v>>1) + 1);
        
    // }
    /*******************************for debug************************************/
    if(edges.a.n > 0)
    {
        for (i = 0; i < edges.a.n; i++)
        {
            asg_arc_del(bub->ug->g, edges.a.a[i].ul>>32, edges.a.a[i].v, 1);
            asg_arc_del(bub->ug->g, (edges.a.a[i].v)^1, (edges.a.a[i].ul>>32)^1, 1);
            delete_sg_e_by_ug(idx->read_g, idx->ug, edges.a.a[i].ul>>32, edges.a.a[i].v);
            delete_sg_e_by_ug(idx->read_g, idx->ug, (edges.a.a[i].v)^1, (edges.a.a[i].ul>>32)^1);
        }
        asg_cleanup(bub->ug->g);
        asg_cleanup(idx->read_g);
    }
    

    free(vis); free(is_vis); free(is_used); free(dedup); free(b.b.a); free(e_w); free(e_occ); free(is_tangle);
    kv_destroy(stack.a); kv_destroy(result.a); kv_destroy(res_utg.a); kv_destroy(edges.a);
    ma_ug_destroy(back_bs_ug);
    // fprintf(stderr, "[M::%s::%.3f]\n", __func__, yak_realtime()-index_time);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, 0x48(%rsp)
movq %rdi, 0x178(%rsp)
movq (%rdi), %rcx
movq %rdx, 0x20(%rsp)
movq 0xc0(%rdx), %rbp
movq 0x18(%rbp), %rax
movl 0x14(%rax), %ebx
addl %ebx, %ebx
movq %rcx, 0x40(%rsp)
movq 0x18(%rcx), %rax
movl 0x14(%rax), %r15d
leal (%r15,%r15), %eax
movslq %eax, %r12
movl $0x1, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x10(%rsp)
movl $0x1, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x30(%rsp)
movl $0x1, %esi
movq %rbx, 0x70(%rsp)
movq %rbx, %rdi
callq 0x2120
movq %rax, 0x38(%rsp)
movl $0x1, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, 0x28(%rsp)
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x2120
movq %rax, 0x78(%rsp)
xorl %r14d, %r14d
movq %r14, 0x170(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x160(%rsp)
movapd %xmm0, 0x150(%rsp)
movapd %xmm0, 0x140(%rsp)
movapd %xmm0, 0x130(%rsp)
movapd %xmm0, 0x120(%rsp)
movapd %xmm0, 0x110(%rsp)
movapd %xmm0, 0xf0(%rsp)
movq %r14, 0x100(%rsp)
movapd %xmm0, 0xd0(%rsp)
movq %r14, 0xe0(%rsp)
movapd %xmm0, 0x50(%rsp)
movq %r14, 0x60(%rsp)
movq 0x18(%rbp), %rax
movl 0x4(%rax), %r15d
andq %rbx, %r15
leaq (,%r15,8), %rdi
callq 0x2280
movq %rax, %r12
movl $0x4, %esi
movq %r15, %rdi
movq %rbp, %r15
callq 0x2120
movq %rax, 0x90(%rsp)
movq %r14, 0xb0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq %rbp, %rdi
callq 0xc815c
movq %rax, 0x18(%rsp)
movq 0x18(%rbp), %rax
movl 0x4(%rax), %eax
andq %rbx, %rax
je 0x15375c
xorl %ecx, %ecx
movabsq $-0x4010000000000000, %rdx # imm = 0xBFF0000000000000
movq %rdx, (%r12,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x153750
movq %r12, 0x80(%rsp)
movq 0x18(%r15), %rax
testl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
movq 0x10(%rsp), %r13
movq %r15, %r14
movq 0x20(%rsp), %r12
je 0x1537ba
xorl %r15d, %r15d
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %ebp, %ebp
movq %r12, %rdi
leaq 0x110(%rsp), %rsi
movl %r15d, %edx
movq %r13, %rcx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x146be0
incl %ebp
movq 0x18(%r14), %rax
movl 0x14(%rax), %eax
andl %ebx, %eax
addl $0x2, %r15d
cmpl %eax, %ebp
jb 0x153788
movq %r14, 0x8(%rsp)
movq 0x70(%rsp), %r14
testq %r14, %r14
je 0x153f17
xorl %r15d, %r15d
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq 0x80(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x28(%rcx), %rax
movq (%rax,%r15,8), %rbx
cmpl $0x2, %ebx
jb 0x153954
movq %rbx, %rax
andq %r8, %rax
je 0x153954
movq 0x8(%rcx), %rcx
movq %rbx, %rsi
shrq $0x20, %rsi
leaq (%rdx,%rsi,8), %r13
movq 0x90(%rsp), %rdi
leaq (%rdi,%rsi,4), %rbp
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %r14
addq $0xc, %r14
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
xorl %ecx, %ecx
xorl %edi, %edi
movl (%r14,%rcx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %edi
addq $0x18, %rcx
cmpq %rcx, %rax
jne 0x153837
cmpl $0x2, %edi
jl 0x153954
movl %r15d, %ecx
xorl $0x1, %ecx
subq $0x8, %rsp
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %ecx, 0x90(%rsp)
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq $0x0
callq 0x149b3f
addq $0x10, %rsp
cmpl $0x1, %ebx
adcl $0x0, %ebx
xorl %r12d, %r12d
cmpl $0x0, (%r14)
js 0x153907
movl -0x4(%r14), %ecx
subq $0x8, %rsp
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r15d, %r8d
movq 0x50(%rsp), %r9
leaq 0xa4(%rsp), %rax
pushq %rax
pushq $0x0
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x50, %rsp
movsd %xmm0, (%r13,%r12,8)
movl 0x9c(%rsp), %eax
movl %eax, (%rbp,%r12,4)
incq %r12
addq $0x18, %r14
cmpq %r12, %rbx
jne 0x153896
subq $0x8, %rsp
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x90(%rsp), %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq $0x0
callq 0x149b3f
addq $0x10, %rsp
movq 0x80(%rsp), %rdx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
incq %r15
movq 0x70(%rsp), %r14
cmpq %r14, %r15
jne 0x1537de
xorpd %xmm1, %xmm1
xorl %r12d, %r12d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movq 0x38(%rsp), %rbx
movq 0x8(%rsp), %r15
movq 0x18(%r15), %rax
movq 0x28(%rax), %rcx
movq (%rcx,%r12,8), %rbp
cmpl $0x2, %ebp
jb 0x153bbc
movq %rbp, %rcx
andq %r9, %rcx
je 0x153bbc
movq 0x8(%rax), %rax
movq %rbp, %rdi
shrq $0x20, %rdi
leaq (%rdi,%rdi,2), %rsi
leaq (%rax,%rsi,8), %r10
leaq (%rdx,%rdi,8), %r11
movq 0x90(%rsp), %r8
leaq (%r8,%rdi,4), %rdi
movq %rdi, 0x88(%rsp)
leaq (%rax,%rsi,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %r8d, %r8d
xorl %esi, %esi
movl (%rax,%r8), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %r8
cmpq %r8, %rcx
jne 0x1539dd
cmpl $0x2, %esi
jl 0x153bbc
cmpl $0x1, %ebp
adcl $0x0, %ebp
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpl $0x0, (%rax)
js 0x153a27
movsd (%r11,%rdi,8), %xmm0
cmpl $-0x1, %esi
je 0x153a1f
ucomisd %xmm1, %xmm0
jbe 0x153a25
movl %edi, %esi
movapd %xmm0, %xmm1
incl %ecx
incq %rdi
addq $0x18, %rax
cmpq %rdi, %rbp
jne 0x153a09
cmpl $-0x1, %esi
je 0x153bbc
movl %esi, %esi
movq 0x88(%rsp), %rax
movq %rsi, 0xc8(%rsp)
cmpl $0x5, (%rax,%rsi,4)
setb %al
cmpl $0x2, %ecx
setb %cl
orb %al, %cl
jne 0x153bbc
xorl %r13d, %r13d
movq 0xc8(%rsp), %r9
movsd %xmm1, 0x190(%rsp)
movq %r10, 0x188(%rsp)
movq %r11, 0x180(%rsp)
leaq (,%r13,2), %rax
addq %r13, %rax
movl 0xc(%r10,%rax,8), %ebx
testl %ebx, %ebx
js 0x153b9b
cmpq %r9, %r13
je 0x153b9b
leaq (%r10,%rax,8), %r15
movl 0x8(%r15), %r14d
movl %r14d, %eax
xorl %r12d, %eax
cmpl $0x1, %eax
ja 0x153ace
movq 0x88(%rsp), %rax
cmpl $0x5, (%rax,%r13,4)
jb 0x153b9b
movsd (%r11,%r13,8), %xmm0
addsd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x153b9b
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x90(%rsp), %rcx
movsd 0xdb516(%rip), %xmm0    # 0x22f010
movl $0x4, %r8d
callq 0x14a8c0
movq 0xc8(%rsp), %r9
movq 0x180(%rsp), %r11
movq 0x188(%rsp), %r10
movsd 0x190(%rsp), %xmm1
movq 0x80(%rsp), %rdx
testl %eax, %eax
je 0x153b9b
orl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0xc(%r15)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
xorq $0x1, %r14
movq 0x28(%rcx), %rax
movq (%rax,%r14,8), %r8
movq %r8, %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rsi
je 0x153b9b
movl 0x4(%r15), %eax
movq 0x8(%rcx), %rdi
shrq $0x20, %r8
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rcx
leaq (%r8,%r8,2), %rsi
leaq (%rdi,%rsi,8), %r8
addq $0xc, %r8
xorl %esi, %esi
movl -0x4(%r8,%rsi), %edi
xorl %eax, %edi
cmpl $0x1, %edi
jne 0x153b92
orb $-0x80, 0x3(%r8,%rsi)
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x153b80
incq %r13
cmpq %rbp, %r13
jne 0x153a87
movq 0x38(%rsp), %rbx
movq 0x8(%rsp), %r15
movq 0x70(%rsp), %r14
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
incq %r12
cmpq %r14, %r12
jne 0x15397c
xorl %ebp, %ebp
movq 0x20(%rsp), %r13
movq 0x18(%r15), %rax
movq 0x28(%rax), %rcx
movq (%rcx,%rbp,8), %rdx
movq %rdx, %rsi
movl $0x0, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rsi
je 0x153c2d
movq 0x8(%rax), %rdi
movq %rdx, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
leaq (%rdi,%r8,8), %r8
addq $0xc, %r8
leaq (,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %r9
xorl %r10d, %r10d
xorl %edi, %edi
movl (%r8,%r10), %r11d
notl %r11d
shrl $0x1f, %r11d
addl %r11d, %edi
addq $0x18, %r10
cmpq %r10, %r9
jne 0x153c16
cmpl %edx, %edi
je 0x153f09
cmpl $0x2, %edx
jb 0x153f09
cmpl $0x1, %edi
jne 0x153f09
testq %rsi, %rsi
je 0x153c7e
movq 0x8(%rax), %rdi
shrq $0x20, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rdx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %edi, %edi
cmpl $0x0, (%rdx,%rdi)
js 0x153c75
movl -0x4(%rdx,%rdi), %r12d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0x153c6a
movl %r12d, %r15d
xorq $0x1, %r15
movq (%rcx,%r15,8), %rdx
movq %rdx, %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rcx
je 0x153f01
movq 0x8(%rax), %rax
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x153cba
cmpl $0x1, %esi
jne 0x153f01
movq 0xb8(%r13), %rsi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
movl %ebp, %r8d
movl %r15d, %r9d
callq 0x147dea
cmpb $0x0, (%rbx,%rbp)
jne 0x153f01
cmpb $0x0, (%rbx,%r15)
jne 0x153f01
movb $0x1, %al
movb %al, (%rbx,%r15)
movb %al, (%rbx,%rbp)
xorl %ebx, %ebx
movq %rbx, 0x50(%rsp)
movl %ebp, %ecx
xorl $0x1, %ecx
movl %ecx, 0x70(%rsp)
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
movq 0x50(%rsp), %r9
pushq %rbx
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x78(%rsp), %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x153de5
movq 0x60(%rsp), %rcx
xorl %ebx, %ebx
movq 0x28(%rsp), %rsi
movl (%rcx,%rbx,4), %edx
shrl %edx
orb $0x1, (%rsi,%rdx)
incq %rbx
movl %ebx, %edx
cmpq %rdx, %rax
ja 0x153dd2
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x78(%rsp), %ecx
movl %r15d, %r8d
movq 0x50(%rsp), %r9
xorl %eax, %eax
pushq %rax
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
movl %ebx, %ecx
cmpq %rcx, %rax
movq 0x28(%rsp), %rdi
jbe 0x153eb8
movq 0x60(%rsp), %rdx
leal 0x1(%rcx), %esi
movl (%rdx,%rcx,4), %ecx
shrl %ecx
orb $0x2, (%rdi,%rcx)
movl %esi, %ecx
incl %esi
cmpq %rcx, %rax
ja 0x153ea6
testq %rax, %rax
movq 0x78(%rsp), %r8
movq 0x38(%rsp), %rbx
je 0x153f01
movq 0x60(%rsp), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
shrl %esi
movq %rdi, %r9
movb $0x3, %dil
cmpb $0x3, (%r9,%rsi)
je 0x153eea
movb $0x1, %dil
cmpb $0x3, (%r8,%rsi)
je 0x153eee
movb %dil, (%r8,%rsi)
movq 0x28(%rsp), %rdi
movb $0x0, (%rdi,%rsi)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x153ece
movl %r15d, %r12d
movq 0x8(%rsp), %r15
incq %rbp
cmpq %r14, %rbp
jne 0x153bcf
jmp 0x153f26
movq 0x38(%rsp), %rbx
movq 0x8(%rsp), %r15
movq 0x20(%rsp), %r13
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
testq %r14, %r14
je 0x15429d
xorl %ebp, %ebp
movq 0x18(%r15), %rax
movq 0x28(%rax), %rcx
movq (%rcx,%rbp,8), %rdx
movq %rdx, %rsi
movl $0x0, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rsi
je 0x153f9c
movq 0x8(%rax), %rdi
movq %rdx, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
leaq (%rdi,%r8,8), %r8
addq $0xc, %r8
leaq (,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %r9
xorl %r10d, %r10d
xorl %edi, %edi
movl (%r8,%r10), %r11d
notl %r11d
shrl $0x1f, %r11d
addl %r11d, %edi
addq $0x18, %r10
cmpq %r10, %r9
jne 0x153f85
cmpl %edx, %edi
je 0x154291
cmpl $0x2, %edx
jb 0x154291
cmpl $0x1, %edi
jne 0x154291
testq %rsi, %rsi
je 0x153fed
movq 0x8(%rax), %rdi
shrq $0x20, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rdx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %edi, %edi
cmpl $0x0, (%rdx,%rdi)
js 0x153fe4
movl -0x4(%rdx,%rdi), %r12d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0x153fd9
movl %r12d, %r15d
xorq $0x1, %r15
movq (%rcx,%r15,8), %rdx
movq %rdx, %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rcx
je 0x154289
movq 0x8(%rax), %rax
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x154029
cmpl $0x1, %esi
jne 0x154289
movq 0xb8(%r13), %rsi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
movl %ebp, %r8d
movl %r15d, %r9d
callq 0x147dea
cmpb $0x0, (%rbx,%rbp)
jne 0x154289
cmpb $0x0, (%rbx,%r15)
jne 0x154289
movb $0x1, %al
movb %al, (%rbx,%r15)
movb %al, (%rbx,%rbp)
xorl %ebx, %ebx
movq %rbx, 0x50(%rsp)
movl %ebp, %ecx
xorl $0x1, %ecx
movl %ecx, 0x20(%rsp)
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
movq 0x50(%rsp), %r9
pushq %rbx
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x154154
movq 0x60(%rsp), %rcx
xorl %ebx, %ebx
movq 0x28(%rsp), %rsi
movl (%rcx,%rbx,4), %edx
shrl %edx
orb $0x1, (%rsi,%rdx)
incq %rbx
movl %ebx, %edx
cmpq %rdx, %rax
ja 0x154141
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x28(%rsp), %ecx
movl %r15d, %r8d
movq 0x50(%rsp), %r9
xorl %eax, %eax
pushq %rax
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
movl %ebx, %ecx
cmpq %rcx, %rax
movq 0x28(%rsp), %rdi
jbe 0x154227
movq 0x60(%rsp), %rdx
leal 0x1(%rcx), %esi
movl (%rdx,%rcx,4), %ecx
shrl %ecx
orb $0x2, (%rdi,%rcx)
movl %esi, %ecx
incl %esi
cmpq %rcx, %rax
ja 0x154215
movl %ebp, %eax
shrl %eax
shrl %r12d
subq $0x8, %rsp
movq %rdi, %rcx
movq %r13, %rdi
movq 0x18(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq 0x80(%rsp), %r8
xorl %r9d, %r9d
pushq %r12
pushq %rax
pushq $0x1
callq 0x152af6
addq $0x20, %rsp
movq 0x50(%rsp), %rax
testq %rax, %rax
movq 0x38(%rsp), %rbx
je 0x154289
movq 0x60(%rsp), %rcx
xorl %edx, %edx
movq 0x28(%rsp), %rdi
movl (%rcx,%rdx,4), %esi
shrl %esi
movb $0x0, (%rdi,%rsi)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x154276
movl %r15d, %r12d
movq 0x8(%rsp), %r15
incq %rbp
cmpq %r14, %rbp
jne 0x153f3e
movq $0x0, 0xa0(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
testq %r14, %r14
je 0x154625
xorl %ebp, %ebp
movq 0x18(%r15), %rax
movq 0x28(%rax), %rcx
movq (%rcx,%rbp,8), %rdx
movq %rdx, %rsi
movl $0x0, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rsi
je 0x15431f
movq 0x8(%rax), %rdi
movq %rdx, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
leaq (%rdi,%r8,8), %r8
addq $0xc, %r8
leaq (,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %r9
xorl %r10d, %r10d
xorl %edi, %edi
movl (%r8,%r10), %r11d
notl %r11d
shrl $0x1f, %r11d
addl %r11d, %edi
addq $0x18, %r10
cmpq %r10, %r9
jne 0x154308
cmpl %edx, %edi
je 0x154619
cmpl $0x2, %edx
jb 0x154619
cmpl $0x1, %edi
jne 0x154619
testq %rsi, %rsi
je 0x154370
movq 0x8(%rax), %rdi
shrq $0x20, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rdx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %edi, %edi
cmpl $0x0, (%rdx,%rdi)
js 0x154367
movl -0x4(%rdx,%rdi), %r12d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0x15435c
movl %r12d, %r15d
xorq $0x1, %r15
movq (%rcx,%r15,8), %rdx
movq %rdx, %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rcx
je 0x154611
movq 0x8(%rax), %rax
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x1543ac
cmpl $0x1, %esi
jne 0x154611
movq 0xb8(%r13), %rsi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
movl %ebp, %r8d
movl %r15d, %r9d
callq 0x147dea
cmpb $0x0, (%rbx,%rbp)
jne 0x154611
cmpb $0x0, (%rbx,%r15)
jne 0x154611
movb $0x1, %al
movb %al, (%rbx,%r15)
movb %al, (%rbx,%rbp)
xorl %ebx, %ebx
movq %rbx, 0x50(%rsp)
movl %ebp, %ecx
xorl $0x1, %ecx
movl %ecx, 0x20(%rsp)
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
movq 0x50(%rsp), %r9
pushq %rbx
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x28(%rsp), %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
pushq %rbx
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x1544d7
movq 0x60(%rsp), %rcx
xorl %ebx, %ebx
movq 0x28(%rsp), %rsi
movl (%rcx,%rbx,4), %edx
shrl %edx
orb $0x1, (%rsi,%rdx)
incq %rbx
movl %ebx, %edx
cmpq %rdx, %rax
ja 0x1544c4
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl 0x28(%rsp), %ecx
movl %r15d, %r8d
movq 0x50(%rsp), %r9
xorl %eax, %eax
pushq %rax
leaq 0x60(%rsp), %rax
pushq %rax
pushq $0x4
pushq $0x1
leaq 0xf8(%rsp), %rax
pushq %rax
leaq 0x120(%rsp), %rax
pushq %rax
pushq 0x78(%rsp)
pushq 0x70(%rsp)
pushq 0x58(%rsp)
callq 0x1522b6
addq $0x48, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdx
movl %r12d, %ecx
movq 0x18(%rsp), %r8
movl $0x1, %r9d
xorl %eax, %eax
pushq %rax
callq 0x149b3f
addq $0x10, %rsp
movq 0x50(%rsp), %rax
movl %ebx, %ecx
cmpq %rcx, %rax
movq 0x28(%rsp), %rdi
jbe 0x1545aa
movq 0x60(%rsp), %rdx
leal 0x1(%rcx), %esi
movl (%rdx,%rcx,4), %ecx
shrl %ecx
orb $0x2, (%rdi,%rcx)
movl %esi, %ecx
incl %esi
cmpq %rcx, %rax
ja 0x154598
movl %ebp, %eax
shrl %eax
shrl %r12d
subq $0x8, %rsp
movq %rdi, %rcx
movq %r13, %rdi
movq 0x18(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq 0x80(%rsp), %r8
leaq 0xa8(%rsp), %r9
pushq %r12
pushq %rax
pushq $0x1
callq 0x152af6
addq $0x20, %rsp
movq 0x50(%rsp), %rax
testq %rax, %rax
movq 0x38(%rsp), %rbx
je 0x154611
movq 0x60(%rsp), %rcx
xorl %edx, %edx
movq 0x28(%rsp), %rdi
movl (%rcx,%rdx,4), %esi
shrl %esi
movb $0x0, (%rdi,%rsi)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x1545fe
movl %r15d, %r12d
movq 0x8(%rsp), %r15
incq %rbp
cmpq %r14, %rbp
jne 0x1542c1
cmpq $0x0, 0xa0(%rsp)
movq 0x10(%rsp), %rdi
je 0x1547a4
cmpq $0x0, 0xa0(%rsp)
movq 0x178(%rsp), %r12
je 0x154783
xorl %eax, %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movq 0x10(%r13), %rcx
movq 0x18(%rcx), %rsi
movq 0xb0(%rsp), %rdx
leaq (%rax,%rax,2), %rcx
movl 0x4(%rdx,%rcx,8), %edi
movq 0x28(%rsi), %r8
movq (%r8,%rdi,8), %rdi
movq %rdi, %r8
andq %rbx, %r8
je 0x1546bb
movl 0x8(%rdx,%rcx,8), %edx
movq 0x8(%rsi), %r9
shrq $0x20, %rdi
shlq $0x3, %r8
leaq (%r8,%r8,2), %rsi
leaq (%rdi,%rdi,2), %rdi
leaq (%r9,%rdi,8), %rdi
addq $0xc, %rdi
xorl %r8d, %r8d
cmpl %edx, -0x4(%rdi,%r8)
jne 0x1546b2
orb $-0x80, 0x3(%rdi,%r8)
addq $0x18, %r8
cmpq %r8, %rsi
jne 0x1546a5
movq 0x10(%r13), %rdx
movq 0x18(%rdx), %rdx
movq 0xb0(%rsp), %rdi
movl 0x8(%rdi,%rcx,8), %esi
xorq $0x1, %rsi
movq 0x28(%rdx), %r8
movq (%r8,%rsi,8), %rsi
movq %rsi, %r8
andq %rbx, %r8
je 0x154721
movl 0x4(%rdi,%rcx,8), %ecx
movq 0x8(%rdx), %rdi
shrq $0x20, %rsi
shlq $0x3, %r8
leaq (%r8,%r8,2), %rdx
leaq (%rsi,%rsi,2), %rsi
leaq (%rdi,%rsi,8), %rsi
addq $0xc, %rsi
xorl %edi, %edi
movl -0x4(%rsi,%rdi), %r8d
xorl %ecx, %r8d
cmpl $0x1, %r8d
jne 0x154718
orb $-0x80, 0x3(%rsi,%rdi)
addq $0x18, %rdi
cmpq %rdi, %rdx
jne 0x154705
movq (%r12), %rsi
movq 0x8(%r12), %rdi
movq 0xb0(%rsp), %rcx
shlq $0x3, %rax
leaq (%rax,%rax,2), %r15
movl 0x4(%rcx,%r15), %edx
movl 0x8(%rcx,%r15), %ecx
callq 0x1534c4
movq (%r12), %rsi
movq 0x8(%r12), %rdi
movq 0xb0(%rsp), %rax
movl 0x4(%rax,%r15), %ecx
movl 0x8(%rax,%r15), %edx
xorl $0x1, %edx
xorl $0x1, %ecx
callq 0x1534c4
incl %r14d
movq %r14, %rax
cmpq %r14, 0xa0(%rsp)
ja 0x15465a
movq 0x10(%r13), %rax
movq 0x18(%rax), %rdi
callq 0xa02fa
movq 0x8(%r12), %rdi
callq 0xa02fa
movq 0x10(%rsp), %rdi
movq 0x38(%rsp), %rbx
callq 0x2220
movq 0x30(%rsp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
movq 0x28(%rsp), %rdi
callq 0x2220
movq 0x158(%rsp), %rdi
callq 0x2220
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0x90(%rsp), %rdi
callq 0x2220
movq 0x78(%rsp), %rdi
callq 0x2220
movq 0x100(%rsp), %rdi
callq 0x2220
movq 0xe0(%rsp), %rdi
callq 0x2220
movq 0x60(%rsp), %rdi
callq 0x2220
movq 0xb0(%rsp), %rdi
callq 0x2220
movq 0x18(%rsp), %rdi
callq 0xa0004
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq