// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: rescue_bubbles_by_missing_ovlp(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(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 chainLenThres, 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, v, w;
    uint64_t l_bub, m_bub, r_bub/**, bub_0, bub_1**/;
    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);
    asg_arc_t t, 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);


    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;
                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;
                    }


                    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)
                    {
                        ///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);
                        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 (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);
    free(expect_vis);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movl %r9d, -0x3c(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xc0(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x2140
movq %rax, -0xc0(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0xa8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1585ef
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movb $0x0, 0x4(%rax,%rcx,8)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x1585be
movq $0x0, -0x100(%rbp)
movq $0x0, -0x108(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x118(%rbp)
movq $0x0, -0x120(%rbp)
movq $0x0, -0x110(%rbp)
movq -0xa8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x48(%rbp), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x15872e
movl -0x80(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0xa8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x74(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x158693
jmp 0x158720
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x1586ab
jmp 0x158720
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x15871e
movq -0x38(%rbp), %rdi
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x70(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, %esi
movl -0x74(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %r8
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x70(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
shlq $0x3, %rax
addq %rax, %r8
addq $0x4, %r8
movl $0x1, %ecx
callq 0xd0e20
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x1586b2
jmp 0x158720
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x158647
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq 0x30(%rbp), %rcx
movq 0xc0(%rcx), %rcx
cmpq (%rcx), %rax
jae 0x158d92
movq 0x30(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x10(%rax), %rax
movl -0x60(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jae 0x15877e
jmp 0x158d84
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movq -0xb8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x158d82
movq -0xb8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq %rax, -0x98(%rbp)
movq $-0x1, -0xa0(%rbp)
movq $-0x1, -0x90(%rbp)
movq -0x98(%rbp), %rax
movl 0x20(%rbp), %ecx
cmpq %rcx, %rax
jb 0x1587f1
movq -0x98(%rbp), %rax
movl 0x20(%rbp), %ecx
addl 0x28(%rbp), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0x1587f6
jmp 0x158d74
movq -0xb8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq %rax, -0x90(%rbp)
movq -0xb8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq %rax, -0xa0(%rbp)
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x90(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
movl $0x1, %r9d
callq 0x154b80
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0xa0(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
movl $0x1, %r9d
callq 0x154b80
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x98(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
movl $0x1, %r9d
callq 0x154b80
movq 0x30(%rbp), %rdi
movq -0x98(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
leaq -0x50(%rbp), %rcx
leaq -0x58(%rbp), %r8
leaq -0x5c(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x1c4b20
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x158cff
movq -0x58(%rbp), %rax
movl -0x68(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl %eax
movl %eax, -0x74(%rbp)
movq -0xa8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x74(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x158932
jmp 0x158cf1
movl $0x0, -0x6c(%rbp)
cmpl $0x2, -0x6c(%rbp)
jae 0x158cef
movl -0x74(%rbp), %eax
shll %eax
addl -0x6c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x48(%rbp), %rdi
movl -0x80(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x0, %eax
je 0x158968
jmp 0x158ce1
movl -0x80(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x158985
movq -0xb0(%rbp), %rax
movl 0x4(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x158995
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x78(%rbp)
movl $0x0, -0x70(%rbp)
movq $0x0, -0x120(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0xc0(%rbp), %r9
movl -0x3c(%rbp), %r14d
movl 0x10(%rbp), %ebx
movl -0x78(%rbp), %r11d
leaq -0x70(%rbp), %r10
leaq -0xf0(%rbp), %rax
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
callq 0x169ca0
cmpl $0x0, %eax
je 0x158ab6
jmp 0x158a0a
movq -0x120(%rbp), %rax
cmpq -0x118(%rbp), %rax
jne 0x158a6e
cmpq $0x0, -0x118(%rbp)
je 0x158a37
movq -0x118(%rbp), %rax
shlq %rax
movq %rax, -0x130(%rbp)
jmp 0x158a45
movl $0x2, %eax
movq %rax, -0x130(%rbp)
jmp 0x158a45
movq -0x130(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rdi
imulq $0x18, -0x118(%rbp), %rsi
callq 0x2360
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq -0x120(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x120(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xf0(%rbp), %rcx
movq %rcx, (%rax)
movq -0xe8(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xe0(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x1589a7
cmpq $0x0, -0x120(%rbp)
jbe 0x158cdf
movq -0x20(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq -0x120(%rbp), %rax
movl %eax, %edx
callq 0x1553d0
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpq -0x120(%rbp), %rax
jae 0x158cdd
movq -0x110(%rbp), %rax
movl -0x70(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0xd8(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xd0(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xc8(%rbp)
movl -0xcc(%rbp), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x158b38
jmp 0x158ccf
jmp 0x158b3a
movq -0x108(%rbp), %rax
cmpq -0x100(%rbp), %rax
jne 0x158b9e
cmpq $0x0, -0x100(%rbp)
je 0x158b67
movq -0x100(%rbp), %rax
shlq %rax
movq %rax, -0x138(%rbp)
jmp 0x158b75
movl $0x2, %eax
movq %rax, -0x138(%rbp)
jmp 0x158b75
movq -0x138(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
imulq $0x18, -0x100(%rbp), %rsi
callq 0x2360
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x108(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xd8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xd0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xc8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl -0xd0(%rbp), %r9d
xorl $0x1, %r9d
movq -0xd8(%rbp), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %r10d
leaq -0xd8(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
movq -0x108(%rbp), %rax
cmpq -0x100(%rbp), %rax
jne 0x158c8a
cmpq $0x0, -0x100(%rbp)
je 0x158c53
movq -0x100(%rbp), %rax
shlq %rax
movq %rax, -0x140(%rbp)
jmp 0x158c61
movl $0x2, %eax
movq %rax, -0x140(%rbp)
jmp 0x158c61
movq -0x140(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
imulq $0x18, -0x100(%rbp), %rsi
callq 0x2360
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq -0x108(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x108(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xd8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xd0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xc8(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x158ccf
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x158ae4
jmp 0x158cdf
jmp 0x158ce1
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x158939
jmp 0x158cf1
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x1588e9
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x90(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
xorl %r9d, %r9d
callq 0x154b80
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0xa0(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
xorl %r9d, %r9d
callq 0x154b80
movq 0x30(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x98(%rbp), %rax
movl %eax, %ecx
movq -0xc0(%rbp), %r8
xorl %r9d, %r9d
callq 0x154b80
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x158785
jmp 0x158d84
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x158735
movq $0x0, -0x128(%rbp)
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpq -0x108(%rbp), %rax
jae 0x158df9
movq -0x20(%rbp), %rdi
callq 0xd4050
movq %rax, -0x128(%rbp)
movq -0xf8(%rbp), %rcx
movl -0x70(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0x128(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x158da4
cmpq $0x0, -0x108(%rbp)
je 0x158e41
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x20(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rdi
callq 0xcdd10
movq -0x20(%rbp), %rdi
callq 0xce020
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x150830
movq -0x20(%rbp), %rdi
movq 0x38(%rbp), %rsi
callq 0x151020
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpq -0x108(%rbp), %rax
jae 0x158f5f
movq -0xf8(%rbp), %rax
movl -0x70(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x80(%rbp)
movq -0xf8(%rbp), %rax
movl -0x70(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x158ecc
jmp 0x158f51
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x84(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x158eeb
jmp 0x158f51
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x80(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x158f1d
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x84(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x158f1d
jmp 0x158f51
movq -0x20(%rbp), %rdi
movl -0x80(%rbp), %esi
movl -0x84(%rbp), %edx
movl $0x1, %ecx
callq 0xd6530
movq -0x20(%rbp), %rdi
movl -0x84(%rbp), %esi
xorl $0x1, %esi
movl -0x80(%rbp), %edx
xorl $0x1, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x158e68
movq -0x20(%rbp), %rdi
callq 0xcdd10
movq -0x20(%rbp), %rdi
callq 0xce020
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x158fbd
movq -0x38(%rbp), %rdi
movl -0x80(%rbp), %esi
leaq -0x74(%rbp), %rdx
leaq -0x7c(%rbp), %rcx
callq 0xd3d50
cmpl $0x1, -0x7c(%rbp)
jne 0x158fb0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x80(%rbp), %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
jmp 0x158fb2
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x158f78
movq -0xf8(%rbp), %rdi
callq 0x2210
movq -0x110(%rbp), %rdi
callq 0x2210
movq -0xc0(%rbp), %rdi
callq 0x2210
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)