// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: identify_bubbles_recal_poy(asg_t*, ma_ug_t*, bubble_type*, unsigned char*, ma_hit_t_alloc*, R_to_U*, kv_u_trans_t*)
void identify_bubbles_recal_poy(asg_t* sg, ma_ug_t* ug, bubble_type* bub, uint8_t *r_het_flag, ma_hit_t_alloc* sources, R_to_U* ruIndex,
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, hom_cov, het_cov, m_het_cov, m_hom_cov;
    bub->ug = ug; 
    bub->b_bub = bub->b_end_bub = bub->tangle_bub = bub->cross_bub = bub->mess_bub = 0;
    if(asm_opt.hom_global_coverage_set) {
        hom_cov = asm_opt.hom_global_coverage;
    } else {
        hom_cov = ((double)asm_opt.hom_global_coverage)/((double)HOM_PEAK_RATE);
    }
    het_cov = hom_cov/asm_opt.polyploidy;
    m_het_cov = het_cov + (het_cov*0.333333);///hom_cov - het_cov + (het_cov*0.333333);
    m_hom_cov = het_cov + (het_cov*0.6);///hom_cov - het_cov + (het_cov*0.6);
    // fprintf(stderr, "hom_cov::%lu, het_cov::%lu, m_het_cov::%lu, m_hom_cov::%lu\n",  hom_cov, het_cov, m_het_cov, m_hom_cov);

    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;
    

    memset(r_het_flag, 0, sizeof((*r_het_flag))*sg->n_seq);
    for (i = 0; i < ug->g->n_seq; i++) {
        bub->index[i] = get_unitig_het_fly(ug, i, sg, m_het_cov, m_hom_cov,
        sources, ruIndex, r_het_flag, 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(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);
    }
    
    bub->b_g = NULL;
    bub->b_ug = NULL;
    build_bub_graph(ug, bub);


    ///make het nodes to be hom
    ma_utg_t *u = NULL;
    for (i = 0; i < bub->b_ug->u.n; i++) {
        u = &(bub->b_ug->u.a[i]);
        if(u->n == 0) continue;
        for (k = 0; k < u->n; k++) {
            reset_inner_bub_het_poy(sg, ug, bub, u->a[k]>>33, tLen, &b, m_het_cov, m_hom_cov, r_het_flag, sources, ruIndex);   
        }
    }
    free(b.a); free(b.S.a); free(b.T.a); free(b.b.a); free(b.e.a);

    for (i = 0; i < ug->g->n_seq; i++) {
        if(IF_HOM(i, *bub)) continue;
        if(deter_unitig_het_fly(ug, i, sg, het_cov*1.15, sources, ruIndex, r_het_flag)) continue;
        bub->index[i] = (uint32_t)-1;
    }
    // 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 $0x148, %rsp            # imm = 0x148
movq %r9, %rbx
movq %r8, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %rbp
movq %rdi, 0x70(%rsp)
movq 0x18(%rsi), %rdi
callq 0xa02fa
movq 0x18(%rbp), %rdi
cmpl $0x0, 0x14(%rdi)
js 0x13abf9
callq 0xa047e
movq %rbx, 0x60(%rsp)
movq 0x18(%rbp), %rbx
movl 0x14(%rbx), %r12d
addl %r12d, %r12d
movq 0x8(%rsp), %r15
movq %rbp, 0x10(%r15)
xorps %xmm2, %xmm2
movups %xmm2, 0x88(%r15)
movups %xmm2, 0x98(%r15)
xorl %ecx, %ecx
movq %rcx, 0xa8(%r15)
leaq 0x14fb23(%rip), %rdx    # 0x28a758
movslq 0x144(%rdx), %rsi
cvtsi2sd %esi, %xmm0
divsd 0xeef20(%rip), %xmm0    # 0x229b68
cvttsd2si %xmm0, %rdi
subsd 0xea613(%rip), %xmm0    # 0x225268
cvttsd2si %xmm0, %r8
movq %rdi, %rax
sarq $0x3f, %rax
andq %r8, %rax
orq %rdi, %rax
cmpl $0x0, 0x148(%rdx)
cmovneq %rsi, %rax
movslq 0x1bc(%rdx), %rsi
xorl %edx, %edx
divq %rsi
movq %rax, %xmm0
punpckldq 0xea5b5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xea5bd(%rip), %xmm0    # 0x225250
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0xea8b1(%rip), %xmm0    # 0x225558
mulsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0xea7cf(%rip), %xmm0    # 0x225488
movapd %xmm1, 0xf0(%rsp)
mulsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
leaq 0x80(%rsp), %r14
movq %rcx, 0x60(%r14)
movaps %xmm2, 0x50(%r14)
movaps %xmm2, 0x40(%r14)
movaps %xmm2, 0x30(%r14)
movaps %xmm2, 0x20(%r14)
movaps %xmm2, 0x10(%r14)
movaps %xmm2, (%r14)
movl $0x1c, %esi
movq %r12, %rdi
callq 0x2120
movq %rax, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbf22d
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%r15)
movupd %xmm0, 0x28(%r15)
movupd %xmm0, 0x38(%r15)
movupd %xmm0, 0x48(%r15)
movupd %xmm0, 0x58(%r15)
movupd %xmm0, 0x68(%r15)
movq 0x18(%rbp), %rbx
movl 0x14(%rbx), %eax
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rax
movq %rax, 0x68(%r15)
movl 0x14(%rbx), %edi
andq %r14, %rdi
shlq $0x3, %rdi
callq 0x2280
movq %rax, 0x70(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0xc0(%r15)
movupd %xmm0, 0xd0(%r15)
movl 0x14(%rbx), %edx
andq %r14, %rdx
movq %rdx, 0x60(%r15)
shlq $0x3, %rdx
movq %rax, %rdi
movl $0xff, %esi
callq 0x20e0
movl $0x4, %esi
movq %r12, %rdi
callq 0x2120
movq %r15, %r9
movq %rax, (%r15)
testl $0x7fffffff, 0x14(%rbx) # imm = 0x7FFFFFFF
je 0x13adcd
movq 0x20(%rbx), %rax
xorl %ecx, %ecx
movb $0x0, 0x4(%rax,%rcx,8)
incq %rcx
movl 0x14(%rbx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpq %rdx, %rcx
jb 0x13adb7
movapd 0xf0(%rsp), %xmm0
movapd 0x30(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
movapd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movl %r12d, %eax
movq %rax, 0x10(%rsp)
testl %r12d, %r12d
je 0x13af39
xorl %ebx, %ebx
leaq 0x80(%rsp), %r14
xorl %r15d, %r15d
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rax
movl %r15d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x13af2b
movq 0x28(%rdi), %rax
testl $0xfffffffe, (%rax,%r15,8) # imm = 0xFFFFFFFE
je 0x13af2b
movq (%r9), %rax
testb $0x3, (%rax,%r15,4)
jne 0x13af2b
subq $0x40, %rsp
movq %rbx, 0x38(%rsp)
movl %ebx, 0x30(%rsp)
movl %ebx, 0x28(%rsp)
movq %rbx, 0x20(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
movl %ebx, 0x8(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
xorl %esi, %esi
movl %r15d, %edx
movq 0x80(%rsp), %rcx
movq %r14, %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
movq 0x48(%rsp), %r9
addq $0x40, %rsp
testq %rax, %rax
je 0x13af2b
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0x13aefe
movq 0x98(%rsp), %rcx
movq 0xc8(%rsp), %rdx
xorl %esi, %esi
movl (%rdx,%rsi,4), %edi
cmpq %rdi, %r15
je 0x13aef4
cmpl (%rcx), %edi
je 0x13aef4
movq (%r9), %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 0x13aec2
movq (%r9), %rax
movl (%rax,%r15,4), %ecx
andl $-0x4, %ecx
orl $0x2, %ecx
movl %ecx, (%rax,%r15,4)
movq 0x98(%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 %r15
cmpq 0x10(%rsp), %r15
jne 0x13ae14
movq %rbp, 0x18(%rsp)
movapd 0x30(%rsp), %xmm0
cvttsd2si %xmm0, %rbx
movsd 0xea317(%rip), %xmm1    # 0x225268
subsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movapd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %r14
subsd %xmm1, %xmm0
movapd %xmm0, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x120(%rsp)
xorl %eax, %eax
movq %rax, 0x130(%rsp)
movapd %xmm0, 0x100(%rsp)
movq %rax, 0x110(%rsp)
testl %r12d, %r12d
movq 0x40(%rsp), %r15
movq %rbx, %r13
movq %r14, %r12
je 0x13b1aa
xorl %ebp, %ebp
movq (%r9), %rax
movl (%rax,%rbp,4), %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x13b19c
movq 0x18(%rsp), %rsi
movq 0x18(%rsi), %rdi
subq $0x40, %rsp
xorl %eax, %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x28(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%rsp)
leaq 0xb8(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movq $0x0, 0x38(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movl %ebp, %edx
movq %r15, %rcx
leaq 0xc0(%rsp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
movq 0x48(%rsp), %r9
addq $0x40, %rsp
testq %rax, %rax
je 0x13b19c
movq 0xb8(%rsp), %rax
leal 0x1(%rax), %r14d
cmpq $0x5, %rax
ja 0x13b0e8
movl $0x2c, %ecx
btq %rax, %rcx
jae 0x13b0e8
cmpq $0x0, 0xb8(%rsp)
je 0x13b0e5
movl %ebp, %ebx
shrl %ebx
xorl %r14d, %r14d
movq 0xc8(%rsp), %rax
movl (%rax,%r14,4), %ecx
cmpq %rcx, %rbp
je 0x13b0d6
movq 0x98(%rsp), %rax
movl (%rax), %r9d
cmpl %r9d, %ecx
je 0x13b0d6
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
shrl %ecx
shrl %r9d
leaq 0x120(%rsp), %rsi
leaq 0x100(%rsp), %rdx
movl %ebx, %r8d
callq 0x1386d7
movq 0x100(%rsp), %rax
leaq 0x3(%rax), %rcx
movq 0xb8(%rsp), %rdx
cmpq %rdx, %rcx
setne %cl
addq $0x2, %rax
cmpq %rdx, %rax
setne %al
testb %al, %cl
jne 0x13b0e8
incl %r14d
cmpq %r14, 0xb8(%rsp)
ja 0x13b067
jmp 0x13b0e8
xorl %r14d, %r14d
movl %r14d, %edx
movq 0x8(%rsp), %r9
movq 0x30(%r9), %rcx
movq 0x38(%r9), %rax
cmpq %rdx, 0xb8(%rsp)
jne 0x13b14c
cmpq %rax, %rcx
movq %r13, %rbx
movq %r12, %r14
jne 0x13b137
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x38(%r9)
movq 0x40(%r9), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq %rax, 0x40(%r9)
movq 0x30(%r9), %rax
movq 0x40(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%r9)
movl %ebp, (%rcx,%rax,4)
jmp 0x13b19c
cmpq %rax, %rcx
movq %r13, %rbx
movq %r12, %r14
jne 0x13b181
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x38(%r9)
movq 0x40(%r9), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq %rax, 0x40(%r9)
movq 0x30(%r9), %rax
movq 0x40(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%r9)
movl %ebp, %edx
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rcx,%rax,4)
incq %rbp
cmpq 0x10(%rsp), %rbp
jne 0x13afae
sarq $0x3f, %rbx
movq %rbx, 0x68(%rsp)
cvttsd2si 0x30(%rsp), %rax
movq %rax, 0x30(%rsp)
sarq $0x3f, %r14
movq %r14, 0x48(%rsp)
cvttsd2si 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x130(%rsp), %rdi
callq 0x2220
movq 0x110(%rsp), %rdi
callq 0x2220
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rdi
leaq (%rdi,%rax,4), %rsi
callq 0x131a70
movq 0x8(%rsp), %r8
movq $0x0, 0x78(%r8)
movq 0x30(%r8), %rcx
testq %rcx, %rcx
je 0x13b44c
leaq 0x18(%r8), %rax
movq %rax, 0x10(%rsp)
xorl %eax, %eax
xorl %ebx, %ebx
movq 0x40(%r8), %rcx
movl (%rcx,%rax,4), %ebp
testl %ebp, %ebp
js 0x13b23f
incq 0x78(%r8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdx
movl (%rdx), %edx
movl %edx, (%rcx,%rax,4)
movq 0x18(%rsp), %rsi
movq 0x18(%rsi), %rdi
subq $0x40, %rsp
xorl %eax, %eax
movl %eax, 0x30(%rsp)
movl %eax, 0x28(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%rsp)
leaq 0xb8(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movq $0x0, 0x38(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movl %ebp, %edx
movq %r15, %rcx
leaq 0xc0(%rsp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0xbf39f
movq 0x48(%rsp), %r8
addq $0x40, %rsp
testq %rax, %rax
je 0x13b435
movq 0x50(%r8), %rax
cmpq %rax, 0x48(%r8)
jne 0x13b2ef
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x50(%r8)
movq 0x58(%r8), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x58(%r8)
movq 0x78(%rsp), %rax
movq 0x48(%r8), %rcx
movq 0x58(%r8), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x48(%r8)
movq %rax, (%rdx,%rcx,8)
movq 0x20(%r8), %rax
cmpq %rax, 0x18(%r8)
jne 0x13b33c
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r8)
movq 0x28(%r8), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x28(%r8)
movq 0x18(%r8), %rax
movq 0x28(%r8), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r8)
movl %ebp, (%rdi,%rax,4)
movq 0x20(%r8), %rax
cmpq %rax, %rcx
jne 0x13b37e
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r8)
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x28(%r8)
movq 0x98(%rsp), %rax
movl (%rax), %eax
xorl $0x1, %eax
movq 0x18(%r8), %rcx
movq 0x28(%r8), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x18(%r8)
movl %eax, (%rdx,%rcx,4)
cmpq $0x0, 0xb8(%rsp)
je 0x13b435
movl $0x1, %r14d
xorl %r15d, %r15d
movq 0xc8(%rsp), %rax
movl (%rax,%r15,4), %eax
cmpl %ebp, %eax
je 0x13b425
movq 0x98(%rsp), %rcx
cmpl (%rcx), %eax
je 0x13b425
movq 0x20(%r8), %rax
cmpq %rax, 0x18(%r8)
jne 0x13b406
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r8)
movq 0x28(%r8), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x28(%r8)
movq 0xc8(%rsp), %rax
movl (%rax,%r15,4), %eax
movq 0x18(%r8), %rcx
movq 0x28(%r8), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x18(%r8)
movl %eax, (%rdx,%rcx,4)
movl %r14d, %r15d
incl %r14d
cmpq %r15, 0xb8(%rsp)
ja 0x13b3b6
incl %ebx
movq 0x30(%r8), %rcx
movq %rbx, %rax
cmpq %rbx, %rcx
movq 0x40(%rsp), %r15
ja 0x13b230
movq 0x30(%rsp), %rbx
andq 0x68(%rsp), %rbx
movq 0x20(%rsp), %r14
andq 0x48(%rsp), %r14
movq 0x38(%r8), %rax
cmpq %rax, %rcx
movq 0x70(%rsp), %r15
jne 0x13b498
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x38(%r8)
movq 0x40(%r8), %rdi
shlq $0x2, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x40(%r8)
orq %rbx, %r13
movq %r13, 0x10(%rsp)
orq %r14, %r12
movq %r12, 0x30(%rsp)
movl 0x18(%r8), %eax
movq 0x40(%r8), %rcx
movq 0x30(%r8), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x30(%r8)
movl %eax, (%rcx,%rdx,4)
movq %rdx, 0x80(%r8)
movl 0x14(%r15), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq 0x50(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x8(%rsp), %rdx
movq %r15, %r13
movq 0x18(%rsp), %r15
movq 0x18(%r15), %rax
testl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
movq 0x60(%rsp), %r14
movq 0x58(%rsp), %rbp
je 0x13b557
xorl %ebx, %ebx
movl 0x30(%rdx), %eax
movq %r15, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq 0x10(%rsp), %rcx
movq 0x30(%rsp), %r8
movq %rbp, %r9
pushq $-0x1
movl %eax, %r10d
incl %r10d
pushq %rax
pushq %r10
pushq $0x14
pushq %r12
pushq %r14
callq 0x1395fa
movq 0x38(%rsp), %rdx
addq $0x30, %rsp
movq (%rdx), %rcx
movl %eax, (%rcx,%rbx,4)
incq %rbx
movq 0x18(%r15), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rbx
jb 0x13b505
cmpq $0x0, 0x80(%rdx)
je 0x13b690
movabsq $-0x100000001, %r12     # imm = 0xFFFFFFFEFFFFFFFF
movq 0x8(%rsp), %rcx
movq 0x28(%rcx), %rdx
movq 0x40(%rcx), %r13
movq 0x58(%rcx), %rsi
movq %rsi, 0x20(%rsp)
movq 0x70(%rcx), %r8
xorl %r9d, %r9d
movl (%r13,%r9,4), %edi
movl 0x4(%r13,%r9,4), %ecx
subl %edi, %ecx
leal 0x1(%rdi), %r10d
movl (%rdx,%rdi,4), %r11d
movl (%rdx,%r10,4), %r10d
movq 0x20(%rsp), %rsi
movq (%rsi,%r9,8), %rbx
movq %rbx, 0x78(%rsp)
addl $-0x2, %ecx
je 0x13b62f
leaq (%rdx,%rdi,4), %rbx
movq 0x8(%rsp), %rsi
movq (%rsi), %r14
movq 0x10(%r15), %r15
movl %ecx, %ebp
xorl %ecx, %ecx
xorl %edi, %edi
movl 0x8(%rbx,%rcx,4), %esi
shrl %esi
movl %r9d, (%r14,%rsi,4)
movl 0x8(%rbx,%rcx,4), %esi
shrl %esi
leaq (%rsi,%rsi,4), %rsi
addl 0x10(%r15,%rsi,8), %edi
incq %rcx
cmpq %rcx, %rbp
jne 0x13b5cd
cmpl $0x4, %edi
movq 0x18(%rsp), %r15
jb 0x13b62f
movq 0x8(%rsp), %rcx
movq (%rcx), %rbx
movq 0x30(%rcx), %rcx
movl %r11d, %edi
shrl %edi
movl (%rbx,%rdi,4), %esi
incq %rcx
cmpq %rsi, %rcx
je 0x13b61b
movl $0xffffffff, (%rbx,%rdi,4) # imm = 0xFFFFFFFF
movl %r10d, %edi
shrl %edi
movl (%rbx,%rdi,4), %esi
cmpq %rsi, %rcx
je 0x13b62f
movl $0xffffffff, (%rbx,%rdi,4) # imm = 0xFFFFFFFF
shrl %r11d
movq (%r8,%r11,8), %rcx
cmpq $-0x1, %rcx
je 0x13b64a
cmpq %r12, %rcx
jbe 0x13b655
shlq $0x20, %rcx
orq %r9, %rcx
jmp 0x13b651
leaq (%r12,%r9), %rcx
incq %rcx
movq %rcx, (%r8,%r11,8)
shrl %r10d
movq (%r8,%r10,8), %rcx
cmpq $-0x1, %rcx
je 0x13b670
cmpq %r12, %rcx
jbe 0x13b67b
shlq $0x20, %rcx
orq %r9, %rcx
jmp 0x13b677
leaq (%r12,%r9), %rcx
incq %rcx
movq %rcx, (%r8,%r10,8)
incl %r9d
movq 0x8(%rsp), %rcx
cmpq %r9, 0x80(%rcx)
ja 0x13b58c
testl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
movq 0x8(%rsp), %rsi
je 0x13b6ca
movq (%rsi), %rcx
movq 0x30(%rsi), %rdx
leaq 0x1(%rdx), %r9
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
cmpq %r8, %r9
jne 0x13b6b7
movl %edx, (%rcx,%rdi,4)
incq %rdi
movl 0x14(%rax), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
cmpq %r8, %rdi
jb 0x13b6ab
xorpd %xmm0, %xmm0
movupd %xmm0, 0xb8(%rsi)
movq %r15, %rdi
callq 0x13957e
movq 0x8(%rsp), %rdx
movq 0xc0(%rdx), %rax
cmpq $0x0, (%rax)
je 0x13b7c8
leaq 0xc0(%rdx), %rcx
movq %rcx, 0x48(%rsp)
xorl %ecx, %ecx
leaq 0x80(%rsp), %r13
movq 0x40(%rsp), %r15
movq 0x10(%rax), %rax
movq %rcx, 0x68(%rsp)
leaq (%rcx,%rcx,4), %rcx
cmpl $0x0, 0x10(%rax,%rcx,8)
movq 0x60(%rsp), %r10
movq 0x58(%rsp), %r11
movq 0x50(%rsp), %r12
movq 0x10(%rsp), %r14
movq 0x30(%rsp), %rbp
je 0x13b7b0
leaq (%rax,%rcx,8), %rcx
cmpl $0x0, 0x10(%rcx)
je 0x13b7b0
xorl %ebx, %ebx
movq %rcx, 0x20(%rsp)
movq 0x18(%rcx), %rax
movq (%rax,%rbx,8), %rcx
shrq $0x21, %rcx
subq $0x8, %rsp
movq 0x78(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %r15, %r8
movq %r13, %r9
pushq %r10
pushq %r11
pushq %r12
pushq %rbp
pushq %r14
movq %r12, %r14
movq %r10, %r12
movq %r11, %rbp
callq 0x13a521
movq 0x50(%rsp), %rcx
movq %rbp, %r11
movq 0x60(%rsp), %rbp
movq %r12, %r10
movq %r14, %r12
movq 0x40(%rsp), %r14
movq 0x38(%rsp), %rdx
addq $0x30, %rsp
incq %rbx
movl 0x10(%rcx), %eax
cmpq %rax, %rbx
jb 0x13b74d
movq 0x68(%rsp), %rcx
incl %ecx
movq 0x48(%rsp), %rax
movq (%rax), %rax
cmpq %rcx, (%rax)
ja 0x13b70f
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0x98(%rsp), %rdi
callq 0x2220
movq 0xb0(%rsp), %rdi
callq 0x2220
movq 0xc8(%rsp), %rdi
callq 0x2220
movq 0xe0(%rsp), %rdi
callq 0x2220
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rbp
movq 0x18(%rbp), %rax
testl $0x7fffffff, 0x14(%rax) # imm = 0x7FFFFFFF
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r13
movq 0x50(%rsp), %r12
je 0x13b8a9
movapd 0xf0(%rsp), %xmm0
mulsd 0xee370(%rip), %xmm0    # 0x229bb0
cvttsd2si %xmm0, %rbx
xorl %r14d, %r14d
movq (%rdx), %rax
movq 0x80(%rdx), %rcx
movl (%rax,%r14,4), %eax
incq %rcx
cmpq %rax, %rcx
jb 0x13b895
subq $0x8, %rsp
movq %rbp, %rdi
movl %r14d, %esi
movq 0x78(%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r8
movq %r15, %r9
pushq %r12
callq 0x13a870
movq 0x18(%rsp), %rdx
addq $0x10, %rsp
testl %eax, %eax
jne 0x13b895
movq (%rdx), %rax
movl $0xffffffff, (%rax,%r14,4) # imm = 0xFFFFFFFF
incq %r14
movq 0x18(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jb 0x13b848
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq