// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: identify_bubbles(ma_ug_t*, bubble_type*, unsigned char*, kv_u_trans_t*)
void identify_bubbles(ma_ug_t* ug, bubble_type* bub, uint8_t *r_het_flag, kv_u_trans_t *ref)
{
    asg_cleanup(ug->g);
    if (!ug->g->is_symm) asg_symm(ug->g);
    uint32_t v, n_vtx = ug->g->n_seq * 2, i, k, mode = (((uint32_t)-1)<<2);
    uint32_t beg, sink, n, *a, n_occ;
    uint64_t pathLen;
    bub->ug = ug; 
    bub->b_bub = bub->b_end_bub = bub->tangle_bub = bub->cross_bub = bub->mess_bub = 0;
    if(bub->round_id == 0)
    {
        buf_t b; memset(&b, 0, sizeof(buf_t)); b.a = (binfo_t*)calloc(n_vtx, sizeof(binfo_t));
        uint64_t tLen = get_bub_pop_max_dist_advance(ug->g, &b);
        kv_init(bub->list); kv_init(bub->num); kv_init(bub->pathLen);
        kv_init(bub->b_s_idx); kv_malloc(bub->b_s_idx, ug->g->n_seq); 
        bub->b_ug = NULL; kv_init(bub->chain_weight);
        bub->b_s_idx.n = ug->g->n_seq;
        memset(bub->b_s_idx.a, -1, bub->b_s_idx.n * sizeof(uint64_t));
        CALLOC(bub->index, n_vtx);
        for (i = 0; i < ug->g->n_seq; i++) ug->g->seq[i].c = 0;
        for (v = 0; v < n_vtx; ++v) 
        {
            if(ug->g->seq[v>>1].del) continue;
            if(asg_arc_n(ug->g, v) < 2) continue;
            if((bub->index[v]&(uint32_t)3) != 0) continue;
            if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL))
            {
                //beg is v, end is b.S.a[0]
                //note b.b include end, does not include beg
                for (i = 0; i < b.b.n; i++)
                {
                    if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                    bub->index[b.b.a[i]] &= mode; bub->index[b.b.a[i]] += 1;
                    bub->index[b.b.a[i]^1] &= mode; bub->index[b.b.a[i]^1] += 1;
                }
                bub->index[v] &= mode; bub->index[v] += 2;
                bub->index[b.S.a[0]^1] &= mode; bub->index[b.S.a[0]^1] += 3;
            }
        }

        kvec_t_u32_warp stack, result;
        kv_init(stack.a); kv_init(result.a);
        for (v = 0; v < n_vtx; ++v) 
        {
            if((bub->index[v]&(uint32_t)3) !=2) continue;
            if(asg_bub_pop1_primary_trio(ug->g, ug, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, &pathLen, NULL, NULL, 0, 0, NULL))
            {   
                //note b.b include end, does not include beg
                i = b.b.n + 1;
                if(b.b.n == 2 || b.b.n == 3 || b.b.n == 5)
                {
                    for (i = 0; i < b.b.n; i++)
                    {
                        if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                        dfs_bubble(ug->g, &stack, &result, b.b.a[i]>>1, v>>1, b.S.a[0]>>1);
                        if((result.a.n + 3) != b.b.n && (result.a.n + 2) != b.b.n) break;
                    }
                }

                if(i == b.b.n)
                {
                    kv_push(uint32_t, bub->num, v);
                }
                else
                {
                    kv_push(uint32_t, bub->num, v + (1<<31));
                }
            }
        }
        kv_destroy(stack.a); kv_destroy(result.a);
        radix_sort_u32(bub->num.a, bub->num.a + bub->num.n);
        bub->s_bub = 0;
        for (k = 0; k < bub->num.n; k++)
        {
            if((bub->num.a[k]>>31) == 0) bub->s_bub++;
            v = (bub->num.a[k]<<1)>>1;
            bub->num.a[k] = bub->list.n;
            if(asg_bub_pop1_primary_trio(ug->g, ug, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, &pathLen, NULL, NULL, 0, 0, NULL))
            {
                kv_push(uint64_t, bub->pathLen, pathLen);
                //beg is v, end is b.S.a[0]
                kv_push(uint32_t, bub->list, v);
                kv_push(uint32_t, bub->list, b.S.a[0]^1);
                
                //note b.b include end, does not include beg
                for (i = 0; i < b.b.n; i++)
                {
                    if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                    kv_push(uint32_t, bub->list, b.b.a[i]);
                }
            }
        }
        kv_push(uint32_t, bub->num, bub->list.n);
        free(b.a); free(b.S.a); free(b.T.a); free(b.b.a); free(b.e.a);
        bub->f_bub = bub->num.n - 1; ///bub->s_bub = bub->num.n - 1;
        
        for (i = 0; i < ug->g->n_seq; i++)
        {
            bub->index[i] = get_unitig_het_arb(ug, i, r_het_flag, ref, 20, M_het(*bub), P_het(*bub), (uint32_t)-1);
        }
        for (i = 0; i < bub->f_bub; i++)
        {
            get_bubbles(bub, i, &beg, &sink, &a, &n, &pathLen);
            for (v = n_occ = 0; v < n; v++)
            {
                bub->index[(a[v]>>1)] = i;
                n_occ += ug->u.a[a[v]>>1].n;
            }

            // if((pathLen*2) >= ug->g->seq[beg>>1].len && (pathLen*2) >= ug->g->seq[sink>>1].len)
            // {
            //     bub->index[(beg>>1)] = (uint32_t)-1;
            //     bub->index[(sink>>1)] = (uint32_t)-1;
            // }

            if(n_occ > 3)
            {
                if(bub->index[(beg>>1)] != M_het(*bub)) bub->index[(beg>>1)] = (uint32_t)-1;
                if(bub->index[(sink>>1)] != M_het(*bub)) bub->index[(sink>>1)] = (uint32_t)-1;
            }
            
            
            v = beg>>1;
            if(bub->b_s_idx.a[v] == (uint64_t)-1)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
            else if((bub->b_s_idx.a[v] & 0xffffffff00000000) == 0xffffffff00000000)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }


            v = sink>>1;
            if(bub->b_s_idx.a[v] == (uint64_t)-1)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
            else if((bub->b_s_idx.a[v] & 0xffffffff00000000) == 0xffffffff00000000)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }        
        }
        for (i = 0; i < ug->g->n_seq; i++)
        {
            if(bub->index[i] == M_het(*bub)) bub->index[i] = P_het(*bub);
        }
    }
    else
    {
        bub->num.n = bub->f_bub + 1; 
        bub->pathLen.n = bub->f_bub;
        bub->list.n = bub->num.a[bub->num.n-1];
        update_bub_b_s_idx(bub);
        bub->check_het = 0;
        asg_destroy(bub->b_g); bub->b_g = NULL;
        ma_ug_destroy(bub->b_ug); bub->b_ug = NULL;
        kv_destroy(bub->chain_weight); kv_init(bub->chain_weight);
    }
    bub->b_g = NULL;
    bub->b_ug = NULL;
    build_bub_graph(ug, bub);
    // fprintf(stderr, "-bub->index[18759]: %u, bub->num.n: %u\n",  (uint32_t)bub->index[18759], bub->num.n);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
callq 0xa02fa
movq 0x18(%r14), %rdi
cmpl $0x0, 0x14(%rdi)
js 0x138ae8
callq 0xa047e
movq 0x18(%r14), %r15
movl 0x14(%r15), %eax
movq %r14, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rbx)
movups %xmm0, 0x98(%rbx)
movq $0x0, 0xa8(%rbx)
cmpl $0x0, 0x8(%rbx)
je 0x138b9b
movq 0x40(%rbx), %rax
movq 0x80(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x30(%rbx)
movq %rcx, 0x48(%rbx)
movl (%rax,%rcx,4), %eax
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
callq 0x1394bc
movl $0x0, 0xb0(%rbx)
movq 0xb8(%rbx), %rdi
callq 0x9fcdb
movq %r14, %r15
xorl %r14d, %r14d
movq %r14, 0xb8(%rbx)
movq 0xc0(%rbx), %rdi
callq 0xa0004
movq %r14, 0xc0(%rbx)
movq 0xd8(%rbx), %rdi
callq 0x2220
movq %r14, 0xd8(%rbx)
movq %r15, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0xc8(%rbx)
jmp 0x139498
movq %r13, 0xc8(%rsp)
movq %r12, 0xd0(%rsp)
addl %eax, %eax
leaq 0x60(%rsp), %r12
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq $0x0, 0x60(%r12)
movl %eax, 0x40(%rsp)
movl %eax, %ebp
movl $0x1c, %esi
movq %rbp, %rdi
callq 0x2120
movq %rax, (%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0xbf22d
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x28(%rbx)
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x48(%rbx)
movups %xmm0, 0x58(%rbx)
movups %xmm0, 0x68(%rbx)
movq %r14, 0x50(%rsp)
movq 0x18(%r14), %r15
movl 0x14(%r15), %eax
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rax
movq %rax, 0x68(%rbx)
movl 0x14(%r15), %edi
andq %r14, %rdi
shlq $0x3, %rdi
callq 0x2280
movq %rax, 0x70(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0xc0(%rbx)
movups %xmm0, 0xd0(%rbx)
movl 0x14(%r15), %edx
andq %r14, %rdx
movq %rdx, 0x60(%rbx)
shlq $0x3, %rdx
movq %rax, %rdi
movl $0xff, %esi
callq 0x20e0
movl $0x4, %esi
movq %rbp, %rdi
callq 0x2120
movq %rax, (%rbx)
testl $0x7fffffff, 0x14(%r15) # imm = 0x7FFFFFFF
je 0x138cb2
movq 0x20(%r15), %rax
xorl %ecx, %ecx
movb $0x0, 0x4(%rax,%rcx,8)
incq %rcx
movl 0x14(%r15), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpq %rdx, %rcx
jb 0x138c9b
cmpl $0x0, 0x40(%rsp)
movq 0x50(%rsp), %r14
je 0x138ddb
xorl %r13d, %r13d
leaq 0x60(%rsp), %r15
xorl %r12d, %r12d
movq 0x18(%r14), %rdi
movq 0x20(%rdi), %rax
movl %r12d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x138dcf
movq 0x28(%rdi), %rax
testl $0xfffffffe, (%rax,%r12,8) # imm = 0xFFFFFFFE
je 0x138dcf
movq (%rbx), %rax
testb $0x3, (%rax,%r12,4)
jne 0x138dcf
movq %r13, 0x38(%rsp)
movl %r13d, 0x30(%rsp)
movl %r13d, 0x28(%rsp)
movq %r13, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl %r13d, 0x8(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
xorl %esi, %esi
movl %r12d, %edx
movq 0x48(%rsp), %rcx
movq %r15, %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
testq %rax, %rax
je 0x138dcf
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x138da5
movq 0x78(%rsp), %rcx
movq 0xa8(%rsp), %rdx
xorl %esi, %esi
movl (%rdx,%rsi,4), %edi
cmpq %rdi, %r12
je 0x138d9b
cmpl (%rcx), %edi
je 0x138d9b
movq (%rbx), %r8
andl $-0x4, (%r8,%rdi,4)
movl (%rdx,%rsi,4), %edi
incl (%r8,%rdi,4)
movl (%rdx,%rsi,4), %edi
xorq $0x1, %rdi
andl $-0x4, (%r8,%rdi,4)
movl (%rdx,%rsi,4), %edi
xorq $0x1, %rdi
incl (%r8,%rdi,4)
incq %rsi
movl %esi, %edi
cmpq %rdi, %rax
ja 0x138d69
movq (%rbx), %rax
movl (%rax,%r12,4), %ecx
andl $-0x4, %ecx
orl $0x2, %ecx
movl %ecx, (%rax,%r12,4)
movq 0x78(%rsp), %rcx
movl (%rcx), %edx
xorq $0x1, %rdx
andl $-0x4, (%rax,%rdx,4)
movl (%rcx), %ecx
xorq $0x1, %rcx
addl $0x3, (%rax,%rcx,4)
incq %r12
cmpq %rbp, %r12
jne 0x138ccd
xorps %xmm0, %xmm0
movaps %xmm0, 0x100(%rsp)
xorl %eax, %eax
movq %rax, 0x110(%rsp)
movaps %xmm0, 0xe0(%rsp)
movq %rax, 0xf0(%rsp)
cmpl $0x0, 0x40(%rsp)
je 0x138fd2
xorl %r15d, %r15d
movq (%rbx), %rax
movl (%rax,%r15,4), %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x138fc6
movq 0x18(%r14), %rdi
xorl %eax, %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
leaq 0x58(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movq $0x0, 0x38(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %r14, %rsi
movl %r15d, %edx
movq 0x48(%rsp), %rcx
leaq 0x60(%rsp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
testq %rax, %rax
je 0x138fc6
movq 0x98(%rsp), %rax
leal 0x1(%rax), %r13d
cmpq $0x5, %rax
ja 0x138f2b
movl $0x2c, %ecx
btq %rax, %rcx
jae 0x138f2b
cmpq $0x0, 0x98(%rsp)
je 0x138f28
movl %r15d, %r12d
shrl %r12d
xorl %r13d, %r13d
movq 0xa8(%rsp), %rax
movl (%rax,%r13,4), %ecx
cmpq %rcx, %r15
je 0x138f19
movq 0x78(%rsp), %rax
movl (%rax), %r9d
cmpl %r9d, %ecx
je 0x138f19
movq 0x18(%r14), %rdi
shrl %ecx
shrl %r9d
leaq 0x100(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
movl %r12d, %r8d
callq 0x1386d7
movq 0xe0(%rsp), %rax
leaq 0x3(%rax), %rcx
movq 0x98(%rsp), %rdx
cmpq %rdx, %rcx
setne %cl
addq $0x2, %rax
cmpq %rdx, %rax
setne %al
testb %al, %cl
jne 0x138f2b
incl %r13d
cmpq %r13, 0x98(%rsp)
ja 0x138eb2
jmp 0x138f2b
xorl %r13d, %r13d
movl %r13d, %edx
movq 0x30(%rbx), %rcx
movq 0x38(%rbx), %rax
cmpq %rdx, 0x98(%rsp)
jne 0x138f80
cmpq %rax, %rcx
jne 0x138f6a
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x38(%rbx)
movq 0x40(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movl %r15d, (%rcx,%rax,4)
jmp 0x138fc6
cmpq %rax, %rcx
jne 0x138faa
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x38(%rbx)
movq 0x40(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movl %r15d, %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rcx,%rax,4)
incq %r15
cmpq %rbp, %r15
jne 0x138e0e
movq 0x110(%rsp), %rdi
callq 0x2220
movq 0xf0(%rsp), %rdi
callq 0x2220
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rdi
leaq (%rdi,%rax,4), %rsi
callq 0x131a70
movq $0x0, 0x78(%rbx)
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0x139209
leaq 0x18(%rbx), %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
xorl %r12d, %r12d
movq 0x40(%rbx), %rcx
movl (%rcx,%rax,4), %r15d
testl %r15d, %r15d
js 0x139031
incq 0x78(%rbx)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq 0x40(%rsp), %rdx
movl (%rdx), %edx
movl %edx, (%rcx,%rax,4)
movq 0x18(%r14), %rdi
xorl %eax, %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
leaq 0x58(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movq $0x0, 0x38(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %r14, %rsi
movl %r15d, %edx
movq 0x48(%rsp), %rcx
leaq 0x60(%rsp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
testq %rax, %rax
je 0x1391f6
movq 0x50(%rbx), %rax
cmpq %rax, 0x48(%rbx)
jne 0x1390c9
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x50(%rbx)
movq 0x58(%rbx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x58(%rbx)
movq 0x58(%rsp), %rax
movq 0x48(%rbx), %rcx
movq 0x58(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x48(%rbx)
movq %rax, (%rdx,%rcx,8)
movq 0x20(%rbx), %rax
cmpq %rax, 0x18(%rbx)
jne 0x139111
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%rbx)
movq 0x28(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x28(%rbx)
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%rbx)
movl %r15d, (%rdi,%rax,4)
movq 0x20(%rbx), %rax
cmpq %rax, %rcx
jne 0x13914f
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%rbx)
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x28(%rbx)
movq 0x78(%rsp), %rax
movl (%rax), %eax
xorl $0x1, %eax
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x18(%rbx)
movl %eax, (%rdx,%rcx,4)
cmpq $0x0, 0x98(%rsp)
je 0x1391f6
movl $0x1, %ebp
xorl %r13d, %r13d
movq 0xa8(%rsp), %rax
movl (%rax,%r13,4), %eax
cmpl %r15d, %eax
je 0x1391e7
movq 0x78(%rsp), %rcx
cmpl (%rcx), %eax
je 0x1391e7
movq 0x20(%rbx), %rax
cmpq %rax, 0x18(%rbx)
jne 0x1391c8
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%rbx)
movq 0x28(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x28(%rbx)
movq 0xa8(%rsp), %rax
movl (%rax,%r13,4), %eax
movq 0x18(%rbx), %rcx
movq 0x28(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x18(%rbx)
movl %eax, (%rdx,%rcx,4)
movl %ebp, %r13d
incl %ebp
cmpq %r13, 0x98(%rsp)
ja 0x13917f
incl %r12d
movq 0x30(%rbx), %rcx
movq %r12, %rax
cmpq %r12, %rcx
ja 0x139020
movq 0x38(%rbx), %rax
cmpq %rax, %rcx
jne 0x139237
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x38(%rbx)
movq 0x40(%rbx), %rdi
shlq $0x2, %rsi
callq 0x2370
movq %rax, 0x40(%rbx)
movl 0x18(%rbx), %eax
movq 0x40(%rbx), %rcx
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x30(%rbx)
movl %eax, (%rcx,%rdx,4)
movq 0x60(%rsp), %rdi
callq 0x2220
movq 0x78(%rsp), %rdi
callq 0x2220
movq 0x90(%rsp), %rdi
callq 0x2220
movq 0xa8(%rsp), %rdi
callq 0x2220
movq 0xc0(%rsp), %rdi
callq 0x2220
movq 0x30(%rbx), %rcx
movq %rcx, 0x48(%rsp)
leaq -0x1(%rcx), %rax
movq %rax, 0x80(%rbx)
movq 0x18(%r14), %rbp
testl $0x7fffffff, 0x14(%rbp) # imm = 0x7FFFFFFF
movq %r14, %r13
movq 0xd0(%rsp), %r12
movq 0xc8(%rsp), %r14
je 0x13931d
movq 0x48(%rsp), %rax
incl %eax
movl %eax, 0x40(%rsp)
movq (%rbx), %rax
movq %rax, 0xd8(%rsp)
xorl %r15d, %r15d
movq 0x48(%rsp), %rax
movl %eax, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movq %r13, %rdi
movl %r15d, %esi
movq %r14, %rdx
movq %r12, %rcx
movl $0x14, %r8d
movl 0x40(%rsp), %r9d
callq 0x138a12
movq 0xd8(%rsp), %rdx
movl %eax, (%rdx,%r15,4)
incq %r15
movl 0x14(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r15
jb 0x1392d5
movq %rbp, 0x40(%rsp)
cmpq $0x0, 0x80(%rbx)
je 0x139456
movabsq $-0x100000001, %r15     # imm = 0xFFFFFFFEFFFFFFFF
movq 0x28(%rbx), %rcx
movq 0x40(%rbx), %r12
movq 0x58(%rbx), %rax
movq %rax, 0x48(%rsp)
movq 0x70(%rbx), %rdi
xorl %r8d, %r8d
movl (%r12,%r8,4), %r11d
movl 0x4(%r12,%r8,4), %eax
subl %r11d, %eax
leal 0x1(%r11), %r9d
movl (%rcx,%r11,4), %r10d
movl (%rcx,%r9,4), %r9d
movq 0x48(%rsp), %rdx
movq (%rdx,%r8,8), %r14
movq %r14, 0x58(%rsp)
addl $-0x2, %eax
je 0x1393fa
movq %r15, %rdx
leaq (%rcx,%r11,4), %r11
movq (%rbx), %r14
movq 0x50(%rsp), %rsi
movq 0x10(%rsi), %r15
movl %eax, %r13d
xorl %ebp, %ebp
xorl %eax, %eax
movl 0x8(%r11,%rbp,4), %esi
shrl %esi
movl %r8d, (%r14,%rsi,4)
movl 0x8(%r11,%rbp,4), %esi
shrl %esi
leaq (%rsi,%rsi,4), %rsi
addl 0x10(%r15,%rsi,8), %eax
incq %rbp
cmpq %rbp, %r13
jne 0x139397
cmpl $0x4, %eax
movq %rdx, %r15
jb 0x1393fa
movq (%rbx), %r11
movq 0x30(%rbx), %rax
movl %r10d, %r14d
shrl %r14d
movl (%r11,%r14,4), %esi
incq %rax
cmpq %rsi, %rax
je 0x1393e3
movl $0xffffffff, (%r11,%r14,4) # imm = 0xFFFFFFFF
movl %r9d, %r14d
shrl %r14d
movl (%r11,%r14,4), %esi
cmpq %rsi, %rax
je 0x1393fa
movl $0xffffffff, (%r11,%r14,4) # imm = 0xFFFFFFFF
shrl %r10d
movq (%rdi,%r10,8), %rax
cmpq $-0x1, %rax
je 0x139415
cmpq %r15, %rax
jbe 0x139420
shlq $0x20, %rax
orq %r8, %rax
jmp 0x13941c
leaq (%r15,%r8), %rax
incq %rax
movq %rax, (%rdi,%r10,8)
shrl %r9d
movq (%rdi,%r9,8), %rax
cmpq $-0x1, %rax
je 0x13943b
cmpq %r15, %rax
jbe 0x139446
shlq $0x20, %rax
orq %r8, %rax
jmp 0x139442
leaq (%r15,%r8), %rax
incq %rax
movq %rax, (%rdi,%r9,8)
incl %r8d
cmpq %r8, 0x80(%rbx)
ja 0x139352
movq 0x40(%rsp), %r12
testl $0x7fffffff, 0x14(%r12) # imm = 0x7FFFFFFF
movq 0x50(%rsp), %rdi
je 0x139498
movq (%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x1(%rcx), %rdx
xorl %esi, %esi
movl (%rax,%rsi,4), %r8d
cmpq %r8, %rdx
jne 0x139484
movl %ecx, (%rax,%rsi,4)
incq %rsi
movl 0x14(%r12), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
cmpq %r8, %rsi
jb 0x139478
xorps %xmm0, %xmm0
movups %xmm0, 0xb8(%rbx)
movq %rbx, %rsi
callq 0x13957e
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq