// File: /workspace/github_cpp_makefile_star2_O1/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 $0xc8, %rsp
movq %r9, 0x78(%rsp)
movq %r8, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rdi, 0x10(%rsp)
cmpq $0x0, 0x38(%rcx)
movq %rcx, 0x8(%rsp)
je 0x10f804
xorl %eax, %eax
xorl %ebx, %ebx
movq %rsi, 0x20(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x48(%rcx), %rcx
movl (%rcx,%rax,4), %edx
movl %edx, %eax
shrl %eax
movq 0x10(%rsi), %rcx
leaq (%rax,%rax,4), %rsi
leaq (%rcx,%rsi,8), %r14
movl 0x10(%r14), %eax
movq %rdx, 0x30(%rsp)
testb $0x1, %dl
movq %rsi, 0x60(%rsp)
jne 0x10f09d
testl %eax, %eax
je 0x10f109
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpq %rbp, %r13
jne 0x10f083
leaq (,%rbp,2), %rbx
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rbx, %rbp
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %rax
movq %rax, (%r12,%r13,8)
incq %r13
movl 0x10(%r14), %eax
cmpq %rax, %r13
jb 0x10f054
jmp 0x10f111
testl %eax, %eax
je 0x10f109
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpq %rbp, %r13
jne 0x10f0dd
leaq (,%rbp,2), %r15
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %r15, %rbp
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
addl %ebx, %ecx
movq (%rax,%rcx,8), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %rax
movq %rax, (%r12,%r13,8)
incq %r13
decl %ebx
cmpl %r13d, 0x10(%r14)
ja 0x10f0ae
jmp 0x10f111
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x18(%rsp), %rax
leal 0x1(%rax), %ebx
movq 0x8(%rsp), %rax
cmpq %rbx, 0x38(%rax)
jbe 0x10f52a
movl 0x10(%r14), %eax
decl %eax
movl %eax, 0x4(%rsp)
movl $0x0, (%rsp)
movq 0x8(%rsp), %r15
movq 0x18(%rsp), %rax
movl %eax, %eax
movl %ebx, %ecx
movq %rcx, 0x18(%rsp)
movq 0x48(%r15), %rcx
movl (%rcx,%rax,4), %r14d
movl (%rcx,%rbx,4), %esi
movq 0x68(%rsp), %rax
movq (%rax), %rcx
movl %r14d, %eax
shrl %eax
leaq (%rax,%rax,2), %rdx
movl %esi, 0x2c(%rsp)
movl %esi, %r10d
shrl %r10d
movq (%rcx,%rdx,8), %rsi
testq %rsi, %rsi
je 0x10f1b0
leaq (%rcx,%rdx,8), %rdi
movq 0x10(%rdi), %r8
xorl %r9d, %r9d
xorl %edi, %edi
shlq $0x6, %r9
cmpl %eax, 0x24(%r8,%r9)
jne 0x10f19c
addq %r8, %r9
cmpl %r10d, 0x28(%r9)
je 0x10f1ab
incl %edi
movq %rdi, %r9
cmpq %rdi, %rsi
ja 0x10f188
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movslq %edi, %rdi
jmp 0x10f1b7
movq $-0x1, %rdi
movl 0x4(%rsp), %esi
movq 0x10(%rcx,%rdx,8), %r8
shlq $0x6, %rdi
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rdx
leaq (%rcx,%rdx,8), %rdx
movq %rdx, 0xa0(%rsp)
leaq (%r10,%r10,4), %rdx
movq %r10, 0x40(%rsp)
leaq (%rcx,%rdx,8), %rbx
movl 0x14(%r8,%rdi), %r11d
movl 0x18(%r8,%rdi), %r10d
movl (%rsp), %ecx
cmpl %r11d, %ecx
cmoval %ecx, %r11d
decl %r10d
cmpl %r10d, %esi
cmovbl %esi, %r10d
movl 0x1c(%r8,%rdi), %ecx
movq %rcx, 0x98(%rsp)
movl 0x20(%r8,%rdi), %r15d
decl %r15d
andl $0x1, %r14d
movq %r14, 0x38(%rsp)
movq %rdi, 0x88(%rsp)
movq %r8, 0x80(%rsp)
movzbl (%r8,%rdi), %ecx
movq %rcx, 0x90(%rsp)
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x100(%rsp), %rdx
movq 0x108(%rsp), %rcx
movq 0x110(%rsp), %r8
movl 0x130(%rsp), %r9d
leaq 0xb0(%rsp), %r14
pushq %r14
leaq 0x50(%rsp), %r14
pushq %r14
pushq 0x138(%rsp)
pushq 0x138(%rsp)
pushq 0x138(%rsp)
pushq 0xb8(%rsp)
pushq 0x68(%rsp)
pushq %r15
pushq 0xd8(%rsp)
pushq %r10
pushq %r11
movq 0x98(%rsp), %r10
pushq %r10
pushq %rax
pushq %rbx
pushq 0x110(%rsp)
movl 0x1b0(%rsp), %eax
pushq %rax
callq 0x10e164
addq $0x80, %rsp
cmpl $0x0, 0x54(%rsp)
js 0x10f525
cmpl $0x0, 0xbc(%rsp)
movq 0x140(%rsp), %r14
js 0x10f7f5
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
jne 0x10f325
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
leaq (%rax,%rax,2), %rax
movq 0x58(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
movl 0x4(%rsp), %r15d
jne 0x10f381
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
leaq (%rax,%rax,2), %rax
movq 0xc0(%rsp), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
movups 0xb0(%rsp), %xmm0
movups %xmm0, (%rcx,%rax,8)
movq 0x48(%rsp), %rax
shrq $0x21, %rax
movq 0x110(%rsp), %rdx
movl (%rdx,%rax,8), %eax
subl %eax, %r15d
subl (%rsp), %eax
cmpl $0x0, 0x38(%rsp)
cmovel %r15d, %eax
movl 0x2c(%rsp), %edi
testb $0x1, %dil
jne 0x10f3ec
movl 0x10(%rbx), %esi
decl %esi
movl 0x50(%rsp), %ecx
shrl %ecx
movl (%rdx,%rcx,8), %ecx
movl %ecx, (%rsp)
jmp 0x10f3fc
movl 0x50(%rsp), %ecx
shrl %ecx
movl (%rdx,%rcx,8), %esi
movl $0x0, (%rsp)
subq %rax, %r13
testb $0x1, %dil
movl %esi, 0x4(%rsp)
jne 0x10f466
movl (%rsp), %eax
movl %eax, %r14d
cmpl %esi, %eax
ja 0x10f4ca
cmpq %rbp, %r13
jne 0x10f44a
leaq (,%rbp,2), %r15
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %r15, %rbp
movl 0x4(%rsp), %esi
movq 0x18(%rbx), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, (%r12,%r13,8)
incq %r13
incl %r14d
cmpl %esi, %r14d
jbe 0x10f417
jmp 0x10f4ca
cmpl (%rsp), %esi
jb 0x10f4ca
movl %esi, %r14d
cmpq %rbp, %r13
jne 0x10f49d
leaq (,%rbp,2), %r15
testq %rbp, %rbp
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %r15, %rbp
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %rax
movq %rax, (%r12,%r13,8)
incq %r13
movq %r14, %rax
subq $0x1, %rax
jb 0x10f4ca
decq %r14
cmpl %eax, (%rsp)
jbe 0x10f46e
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x40(%rsp), %rcx
movb $0x1, 0x4(%rax,%rcx,8)
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x10f504
movq 0x80(%rsp), %rdx
addq 0x88(%rsp), %rdx
movq 0x20(%rsp), %rsi
callq 0x10edf7
movq 0x18(%rsp), %rax
leal 0x1(%rax), %ebx
movq 0x8(%rsp), %r15
cmpq %rbx, 0x38(%r15)
movq 0x140(%rsp), %r14
ja 0x10f143
jmp 0x10f537
movq 0x18(%rsp), %rbx
movq 0x8(%rsp), %r15
movq 0x140(%rsp), %r14
movq %r12, %rdi
movl %r13d, %esi
movq 0x108(%rsp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
leaq 0xa8(%rsp), %r9
callq 0x10e9f4
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rcx
leaq (%rax,%rcx,8), %r14
movq 0x18(%r14), %rdi
callq 0x2220
movq %r12, 0x18(%r14)
movl %r13d, 0x10(%r14)
movl %ebp, 0xc(%r14)
movl 0xa8(%rsp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movl %eax, (%r14)
movl 0x4(%r14), %ecx
movq (%r12), %rax
movq 0x20(%rsp), %rsi
shrq $0x20, %rax
cmpq %rcx, %rax
movq %r15, %rcx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
je 0x10f6c4
movl %eax, 0x4(%r14)
movq 0x30(%rsp), %rax
leaq (,%rax,8), %rax
movq 0x18(%rsi), %rdi
movq 0x28(%rdi), %rdx
orq $0x8, %rax
movq (%rdx,%rax), %rdx
testl %edx, %edx
je 0x10f6c4
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rdi), %rax
movl %edx, %r15d
xorl %edx, %edx
leaq (%rdx,%rdx,2), %rdi
cmpl $0x0, 0xc(%rax,%rdi,8)
js 0x10f6b8
leaq (%rax,%rdi,8), %r12
movq 0x18(%rsi), %r8
movl 0x4(%r12), %edi
movq 0x28(%r8), %r9
movq (%r9,%rdi,8), %r9
movq %r9, %r10
andq %r13, %r10
je 0x10f65a
movl 0x8(%r12), %edi
movq 0x8(%r8), %r11
shrq $0x20, %r9
shlq $0x3, %r10
leaq (%r10,%r10,2), %r8
leaq (%r9,%r9,2), %r9
leaq (%r11,%r9,8), %r9
addq $0xc, %r9
xorl %r10d, %r10d
cmpl %edi, -0x4(%r9,%r10)
jne 0x10f651
orb $-0x80, 0x3(%r9,%r10)
addq $0x18, %r10
cmpq %r10, %r8
jne 0x10f644
movq 0x18(%rsi), %rdi
movl 0x8(%r12), %r8d
xorq $0x1, %r8
movq 0x28(%rdi), %r9
movq (%r9,%r8,8), %r8
movq %r8, %r9
andq %r13, %r9
je 0x10f6b8
movl 0x4(%r12), %r11d
movq 0x8(%rdi), %r10
shrq $0x20, %r8
shlq $0x3, %r9
leaq (%r9,%r9,2), %rdi
leaq (%r8,%r8,2), %r8
leaq (%r10,%r8,8), %r8
addq $0xc, %r8
xorl %r9d, %r9d
movl -0x4(%r8,%r9), %r10d
xorl %r11d, %r10d
cmpl $0x1, %r10d
jne 0x10f6af
orb $-0x80, 0x3(%r8,%r9)
addq $0x18, %r9
cmpq %r9, %rdi
jne 0x10f69b
incq %rdx
cmpq %r15, %rdx
jne 0x10f5f4
movl 0x8(%r14), %edi
movl 0x10(%r14), %eax
movq 0x18(%r14), %rdx
decl %eax
movl 0x4(%rdx,%rax,8), %eax
xorq $0x1, %rax
cmpq %rdi, %rax
je 0x10f7e7
movl %eax, 0x8(%r14)
movq 0x30(%rsp), %rdx
andl $-0x2, %edx
movq 0x18(%rsi), %rdi
movq 0x28(%rdi), %rax
movq (%rax,%rdx,8), %rdx
testl %edx, %edx
je 0x10f7e7
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x8(%rdi), %rax
movl %edx, %r14d
xorl %edx, %edx
leaq (%rdx,%rdx,2), %rdi
cmpl $0x0, 0xc(%rax,%rdi,8)
js 0x10f7db
leaq (%rax,%rdi,8), %r15
movq 0x18(%rsi), %r8
movl 0x4(%r15), %edi
movq 0x28(%r8), %r9
movq (%r9,%rdi,8), %r9
movq %r9, %r10
andq %r13, %r10
je 0x10f77f
movl 0x8(%r15), %edi
movq 0x8(%r8), %r11
shrq $0x20, %r9
shlq $0x3, %r10
leaq (%r10,%r10,2), %r8
leaq (%r9,%r9,2), %r9
leaq (%r11,%r9,8), %r9
addq $0xc, %r9
xorl %r10d, %r10d
cmpl %edi, -0x4(%r9,%r10)
jne 0x10f776
orb $-0x80, 0x3(%r9,%r10)
addq $0x18, %r10
cmpq %r10, %r8
jne 0x10f769
movq 0x18(%rsi), %rdi
movl 0x8(%r15), %r8d
xorq $0x1, %r8
movq 0x28(%rdi), %r9
movq (%r9,%r8,8), %r8
movq %r8, %r9
andq %r13, %r9
je 0x10f7db
movl 0x4(%r15), %r11d
movq 0x8(%rdi), %r10
shrq $0x20, %r8
shlq $0x3, %r9
leaq (%r9,%r9,2), %rdi
leaq (%r8,%r8,2), %r8
leaq (%r10,%r8,8), %r8
addq $0xc, %r8
xorl %r9d, %r9d
movl -0x4(%r8,%r9), %r10d
xorl %r11d, %r10d
cmpl $0x1, %r10d
jne 0x10f7d2
orb $-0x80, 0x3(%r8,%r9)
addq $0x18, %r9
cmpq %r9, %rdi
jne 0x10f7be
incq %rdx
cmpq %r14, %rdx
jne 0x10f71b
movl %ebx, %eax
cmpq %rax, 0x38(%rcx)
ja 0x10f015
jmp 0x10f804
movq 0x18(%rsp), %rbx
movq 0x8(%rsp), %r15
jmp 0x10f537
cmpq $0x0, 0x38(%rcx)
je 0x10f964
xorl %eax, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x48(%rcx), %rsi
movl (%rsi,%rax,4), %edi
movl %edi, %esi
shrl %esi
movq 0x148(%rsp), %rcx
movb $0x1, (%rcx,%rsi)
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rsi
xorl %r8d, %r8d
cmpl $0x2, %edi
setae %r8b
cmpb $0x1, 0x4(%rsi,%r8,8)
jne 0x10f953
xorl %r8d, %r8d
cmpl $0x2, %edi
setae %r8b
cmpb $0x1, 0x4(%rsi,%r8,8)
jne 0x10f953
xorl %esi, %esi
cmpl $0x2, %edi
setae %sil
addl %esi, %esi
xorl %edi, %edi
leaq (%rdi,%rsi), %r8
movq 0x10(%rsp), %rcx
movq 0x28(%rcx), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
andq %rdx, %r9
je 0x10f943
shrq $0x20, %r10
leaq (%r10,%r10,2), %r10
shlq $0x3, %r10
movq 0x10(%rsp), %rcx
addq 0x8(%rcx), %r10
xorl %r11d, %r11d
leaq (%r11,%r11,2), %r14
movl 0xc(%r10,%r14,8), %ebx
testl %ebx, %ebx
js 0x10f937
leaq (%r10,%r14,8), %r15
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %r12
movl 0x8(%r15), %r14d
movl %r14d, %r13d
shrl %r13d
cmpb $0x1, 0x4(%r12,%r13,8)
je 0x10f937
orl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0xc(%r15)
xorq $0x1, %r14
movq 0x10(%rsp), %rcx
movq 0x28(%rcx), %rbx
movq (%rbx,%r14,8), %r14
movq %r14, %rbx
andq %rdx, %rbx
je 0x10f937
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %r15
shrq $0x20, %r14
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
leaq (%r14,%r14,2), %r14
leaq (%r15,%r14,8), %r14
addq $0xc, %r14
xorl %r15d, %r15d
movl -0x4(%r14,%r15), %ebp
xorl %r8d, %ebp
cmpl $0x1, %ebp
jne 0x10f92e
orb $-0x80, 0x3(%r14,%r15)
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x10f91b
incq %r11
cmpq %r9, %r11
jne 0x10f8a4
leaq 0x1(%rdi), %r8
testq %rdi, %rdi
movq %r8, %rdi
je 0x10f86f
incl %eax
movq 0x8(%rsp), %rcx
cmpq %rax, 0x38(%rcx)
ja 0x10f816
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq