// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: purge_merge(asg_t*, ma_ug_t*, hap_overlaps_list*, buf_t*, R_to_U*, ma_hit_t_alloc*, ma_sub_t*, asg_t*, unsigned long*, kvec_asg_arc_t_offset*, kvec_t_i32_warp*, kvec_t_i32_warp*, int, int, kvec_asg_arc_t_warp*, unsigned char*, hap_cov_t*)
void purge_merge(asg_t *purge_g, ma_ug_t *ug, hap_overlaps_list* all_ovlp, buf_t* b_0,
R_to_U* ruIndex, ma_hit_t_alloc* reverse_sources, ma_sub_t *coverage_cut, asg_t *read_g, 
uint64_t* position_index, kvec_asg_arc_t_offset* u_buffer, kvec_t_i32_warp* tailIndex, 
kvec_t_i32_warp* prevIndex, int max_hang, int min_ovlp, kvec_asg_arc_t_warp* edge, uint8_t* visit,
hap_cov_t *cov)
{
    uint32_t i, nv, k, v, w, x_beg_index, x_end_index, y_beg_index, y_end_index, cut_beg, cut_end, begIndex, endIndex, keepUid;
    hap_overlaps *x = NULL/**, *y = NULL**/;
    ma_utg_t *xReads = NULL, *yReads = NULL;
    asg_arc_t t_forward, t_backward;
    asg_arc_t *av = NULL;
    kvec_t(uint64_t) buffer;
    uint64_t totalLen;
    int index = 0;
    i = 0;
    while (i < b_0->b.n)
    {
        cut_beg = 0; cut_end = (uint32_t)-1;
        kv_init(buffer);
        /********************for the first node********************/
        v = b_0->b.a[i];
        keepUid = v>>1;
        xReads = &(ug->u.a[v>>1]);
        if(v&1)
        {
            for (k = 0; k < xReads->n; k++)
            {
                kv_push(uint64_t, buffer, (xReads->a[xReads->n - k - 1])^(uint64_t)(0x100000000));
            }
        }
        else
        {
            for (k = 0; k < xReads->n; k++)
            {
                kv_push(uint64_t, buffer, xReads->a[k]);
            }
        }
        cut_beg = 0; cut_end = xReads->n - 1;
        i++;
        /********************for the first node********************/

        
        for (; i < b_0->b.n; i++)
        {
            ///x = y = NULL;
            x = NULL;

            v = b_0->b.a[i-1];
            w = b_0->b.a[i];
            

            index = get_specific_hap_overlap(&(all_ovlp->x[v>>1]), v>>1, w>>1);
            x = &(all_ovlp->x[v>>1].a.a[index]);


        
            xReads = &(ug->u.a[v>>1]);
            yReads = &(ug->u.a[w>>1]);

            begIndex = x->x_beg_id;
            if(cut_beg > begIndex) begIndex = cut_beg;

            endIndex = x->x_end_id-1;
            if(cut_end < endIndex) endIndex = cut_end;

            get_node_boundary_advance(ruIndex, reverse_sources, coverage_cut, read_g, position_index, max_hang, 
            min_ovlp, xReads, yReads, v>>1, w>>1, begIndex, endIndex, x->y_beg_id, x->y_end_id-1, v&1, 
            x->rev, u_buffer, tailIndex, prevIndex, &t_forward, &t_backward);

            if(t_forward.del || t_backward.del) break;
            
            kv_push(asg_arc_t, edge->a, t_forward);
            kv_push(asg_arc_t, edge->a, t_backward);

            x_beg_index = 0; x_end_index = xReads->n - 1;
            y_beg_index = 0; y_end_index = yReads->n - 1;
            
            if((v&1) == 0)
            {
                x_end_index = (uint32_t)position_index[t_forward.ul>>33];
                buffer.n = buffer.n - (cut_end - x_end_index);
            }
            else
            {
                x_beg_index = (uint32_t)position_index[t_forward.ul>>33];
                buffer.n = buffer.n - (x_beg_index - cut_beg);
            }

            if((w&1) == 1)
            {
                y_end_index = (uint32_t)position_index[t_forward.v>>1];
            }
            else
            {
                y_beg_index = (uint32_t)position_index[t_forward.v>>1];
            }

            cut_beg = y_beg_index;
            cut_end = y_end_index;

            if((w&1) == 1)
            {
                for (k = y_end_index; k >= y_beg_index; k--)
                {
                    kv_push(uint64_t, buffer, (yReads->a[k])^(uint64_t)(0x100000000));
                    if(k==0) break;
                }
            }
            else
            {
                for (k = y_beg_index; k <= y_end_index; k++)
                {
                    kv_push(uint64_t, buffer, yReads->a[k]);
                }
            }

            purge_g->seq[w>>1].c = ALTER_LABLE;
            if(cov) collect_trans_purge_joint_cov(cov, ug, x);

            // if(buffer.n > 1)
            // {
            //     for (k = 0; k < buffer.n - 1; k++)
            //     {
            //         if((buffer.a[k]>>32) == 854769 && (buffer.a[k+1]>>32) == 64486)
            //         {
            //             fprintf(stderr, "+++++++v: %u, w: %u, xReads->n: %u, yReads->n: %u\n", 
            //                         v, w, xReads->n, yReads->n);
            //             fprintf(stderr, "x->rev: %u, x->x_beg_id: %u, x->x_end_id: %u, x->y_beg_id: %u, x->y_end_id: %u\n", 
            //                         x->rev, x->x_beg_id, x->x_end_id, x->y_beg_id, x->y_end_id);
            //             fprintf(stderr, "t_forward.ul>>32: %u, t_forward.v: %u, y_beg_index: %u, y_end_index: %u\n", 
            //                         t_forward.ul>>32, t_forward.v, y_beg_index, y_end_index);
            //             fprintf(stderr, "type: %u, x->x_beg_pos: %u, x->x_end_pos: %u, xReads->len: %u\n", 
            //                         x->type, x->x_beg_pos, x->x_end_pos, xReads->len);
            //             fprintf(stderr, "x->y_beg_pos: %u, x->y_end_pos: %u, yReads->len: %u\n", 
            //                         x->y_beg_pos, x->y_end_pos, yReads->len);
            //         }
            //     }
            // }
        }

        // fprintf(stderr, "+keepUid: %u, i: %u, b_0->b.n: %u, buffer.n: %u\n", 
        //                             keepUid, i, (uint32_t)b_0->b.n, (uint32_t)buffer.n);
        fill_unitig(buffer.a, buffer.n, read_g, edge, 0, &totalLen);
        ///fprintf(stderr, "-keepUid: %u\n", keepUid);

        xReads = &(ug->u.a[keepUid]);
        free(xReads->a);
        xReads->a = buffer.a;
        xReads->n = buffer.n;
        xReads->m = buffer.m;
        xReads->len = totalLen;
        xReads->circ = 0;
        if(xReads->start != (xReads->a[0]>>32))
        {
            xReads->start = xReads->a[0]>>32;
            v = (keepUid<<1)+1;
            av = asg_arc_a(ug->g, v);
            nv = asg_arc_n(ug->g, v);
            for (k = 0; k < nv; k++)
            {
                if(av[k].del) continue;
                asg_arc_del(ug->g, av[k].ul>>32, av[k].v, 1);
                asg_arc_del(ug->g, av[k].v^1, av[k].ul>>32^1, 1);
            }
        }
        
        if(xReads->end != ((xReads->a[xReads->n-1]>>32)^1))
        {
            xReads->end = ((xReads->a[xReads->n-1]>>32)^1);
            v = (keepUid<<1);
            av = asg_arc_a(ug->g, v);
            nv = asg_arc_n(ug->g, v);
            for (k = 0; k < nv; k++)
            {
                if(av[k].del) continue;
                asg_arc_del(ug->g, av[k].ul>>32, av[k].v, 1);
                asg_arc_del(ug->g, av[k].v^1, av[k].ul>>32^1, 1);
            }
        }
    }

    for (i = 0; i < b_0->b.n; i++)
    {
        v = b_0->b.a[i];
        visit[v>>1] = 1;
        if(purge_g->seq[v>1].c != ALTER_LABLE) continue;
        asg_seq_drop(purge_g, v>1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, 0x80(%rsp)
movq %r8, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rdi, 0x40(%rsp)
cmpq $0x0, 0x38(%rcx)
je 0x114fae
movq %rcx, %r13
movq %rsi, %r15
xorl %eax, %eax
xorl %ebx, %ebx
movq %rcx, 0x38(%rsp)
movq %rsi, 0x18(%rsp)
movl %ebx, %r14d
movq 0x48(%r13), %rcx
movl (%rcx,%rax,4), %edx
movl %edx, %eax
shrl %eax
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rsi
leaq (%rcx,%rsi,8), %rbx
movl 0x10(%rbx), %ecx
movq %rdx, 0x58(%rsp)
testb $0x1, %dl
movq %rsi, 0x68(%rsp)
movq %rcx, 0x8(%rsp)
jne 0x11468c
testl %ecx, %ecx
je 0x1146fd
xorl %edx, %edx
xorl %r12d, %r12d
xorl %r8d, %r8d
cmpq %r12, %rdx
jne 0x114667
leaq (%rdx,%rdx), %r12
testq %rdx, %rdx
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %rdx, %rbp
movq %r8, %rdi
callq 0x2370
movq %rbp, %rdx
movq %rax, %r8
movl 0x10(%rbx), %ecx
jmp 0x11466c
movq 0x8(%rsp), %rcx
movq 0x18(%rbx), %rax
movq (%rax,%rdx,8), %rax
movq %rax, (%r8,%rdx,8)
incq %rdx
movq %rcx, 0x8(%rsp)
movl %ecx, %eax
cmpq %rax, %rdx
jb 0x114634
jmp 0x11470e
testl %ecx, %ecx
je 0x1146fd
xorl %edx, %edx
xorl %r12d, %r12d
xorl %r8d, %r8d
cmpq %r12, %rdx
jne 0x1146cb
leaq (%rdx,%rdx), %r12
testq %rdx, %rdx
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %rdx, %rbp
movq %r8, %rdi
callq 0x2370
movq %rbp, %rdx
movq %rax, %r8
movl 0x10(%rbx), %esi
jmp 0x1146d0
movq 0x8(%rsp), %rsi
movq 0x18(%rbx), %rax
movl %edx, %ecx
notl %ecx
addl %esi, %ecx
movq (%rax,%rcx,8), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %rax
movq %rax, (%r8,%rdx,8)
incq %rdx
movq %rsi, 0x8(%rsp)
cmpl %edx, %esi
ja 0x114698
jmp 0x11470e
movq $0x0, 0x8(%rsp)
xorl %r8d, %r8d
xorl %r12d, %r12d
xorl %edx, %edx
leal 0x1(%r14), %ebx
cmpq %rbx, 0x38(%r13)
movq %rdx, 0x10(%rsp)
jbe 0x114ba4
movq 0x8(%rsp), %rax
decl %eax
movq %rax, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq %r8, 0x48(%rsp)
movl %r14d, %eax
movl %ebx, %ecx
movq %rcx, 0x50(%rsp)
movq 0x48(%r13), %rcx
movl (%rcx,%rax,4), %ebp
movl (%rcx,%rbx,4), %r10d
movq 0x70(%rsp), %rax
movq (%rax), %rdx
movl %ebp, %eax
shrl %eax
leaq (%rax,%rax,2), %rsi
movl %r10d, %r9d
shrl %r9d
movq (%rdx,%rsi,8), %rcx
testq %rcx, %rcx
movl %r10d, 0x34(%rsp)
je 0x1147ad
leaq (%rdx,%rsi,8), %rdx
movq 0x10(%rdx), %r8
xorl %esi, %esi
xorl %edx, %edx
movq 0x8(%rsp), %rdi
shlq $0x6, %rsi
cmpl %eax, 0x24(%r8,%rsi)
jne 0x114799
addq %r8, %rsi
cmpl %r9d, 0x28(%rsi)
je 0x1147a8
incl %edx
movq %rdx, %rsi
cmpq %rdx, %rcx
ja 0x114785
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movslq %edx, %rsi
jmp 0x1147be
movq 0x10(%rdx,%rsi,8), %r8
movq $-0x1, %rsi
movq 0x8(%rsp), %rdi
shlq $0x6, %rsi
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rdx
leaq (%rcx,%rdx,8), %rdx
movq %rdx, 0x98(%rsp)
leaq (%r9,%r9,4), %rdx
leaq (%rcx,%rdx,8), %r14
movl 0x14(%r8,%rsi), %r11d
movq %r9, 0x60(%rsp)
movl 0x18(%r8,%rsi), %ebx
movq 0x20(%rsp), %rcx
cmpl %r11d, %ecx
cmoval %ecx, %r11d
decl %ebx
cmpl %ebx, %edi
cmovbl %edi, %ebx
movl 0x1c(%r8,%rsi), %ecx
movq %rcx, 0x28(%rsp)
movl 0x20(%r8,%rsi), %r15d
decl %r15d
andl $0x1, %ebp
movq %r8, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movzbl (%r8,%rsi), %r13d
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x110(%rsp), %rdx
movq 0x118(%rsp), %rcx
movq 0x120(%rsp), %r8
movl 0x140(%rsp), %r9d
leaq 0xc0(%rsp), %r10
pushq %r10
leaq 0xb0(%rsp), %r10
pushq %r10
pushq 0x148(%rsp)
pushq 0x148(%rsp)
pushq 0x148(%rsp)
pushq %r13
pushq %rbp
pushq %r15
pushq 0x68(%rsp)
pushq %rbx
pushq %r11
pushq 0xb8(%rsp)
pushq %rax
movq %r14, 0x90(%rsp)
pushq %r14
pushq 0x108(%rsp)
movl 0x1c0(%rsp), %eax
pushq %rax
callq 0x11315e
addq $0x80, %rsp
cmpl $0x0, 0xb4(%rsp)
js 0x114b89
cmpl $0x0, 0xcc(%rsp)
movq 0x48(%rsp), %r8
js 0x114b9a
movq 0x150(%rsp), %rbx
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x11491a
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x40(%rsp), %r14
movq 0x8(%rsp), %r15
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
leaq (%rcx,%rcx,2), %rcx
movq 0xb8(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movups 0xa8(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x114980
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x48(%rsp), %r8
movq 0x10(%rsp), %rdi
movl 0x34(%rsp), %esi
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
leaq (%rcx,%rcx,2), %rcx
movq 0xd0(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movups 0xc0(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0xa8(%rsp), %rax
shrq $0x21, %rax
movq 0x120(%rsp), %rdx
movl (%rdx,%rax,8), %eax
subl %eax, %r15d
subl 0x20(%rsp), %eax
testl %ebp, %ebp
cmovel %r15d, %eax
movq %rdi, %rbp
subq %rax, %rbp
movl 0xb0(%rsp), %ecx
shrl %ecx
movq (%rdx,%rcx,8), %rcx
testb $0x1, %sil
movq %rcx, 0x20(%rsp)
jne 0x114a64
movq 0x28(%rsp), %rax
movl 0x10(%rax), %r13d
decl %r13d
movl %ecx, %ebx
cmpl %ecx, %r13d
movq 0x18(%rsp), %r15
movq %r13, 0x8(%rsp)
jb 0x114a5a
cmpq %r12, %rbp
jne 0x114a3d
leaq (,%rbp,2), %r12
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq %r8, %rdi
callq 0x2370
movq %rax, %r8
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, (%r8,%rbp,8)
incq %rbp
incl %ebx
cmpl %r13d, %ebx
jbe 0x114a11
movq %rbp, 0x10(%rsp)
jmp 0x114b36
movl %ecx, %edx
leaq (%rdi,%rdi), %r14
subq %rax, %r14
subq %rax, %r14
shlq $0x3, %rdi
shlq $0x3, %rax
subq %rax, %rdi
movq $-0x1, %r13
movq %rdx, %rbx
movq %rdi, 0x10(%rsp)
leaq 0x1(,%r13), %rax
addq %rbp, %rax
cmpq %r12, %rax
jne 0x114ad7
movq %rbp, %rax
addq %r13, %rax
cmpq $-0x1, %rax
movq %r14, %r15
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r8, %rdi
movq %rbp, %r12
movq %rdx, %rbp
callq 0x2370
movq %rbp, %rdx
movq %r12, %rbp
movq 0x10(%rsp), %rdi
movq %r15, %r12
movq %rax, %r8
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %rax
leaq (%r8,%rdi), %rcx
movq %rax, 0x8(%rcx,%r13,8)
decq %rbx
incq %r13
addq $0x2, %r14
cmpq %r13, %rdx
jne 0x114a8a
leaq 0x1(,%r13), %rax
addq %rbp, %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x40(%rsp), %r14
movq 0x18(%rsp), %r15
movq 0x20(%r14), %rax
movq 0x60(%rsp), %rcx
movb $0x1, 0x4(%rax,%rcx,8)
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
movq 0x38(%rsp), %r13
movq 0x50(%rsp), %r14
je 0x114b79
movq 0x90(%rsp), %rdx
addq 0x88(%rsp), %rdx
movq %r15, %rsi
movq %r8, %rbx
callq 0x1143cc
movq %rbx, %r8
leal 0x1(%r14), %ebx
cmpq %rbx, 0x38(%r13)
ja 0x114736
jmp 0x114ba4
movq 0x50(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x48(%rsp), %r8
jmp 0x114ba4
movq 0x50(%rsp), %rbx
movq 0x18(%rsp), %r15
movq %r8, %rdi
movq 0x10(%rsp), %r14
movl %r14d, %esi
movq 0x118(%rsp), %rdx
movq 0x150(%rsp), %rcx
movq %r8, %r13
xorl %r8d, %r8d
leaq 0xa0(%rsp), %r9
callq 0x113fe2
movq 0x10(%r15), %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rcx,8), %rbp
movq 0x18(%rbp), %rdi
callq 0x2220
movq %r13, %rsi
movq %r13, 0x18(%rbp)
movl %r14d, 0x10(%rbp)
movl %r12d, 0xc(%rbp)
movl 0xa0(%rsp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movl %eax, (%rbp)
movl 0x4(%rbp), %ecx
movq (%r13), %rax
shrq $0x20, %rax
cmpq %rcx, %rax
jne 0x114c28
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x38(%rsp), %r13
jmp 0x114d54
movl %eax, 0x4(%rbp)
movq 0x58(%rsp), %rax
leaq (,%rax,8), %rax
movq 0x18(%r15), %rcx
movq 0x28(%rcx), %rdx
orq $0x8, %rax
movq (%rdx,%rax), %rdx
testl %edx, %edx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x38(%rsp), %r13
je 0x114d54
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rcx), %rax
movl %edx, %ecx
xorl %edx, %edx
leaq (%rdx,%rdx,2), %rsi
cmpl $0x0, 0xc(%rax,%rsi,8)
js 0x114d40
leaq (%rax,%rsi,8), %r9
movq 0x18(%r15), %r10
movq (%r9), %rsi
shrq $0x20, %rsi
movl 0x8(%r9), %edi
movq 0x8(%r10), %r8
movq 0x28(%r10), %r10
movq (%r10,%rsi,8), %r11
movq %r11, %r15
andq %r12, %r15
je 0x114cf4
shrq $0x20, %r11
shlq $0x3, %r15
leaq (%r15,%r15,2), %rsi
leaq (%r11,%r11,2), %r10
leaq (%r8,%r10,8), %r8
addq $0xc, %r8
xorl %r10d, %r10d
movq 0x18(%rsp), %r15
cmpl %edi, -0x4(%r8,%r10)
jne 0x114cd5
orb $-0x80, 0x3(%r8,%r10)
addq $0x18, %r10
cmpq %r10, %rsi
jne 0x114cc8
movq 0x18(%r15), %r10
movl 0x4(%r9), %esi
movl 0x8(%r9), %edi
movq 0x8(%r10), %r8
movq 0x28(%r10), %r10
jmp 0x114cf9
movq 0x18(%rsp), %r15
xorl $0x1, %edi
movq (%r10,%rdi,8), %r9
movq %r9, %rdi
andq %r12, %rdi
je 0x114d40
shrq $0x20, %r9
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%r9,%r9,2), %r9
leaq (%r8,%r9,8), %r8
addq $0xc, %r8
xorl %r9d, %r9d
movl -0x4(%r8,%r9), %r10d
xorl %esi, %r10d
cmpl $0x1, %r10d
jne 0x114d37
orb $-0x80, 0x3(%r8,%r9)
addq $0x18, %r9
cmpq %r9, %rdi
jne 0x114d23
incq %rdx
cmpq %rcx, %rdx
jne 0x114c72
movq 0x18(%rbp), %rsi
movl 0x10(%rbp), %r14d
movl 0x8(%rbp), %ecx
decl %r14d
movl 0x4(%rsi,%r14,8), %eax
xorq $0x1, %rax
cmpq %rcx, %rax
je 0x114e70
movl %eax, 0x8(%rbp)
movq 0x58(%rsp), %rdx
andl $-0x2, %edx
movq 0x18(%r15), %rcx
movq 0x28(%rcx), %rax
movq (%rax,%rdx,8), %rdx
testl %edx, %edx
je 0x114e70
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rcx), %rax
movl %edx, %ecx
xorl %edx, %edx
leaq (%rdx,%rdx,2), %rsi
cmpl $0x0, 0xc(%rax,%rsi,8)
js 0x114e64
leaq (%rax,%rsi,8), %r9
movq 0x18(%r15), %r10
movq (%r9), %rsi
shrq $0x20, %rsi
movl 0x8(%r9), %edi
movq 0x8(%r10), %r8
movq 0x28(%r10), %r10
movq (%r10,%rsi,8), %r11
movq %r11, %r14
andq %r12, %r14
je 0x114e1d
shrq $0x20, %r11
shlq $0x3, %r14
leaq (%r14,%r14,2), %rsi
leaq (%r11,%r11,2), %r10
leaq (%r8,%r10,8), %r8
addq $0xc, %r8
xorl %r10d, %r10d
cmpl %edi, -0x4(%r8,%r10)
jne 0x114e00
orb $-0x80, 0x3(%r8,%r10)
addq $0x18, %r10
cmpq %r10, %rsi
jne 0x114df3
movq 0x18(%r15), %r10
movl 0x4(%r9), %esi
movl 0x8(%r9), %edi
movq 0x8(%r10), %r8
movq 0x28(%r10), %r10
xorl $0x1, %edi
movq (%r10,%rdi,8), %r9
movq %r9, %rdi
andq %r12, %rdi
je 0x114e64
shrq $0x20, %r9
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%r9,%r9,2), %r9
leaq (%r8,%r9,8), %r8
addq $0xc, %r8
xorl %r9d, %r9d
movl -0x4(%r8,%r9), %r10d
xorl %esi, %r10d
cmpl $0x1, %r10d
jne 0x114e5b
orb $-0x80, 0x3(%r8,%r9)
addq $0x18, %r9
cmpq %r9, %rdi
jne 0x114e47
incq %rdx
cmpq %rcx, %rdx
jne 0x114da2
movl %ebx, %eax
movq 0x38(%r13), %rcx
cmpq %rax, %rcx
ja 0x1145f3
testq %rcx, %rcx
je 0x114fae
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x48(%r13), %rdx
movl (%rdx,%rax,4), %esi
movl %esi, %edx
shrl %edx
movq 0x158(%rsp), %rdi
movb $0x1, (%rdi,%rdx)
movq 0x40(%rsp), %r13
movq 0x20(%r13), %rdx
xorl %edi, %edi
cmpl $0x2, %esi
setae %dil
cmpb $0x1, 0x4(%rdx,%rdi,8)
jne 0x114f9d
xorl %edx, %edx
cmpl $0x2, %esi
setae %dl
addl %edx, %edx
movb $0x1, %sil
xorl %edi, %edi
orq %rdx, %rdi
movq 0x28(%r13), %r8
movq (%r8,%rdi,8), %r9
movq %r9, %r8
andq %rcx, %r8
je 0x114f89
shrq $0x20, %r9
leaq (%r9,%r9,2), %r9
shlq $0x3, %r9
addq 0x8(%r13), %r9
xorl %r10d, %r10d
leaq (%r10,%r10,2), %rbx
movl 0xc(%r9,%rbx,8), %r11d
testl %r11d, %r11d
js 0x114f7d
leaq (%r9,%rbx,8), %r14
movq 0x20(%r13), %r15
movl 0x8(%r14), %ebx
movl %ebx, %r12d
shrl %r12d
cmpb $0x1, 0x4(%r15,%r12,8)
je 0x114f7d
orl $0x80000000, %r11d      # imm = 0x80000000
movl %r11d, 0xc(%r14)
xorq $0x1, %rbx
movq 0x28(%r13), %r11
movq (%r11,%rbx,8), %rbx
movq %rbx, %r11
andq %rcx, %r11
je 0x114f7d
movq 0x8(%r13), %r14
shrq $0x20, %rbx
shlq $0x3, %r11
leaq (%r11,%r11,2), %r11
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%rbx,8), %rbx
addq $0xc, %rbx
xorl %r14d, %r14d
movl -0x4(%rbx,%r14), %ebp
xorl %edi, %ebp
cmpl $0x1, %ebp
jne 0x114f74
orb $-0x80, 0x3(%rbx,%r14)
addq $0x18, %r14
cmpq %r14, %r11
jne 0x114f62
incq %r10
cmpq %r8, %r10
jne 0x114efc
movl $0x1, %edi
testb $0x1, %sil
movl $0x0, %esi
jne 0x114ed2
incl %eax
movq 0x38(%rsp), %r13
cmpq %rax, 0x38(%r13)
ja 0x114e8f
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq