// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: rescue_bubbles_by_missing_ovlp_backward(ma_ug_t*, asg_t*, ma_hit_t_alloc*, ma_sub_t*, R_to_U*, int, int, unsigned int, unsigned int, unsigned int, bubble_type*, bub_label_t*)
void rescue_bubbles_by_missing_ovlp_backward(ma_ug_t *i_u_g, asg_t *r_g, ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, 
R_to_U* ruIndex, int max_hang, int min_ovlp, uint32_t backward_steps, uint32_t beg_idx, uint32_t occ, bubble_type* bub, bub_label_t* b_mask_t)
{
    asg_t* nsg = NULL;
    uint32_t beg_utg, sink_utg, *a = NULL, n, i, bub_i, k_i, k_v, k, uId, endRid, is_Unitig, round, cur_backward_steps;
    uint32_t v, w, mode, nv;
    uint64_t l_bub, m_bub, r_bub, /**bub_0, bub_1,**/ tmp;
    ma_ug_t* ug = i_u_g;
    ma_utg_t *nsu = NULL, *u = NULL;
    uint8_t* expect_vis = NULL; CALLOC(expect_vis, r_g->n_seq);
    long long init, step = 0;
    asg_arc_t t, r_edge, *av = NULL;

    for (v = 0; v < ug->u.n; v++) ug->g->seq[v].c = PRIMARY_LABLE;
    
    kvec_t(asg_arc_t) new_edges;
    kv_init(new_edges);

    kvec_asg_arc_t_warp recover_edges;
    kv_init(recover_edges.a);

    kvec_t(asg_arc_t) rbub_edges;
    kv_init(rbub_edges);

    kvec_t_u64_warp u_vecs;
    kv_init(u_vecs.a);


    nsg = ug->g;
    for (v = 0; v < nsg->n_seq; v++)
    {
        uId = v;
        nsu = &(ug->u.a[uId]);
        if(nsu->m == 0) continue;
        if(nsg->seq[v].del) continue;
        for (k = 0; k < nsu->n; k++) 
        {
            set_R_to_U(ruIndex, nsu->a[k]>>33, uId, 1, &(r_g->seq[nsu->a[k]>>33].c));
        }
    }


    for (i = 0; i < bub->b_ug->u.n; i++)
    {
        u = &(bub->b_ug->u.a[i]);
        if(u->n < 3) continue; ///should be at least 3
        for (bub_i = 1; bub_i+1 < u->n; bub_i++)
        {
            m_bub = u->a[bub_i]>>33; l_bub = r_bub = (uint64_t)-1;
            if(m_bub < beg_idx || m_bub >= beg_idx + occ) continue;
            l_bub = u->a[bub_i-1]>>33;
            r_bub = u->a[bub_i+1]>>33;

            set_rtg_flag_by_bubble(bub, ug, r_g, l_bub, expect_vis, 1);
            set_rtg_flag_by_bubble(bub, ug, r_g, r_bub, expect_vis, 1);
            set_rtg_flag_by_bubble(bub, ug, r_g, m_bub, expect_vis, 1);
            get_bubbles(bub, m_bub, &beg_utg, &sink_utg, &a, &n, NULL);
            for (k_i = 0; k_i < n; k_i++)
            {
                uId = a[k_i]>>1;
                nsu = &(ug->u.a[uId]);
                if(nsu->m == 0) continue;

                rbub_edges.n = round = 0;
                for (k_v = 0; k_v < 2; k_v++)
                {
                    if(rbub_edges.n > 0)
                    {
                        cur_backward_steps = nsu->n - round - 1;
                        if(cur_backward_steps > backward_steps)
                        {
                            cur_backward_steps = backward_steps;
                        }
                    }
                    else
                    {
                        cur_backward_steps = backward_steps;
                    }


                    v = (uId<<1) + k_v;
                    if(get_real_length(nsg, v, NULL) != 0) continue;
                    ///fprintf(stderr, "++++++tig-utg%.6ul\n", uId+1);
                    ///that means this unitig has been changed
                    // if(nsu->start!=((uint64_t)(nsu->a[0])>>32)) continue;
                    // if((nsu->end^1)!=((uint64_t)(nsu->a[nsu->n-1])>>32)) continue;

                    if(v&1)
                    {
                        init = 0;
                        step = 1;
                        mode = 1;
                    }
                    else
                    {
                        init = nsu->n - 1;
                        step = -1;
                        mode = 0;
                    }

                    rbub_edges.n = 0;
                    for (round = 0; round < cur_backward_steps && init >= 0 && init < (long long)nsu->n; 
                                                                            init = init + step, round++)
                    {
                        endRid = ((uint64_t)(nsu->a[init]))>>32;
                        endRid = endRid^mode;

                        k = 0; rbub_edges.n = 0;
                        while(get_edge2existing_node_advance_by_broken_bub(ug, r_g, sources, coverage_cut, 
                            ruIndex, expect_vis, max_hang, min_ovlp, endRid, &k, &r_edge, 1))
                        {
                            kv_push(asg_arc_t, rbub_edges, r_edge);
                        }

                        if(rbub_edges.n > 0) break;
                    }

                    if(rbub_edges.n > 0)
                    {
                        //save for revert
                        tmp = mode; tmp = tmp <<31; tmp = tmp | (uint64_t)(init); tmp = tmp << 32; tmp = tmp | uId;
                        kv_push(uint64_t, u_vecs.a, tmp);
                        ///need to do transitive reduction
                        ///note here is different to standard transitive reduction
                        minor_transitive_reduction_r_g(r_g, rbub_edges.a, rbub_edges.n);


                        ///modify read graph
                        for (init = init - step; init >= 0 && init < (long long)nsu->n; init = init - step)
                        {
                            w = ((uint64_t)(nsu->a[init]))>>32;
                            nv = asg_arc_n(r_g, w);
                            av = asg_arc_a(r_g, w);
                            for (k = 0; k < nv; k++)
                            {
                                if(av[k].del) continue;
                                kv_push(asg_arc_t, recover_edges.a, av[k]);
                                if(asg_get_arc(r_g, av[k].v^1, av[k].ul>>32^1, &t)==0)
                                {
                                    fprintf(stderr, "error\n");
                                } 
                                kv_push(asg_arc_t, recover_edges.a, t);
                            }
                            

                            nv = asg_arc_n(r_g, w^1);
                            av = asg_arc_a(r_g, w^1);
                            for (k = 0; k < nv; k++)
                            {
                                if(av[k].del) continue;
                                kv_push(asg_arc_t, recover_edges.a, av[k]);
                                if(asg_get_arc(r_g, av[k].v^1, av[k].ul>>32^1, &t)==0)
                                {
                                    fprintf(stderr, "error\n");
                                } 
                                kv_push(asg_arc_t, recover_edges.a, t);
                            }

                            ///w = ((uint64_t)(nsu->a[init]))>>32;
                            asg_seq_del(r_g, w>>1);
                            expect_vis[w>>1] = 0;
                        }


                        for (k = 0; k < rbub_edges.n; k++)
                        {
                            t = rbub_edges.a[k];
                            if(t.del) continue;

                            kv_push(asg_arc_t, new_edges, t);
                            get_edge_from_source(sources, coverage_cut, ruIndex, max_hang, min_ovlp, 
                            (t.v^1), ((t.ul>>32)^1), &t);
                            kv_push(asg_arc_t, new_edges, t);
                        }
                    }

                }
            }
            

            set_rtg_flag_by_bubble(bub, ug, r_g, l_bub, expect_vis, 0);
            set_rtg_flag_by_bubble(bub, ug, r_g, r_bub, expect_vis, 0);
            set_rtg_flag_by_bubble(bub, ug, r_g, m_bub, expect_vis, 0);
        }
    }

    asg_arc_t* p = NULL;
    for (k = 0; k < new_edges.n; k++)
    {
        p = asg_arc_pushp(r_g);
        *p = new_edges.a[k];
    }
    if(new_edges.n != 0)
    {
        free(r_g->idx);
        r_g->idx = 0;
        r_g->is_srt = 0;
        asg_cleanup(r_g);
        asg_symm(r_g);
    }

    pre_clean(sources, coverage_cut, r_g, 0);

    lable_all_bubbles(r_g, b_mask_t);

    for (k = 0; k < new_edges.n; k++)
    {
        v = new_edges.a[k].ul>>32;
        w = new_edges.a[k].v;

        if(r_g->seq[v>>1].del) continue;
        if(r_g->seq[w>>1].del) continue;
        ///if this edge is at a bubble
        if(r_g->seq_vis[v]!=0 && r_g->seq_vis[w^1]!=0) continue;

        asg_arc_del(r_g, v, w, 1);
        asg_arc_del(r_g, w^1, v^1, 1);
    }
    asg_cleanup(r_g);
    asg_symm(r_g);

    for (k = 0; k < recover_edges.a.n; k++)
    {
        recover_edges.a.a[k].del = 1;
    }

    for (k = 0; k < u_vecs.a.n; k++)
    {
        mode = (uint64_t)u_vecs.a.a[k]>>63;
        if(mode == 1) step = 1;
        if(mode == 0) step = -1;
        init = (uint64_t)((uint64_t)u_vecs.a.a[k]>>32)&((uint64_t)(0x7fffffff));
        uId = (uint32_t)u_vecs.a.a[k];
        nsu = &(ug->u.a[uId]);

        endRid = ((uint64_t)(nsu->a[init]))>>32;
        endRid = endRid^mode;
        if(get_real_length(r_g, endRid, NULL) > 0)
        {
            update_unitig(step, init, nsu, r_g, &recover_edges, 1);
        }
        else
        {
            update_unitig(step, init, nsu, r_g, &recover_edges, 0);
        }
        // if(get_real_length(r_g, endRid, NULL) <= 0)
        // {
        //     update_unitig(step, init, nsu, r_g, &recover_edges, 0);
        // } 
    }

    uint64_t recov_occ = 0;
    for (k = 0; k < recover_edges.a.n; k++)
    {
        if(recover_edges.a.a[k].del) continue;
        p = asg_arc_pushp(r_g);
        *p = recover_edges.a.a[k];
        recov_occ++;
    }

    if(recov_occ != 0)
    {
        free(r_g->idx);
        r_g->idx = 0;
        r_g->is_srt = 0;
        asg_cleanup(r_g);
        asg_symm(r_g);
    }

    
    for (v = 0; v < ruIndex->len; v++)
    {
        get_R_to_U(ruIndex, v, &uId, &is_Unitig);
        if(is_Unitig == 1) ruIndex->index[v] = (uint32_t)-1;
    }

    // fprintf(stderr, "M::%s has done!\n", __func__);
    // print_bubble_filling_status(ug, r_g, ruIndex, bub, beg_idx, occ, new_edges.a, new_edges.n);

    kv_destroy(new_edges);
    kv_destroy(rbub_edges);
    kv_destroy(u_vecs.a);
    kv_destroy(recover_edges.a);
    free(expect_vis);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %r9, 0x100(%rsp)
movq %r8, 0xb8(%rsp)
movq %rcx, 0xf8(%rsp)
movq %rdx, 0xe8(%rsp)
movq %rsi, %rbp
movq %rdi, %r14
movl 0x1d8(%rsp), %r13d
movl 0x1d0(%rsp), %ebx
andq $0x0, 0x108(%rsp)
movl 0x14(%rsi), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, 0x88(%rsp)
movq %r14, 0x20(%rsp)
movq (%r14), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xba53c
movq 0x20(%rsp), %rdx
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
movb $0x0, 0x4(%rdx,%rcx,8)
incl %ecx
jmp 0xba51f
xorps %xmm0, %xmm0
andq $0x0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0xd0(%rsp)
xorl %r12d, %r12d
movq 0xd0(%rsp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r12
jae 0xba5e7
movq 0x20(%rsp), %rax
movq 0x10(%rax), %r14
imulq $0x28, %r12, %rax
cmpl $0x0, 0xc(%r14,%rax)
je 0xba5df
movq 0xd0(%rsp), %rcx
movq 0x20(%rcx), %rcx
cmpl $0x0, (%rcx,%r12,8)
js 0xba5df
addq %rax, %r14
xorl %r15d, %r15d
movl %r15d, 0xc(%rsp)
movl 0x10(%r14), %eax
cmpq %rax, %r15
jae 0xba5df
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rsi
shrq $0x21, %rsi
movq 0x20(%rbp), %rax
leaq (%rax,%rsi,8), %r8
addq $0x4, %r8
movq 0xb8(%rsp), %rdi
movl %r12d, %edx
pushq $0x1
popq %rcx
callq 0x6ab56
incq %r15
jmp 0xba5a1
incq %r12
jmp 0xba55e
movl %ebx, %r8d
addl %ebx, %r13d
movq %r13, %rdi
xorl %r9d, %r9d
xorl %r15d, %r15d
movq $0x0, 0xd8(%rsp)
movq $0x0, 0x58(%rsp)
xorl %eax, %eax
xorl %r13d, %r13d
xorl %edx, %edx
xorl %r10d, %r10d
movq $0x0, 0xa8(%rsp)
movq %rbp, 0x28(%rsp)
movq %rdi, 0x118(%rsp)
movq %r8, 0x110(%rsp)
movq %rax, 0x30(%rsp)
movl %r9d, %r9d
movq 0x1e0(%rsp), %rax
movq 0xc0(%rax), %rax
cmpq %r9, (%rax)
movq %rdx, 0x10(%rsp)
jbe 0xbafc7
movq 0x10(%rax), %r11
imulq $0x28, %r9, %rcx
movl 0x10(%r11,%rcx), %eax
cmpl $0x3, %eax
jb 0xbafba
addq %rcx, %r11
pushq $0x1
popq %rdx
movl %eax, %eax
leaq 0x1(%rdx), %r14
cmpq %rax, %r14
jae 0xbafb5
movq 0x18(%r11), %rbx
movq (%rbx,%rdx,8), %r12
shrq $0x21, %r12
cmpq %r8, %r12
setb %dl
cmpq %rdi, %r12
setae %sil
orb %dl, %sil
movq %r14, %rdx
jne 0xba679
movq %r11, 0x138(%rsp)
movq %r10, 0xc8(%rsp)
movq %r9, 0x140(%rsp)
movq -0x10(%rbx,%r14,8), %rcx
movq %r14, 0x130(%rsp)
movq (%rbx,%r14,8), %rbx
shrq $0x21, %rcx
shrq $0x21, %rbx
movq %r12, 0xc0(%rsp)
movq 0x1e0(%rsp), %rdi
movq 0x20(%rsp), %r14
movq %r14, %rsi
movq %rbp, %rdx
movq %rcx, 0x120(%rsp)
movq %r13, 0x18(%rsp)
movq 0x88(%rsp), %r12
movq %r12, %r8
pushq $0x1
popq %r9
callq 0xb7865
movq 0x1e0(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbx, 0x128(%rsp)
movl %ebx, %ecx
movq %r12, %r8
pushq $0x1
popq %r9
callq 0xb7865
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0xc0(%rsp), %rcx
movq %r12, %r8
movq 0x18(%rsp), %rbx
pushq $0x1
popq %r9
callq 0xb7865
subq $0x8, %rsp
movq %r13, %rdi
movq 0xc8(%rsp), %rsi
leaq 0x174(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x110(%rsp), %r8
leaq 0xfc(%rsp), %r9
pushq $0x0
callq 0xf6ab5
addq $0x10, %rsp
xorl %ecx, %ecx
movl 0xf4(%rsp), %eax
cmpq %rax, %rcx
jae 0xbaf10
movq 0x108(%rsp), %rax
movl (%rax,%rcx,4), %edx
movl %edx, %esi
shrl %esi
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
movq %rsi, 0x150(%rsp)
imulq $0x28, %rsi, %rax
cmpl $0x0, 0xc(%rdi,%rax)
je 0xbaf08
movq %rcx, 0x148(%rsp)
addq %rax, %rdi
andl $-0x2, %edx
movl %edx, 0xf0(%rsp)
xorl %eax, %eax
movl $0x0, 0x44(%rsp)
xorl %r12d, %r12d
movq %rdi, %rcx
movq %rdi, 0x50(%rsp)
cmpl $0x2, %eax
je 0xbaf00
movq %rax, 0x80(%rsp)
movl 0x1c8(%rsp), %eax
movl %eax, %r13d
testq %r12, %r12
je 0xba835
movl 0x44(%rsp), %r13d
notl %r13d
addl 0x10(%rcx), %r13d
cmpl %eax, %r13d
cmovael %eax, %r13d
movq 0x80(%rsp), %r14
movl %r14d, %esi
orl 0xf0(%rsp), %esi
movq 0xd0(%rsp), %rdi
xorl %edx, %edx
callq 0xc2e7a
testl %eax, %eax
je 0xba867
movq 0x50(%rsp), %rcx
movq %r14, %rax
jmp 0xbaef9
testl %r14d, %r14d
je 0xba888
pushq $0x1
popq %rax
movq %rax, 0x38(%rsp)
xorl %esi, %esi
pushq $0x1
popq %rax
movq %rax, 0xe0(%rsp)
movq 0x50(%rsp), %rcx
jmp 0xba8a6
movq 0x50(%rsp), %rcx
movl 0x10(%rcx), %esi
decl %esi
movq $0x0, 0x38(%rsp)
pushq $-0x1
popq %rax
movq %rax, 0xe0(%rsp)
xorl %edx, %edx
movq 0x80(%rsp), %rax
movq %r15, 0x48(%rsp)
cmpl %r13d, %edx
movl %edx, 0x44(%rsp)
jae 0xba9d6
testq %rsi, %rsi
js 0xba9d6
movl 0x10(%rcx), %eax
cmpq %rax, %rsi
jae 0xba9de
movq 0x18(%rcx), %rax
movq %rsi, 0xb0(%rsp)
movl 0x4(%rax,%rsi,8), %r14d
andl $0x0, 0xc(%rsp)
xorl 0x38(%rsp), %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq 0xe8(%rsp), %rdx
movq 0xf8(%rsp), %rcx
movq 0xb8(%rsp), %r8
movq 0x88(%rsp), %r9
pushq $0x1
leaq 0x178(%rsp), %rax
pushq %rax
leaq 0x1c(%rsp), %rax
pushq %rax
pushq %r14
movl 0x1e0(%rsp), %eax
pushq %rax
pushq 0x128(%rsp)
callq 0xc4a03
addq $0x30, %rsp
testl %eax, %eax
je 0xba9a4
cmpq %rbx, %r12
jne 0xba974
movq %rbx, %rax
addq %rbx, %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq 0x30(%rsp), %rdi
callq 0x2370
jmp 0xba979
movq 0x30(%rsp), %rax
incq %r12
movq 0x180(%rsp), %rcx
movq %rcx, 0x10(%rax,%r15)
movups 0x170(%rsp), %xmm0
movq %rax, 0x30(%rsp)
movups %xmm0, (%rax,%r15)
addq $0x18, %r15
jmp 0xba8f8
testq %r12, %r12
movq 0x80(%rsp), %rax
jne 0xba9e6
movq 0xb0(%rsp), %rsi
addq 0xe0(%rsp), %rsi
movl 0x44(%rsp), %edx
incl %edx
movq 0x48(%rsp), %r15
movq 0x50(%rsp), %rcx
jmp 0xba8b5
xorl %r12d, %r12d
jmp 0xbaef9
xorl %r12d, %r12d
jmp 0xbaef1
movq 0xc8(%rsp), %rax
cmpq %rax, 0xa8(%rsp)
movq 0x48(%rsp), %r15
movq %rbx, 0x18(%rsp)
jne 0xbaa31
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x2370
movq %rbx, 0xc8(%rsp)
movq 0x18(%rsp), %rbx
jmp 0xbaa36
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
shll $0x1f, %edx
orl 0xb0(%rsp), %edx
shlq $0x20, %rdx
addq 0x150(%rsp), %rdx
movq %rax, 0x10(%rsp)
movq 0xa8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0xa8(%rsp)
movq %rbp, %rdi
movl %r12d, %edx
callq 0xb7e0d
movq 0xb0(%rsp), %rdx
subq 0xe0(%rsp), %rdx
movq 0x50(%rsp), %rcx
js 0xbada3
movl 0x10(%rcx), %eax
cmpq %rax, %rdx
jae 0xbada3
movq 0x18(%rcx), %rax
movq %rdx, 0xb0(%rsp)
movq (%rax,%rdx,8), %rax
movq %rax, 0x160(%rsp)
movq %rax, %rcx
shrq $0x20, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x158(%rsp)
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
shrq $0x20, %rax
imulq $0x18, %rax, %r15
addq 0x8(%rbp), %r15
xorl %ecx, %ecx
movl %ecx, 0xc(%rsp)
cmpl 0x38(%rsp), %ecx
jae 0xbac1a
movl %ecx, %eax
imulq $0x18, %rax, %rdx
cmpl $0x0, 0xc(%r15,%rdx)
js 0xbabf2
movq 0x60(%rsp), %rbp
movq 0x68(%rsp), %rbx
movq 0x70(%rsp), %r13
cmpq %rbx, %rbp
jne 0xbab49
leaq (,%rbp,2), %rbx
testq %rbp, %rbp
pushq $0x2
popq %rax
cmoveq %rax, %rbx
movq %rbx, 0x68(%rsp)
imulq $0x18, %rbx, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq %rax, 0x70(%rsp)
movl 0xc(%rsp), %eax
imulq $0x18, %rax, %rax
imulq $0x18, %rbp, %rcx
movq 0x10(%r15,%rax), %rdx
movq %rdx, 0x10(%r13,%rcx)
movups (%r15,%rax), %xmm0
movups %xmm0, (%r13,%rcx)
movl 0x4(%r15,%rax), %edx
movl 0x8(%r15,%rax), %esi
xorl $0x1, %esi
xorl $0x1, %edx
movq 0x28(%rsp), %rdi
leaq 0x90(%rsp), %rcx
callq 0xbb2b9
testl %eax, %eax
je 0xbabf9
leaq 0x1(%rbp), %r14
cmpq %rbx, %r14
jne 0xbabbc
leaq (%rbx,%rbx), %rax
testq %rbx, %rbx
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
movq %rax, 0x68(%rsp)
imulq $0x18, %rax, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq %rax, 0x70(%rsp)
movq 0x18(%rsp), %rbx
addq $0x2, %rbp
movq %rbp, 0x60(%rsp)
imulq $0x18, %r14, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%r13,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%r13,%rax)
movl 0xc(%rsp), %ecx
movq 0x28(%rsp), %rbp
incl %ecx
jmp 0xbaae6
movq 0x1983e0(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x128d63(%rip), %rdi    # 0x1e396d
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0xbab8c
movq 0x28(%rbp), %rax
movq 0x158(%rsp), %rcx
xorq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
shrq $0x20, %rax
imulq $0x18, %rax, %r15
addq 0x8(%rbp), %r15
xorl %ecx, %ecx
movl %ecx, 0xc(%rsp)
cmpl 0x38(%rsp), %ecx
jae 0xbad75
movl %ecx, %eax
imulq $0x18, %rax, %rdx
cmpl $0x0, 0xc(%r15,%rdx)
js 0xbad4d
movq 0x60(%rsp), %rbp
movq 0x68(%rsp), %rbx
movq 0x70(%rsp), %r13
cmpq %rbx, %rbp
jne 0xbaca4
leaq (,%rbp,2), %rbx
testq %rbp, %rbp
pushq $0x2
popq %rax
cmoveq %rax, %rbx
movq %rbx, 0x68(%rsp)
imulq $0x18, %rbx, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq %rax, 0x70(%rsp)
movl 0xc(%rsp), %eax
imulq $0x18, %rax, %rax
imulq $0x18, %rbp, %rcx
movq 0x10(%r15,%rax), %rdx
movq %rdx, 0x10(%r13,%rcx)
movups (%r15,%rax), %xmm0
movups %xmm0, (%r13,%rcx)
movl 0x4(%r15,%rax), %edx
movl 0x8(%r15,%rax), %esi
xorl $0x1, %esi
xorl $0x1, %edx
movq 0x28(%rsp), %rdi
leaq 0x90(%rsp), %rcx
callq 0xbb2b9
testl %eax, %eax
je 0xbad54
leaq 0x1(%rbp), %r14
cmpq %rbx, %r14
jne 0xbad17
leaq (%rbx,%rbx), %rax
testq %rbx, %rbx
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
movq %rax, 0x68(%rsp)
imulq $0x18, %rax, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq %rax, 0x70(%rsp)
movq 0x18(%rsp), %rbx
addq $0x2, %rbp
movq %rbp, 0x60(%rsp)
imulq $0x18, %r14, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%r13,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%r13,%rax)
movl 0xc(%rsp), %ecx
movq 0x28(%rsp), %rbp
incl %ecx
jmp 0xbac41
movq 0x198285(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x128c08(%rip), %rdi    # 0x1e396d
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0xbace7
movq 0x160(%rsp), %r14
shrq $0x21, %r14
movq %rbp, %rdi
movl %r14d, %esi
callq 0x6f8da
movq 0x88(%rsp), %rax
movb $0x0, (%rax,%r14)
movq 0x48(%rsp), %r15
jmp 0xbaa7d
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, %ecx
cmpq %rcx, %r12
jbe 0xbaeec
imulq $0x18, %rcx, %rcx
movq 0x30(%rsp), %rdx
movups (%rdx,%rcx), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0x10(%rdx,%rcx), %rcx
movq %rcx, 0xa0(%rsp)
cmpl $0x0, 0x9c(%rsp)
js 0xbaee5
movq 0xd8(%rsp), %r14
cmpq %r14, 0x58(%rsp)
jne 0xbae13
leaq (%r14,%r14), %rbx
testq %r14, %r14
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %r15, %rdi
callq 0x2370
movq %rax, %r15
movq %rbx, %r14
movq 0x58(%rsp), %rax
leaq 0x1(%rax), %rbx
imulq $0x18, %rax, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%r15,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%r15,%rax)
movl 0x94(%rsp), %eax
movl 0x98(%rsp), %r9d
xorl $0x1, %r9d
xorl $0x1, %eax
movq 0xe8(%rsp), %rdi
movq 0xf8(%rsp), %rsi
movq 0x100(%rsp), %rcx
movl 0x1c0(%rsp), %r8d
leaq 0x90(%rsp), %rdx
pushq %rdx
pushq %rax
callq 0x79204
popq %rcx
popq %rdx
cmpq %r14, %rbx
movq %r14, %rax
jne 0xbaeb0
leaq (%rax,%rax), %r14
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %r14
imulq $0x18, %r14, %rsi
movq %r15, %rdi
callq 0x2370
movq %rax, %r15
movq %r14, 0xd8(%rsp)
jmp 0xbaeb8
movq %rax, 0xd8(%rsp)
addq $0x2, 0x58(%rsp)
imulq $0x18, %rbx, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%r15,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%r15,%rax)
movl 0xc(%rsp), %eax
movq 0x18(%rsp), %rbx
incl %eax
jmp 0xbada5
movq 0x50(%rsp), %rcx
movq 0x80(%rsp), %rax
incl %eax
jmp 0xba802
movq 0x148(%rsp), %rcx
incq %rcx
jmp 0xba799
movq 0x1e0(%rsp), %r12
movq %r12, %rdi
movq 0x20(%rsp), %r14
movq %r14, %rsi
movq %rbp, %rdx
movq 0x120(%rsp), %rcx
movq %rbx, %r13
movq 0x88(%rsp), %rbx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0x128(%rsp), %rcx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0xc0(%rsp), %rcx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq 0x138(%rsp), %r11
movl 0x10(%r11), %eax
movq 0x118(%rsp), %rdi
movq 0x110(%rsp), %r8
movq 0x140(%rsp), %r9
movq 0xc8(%rsp), %r10
movq 0x130(%rsp), %rdx
jmp 0xba677
movq 0x10(%rsp), %rdx
incl %r9d
movq 0x30(%rsp), %rax
jmp 0xba636
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, %eax
cmpq %rax, 0x58(%rsp)
jbe 0xbaffc
movq %rbp, %rdi
callq 0x6c45d
movl 0xc(%rsp), %ecx
imulq $0x18, %rcx, %rdx
movq 0x10(%r15,%rdx), %rsi
movq %rsi, 0x10(%rax)
movups (%r15,%rdx), %xmm0
movups %xmm0, (%rax)
leal 0x1(%rcx), %eax
jmp 0xbafc9
cmpq $0x0, 0x58(%rsp)
je 0xbb026
movq 0x28(%rbp), %rdi
callq 0x2220
andq $0x0, 0x28(%rbp)
andb $0x7f, 0x7(%rbp)
movq %rbp, %rdi
callq 0x694eb
movq %rbp, %rdi
callq 0x69638
movq %rbp, %rbx
xorl %ebp, %ebp
movq 0xe8(%rsp), %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0xb4c38
movq %rbx, %rdi
movq 0x1e8(%rsp), %rsi
callq 0xb5068
pushq $0x1
popq %rbx
movq %r15, 0x48(%rsp)
movl %ebp, 0xc(%rsp)
movl %ebp, %eax
cmpq %rax, 0x58(%rsp)
jbe 0xbb0eb
imulq $0x18, %rax, %rcx
movq (%r15,%rcx), %r14
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movq %r14, %rdx
shrq $0x21, %rdx
cmpl $0x0, (%rax,%rdx,8)
js 0xbb0e4
movl 0x8(%r15,%rcx), %edx
movl %edx, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0xbb0e4
shrq $0x20, %r14
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rax
movq %rdx, %r12
xorq $0x1, %r12
cmpb $0x0, (%rax,%r14)
je 0xbb0b5
cmpb $0x0, (%rax,%r12)
jne 0xbb0e4
movq 0x28(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %ecx
callq 0x6db50
xorl $0x1, %r14d
movq %r15, %rdi
movq 0x48(%rsp), %r15
movl %r12d, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x6db50
movl 0xc(%rsp), %ebp
incl %ebp
jmp 0xbb055
movq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x694eb
movq %r15, %rdi
callq 0x69638
xorl %ecx, %ecx
movq 0x60(%rsp), %rax
movq 0x10(%rsp), %rsi
movl %ecx, 0xc(%rsp)
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xbb130
movq 0x70(%rsp), %rdx
imulq $0x18, %rcx, %rcx
orl $0x80000000, 0xc(%rdx,%rcx) # imm = 0x80000000
movl 0xc(%rsp), %ecx
incl %ecx
jmp 0xbb10c
xorl %eax, %eax
leaq 0x60(%rsp), %rbx
movl %eax, 0xc(%rsp)
movl %eax, %eax
cmpq %rax, 0xa8(%rsp)
jbe 0xbb1c4
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %rsi, %r14
movq %rsi, %r12
movl %esi, %eax
shrq $0x3f, %rsi
notq %r14
sarq $0x3f, %r14
orq $0x1, %r14
shrq $0x20, %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
leaq (%rcx,%rax), %r13
movq 0x18(%rcx,%rax), %rax
xorl 0x4(%rax,%r12,8), %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0xc2e7a
xorl %r9d, %r9d
testl %eax, %eax
setg %r9b
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
callq 0xbb311
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %eax
incl %eax
jmp 0xbb137
xorl %ecx, %ecx
xorl %ebx, %ebx
movl %ecx, 0xc(%rsp)
movl %ecx, %eax
cmpq %rax, 0x60(%rsp)
jbe 0xbb216
movq 0x70(%rsp), %rdx
imulq $0x18, %rax, %rax
cmpl $0x0, 0xc(%rdx,%rax)
js 0xbb212
movq %r15, %rdi
callq 0x6c45d
movq 0x70(%rsp), %rdx
movl 0xc(%rsp), %ecx
imulq $0x18, %rcx, %rsi
movq 0x10(%rdx,%rsi), %rdi
movq %rdi, 0x10(%rax)
movups (%rdx,%rsi), %xmm0
movq 0x10(%rsp), %rsi
movups %xmm0, (%rax)
incq %rbx
incl %ecx
jmp 0xbb1c8
testq %rbx, %rbx
je 0xbb243
movq 0x28(%r15), %rdi
callq 0x2220
andq $0x0, 0x28(%r15)
andb $0x7f, 0x7(%r15)
movq %r15, %rdi
callq 0x694eb
movq %r15, %rdi
callq 0x69638
movq 0x10(%rsp), %rsi
movq 0xb8(%rsp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movq 0x48(%rsp), %rdi
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xbb276
movq 0xb8(%rsp), %rdx
movq 0x8(%rdx), %rdx
cmpl $-0x2, (%rdx,%rcx,4)
jg 0xbb272
orl $-0x1, (%rdx,%rcx,4)
incl %ecx
jmp 0xbb255
movq %rsi, %rbx
callq 0x2220
movq 0x30(%rsp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
movq 0x70(%rsp), %rdi
callq 0x2220
movq 0x88(%rsp), %rdi
callq 0x2220
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq