// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: rescue_missing_overlaps_aggressive(ma_ug_t*, asg_t*, ma_hit_t_alloc*, ma_sub_t*, R_to_U*, int, int, unsigned int, unsigned int, kvec_asg_arc_t_warp*, bub_label_t*)
void rescue_missing_overlaps_aggressive(ma_ug_t *i_ug, 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 is_bubble_check, uint32_t is_primary_check,
kvec_asg_arc_t_warp* new_rtg_edges, bub_label_t* b_mask_t)
{
    uint32_t n_vtx, v, k, is_Unitig, uId, rId, endRid, oLen, w, max_oLen, max_oLen_i;
    asg_t* nsg = NULL;
    ma_utg_t* nsu = NULL;
    ma_ug_t *ug = NULL;
    asg_arc_t t, r_edge;
    kvec_t(asg_arc_t) new_edges;
    kv_init(new_edges);

    kvec_t(asg_arc_t) rbub_edges;
    kv_init(rbub_edges);

    if(i_ug != NULL)
    {
        ug = i_ug;
    }
    else
    {
        ug = ma_ug_gen(r_g);
        for (v = 0; v < ug->g->n_seq; v++)
        {
            ug->g->seq[v].c = PRIMARY_LABLE;
        }
    }
    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;
        if(is_primary_check && nsg->seq[v].c==ALTER_LABLE) continue;

        for (k = 0; k < nsu->n; k++)
        {
            rId = nsu->a[k]>>33;
            set_R_to_U(ruIndex, rId, uId, 1,  &(r_g->seq[rId].c));
        }
    }


    n_vtx = nsg->n_seq * 2;
    for (v = 0; v < n_vtx; v++)
    {
        uId = v>>1;
        if(nsg->seq[uId].del) continue;
        if(is_primary_check && nsg->seq[uId].c == ALTER_LABLE) continue;

        nsu = &(ug->u.a[uId]);
        if(nsu->m == 0) continue;
        if(nsu->circ || nsu->start == UINT32_MAX || nsu->end == UINT32_MAX) continue;
        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(ug, r_g, sources, coverage_cut, ruIndex, 
                max_hang, min_ovlp, endRid, &uId, 1, &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(ug, ruIndex, rbub_edges.a, rbub_edges.n);
            if(is_primary_check)
            {
                max_oLen = 0; max_oLen_i = (uint32_t)-1;
                for (k = 0; k < rbub_edges.n; k++)
                {
                    t = rbub_edges.a[k];
                    if(t.del) continue;
                    if(t.ol > max_oLen)
                    {
                        max_oLen = t.ol;
                        max_oLen_i = k;
                    }
                }

                if(max_oLen_i == (uint32_t)-1) continue;
                t = rbub_edges.a[max_oLen_i];
                w = get_corresponding_uId(ug, ruIndex, t.v);
                if(w == ((uint32_t)(-1))) continue;
                if(get_real_length(nsg, w^1, NULL)!=0) continue;

                kv_push(asg_arc_t, new_edges, t);
                oLen = t.ol;
                asg_append_edges_to_srt(nsg, v, ug->u.a[v>>1].len, w, oLen, t.strong, t.el, t.no_l_indel);


                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);
                oLen = t.ol;
                asg_append_edges_to_srt(nsg, w^1, ug->u.a[w>>1].len, v^1, oLen, t.strong, t.el, t.no_l_indel);
            }
            else
            {
                for (k = 0; k < rbub_edges.n; k++)
                {
                    t = rbub_edges.a[k];
                    if(t.del) continue;
                    w = get_corresponding_uId(ug, ruIndex, t.v);
                    if(w == ((uint32_t)(-1))) continue;
                    // get_R_to_U(ruIndex, t.v>>1, &uId, &is_Unitig);
                    // w = (uint32_t)-1;
                    // if(t.v == ug->u.a[uId].start) w = uId<<1;
                    // if(t.v == ug->u.a[uId].end) w = (uId<<1)^1;
                    kv_push(asg_arc_t, new_edges, t);
                    oLen = t.ol;
                    asg_append_edges_to_srt(nsg, v, ug->u.a[v>>1].len, w, oLen, t.strong, t.el, t.no_l_indel);


                    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);
                    oLen = t.ol;
                    asg_append_edges_to_srt(nsg, w^1, ug->u.a[w>>1].len, v^1, oLen, t.strong, t.el, t.no_l_indel);
                }
            }

        }
    }

    asg_arc_t* p = NULL;
    if(is_bubble_check)
    {
        
        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);
        }
        

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

    if(is_primary_check)
    {
        for (k = 0; k < new_edges.n; k++)
        {
            p = asg_arc_pushp(r_g);
            *p = new_edges.a[k];
            if(new_rtg_edges) kv_push(asg_arc_t, new_rtg_edges->a, 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);
        }
    }


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

    if(i_ug == NULL) ma_ug_destroy(ug);

    kv_destroy(new_edges);
    kv_destroy(rbub_edges);
    /*************************just for debug**************************/
    // debug_utg_graph(ug, r_g, 0, 0);
    /*************************just for debug**************************/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
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, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movq $0x0, -0xd0(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x121ad2
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x121b1f
movq -0x20(%rbp), %rdi
callq 0xe5910
movq %rax, -0x80(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x80(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x121b1d
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movb $0x0, 0x4(%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x121ae6
jmp 0x121b1f
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x70(%rbp), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x121c18
movl -0x44(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x50(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x121b75
jmp 0x121c0a
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x121b8d
jmp 0x121c0a
cmpl $0x0, 0x20(%rbp)
je 0x121baa
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
jne 0x121baa
jmp 0x121c0a
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x121c08
movq -0x78(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x48(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rdi
movl -0x54(%rbp), %esi
movl -0x50(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %r8
movl -0x54(%rbp), %eax
shlq $0x3, %rax
addq %rax, %r8
addq $0x4, %r8
movl $0x1, %ecx
callq 0xd0e20
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x121bb1
jmp 0x121c0a
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x121b32
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x122522
movl -0x44(%rbp), %eax
shrl %eax
movl %eax, -0x50(%rbp)
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x50(%rbp), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x121c5f
jmp 0x122514
cmpl $0x0, 0x20(%rbp)
je 0x121c7f
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x50(%rbp), %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
jne 0x121c7f
jmp 0x122514
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x50(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x121ca4
jmp 0x122514
movq -0x78(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x121cc6
movq -0x78(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
je 0x121cc6
movq -0x78(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x121ccb
jmp 0x122514
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x0, %eax
je 0x121ce5
jmp 0x122514
movl -0x44(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x121cff
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x121d0c
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x58(%rbp)
movl $0x0, -0x48(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x80(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movl -0x3c(%rbp), %r9d
movl 0x10(%rbp), %r14d
movl -0x58(%rbp), %ebx
leaq -0x50(%rbp), %r11
leaq -0x48(%rbp), %r10
leaq -0xb0(%rbp), %rax
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movl $0x1, 0x30(%rsp)
callq 0x169940
cmpl $0x0, %eax
je 0x121e2f
jmp 0x121d83
movq -0xe0(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jne 0x121de7
cmpq $0x0, -0xd8(%rbp)
je 0x121db0
movq -0xd8(%rbp), %rax
shlq %rax
movq %rax, -0xf0(%rbp)
jmp 0x121dbe
movl $0x2, %eax
movq %rax, -0xf0(%rbp)
jmp 0x121dbe
movq -0xf0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
imulq $0x18, -0xd8(%rbp), %rsi
callq 0x2360
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xe0(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq -0xa8(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xa0(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x121d1e
cmpq $0x0, -0xe0(%rbp)
jbe 0x122512
movq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movq -0xe0(%rbp), %rax
movl %eax, %ecx
callq 0x1516a0
cmpl $0x0, 0x20(%rbp)
je 0x1221fd
movl $0x0, -0x64(%rbp)
movl $0xffffffff, -0x68(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xe0(%rbp), %rax
jae 0x121ef7
movq -0xd0(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x98(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movl -0x8c(%rbp), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x121ec6
jmp 0x121eec
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x64(%rbp), %eax
jbe 0x121eea
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x64(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x68(%rbp)
jmp 0x121eec
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x121e79
cmpl $-0x1, -0x68(%rbp)
jne 0x121f02
jmp 0x122514
movq -0xd0(%rbp), %rax
movl -0x68(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x98(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x90(%rbp), %edx
callq 0x1515e0
movl %eax, -0x60(%rbp)
cmpl $-0x1, -0x60(%rbp)
jne 0x121f54
jmp 0x122514
movq -0x70(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x0, %eax
je 0x121f71
jmp 0x122514
jmp 0x121f73
movq -0xc8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jne 0x121fd7
cmpq $0x0, -0xc0(%rbp)
je 0x121fa0
movq -0xc0(%rbp), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
jmp 0x121fae
movl $0x2, %eax
movq %rax, -0xf8(%rbp)
jmp 0x121fae
movq -0xf8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
imulq $0x18, -0xc0(%rbp), %rsi
callq 0x2360
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xc8(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x5c(%rbp)
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl -0x60(%rbp), %ecx
movl -0x5c(%rbp), %r8d
movw -0x88(%rbp), %ax
shrw $0xe, %ax
andw $0x1, %ax
movb %al, %r9b
movb -0x86(%rbp), %r10b
movw -0x88(%rbp), %ax
shrw $0xf, %ax
movzbl %r9b, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x141be0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl -0x90(%rbp), %r9d
xorl $0x1, %r9d
movq -0x98(%rbp), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %r10d
leaq -0x98(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
movq -0xc8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jne 0x122139
cmpq $0x0, -0xc0(%rbp)
je 0x122102
movq -0xc0(%rbp), %rax
shlq %rax
movq %rax, -0x100(%rbp)
jmp 0x122110
movl $0x2, %eax
movq %rax, -0x100(%rbp)
jmp 0x122110
movq -0x100(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
imulq $0x18, -0xc0(%rbp), %rsi
callq 0x2360
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xc8(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x5c(%rbp)
movq -0x70(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl $0x1, %esi
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x60(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl -0x44(%rbp), %ecx
xorl $0x1, %ecx
movl -0x5c(%rbp), %r8d
movw -0x88(%rbp), %ax
shrw $0xe, %ax
andw $0x1, %ax
movb %al, %r9b
movb -0x86(%rbp), %r10b
movw -0x88(%rbp), %ax
shrw $0xf, %ax
movzbl %r9b, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x141be0
jmp 0x122510
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xe0(%rbp), %rax
jae 0x12250e
movq -0xd0(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x98(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movl -0x8c(%rbp), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x122258
jmp 0x122500
movq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x90(%rbp), %edx
callq 0x1515e0
movl %eax, -0x60(%rbp)
cmpl $-0x1, -0x60(%rbp)
jne 0x122279
jmp 0x122500
jmp 0x12227b
movq -0xc8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jne 0x1222df
cmpq $0x0, -0xc0(%rbp)
je 0x1222a8
movq -0xc0(%rbp), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x1222b6
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x1222b6
movq -0x108(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
imulq $0x18, -0xc0(%rbp), %rsi
callq 0x2360
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xc8(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x5c(%rbp)
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl -0x60(%rbp), %ecx
movl -0x5c(%rbp), %r8d
movw -0x88(%rbp), %ax
shrw $0xe, %ax
andw $0x1, %ax
movb %al, %r9b
movb -0x86(%rbp), %r10b
movw -0x88(%rbp), %ax
shrw $0xf, %ax
movzbl %r9b, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x141be0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl -0x90(%rbp), %r9d
xorl $0x1, %r9d
movq -0x98(%rbp), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %r10d
leaq -0x98(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
movq -0xc8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jne 0x122441
cmpq $0x0, -0xc0(%rbp)
je 0x12240a
movq -0xc0(%rbp), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x122418
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x122418
movq -0x110(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
imulq $0x18, -0xc0(%rbp), %rsi
callq 0x2360
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xc8(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x98(%rbp), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x8c(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x5c(%rbp)
movq -0x70(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl $0x1, %esi
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x60(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl -0x44(%rbp), %ecx
xorl $0x1, %ecx
movl -0x5c(%rbp), %r8d
movw -0x88(%rbp), %ax
shrw $0xe, %ax
andw $0x1, %ax
movb %al, %r9b
movb -0x86(%rbp), %r10b
movw -0x88(%rbp), %ax
shrw $0xf, %ax
movzbl %r9b, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movzbl %al, %eax
movl %eax, 0x8(%rsp)
callq 0x141be0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x122204
jmp 0x122510
jmp 0x122512
jmp 0x122514
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x121c30
movq $0x0, -0xe8(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0x1226e7
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xc8(%rbp), %rax
jae 0x122593
movq -0x20(%rbp), %rdi
callq 0xd4050
movq %rax, -0xe8(%rbp)
movq -0xb8(%rbp), %rcx
movl -0x48(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0xe8(%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 -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x12253e
cmpq $0x0, -0xc8(%rbp)
je 0x1225d2
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 -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x150830
movq -0x20(%rbp), %rdi
movq 0x30(%rbp), %rsi
callq 0x151020
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xc8(%rbp), %rax
jae 0x1226de
movq -0xb8(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x44(%rbp)
movq -0xb8(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x122657
jmp 0x1226d0
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x60(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x122673
jmp 0x1226d0
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x1226a2
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x60(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x1226a2
jmp 0x1226d0
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x60(%rbp), %edx
movl $0x1, %ecx
callq 0xd6530
movq -0x20(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl $0x1, %esi
movl -0x44(%rbp), %edx
xorl $0x1, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1225f9
movq -0x20(%rbp), %rdi
callq 0xcdd10
cmpl $0x0, 0x20(%rbp)
je 0x12285b
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpq -0xc8(%rbp), %rax
jae 0x12281a
movq -0x20(%rbp), %rdi
callq 0xd4050
movq %rax, -0xe8(%rbp)
movq -0xb8(%rbp), %rcx
movl -0x48(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0xe8(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
cmpq $0x0, 0x28(%rbp)
je 0x12280a
jmp 0x122753
movq 0x28(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x1227c1
movq 0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x122783
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x118(%rbp)
jmp 0x122791
movl $0x2, %eax
movq %rax, -0x118(%rbp)
jmp 0x122791
movq -0x118(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rbp), %rax
imulq $0x18, 0x8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xb8(%rbp), %rcx
movl -0x48(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq 0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x28(%rbp), %rsi
movq (%rsi), %rdx
movq %rdx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x12280a
jmp 0x12280c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1226f8
cmpq $0x0, -0xc8(%rbp)
je 0x122859
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
jmp 0x12285b
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1228a7
movq -0x38(%rbp), %rdi
movl -0x44(%rbp), %esi
leaq -0x50(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
callq 0xd3d50
cmpl $0x1, -0x4c(%rbp)
jne 0x12289a
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x44(%rbp), %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
jmp 0x12289c
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x122862
cmpq $0x0, -0x18(%rbp)
jne 0x1228b7
movq -0x80(%rbp), %rdi
callq 0xcd6f0
movq -0xb8(%rbp), %rdi
callq 0x2210
movq -0xd0(%rbp), %rdi
callq 0x2210
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)