// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: rescue_bubbles_by_cmk_reads(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*, unsigned char*)
void rescue_bubbles_by_cmk_reads(ma_ug_t *i_u_g, asg_t *rg, ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, R_to_U* ruIndex, int max_hang, int min_ovlp, uint32_t chainLenThres, uint32_t beg_idx, uint32_t occ, bubble_type* bub, bub_label_t* b_mask_t, uint8_t *cmk)
{
    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, contain_rId;
    uint32_t ava_max, ava_ol_max, ava_min_chain, ava_cur, test_oLen, ava_chainLen, is_update, v, w;
    uint64_t l_bub, m_bub, r_bub, a_nodes; ma_ug_t* ug = i_u_g;
    ma_utg_t *nsu = NULL, *u = NULL; ma_hit_t_alloc* x = NULL; ma_hit_t *h = NULL, *h_max = NULL;
    uint8_t* expect_vis = NULL; CALLOC(expect_vis, rg->n_seq);
    uint8_t* circle_vis = NULL; CALLOC(circle_vis, rg->n_seq);
    uint8_t* utg_vis = NULL; CALLOC(utg_vis, ug->g->n_seq); asg_arc_t t, t_max, r_edge;

    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_t(asg_arc_t) rbub_edges; kv_init(rbub_edges);

    kvec_t_u64_warp u_vecs; kv_init(u_vecs.a);

    kvec_asg_arc_t_warp chain_edges; kv_init(chain_edges.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, &(rg->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, rg, l_bub, expect_vis, 1);
            set_rtg_flag_by_bubble(bub, ug, rg, r_bub, expect_vis, 1);
            set_rtg_flag_by_bubble(bub, ug, rg, 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;
                for (k_v = 0; k_v < 2; k_v++) {
                    v = (uId<<1) + k_v;
                    if(get_real_length(nsg, v, NULL) != 0) continue;

                    if(v&1) endRid = nsu->start^1;
                    else endRid = nsu->end^1;

                    //x is the end read of a tip
                    ///find all overlap of x
                    x = &(sources[(endRid>>1)]);
                    ava_ol_max = ava_max = 0; ava_min_chain = (uint32_t)-1;
                    h_max = NULL;
                    for (k = 0; k < x->length; k++) {
                        ///h is the edge of endRid
                        h = &(x->buffer[k]);
                        ///means we found a contained read
                        if(get_chimeric_reads_chain_by_broken_bub(h, sources, coverage_cut, ruIndex, ug, rg, max_hang, min_ovlp, endRid, uId, &chain_edges, &ava_cur, &test_oLen, &ava_chainLen, expect_vis, circle_vis, utg_vis, chainLenThres, 1, cmk)) {
                            is_update = 0;

                            if(ava_cur > ava_max) {
                                is_update = 1;
                            } else if(ava_cur == ava_max) {
                                if(ava_chainLen < ava_min_chain) {
                                    is_update = 1;
                                } else if(ava_chainLen == ava_min_chain && test_oLen > ava_ol_max) {
                                    is_update = 1;
                                }
                            }

                            if(is_update) {
                                ava_min_chain = ava_chainLen;
                                ava_max = ava_cur;
                                ava_ol_max = test_oLen;
                                h_max = h;
                            }
                        }
                    }

                    if(ava_max > 0) {
                        ///fprintf(stderr, "ava_max: %u\n", ava_max);
                        get_chimeric_reads_chain_by_broken_bub(h_max, sources, coverage_cut, ruIndex, ug, rg, max_hang, min_ovlp, endRid, uId, &chain_edges, &ava_cur, &test_oLen, &ava_chainLen, expect_vis, circle_vis, NULL, chainLenThres, 1, cmk);
                        if(chain_edges.a.n < 1) continue;
                        ///the last cantained read
                        t_max = chain_edges.a.a[chain_edges.a.n-1];

                        k = 0; rbub_edges.n = 0;
                        ///edges from the last contained read to other unitigs

                        while(get_edge2existing_node_advance_by_broken_bub(ug, rg, sources, coverage_cut, ruIndex, expect_vis, max_hang, min_ovlp, t_max.v, &k, &r_edge, 1)) {
                            kv_push(asg_arc_t, rbub_edges, r_edge);
                        }

                        ///need to do transitive reduction
                        ///note here is different to standard transitive reduction
                        minor_transitive_reduction_r_g(rg, rbub_edges.a, rbub_edges.n);

                        for (k = 0; k < chain_edges.a.n; k++) {
                            t_max = chain_edges.a.a[k];
                            ///save all infor for reverting
                            get_R_to_U(ruIndex, t_max.v>>1, &contain_rId, &is_Unitig);
                            if((is_Unitig == 1) || (is_Unitig == ((uint32_t)-1))) contain_rId = ((uint32_t)-1);///shouldn't be possible
                            a_nodes=contain_rId; 
                            a_nodes=a_nodes<<32; 
                            a_nodes=a_nodes|((uint64_t)(t_max.v>>1));
                            kv_push(uint64_t, u_vecs.a, a_nodes);

                            rg->seq[t_max.v>>1].del = 0;
                            coverage_cut[t_max.v>>1].del = 0;
                            coverage_cut[t_max.v>>1].c = PRIMARY_LABLE;

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

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


                        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, rg, l_bub, expect_vis, 0);
            set_rtg_flag_by_bubble(bub, ug, rg, r_bub, expect_vis, 0);
            set_rtg_flag_by_bubble(bub, ug, rg, m_bub, expect_vis, 0);
        }
    }

    asg_arc_t* p = NULL;
    for (k = 0; k < new_edges.n; k++) {
        p = asg_arc_pushp(rg);
        *p = new_edges.a[k];
    }

    if(new_edges.n != 0) {
        free(rg->idx);
        rg->idx = 0;
        rg->is_srt = 0;
        asg_cleanup(rg);
        asg_symm(rg);
    }

    pre_clean(sources, coverage_cut, rg, 0);

    lable_all_bubbles(rg, 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(rg->seq[v>>1].del) continue;
        if(rg->seq[w>>1].del) continue;
        ///if this edge is at a bubble
        if(rg->seq_vis[v]!=0 && rg->seq_vis[w^1]!=0) continue;

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

    for (k = 0; k < u_vecs.a.n; k++) {
        w = (uint32_t)u_vecs.a.a[k];
        w = w<<1;
        if((!rg->seq[w>>1].del) && (get_real_length(rg, w, NULL)!=0 || get_real_length(rg, (w^1), NULL)!=0)) {
            w=w>>1;
            ruIndex->index[w] = (uint32_t)-1;
        } else {
            w=w>>1;
            rg->seq[w].del = 1; coverage_cut[w].del = 1;
        }
    }
    
    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(chain_edges.a);
    free(expect_vis);
    free(circle_vis);
    free(utg_vis);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %r9, 0x78(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, 0x58(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, %r13
movq %rdi, %r15
movl 0x1d0(%rsp), %ebp
andq $0x0, 0xf8(%rsp)
movl 0x14(%rsi), %ebx
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rbx
pushq $0x1
popq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0x70(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0xd0(%rsp)
movq 0x18(%r15), %rax
movq %rax, 0xb0(%rsp)
movl 0x14(%rax), %edi
andq %r14, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0xf0(%rsp)
movq %r15, 0x50(%rsp)
movq (%r15), %rax
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xb8fec
movq 0xb0(%rsp), %rdx
movq 0x20(%rdx), %rdx
movb $0x0, 0x4(%rdx,%rcx,8)
incl %ecx
jmp 0xb8fd0
andq $0x0, 0x110(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x100(%rsp)
xorl %ebx, %ebx
pushq $0x1
popq %r14
movq 0xb0(%rsp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %rbx
jae 0xb908a
movq 0x50(%rsp), %rax
movq 0x10(%rax), %r15
imulq $0x28, %rbx, %rax
cmpl $0x0, 0xc(%r15,%rax)
je 0xb9082
movq 0xb0(%rsp), %rcx
movq 0x20(%rcx), %rcx
cmpl $0x0, (%rcx,%rbx,8)
js 0xb9082
addq %rax, %r15
xorl %r12d, %r12d
movl %r12d, 0x4(%rsp)
movl 0x10(%r15), %eax
cmpq %rax, %r12
jae 0xb9082
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rsi
shrq $0x21, %rsi
movq 0x20(%r13), %rax
leaq (%rax,%rsi,8), %r8
addq $0x4, %r8
movq 0x28(%rsp), %rdi
movl %ebx, %edx
movl %r14d, %ecx
callq 0x6ab56
incq %r12
jmp 0xb9048
incq %rbx
jmp 0xb9006
movl %ebp, %r8d
movl 0x1d8(%rsp), %edi
addl %ebp, %edi
xorl %r9d, %r9d
xorl %edx, %edx
movq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movq $0x0, 0xe8(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0xe0(%rsp)
movq $0x0, 0xb8(%rsp)
movq %r13, 0xc0(%rsp)
movq %rdi, 0x130(%rsp)
movq %r8, 0x128(%rsp)
movl %r9d, %r9d
movq 0x1e0(%rsp), %rax
movq 0xc0(%rax), %rax
cmpq %r9, (%rax)
movq %rdx, 0x8(%rsp)
jbe 0xb9a8e
movq 0x10(%rax), %r10
imulq $0x28, %r9, %rcx
movl 0x10(%r10,%rcx), %eax
cmpl $0x3, %eax
jb 0xb9a86
movq %rbx, 0x18(%rsp)
addq %rcx, %r10
pushq $0x1
popq %rdx
movl %eax, %eax
leaq 0x1(%rdx), %r11
cmpq %rax, %r11
jae 0xb9a7c
movq 0x18(%r10), %rbx
movq (%rbx,%rdx,8), %rbp
shrq $0x21, %rbp
cmpq %r8, %rbp
setb %dl
cmpq %rdi, %rbp
setae %sil
orb %dl, %sil
movq %r11, %rdx
jne 0xb9134
movq %r10, 0x150(%rsp)
movq %r9, 0x158(%rsp)
movq -0x10(%rbx,%r11,8), %rcx
movq %r11, 0x148(%rsp)
movq (%rbx,%r11,8), %rbx
shrq $0x21, %rcx
shrq $0x21, %rbx
movq 0x1e0(%rsp), %rdi
movq 0x50(%rsp), %r14
movq %r14, %rsi
movq %r13, %rdx
movq %rcx, 0x138(%rsp)
movq 0x70(%rsp), %r12
movq %r12, %r8
movq %rbp, 0x48(%rsp)
pushq $0x1
popq %r9
callq 0xb7865
movq 0x1e0(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, 0x140(%rsp)
movl %ebx, %ecx
movq %r12, %r8
pushq $0x1
popq %r9
callq 0xb7865
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq 0x48(%rsp), %rcx
movq %r12, %r8
movq 0x18(%rsp), %rbx
pushq $0x1
popq %r9
movq 0x48(%rsp), %rbp
callq 0xb7865
subq $0x8, %rsp
movq 0x1e8(%rsp), %rdi
movq %rbp, %rsi
leaq 0x174(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x100(%rsp), %r8
leaq 0xe4(%rsp), %r9
pushq $0x0
callq 0xf6ab5
addq $0x10, %rsp
xorl %ecx, %ecx
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rsi
movl 0xdc(%rsp), %eax
cmpq %rax, %rcx
jae 0xb99dc
movq 0xf8(%rsp), %rax
movq %rcx, 0xc8(%rsp)
movl (%rax,%rcx,4), %r12d
movl %r12d, %eax
shrl %eax
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
cmpl $0x0, 0xc(%rcx,%rax)
je 0xb99c9
addq %rax, %rcx
movq %rcx, 0x160(%rsp)
andl $-0x2, %r12d
xorl %ecx, %ecx
movq 0xc8(%rsp), %rax
movl %r12d, 0x14(%rsp)
cmpl $0x2, %ecx
je 0xb99d1
movq %rsi, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
movl %ecx, %esi
orl %r12d, %esi
movq 0xb0(%rsp), %rdi
xorl %edx, %edx
movl %ecx, %r14d
callq 0xc2e7a
testl %eax, %eax
je 0xb92ec
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rsi
movl %r14d, %ecx
jmp 0xb99ba
movq %rbx, 0x18(%rsp)
movq %r15, 0x40(%rsp)
xorl %eax, %eax
movl %r14d, 0x64(%rsp)
testl %r14d, %r14d
sete %al
movq 0x160(%rsp), %rcx
movl 0x4(%rcx,%rax,4), %eax
movl %eax, %ebp
xorl $0x1, %ebp
shrl %eax
imulq $0x18, %rax, %r12
addq 0x38(%rsp), %r12
xorl %edx, %edx
xorl %r15d, %r15d
xorl %r13d, %r13d
pushq $-0x1
popq %rax
movl %eax, 0x30(%rsp)
xorl %ebx, %ebx
movl %edx, 0x4(%rsp)
cmpl 0xc(%r12), %edx
jae 0xb9456
movl %edx, %eax
imulq $0x28, %rax, %r14
addq (%r12), %r14
subq $0x70, %rsp
movq 0x160(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xd8(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0xdc(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0xfc(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x170(%rsp), %rax
movq %rax, 0x20(%rsp)
movl %ebp, 0x10(%rsp)
movl 0x230(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0xe8(%rsp), %rax
movl %eax, (%rsp)
movl $0x1, 0x60(%rsp)
movq %r14, %rdi
movq 0xa8(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x98(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq 0x130(%rsp), %r9
callq 0xb6329
addq $0x70, %rsp
testl %eax, %eax
je 0xb9439
movl 0x8c(%rsp), %eax
cmpl %r15d, %eax
jbe 0xb941c
movl 0x68(%rsp), %ecx
movl %ecx, 0x30(%rsp)
movl 0x6c(%rsp), %ecx
jmp 0xb9442
jne 0xb9439
movl 0x68(%rsp), %edx
movl 0x6c(%rsp), %ecx
cmpl 0x30(%rsp), %edx
jae 0xb9432
movl %edx, 0x30(%rsp)
jmp 0xb9442
jne 0xb9439
cmpl %r13d, %ecx
ja 0xb9442
movl %r15d, %eax
movl %r13d, %ecx
movq %rbx, %r14
movl 0x4(%rsp), %edx
incl %edx
movl %eax, %r15d
movl %ecx, %r13d
movq %r14, %rbx
jmp 0xb9330
testl %r15d, %r15d
je 0xb9975
subq $0x70, %rsp
movq 0x140(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xd8(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0xdc(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0xfc(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x170(%rsp), %rax
movq %rax, 0x20(%rsp)
movl %ebp, 0x10(%rsp)
movl 0x230(%rsp), %eax
movl %eax, 0x8(%rsp)
andq $0x0, 0x50(%rsp)
movq 0xe8(%rsp), %rax
movl %eax, (%rsp)
movl $0x1, 0x60(%rsp)
movq %rbx, %rdi
movq 0xa8(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x98(%rsp), %rcx
movq 0xc0(%rsp), %r8
movq 0x130(%rsp), %r13
movq %r13, %r9
callq 0xb6329
addq $0x70, %rsp
movq 0x100(%rsp), %rax
testq %rax, %rax
movl 0x14(%rsp), %r12d
je 0xb999d
movq 0x110(%rsp), %rcx
imulq $0x18, %rax, %rax
movl -0x10(%rcx,%rax), %r14d
andl $0x0, 0x4(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x30(%rsp)
movq 0x40(%rsp), %rbx
leaq 0x170(%rsp), %rbp
movq 0x50(%rsp), %rdi
movq %r13, %rsi
movq 0x38(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x70(%rsp), %r9
pushq $0x1
pushq %rbp
leaq 0x14(%rsp), %rax
pushq %rax
pushq %r14
movl 0x1e0(%rsp), %eax
pushq %rax
pushq 0xa0(%rsp)
callq 0xc4a03
addq $0x30, %rsp
testl %eax, %eax
je 0xb95f9
movq 0xe8(%rsp), %rax
cmpq %rax, 0x30(%rsp)
jne 0xb95d1
leaq (%rax,%rax), %r12
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %r12
imulq $0x18, %r12, %rsi
movq %rbx, %rdi
callq 0x2370
movq %rax, %rbx
movq %r12, 0xe8(%rsp)
movl 0x14(%rsp), %r12d
incq 0x30(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x10(%rbx,%r15)
movups 0x170(%rsp), %xmm0
movups %xmm0, (%rbx,%r15)
addq $0x18, %r15
jmp 0xb9555
movq %r13, %rdi
movq %rbx, 0x40(%rsp)
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
callq 0xb7e0d
movq 0x18(%rsp), %rbx
imulq $0x18, %rbx, %rbp
xorl %eax, %eax
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rsi
movl %eax, 0x4(%rsp)
movl %eax, %ecx
cmpq %rcx, 0x100(%rsp)
jbe 0xb9830
movq %rdx, 0x8(%rsp)
movq 0x110(%rsp), %rax
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %r12d
movl %r12d, %r15d
shrl %r15d
movq 0x28(%rsp), %rdx
cmpq %r15, (%rdx)
jbe 0xb966f
movq 0x28(%rsp), %rdx
movq 0x8(%rdx), %rdx
movl (%rdx,%r15,4), %r13d
testl %r13d, %r13d
jns 0xb9675
pushq $-0x1
popq %rdx
movl %edx, %r13d
movq %rsi, 0x20(%rsp)
movq (%rax,%rcx), %r14
movq 0xe0(%rsp), %rax
cmpq %rax, 0xb8(%rsp)
movq %rbx, 0x18(%rsp)
jne 0xb96c7
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq 0x80(%rsp), %rdi
callq 0x2370
movq %rbx, 0xe0(%rsp)
movq 0x18(%rsp), %rbx
jmp 0xb96cf
movq 0x80(%rsp), %rax
shlq $0x20, %r13
orq %r15, %r13
movq %rax, 0x80(%rsp)
movq 0xb8(%rsp), %rcx
movq %r13, (%rax,%rcx,8)
movq 0xc0(%rsp), %r13
movq 0x20(%r13), %rax
andl $0x7fffffff, (%rax,%r15,8) # imm = 0x7FFFFFFF
imulq $0xc, %r15, %rax
movq 0x58(%rsp), %rsi
andb $0x7f, 0x3(%rsi,%rax)
movb $0x0, 0x8(%rsi,%rax)
shrq $0x20, %r14
movq 0x38(%rsp), %rdi
movq 0x78(%rsp), %rcx
movl 0x1c0(%rsp), %r8d
movl %r14d, %r9d
leaq 0x90(%rsp), %rax
pushq %rax
pushq %r12
callq 0x79204
popq %rcx
popq %rdx
movq 0x20(%rsp), %r15
cmpq %r15, %rbx
jne 0xb976c
leaq (%r15,%r15), %rbx
testq %r15, %r15
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq 0x8(%rsp), %rdi
callq 0x2370
movq %rbx, %r15
movq 0x18(%rsp), %rbx
jmp 0xb9771
movq 0x8(%rsp), %rax
incq %rbx
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%rax,%rbp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rax,%rbp)
xorl $0x1, %r12d
xorl $0x1, %r14d
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x78(%rsp), %rcx
movl 0x1c0(%rsp), %r8d
movl %r12d, %r9d
leaq 0x90(%rsp), %rdx
pushq %rdx
pushq %r14
movq %rax, %r14
callq 0x79204
popq %rcx
popq %rdx
cmpq %r15, %rbx
movq %r15, %rsi
jne 0xb97ee
leaq (%rsi,%rsi), %rbx
testq %rsi, %rsi
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %r14, %rdi
callq 0x2370
movq %rax, %rdx
movq %rbx, %rsi
jmp 0xb97f1
movq %r14, %rdx
movl 0x14(%rsp), %r12d
movq 0x18(%rsp), %rbx
addq $0x2, %rbx
movq 0xa0(%rsp), %rax
movq %rax, 0x28(%rdx,%rbp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, 0x18(%rdx,%rbp)
movl 0x4(%rsp), %eax
incl %eax
addq $0x30, %rbp
incq 0xb8(%rsp)
jmp 0xb9623
xorl %eax, %eax
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %rbp
movl %eax, 0x4(%rsp)
movl %eax, %ecx
cmpq %rcx, 0x30(%rsp)
jbe 0xb99b6
imulq $0x18, %rcx, %rcx
movups (%r15,%rcx), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0x10(%r15,%rcx), %rcx
movq %rcx, 0xa0(%rsp)
cmpl $0x0, 0x9c(%rsp)
js 0xb996e
cmpq %rsi, %rbx
jne 0xb98a6
movq %rbx, %r14
leaq (%rsi,%rsi), %rbx
testq %rsi, %rsi
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %rdx, %rdi
callq 0x2370
movq %rax, %rdx
movq %rbx, %rbp
movq %r14, %rbx
jmp 0xb98a9
movq %rsi, %rbp
leaq 0x1(%rbx), %r14
imulq $0x18, %rbx, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%rdx,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rdx,%rax)
movl 0x94(%rsp), %eax
movl 0x98(%rsp), %r9d
xorl $0x1, %r9d
xorl $0x1, %eax
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x78(%rsp), %rcx
movl 0x1c0(%rsp), %r8d
leaq 0x90(%rsp), %r10
pushq %r10
pushq %rax
movq %rdx, %r12
callq 0x79204
popq %rcx
popq %rdx
cmpq %rbp, %r14
movq %rbp, %rsi
jne 0xb993c
movq %rbx, %rbp
leaq (%rsi,%rsi), %rbx
testq %rsi, %rsi
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %rdx
movq %rbx, %rsi
movq %rbp, %rbx
jmp 0xb993f
movq %r12, %rdx
movq 0x48(%rsp), %rbp
addq $0x2, %rbx
imulq $0x18, %r14, %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x10(%rdx,%rax)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rdx,%rax)
movl 0x4(%rsp), %eax
movl 0x14(%rsp), %r12d
incl %eax
jmp 0xb983c
movq 0xc0(%rsp), %r13
movq 0x40(%rsp), %r15
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %rsi
movq 0x48(%rsp), %rbp
movl 0x14(%rsp), %r12d
jmp 0xb99b6
movq 0x40(%rsp), %r15
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %rsi
movq 0x48(%rsp), %rbp
movl 0x64(%rsp), %ecx
incl %ecx
movq 0xc8(%rsp), %rax
jmp 0xb92ac
movq 0xc8(%rsp), %rax
incq %rax
movq %rax, %rcx
jmp 0xb924d
movq %rsi, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x1e0(%rsp), %r12
movq %r12, %rdi
movq 0x50(%rsp), %r14
movq %r14, %rsi
movq %r13, %rdx
movq 0x138(%rsp), %rcx
movq %rbx, 0x18(%rsp)
movq 0x70(%rsp), %rbx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq 0x140(%rsp), %rcx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0xb7865
movq 0x150(%rsp), %r10
movl 0x10(%r10), %eax
movq 0x130(%rsp), %rdi
movq 0x128(%rsp), %r8
movq 0x158(%rsp), %r9
movq 0x148(%rsp), %rdx
jmp 0xb9132
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rbx
incl %r9d
jmp 0xb90f1
xorl %eax, %eax
movl %eax, 0x4(%rsp)
movl %eax, %eax
cmpq %rax, %rbx
jbe 0xb9ac5
movq %r13, %rdi
callq 0x6c45d
movl 0x4(%rsp), %ecx
imulq $0x18, %rcx, %rdx
movq 0x8(%rsp), %rdi
movq 0x10(%rdi,%rdx), %rsi
movq %rsi, 0x10(%rax)
movups (%rdi,%rdx), %xmm0
movups %xmm0, (%rax)
leal 0x1(%rcx), %eax
jmp 0xb9a90
movq %r15, 0x40(%rsp)
movq %rbx, %r15
testq %rbx, %rbx
je 0xb9af5
movq 0x28(%r13), %rdi
callq 0x2220
andq $0x0, 0x28(%r13)
andb $0x7f, 0x7(%r13)
movq %r13, %rdi
callq 0x694eb
movq %r13, %rdi
callq 0x69638
xorl %ebp, %ebp
movq 0x38(%rsp), %rdi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xb4c38
movq %r13, %rdi
movq 0x1e8(%rsp), %rsi
callq 0xb5068
pushq $0x1
popq %rbx
movl %ebp, 0x4(%rsp)
movl %ebp, %eax
cmpq %rax, %r15
movq 0x8(%rsp), %rdx
jbe 0xb9b99
imulq $0x18, %rax, %rcx
movq (%rdx,%rcx), %r14
movq 0x20(%r13), %rax
movq %rdx, %rsi
movq %r14, %rdx
shrq $0x21, %rdx
cmpl $0x0, (%rax,%rdx,8)
js 0xb9b95
movl 0x8(%rsi,%rcx), %edx
movl %edx, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0xb9b95
shrq $0x20, %r14
movq 0x30(%r13), %rax
movq %rdx, %r12
xorq $0x1, %r12
cmpb $0x0, (%rax,%r14)
je 0xb9b70
cmpb $0x0, (%rax,%r12)
jne 0xb9b95
movq %r13, %rdi
movl %r14d, %esi
movl %ebx, %ecx
callq 0x6db50
xorl $0x1, %r14d
movq %r13, %rdi
movl %r12d, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x6db50
movl 0x4(%rsp), %ebp
incl %ebp
jmp 0xb9b19
movq %r13, %rdi
callq 0x694eb
movq %r13, %rdi
callq 0x69638
xorl %eax, %eax
movq 0x40(%rsp), %r15
movl %eax, 0x4(%rsp)
movl %eax, %eax
cmpq %rax, 0xb8(%rsp)
jbe 0xb9c46
movq 0x80(%rsp), %rcx
movq (%rcx,%rax,8), %rbx
movq 0x20(%r13), %rax
movl %ebx, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl (%rax,%r14,8), %ecx
testl %ecx, %ecx
js 0xb9c23
addl %ebx, %ebx
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xc2e7a
testl %eax, %eax
jne 0xb9c0b
orl $0x1, %ebx
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xc2e7a
testl %eax, %eax
je 0xb9c1b
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
orl $-0x1, (%rax,%r14,4)
jmp 0xb9c3b
movq 0x20(%r13), %rax
movl (%rax,%r14,8), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, (%rax,%r14,8)
imulq $0xc, %r14, %rax
movq 0x58(%rsp), %rcx
orb $-0x80, 0x3(%rcx,%rax)
movl 0x4(%rsp), %eax
incl %eax
jmp 0xb9bb0
movq 0x28(%rsp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movq 0x8(%rsp), %rdi
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0xb9c73
movq 0x28(%rsp), %rdx
movq 0x8(%rdx), %rdx
cmpl $-0x2, (%rdx,%rcx,4)
jg 0xb9c6f
orl $-0x1, (%rdx,%rcx,4)
incl %ecx
jmp 0xb9c50
callq 0x2220
movq %r15, %rdi
callq 0x2220
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0x110(%rsp), %rdi
callq 0x2220
movq 0x70(%rsp), %rdi
callq 0x2220
movq 0xd0(%rsp), %rdi
callq 0x2220
movq 0xf0(%rsp), %rdi
callq 0x2220
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq