// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: gen_rphase_dp0_single_path(SnpStats*, long, haplotype_evdience*, Chain_Data*, asg64_v*, long, long, long, double, unsigned long, asg64_v*, unsigned char*)
void gen_rphase_dp0_single_path(SnpStats *a, int64_t an, haplotype_evdience *za, Chain_Data *dp, asg64_v *idx, int64_t het_cov, int64_t hom_cov, int64_t n_hap, double cut_rate, uint64_t cut_bd, asg64_v *res, uint8_t *qual_a)
{
    if(an <= 0) return;
    int64_t *p, i, k, j, st, max_f, max_j, sc, ch_n, plus = 0, rn, rn0; int32_t *f, *ii; uint64_t m, cc = 0;
    resize_Chain_Data(dp, an, NULL); idx->n = res->n = 0;
    f = dp->score; p = dp->pre; ii = dp->occ;
    cc = ((het_cov > 0)?(het_cov):(hom_cov/n_hap)); cc *= cut_rate; if(cc < cut_bd) cc = cut_bd;

    // fprintf(stderr, "\n\n\n[M::%s]\tcc::%lu\n\n\n", __func__, cc);

    for (i = 0; i < an; ++i) {
        max_f = 1; max_j = -1; 
        st = 0; ///if(a[i].occ_0 < cc) st = i;
        for (j = i - 1; j >= st; --j) {
            sc = comput_sc_rphase(&a[i], i, &a[j], j, za, 0/**cc**/);
            if (sc == INT64_MIN) continue;
            sc += f[j];
            if (sc > max_f) {
                max_f = sc; max_j = j;
            } 
        }

        f[i] = max_f; p[i] = max_j; ii[i] = 0;
        if(f[i] < plus) plus = f[i];
    }

    for (i = 0; i < an; i++) {
        f[i] -= plus;
        m = f[i]; m = ((uint32_t)-1) - m; m <<= 32; m |= i;
        kv_push(uint64_t, *idx, m);
    }
    radix_sort_bc64(idx->a, idx->a + idx->n);

    kv_resize(uint64_t, *res, ((uint64_t)an));
    for (i = rn = 0; i < an; i++) {///idx->a:: [0, ch_n) -> tree; [ch_n, ch_n + an) -> sort; [ch_n + an, -1) -> path
        rn0 = rn;
        for(k = (uint32_t)idx->a[i]; (k >= 0) && (!ii[k]);) {
            res->a[rn++] = k; ii[k] = 1; k = p[k];
        }
        if(rn0 == rn) continue;
        m = rn - rn0; m = ((uint32_t)-1) - m; m <<= 32; m |= rn0;
        kv_push(uint64_t, *idx, m);
    }

    radix_sort_bc64(idx->a + an, idx->a + idx->n);
    ch_n = idx->n; 
    if(!qual_a) {    
        for (k = an; k < ch_n; k++) {
            rn0 = ((uint32_t)idx->a[k]);
            rn = ((uint32_t)-1) - (idx->a[k]>>32);
            // break;
            plus = -1;
            if(rn > 1) {
                // for (i = 0; (i < rn) && (is_hpc_vec(&(a[res->a[rn0+rn-i-1]]), res->a[rn0+rn-i-1], za)); i++);
                // plus = ((i < rn)?(1):(-1));
                plus = 1;
                
                // for (i = 0; i < rn; i++) {
                //     a[res->a[rn0+rn-i-1]].score = plus;
                //     // fprintf(stderr, "pos::%u\tsc::%ld\tn0::%u\tn1::%u\tn2::%u\tk::%lu\n", a[res->a[rn0+rn-i-1]].site, plus, a[res->a[rn0+rn-i-1]].occ_0, a[res->a[rn0+rn-i-1]].occ_1, 
                //     // 1 + a[res->a[rn0+rn-i-1]].homopolymer_num - a[res->a[rn0+rn-i-1]].non_homopolymer_num - a[res->a[rn0+rn-i-1]].occ_0 - a[res->a[rn0+rn-i-1]].occ_1, res->a[rn0+rn-i-1]);
                // }
                
            } else {
                if((!is_hpc_vec(&(a[res->a[rn0]]), res->a[rn0], za)) && (a[res->a[rn0]].occ_0 >= cc)) plus = 1;
                ///a[res->a[rn0]].score = plus;
                // fprintf(stderr, "pos::%u\tsc::%ld\tn0::%u\tn1::%u\tn2::%u\tk::%lu\n", a[res->a[rn0]].site, plus, a[res->a[rn0]].occ_0, a[res->a[rn0]].occ_1, 
                // 1 + a[res->a[rn0]].homopolymer_num - a[res->a[rn0]].non_homopolymer_num - a[res->a[rn0]].occ_0 - a[res->a[rn0]].occ_1, res->a[rn0]);
            }

            // fprintf(stderr, "\n[M::%s]\tcnt::%lu\tplus::%ld\n", __func__, rn, plus);
            // if(plus > 0) {
            //     for (i = 0; (i < rn) && (a[res->a[rn0 + i]].occ_0 < cc); i++);
            //     if(i < rn) {
            //         for (i = 0; i < rn; i++) a[res->a[rn0 + i]].score = plus;
            //     }
            // }
            for (i = 0; i < rn; i++) {
                if(a[res->a[rn0 + i]].occ_0 >= cc) {
                    a[res->a[rn0 + i]].score = plus;
                } else {
                    a[res->a[rn0 + i]].score = -1;
                }
                // fprintf(stderr, "pos::%u\tsc::%d\tn0::%u\tn1::%u\tn2::%u\tk::%lu\n", a[res->a[rn0 + i]].site, a[res->a[rn0 + i]].score, a[res->a[rn0 + i]].occ_0, a[res->a[rn0 + i]].occ_1, 
                //     1 + a[res->a[rn0 + i]].homopolymer_num - a[res->a[rn0 + i]].non_homopolymer_num - a[res->a[rn0 + i]].occ_0 - a[res->a[rn0 + i]].occ_1, res->a[rn0 + i]);
            }
        }
   } else {
        int64_t b0l, b0h, b1l, b1h, krn;
        /**
        for (k = an; k < ch_n; k++) {
            rn0 = ((uint32_t)idx->a[k]);
            rn = ((uint32_t)-1) - (idx->a[k]>>32);
            // break;
            fprintf(stderr, "\n[M::%s]\tcnt::%lu\n", __func__, rn);
            if(rn > 1) {
                for (i = 0; i < rn; i++) {
                    get_hq_value(&(a[res->a[rn0 + i]]), res->a[rn0 + i], za, &b0l, &b0h, &b1l, &b1h, qual_a);
                    if(b0h > b0l && b0h >= asm_opt.s_hap_cov && b1h > b1l && b1h >= asm_opt.infor_cov) {
                        a[res->a[rn0 + i]].score = 1;
                    } else {
                        a[res->a[rn0 + i]].score = -1;
                    }
                    fprintf(stderr, "pos::%u\tsc::%d\tn0::%u\tn1::%u\tn2::%u\tk::%lu\tb0l::%ld\tb0h::%ld\tb1l::%ld\tb1h::%ld\n", a[res->a[rn0 + i]].site, a[res->a[rn0 + i]].score, a[res->a[rn0 + i]].occ_0, a[res->a[rn0 + i]].occ_1, 
                    1 + a[res->a[rn0 + i]].homopolymer_num - a[res->a[rn0 + i]].non_homopolymer_num - a[res->a[rn0 + i]].occ_0 - a[res->a[rn0 + i]].occ_1, res->a[rn0 + i], b0l, b0h, b1l, b1h);
                }
            } else {
                if((!is_hpc_vec(&(a[res->a[rn0]]), res->a[rn0], za))) {
                    get_hq_value(&(a[res->a[rn0]]), res->a[rn0], za, &b0l, &b0h, &b1l, &b1h, qual_a);
                    if(((b0h > b0l) && (b0h > ((b0h + b0l)*0.7)) && (b0h >= asm_opt.s_hap_cov) && (b0h >= (int64_t)cc)) && 
                            ((b1h > b1l) && (b1h > ((b1h + b1l)*0.7)) && (b1h >= asm_opt.infor_cov) && (b1h >= (int64_t)cc))) {
                        a[res->a[rn0]].score = 1;
                    } else {
                        a[res->a[rn0]].score = -1;
                    }
                }
            }
        }
        **/
       for (k = an; k < ch_n; k++) {
            rn0 = ((uint32_t)idx->a[k]);
            rn = ((uint32_t)-1) - (idx->a[k]>>32);
            krn = rn;
            // break;
            
            for (i = 1; (i < rn) && ((a[res->a[rn0 + i]].site + 8) >= a[res->a[rn0 + i - 1]].site); i++);
            if(i >= rn) krn = 1;
            // fprintf(stderr, "\n[M::%s]\tcnt::%lu\tkrn::%ld\n", __func__, rn, krn);

            for (i = 0; i < rn; i++) {
                get_hq_value(&(a[res->a[rn0 + i]]), res->a[rn0 + i], za, &b0l, &b0h, &b1l, &b1h, qual_a);
                if(krn > 1) {
                    if(b0h > b0l && b0h >= asm_opt.s_hap_cov && b1h > b1l && b1h >= asm_opt.infor_cov) {
                        a[res->a[rn0 + i]].score = 1;
                    } else {
                        a[res->a[rn0 + i]].score = -1;
                    }
                } else {
                    if(((b0h > b0l) && (b0h > ((b0h + b0l)*0.7)) && (b0h >= asm_opt.s_hap_cov) && (b0h >= (int64_t)cc)) && 
                            ((b1h > b1l) && (b1h > ((b1h + b1l)*0.7)) && (b1h >= asm_opt.infor_cov) && (b1h >= (int64_t)cc))) {
                        a[res->a[rn0 + i]].score = 1;
                    } else {
                        a[res->a[rn0 + i]].score = -1;
                    }
                }
                
                // fprintf(stderr, "pos::%u\tsc::%d\tn0::%u\tn1::%u\tn2::%u\tk::%lu\tb0l::%ld\tb0h::%ld\tb1l::%ld\tb1h::%ld\n", a[res->a[rn0 + i]].site, a[res->a[rn0 + i]].score, a[res->a[rn0 + i]].occ_0, a[res->a[rn0 + i]].occ_1, 
                // 1 + a[res->a[rn0 + i]].homopolymer_num - a[res->a[rn0 + i]].non_homopolymer_num - a[res->a[rn0 + i]].occ_0 - a[res->a[rn0 + i]].occ_1, res->a[rn0 + i], b0l, b0h, b1l, b1h);
            }

            for (i = j = 0; i < rn; i = j) {
                plus = a[res->a[rn0 + i]].score;
                for (j = i + 1; (j < rn) && ((a[res->a[rn0 + i]].site-a[res->a[rn0 + j]].site) == (j-i)); j++) {
                    if(a[res->a[rn0 + j]].score == -1) plus = -1;
                }
                // fprintf(stderr, "[M::%s]\ti::%ld\tj::%ld\tplus::%ld\n", __func__, i, j, plus);
                if(plus == -1) {
                    for (; i < j; i++) {
                        a[res->a[rn0 + i]].score = plus;
                    }
                } 
            }
            
        }
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, 0x48(%rsp)
testq %rsi, %rsi
jle 0x25d1d
movq %r9, %r15
movq %r8, %r13
movq %rcx, %rbx
movq %rsi, %rbp
movq %rdi, %r12
movsd %xmm0, 0x8(%rsp)
movq 0xc8(%rsp), %r14
movq %rcx, %rdi
xorl %edx, %edx
callq 0x1383e
andq $0x0, (%r14)
andq $0x0, (%r13)
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x20(%rbx), %r14
testq %r15, %r15
jg 0x256bd
movq 0xb0(%rsp), %rax
cqto
idivq 0xb8(%rsp)
movq %rax, %r15
movq %r15, %xmm0
punpckldq 0x1bdba6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1bdbae(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x8(%rsp), %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x1bdba4(%rip), %xmm1   # 0x1e3298
cvttsd2si %xmm1, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x60(%rsp)
leaq -0x28(%r12), %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r15d, %r15d
movq %r13, 0x30(%rsp)
movq %rbp, 0x20(%rsp)
cmpq %rbp, %r15
je 0x257f6
imulq $0x28, %r15, %r13
addq %r12, %r13
pushq $0x1
popq %rax
movq %rax, 0x8(%rsp)
pushq $-0x1
popq %rax
movq %rax, 0x18(%rsp)
movq %r15, %rbp
imulq $0x28, %rbp, %rbx
addq 0x38(%rsp), %rbx
testq %rbp, %rbp
jle 0x257ae
decq %rbp
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movq 0x48(%rsp), %r8
xorl %r9d, %r9d
callq 0x53aca
addq $-0x28, %rbx
movq %rax, %rcx
negq %rcx
jo 0x25754
movq 0x10(%rsp), %rcx
movslq (%rcx,%rbp,4), %rcx
addq %rcx, %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
cmovgq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %rax
cmovgq %rbp, %rax
movq %rax, 0x18(%rsp)
jmp 0x2574b
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movl %eax, (%rcx,%r15,4)
movq 0x40(%rsp), %rax
movq 0x18(%rsp), %rdx
movq %rdx, (%rax,%r15,8)
andl $0x0, (%r14,%r15,4)
movslq (%rcx,%r15,4), %rax
movq 0x28(%rsp), %rcx
cmpq %rax, %rcx
cmovgeq %rax, %rcx
movq %rcx, 0x28(%rsp)
incq %r15
movq 0x30(%rsp), %r13
movq 0x20(%rsp), %rbp
jmp 0x25728
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x2585e
movq 0x10(%rsp), %rax
movl (%rax,%rbx,4), %r15d
subl 0x28(%rsp), %r15d
movl %r15d, (%rax,%rbx,4)
movq (%r13), %rcx
movq 0x10(%r13), %rax
cmpq 0x8(%r13), %rcx
jne 0x25843
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r13)
movq (%r13), %rcx
notl %r15d
shlq $0x20, %r15
orq %rbx, %r15
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
movq %r15, (%rax,%rcx,8)
incq %rbx
jmp 0x257f8
movq 0xc0(%rsp), %rax
movq 0x60(%rsp), %rcx
cmpq %rax, %rcx
cmovaq %rcx, %rax
movq %rax, 0x10(%rsp)
movq (%r13), %rax
movq 0x10(%r13), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x1905d
movq 0xc8(%rsp), %rax
cmpq %rbp, 0x8(%rax)
jae 0x258f0
leaq -0x1(%rbp), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq 0xc8(%rsp), %rbx
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movabsq $-0x100000000, %rbx     # imm = 0xFFFFFFFF00000000
xorl %r9d, %r9d
xorl %r8d, %r8d
movq 0x40(%rsp), %rdi
movq 0x30(%rsp), %r13
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
cmpq %rbp, %r8
je 0x259c8
movl (%rax,%r8,8), %ecx
xorl %edx, %edx
movq %rbx, %r15
movq %r9, %rbp
testq %rcx, %rcx
js 0x2595b
cmpl $0x0, (%r14,%rcx,4)
jne 0x2595b
movq 0xc8(%rsp), %rsi
movq 0x10(%rsi), %rsi
movq %rcx, (%rsi,%rbp,8)
incq %rbp
movl $0x1, (%r14,%rcx,4)
movq (%rdi,%rcx,8), %rcx
addq %rbx, %r15
decq %rdx
jmp 0x25928
testq %rdx, %rdx
je 0x259b8
movq (%r13), %rcx
cmpq 0x8(%r13), %rcx
jne 0x259a4
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
movq %r8, 0x8(%rsp)
movq %r9, 0x18(%rsp)
callq 0x2370
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %r8
movq %rax, 0x10(%r13)
movq (%r13), %rcx
orq %r9, %r15
leaq 0x1(%rcx), %rdx
movq %rdx, (%r13)
movq %r15, (%rax,%rcx,8)
movq 0x40(%rsp), %rdi
incq %r8
movq %rbp, %r9
movq 0x20(%rsp), %rbp
jmp 0x2590a
leaq (%rax,%rbp,8), %rdi
movq 0x30(%rsp), %r13
movq (%r13), %rcx
leaq (%rax,%rcx,8), %rsi
callq 0x1905d
movq (%r13), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0xd0(%rsp)
je 0x25c57
pushq $-0x1
popq %rbx
cmpq 0x38(%rsp), %rbp
jge 0x25d1d
movq 0x10(%r13), %rax
movq (%rax,%rbp,8), %r13
movl %r13d, %eax
notq %r13
shrq $0x20, %r13
movq %rax, 0x18(%rsp)
leaq (,%rax,8), %rax
movq %rax, 0x8(%rsp)
pushq $0x1
popq %rax
movq %rbp, 0x20(%rsp)
cmpq %r13, %rax
jae 0x25a6a
movq 0xc8(%rsp), %rcx
movq 0x10(%rcx), %rcx
addq 0x8(%rsp), %rcx
imulq $0x28, (%rcx,%rax,8), %rdx
movl 0x20(%r12,%rdx), %edx
imulq $0x28, -0x8(%rcx,%rax,8), %rcx
addl $0x8, %edx
incq %rax
cmpl 0x20(%r12,%rcx), %edx
jae 0x25a30
movq %r13, 0x28(%rsp)
jmp 0x25a72
pushq $0x1
popq %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rbp
movq %r13, %r15
subq $0x1, %r15
jb 0x25ba6
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbp,8), %rsi
imulq $0x28, %rsi, %r14
leaq (%r12,%r14), %rdi
movq 0x48(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x68(%rsp), %r8
leaq 0x58(%rsp), %r9
pushq 0xd0(%rsp)
leaq 0x58(%rsp), %rax
pushq %rax
callq 0x25583
popq %rax
popq %rcx
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpl $0x2, 0x28(%rsp)
jb 0x25b1b
cmpq %rcx, %rax
jle 0x25b96
leaq 0x22dc73(%rip), %rcx    # 0x253758
cmpq 0x218(%rcx), %rax
jl 0x25b96
movq 0x50(%rsp), %rax
cmpq 0x58(%rsp), %rax
jle 0x25b96
pushq $0x1
popq %rcx
leaq 0x22dc4c(%rip), %rdx    # 0x253758
cmpq 0x210(%rdx), %rax
jge 0x25b99
jmp 0x25b96
cmpq %rcx, %rax
jle 0x25b96
cvtsi2sd %rax, %xmm0
addq %rax, %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0x1bd9bb(%rip), %xmm1   # 0x1e34f0
ucomisd %xmm1, %xmm0
jbe 0x25b96
leaq 0x22dc16(%rip), %rcx    # 0x253758
cmpq 0x218(%rcx), %rax
jl 0x25b96
cmpq 0x10(%rsp), %rax
jl 0x25b96
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
cmpq %rcx, %rax
jle 0x25b96
cvtsi2sd %rax, %xmm0
addq %rax, %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0x1bd97a(%rip), %xmm1   # 0x1e34f0
ucomisd %xmm1, %xmm0
jbe 0x25b96
leaq 0x22dbd5(%rip), %rcx    # 0x253758
cmpq 0x210(%rcx), %rax
jl 0x25b96
pushq $0x1
popq %rcx
cmpq 0x10(%rsp), %rax
jge 0x25b99
pushq $-0x1
popq %rcx
movl %ecx, 0x1c(%r12,%r14)
incq %rbp
jmp 0x25a7a
leaq -0x1(%r13), %rax
xorl %r8d, %r8d
movq 0x20(%rsp), %rbp
cmpq %r13, %r8
jge 0x25c4a
movq %r8, %rcx
movq 0xc8(%rsp), %rdx
movq 0x10(%rdx), %rsi
movq 0x18(%rsp), %rdx
leaq (%rsi,%rdx,8), %rdx
imulq $0x28, (%rdx,%r8,8), %rdi
leaq (%r12,%rdi), %r9
addq $0x20, %r9
movslq -0x4(%r9), %rdi
movq 0x8(%rsp), %r8
leaq 0x8(%rsi,%r8), %r10
pushq $0x1
popq %r11
movq %rcx, %rsi
leaq 0x1(%rsi), %r8
cmpq %r13, %r8
jge 0x25c24
imulq $0x28, (%r10,%rsi,8), %r14
movl (%r9), %r15d
subl 0x20(%r12,%r14), %r15d
cmpq %r15, %r11
jne 0x25c2a
addq %r12, %r14
cmpl $-0x1, 0x1c(%r14)
cmoveq %rbx, %rdi
incq %r11
incq %rsi
jmp 0x25bf5
movq %rax, %rsi
movq %r13, %r8
cmpq $-0x1, %rdi
jne 0x25bb2
jmp 0x25c40
imulq $0x28, (%rdx,%rcx,8), %rdi
orl $-0x1, 0x1c(%r12,%rdi)
incq %rcx
cmpq %rsi, %rcx
jle 0x25c32
jmp 0x25bb2
incq %rbp
movq 0x30(%rsp), %r13
jmp 0x259f9
pushq $0x1
popq %rbx
movq %rbp, %rcx
pushq $-0x1
popq %rbp
cmpq 0x38(%rsp), %rcx
jge 0x25d1d
movq 0x10(%r13), %rax
movq %rcx, 0x20(%rsp)
movq (%rax,%rcx,8), %r14
movl %r14d, %r15d
movq %r14, %rax
shrq $0x21, %rax
movl %ebx, %ecx
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jb 0x25cd8
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rsi
imulq $0x28, %rsi, %rdi
addq %r12, %rdi
movq 0x48(%rsp), %rdx
callq 0x254e5
movl %ebp, %ecx
testq %rax, %rax
jne 0x25cd8
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rax
imulq $0x28, (%rax,%r15,8), %rax
movl 0x8(%r12,%rax), %eax
cmpq 0x10(%rsp), %rax
movl $0x0, %ecx
sbbl %ecx, %ecx
orl $0x1, %ecx
notq %r14
shrq $0x20, %r14
subq $0x1, %r14
jb 0x25d10
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rax
imulq $0x28, (%rax,%r15,8), %rax
movl 0x8(%r12,%rax), %esi
movl %ebp, %edx
cmpq %rsi, 0x10(%rsp)
ja 0x25d06
movl %ecx, %edx
movl %edx, 0x1c(%r12,%rax)
incq %r15
jmp 0x25cdf
movq 0x20(%rsp), %rcx
incq %rcx
jmp 0x25c60
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq