// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: detect_break_point_advance(ma_utg_t*, unsigned int, asg_t*, All_reads*, ma_sub_t*, ma_hit_t_alloc*, R_to_U*, kvec_asg_arc_t_warp*, int, int, unsigned char*, kvec_t_u64_warp*, kv_in_sub_t*, kvec_t_u64_warp*, int*, int*, double)
void detect_break_point_advance(ma_utg_t *u, uint32_t uID, asg_t* read_g, All_reads *RNF, ma_sub_t* coverage_cut, 
ma_hit_t_alloc* sources, R_to_U* ruIndex, kvec_asg_arc_t_warp* edge, int max_hang, int min_ovlp,
uint8_t* r_flag, kvec_t_u64_warp* d, kv_in_sub_t* depth_i, kvec_t_u64_warp* res, int* b_low_cov,
int* b_high_cov, double m_rate)
{
    if(u->n < 2 || u->m == 0) return;
    uint32_t k, l, c_beg;
    memset(r_flag, 0, read_g->n_seq);
    for (k = 0; k < u->n; k++) r_flag[u->a[k]>>33] = 1;

    d->a.n = 0;
    for (k = l = 0; k < u->n; k++)
    {
        c_beg = l;
        l += (uint32_t)u->a[k];
        get_break_point_cov_advance((uint64_t)(u->a[k])>>32, c_beg, read_g, RNF, sources, ruIndex, r_flag, d, u->len, u->circ, &uID);
    }
    
    for (k = l = 0; k < u->n; k++)
    {
        c_beg = l;
        l += (uint32_t)u->a[k];
        get_break_point_cov_advance((uint64_t)(u->a[k])>>32, c_beg, read_g, RNF, sources, ruIndex, r_flag, d, u->len, u->circ, NULL);
    }

    radix_sort_arch64(d->a.a, d->a.a + d->a.n);

    long long dp, o_dp;
    uint32_t idx, o_idx, dir, o_dir;
    in_sub_t* p = NULL;



    /*******************************for debug************************************/
    ///debug_break_point_advance(u, uID, read_g, RNF, sources, ruIndex, edge, r_flag);
    /*******************************for debug************************************/









    depth_i->n = 0;
    ///[start, end)
    ///for circle
    dp = 0; o_idx = 0; o_dir = 1;///means it is a beg 
    for (k = 0; k < d->a.n; k++)
    {
        o_dp = dp;
        ///if start = end, we should meet end first, otherwise it will have a bug
        if(d->a.a[k]&1) ++dp;
        else --dp;

        dir = d->a.a[k]&1; idx = d->a.a[k]>>2;
        if((idx - o_idx > 0) || (idx == o_idx && o_dir != dir))
        {
            if(b_low_cov)
            {
                ///merge
                if(o_dp >= (*b_low_cov) && depth_i->n > 0 && (int)depth_i->a[depth_i->n-1].dp >= (*b_low_cov))
                {
                    p = &(depth_i->a[depth_i->n-1]);
                    p->k_end = idx;
                    p->dp = o_dp;
                }
                else //insert new
                {
                    kv_pushp(in_sub_t, *depth_i, &p);
                    p->k_beg = o_idx;
                    p->k_end = idx;
                    p->dp = o_dp;
                }
            }

            if(b_high_cov)
            {
                if(o_dp <= (*b_high_cov) && depth_i->n > 0 && (int)depth_i->a[depth_i->n-1].dp <= (*b_high_cov))
                {
                    p = &(depth_i->a[depth_i->n-1]);
                    p->k_end = idx;
                    p->dp = o_dp;
                }
                else //insert new
                {
                    kv_pushp(in_sub_t, *depth_i, &p);
                    p->k_beg = o_idx;
                    p->k_end = idx;
                    p->dp = o_dp;
                }
            }
            
        } 
        o_idx = idx;
        o_dir = dir;
    }

    if(o_idx != u->len)
    {
        kv_pushp(in_sub_t, *depth_i, &p);
        p->k_beg = o_idx;
        p->k_end = u->len;
        p->dp = 0;
    }

    // if(b_high_cov)
    // {
    //     fprintf(stderr, "\n\n\n\n\n\n\n\n\n\n");
    //     fprintf(stderr, "uID: %u, u->n: %u, u->len: %u\n", uID, (uint32_t)u->n, (uint32_t)u->len);
    //     for (k = 0; k < depth_i->n; k++)
    //     {
    //         fprintf(stderr, "k: %u, k_beg: %lu, k_end: %lu, dp: %u\n", 
    //         k, depth_i->a[k].k_beg, depth_i->a[k].k_end, depth_i->a[k].dp);
    //     }
    // }
    

    uint32_t beg_idx, end_idx, cir_beg_idx, cir_end_idx, min, min_idx, cur_idx, i;
    beg_idx = end_idx = (uint32_t)-1;
    cir_beg_idx = cir_end_idx = (uint32_t)-1;
    uint64_t tmp;

    for (k = 0; k < depth_i->n; k++)
    {
        if(k > 0) 
        {
            if((b_low_cov && (int)depth_i->a[k-1].dp >= (*b_low_cov) && (int)depth_i->a[k].dp < (*b_low_cov)) ||
                (b_high_cov && (int)depth_i->a[k-1].dp <= (*b_high_cov) && (int)depth_i->a[k].dp > (*b_high_cov)))
            {
                beg_idx = k;
            }
        }

        if(k < depth_i->n-1)
        {
            if((b_low_cov && (int)depth_i->a[k].dp < (*b_low_cov) && (int)depth_i->a[k+1].dp >= (*b_low_cov)) || 
                (b_high_cov && (int)depth_i->a[k].dp > (*b_high_cov) && (int)depth_i->a[k+1].dp <= (*b_high_cov)))
            {
                end_idx = k;
                if(beg_idx == (uint32_t)-1) cir_end_idx = k;


                if(beg_idx != (uint32_t)-1 && end_idx >= beg_idx)
                {
                    min = min_idx = (uint32_t)-1;
                    for (i = beg_idx; i <= end_idx; i++)
                    {
                        // if(b_high_cov)
                        // {
                        //     fprintf(stderr, "+k_end: %lu, k_end: %lu, dp: %u\n", depth_i->a[i].k_beg, depth_i->a[i].k_end, depth_i->a[i].dp);
                        // }
                        if(depth_i->a[i].dp < min)
                        {
                            cur_idx = get_break_point_idx(u, RNF, r_flag, sources, read_g, ruIndex,
                                                    depth_i->a[i].k_beg, depth_i->a[i].k_end, m_rate);
                            if(cur_idx == (uint32_t)-1) continue;
                            min = depth_i->a[i].dp; min_idx = cur_idx;
                        }
                    }
                    if(min_idx != (uint32_t)-1)
                    {
                        //fprintf(stderr, "+uID: %u, min_idx: %u, k_beg: %lu, k_end: %lu\n", uID, min_idx, depth_i->a[min_idx].k_beg, depth_i->a[min_idx].k_end);
                        if(min_idx != (uint32_t)-1)
                        {
                            tmp = uID; tmp <<=32; tmp += min_idx;
                            kv_push(uint64_t, res->a, tmp);
                        }
                    } 
                }
                beg_idx = end_idx = (uint32_t)-1;
            }
        }
    }

    if(beg_idx != (uint32_t)-1 && end_idx == (uint32_t)-1) cir_beg_idx = beg_idx;

     if(u->circ && (cir_beg_idx != (uint32_t)-1 || cir_end_idx != (uint32_t)-1))
     {
        beg_idx = cir_beg_idx;
        end_idx = cir_end_idx;

        min = min_idx = (uint32_t)-1;
        if(beg_idx != (uint32_t)-1)
        {
            for (i = beg_idx; i < depth_i->n; i++)
            {
                // if(b_high_cov)
                // {
                //     fprintf(stderr, "-0-k_end: %lu, k_end: %lu, dp: %u\n", depth_i->a[i].k_beg, depth_i->a[i].k_end, depth_i->a[i].dp);
                // }
                if(depth_i->a[i].dp < min)
                {
                    // min = depth_i->a[i].dp;
                    // min_idx = i;
                    cur_idx = get_break_point_idx(u, RNF, r_flag, sources, read_g, ruIndex,
                                            depth_i->a[i].k_beg, depth_i->a[i].k_end, m_rate);
                    if(cur_idx == (uint32_t)-1) continue;
                    min = depth_i->a[i].dp; min_idx = cur_idx;
                }
            }
        }

        if(end_idx != (uint32_t)-1)
        {
            for (i = 0; i <= end_idx; i++)
            {
                // if(b_high_cov)
                // {
                //     fprintf(stderr, "-1-k_end: %lu, k_end: %lu, dp: %u\n", depth_i->a[i].k_beg, depth_i->a[i].k_end, depth_i->a[i].dp);
                // }
                if(depth_i->a[i].dp < min)
                {
                    cur_idx = get_break_point_idx(u, RNF, r_flag, sources, read_g, ruIndex,
                                            depth_i->a[i].k_beg, depth_i->a[i].k_end, m_rate);
                    if(cur_idx == (uint32_t)-1) continue;
                    min = depth_i->a[i].dp; min_idx = cur_idx;
                }
            }
        }

        if(min_idx != (uint32_t)-1)
        {
            ///fprintf(stderr, "-uID: %u, min_idx: %u, k_beg: %lu, k_end: %lu\n", uID, min_idx, depth_i->a[min_idx].k_beg, depth_i->a[min_idx].k_end);
            if(min_idx != (uint32_t)-1)
            {
                tmp = uID; tmp <<=32; tmp += min_idx;
                kv_push(uint64_t, res->a, tmp);
            }
        } 
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movsd %xmm0, 0x30(%rsp)
movq %rcx, 0x20(%rsp)
movl %esi, 0xc(%rsp)
cmpl $0x2, 0x10(%rdi)
jb 0xb980e
movq %rdi, %rbp
cmpl $0x0, 0xc(%rdi)
je 0xb980e
movq %r9, 0x28(%rsp)
movq 0x90(%rsp), %r14
movq %rdx, 0x18(%rsp)
movl 0x14(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r14, %rdi
xorl %esi, %esi
callq 0x20e0
cmpl $0x0, 0x10(%rbp)
je 0xb90d9
xorl %eax, %eax
movq 0x18(%rbp), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x1, (%r14,%rcx)
incq %rax
movl 0x10(%rbp), %ecx
cmpq %rcx, %rax
jb 0xb90bd
movq 0x70(%rsp), %rcx
movq 0x98(%rsp), %r11
movq $0x0, (%r11)
cmpl $0x0, 0x10(%rbp)
movq 0x20(%rsp), %r9
movq 0x28(%rsp), %r8
movq 0x18(%rsp), %r13
je 0xb917a
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x18(%rbp), %rax
movq (%rax,%rbx,8), %rdi
movl %r15d, %esi
addl %edi, %r15d
shrq $0x20, %rdi
movl (%rbp), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq %r13, %rdx
movq %r9, %rcx
movq %r8, %r12
movq 0x78(%rsp), %r9
leaq 0x14(%rsp), %r14
pushq %r14
pushq %rax
pushq %r10
pushq %r11
pushq 0xb8(%rsp)
callq 0xb84c6
movq %r12, %r8
movq 0x50(%rsp), %r9
movq 0xc8(%rsp), %r11
movq 0xa0(%rsp), %rcx
addq $0x30, %rsp
incq %rbx
movl 0x10(%rbp), %eax
cmpq %rax, %rbx
jb 0xb9107
cmpl $0x0, 0x10(%rbp)
movq %rbp, %r12
je 0xb91f3
movq %rcx, %r15
movq %r9, %r13
movq %r8, %rbp
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x18(%r12), %rax
movq (%rax,%rbx,8), %rdi
movl %r14d, %esi
addl %edi, %r14d
shrq $0x20, %rdi
movl (%r12), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq 0x20(%rsp), %rdx
movq %r13, %rcx
movq %rbp, %r8
movq %r15, %r9
pushq $0x0
pushq %rax
pushq %r10
pushq %r11
pushq 0xb8(%rsp)
callq 0xb84c6
movq 0xc8(%rsp), %r11
addq $0x30, %rsp
incq %rbx
movl 0x10(%r12), %eax
cmpq %rax, %rbx
jb 0xb9191
movq %r12, 0x10(%rsp)
movq (%r11), %rax
movq 0x10(%r11), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x9d53f
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %r12
movq $0x0, (%r12)
cmpq $0x0, (%rdi)
je 0xb9402
xorl %eax, %eax
movl $0x1, %r14d
movl $0x1, %ebx
xorl %ebp, %ebp
xorl %r15d, %r15d
movl %ebp, %ecx
movl %ebx, %edx
movq 0x10(%rdi), %rsi
movq (%rsi,%rax,8), %rbp
movl %ebp, %ebx
andl $0x1, %ebx
cmpq $0x1, %rbx
movl $0x0, %r13d
sbbq %r13, %r13
shrq $0x2, %rbp
movl %ecx, %eax
xorl %ebp, %eax
xorl %ebx, %edx
orl %eax, %edx
je 0xb93bf
movl %ecx, %r8d
cmpq $0x0, 0xb0(%rsp)
je 0xb9317
movq 0xb0(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r15
jl 0xb92aa
movq (%r12), %rcx
testq %rcx, %rcx
je 0xb92aa
movq 0x10(%r12), %rdx
leaq (%rcx,%rcx,2), %rcx
cmpl %eax, -0x18(%rdx,%rcx,8)
jge 0xb93d7
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0xb92f1
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %r8, (%rsp)
callq 0x2370
movq (%rsp), %r8
movq 0x98(%rsp), %rdi
movq %rax, 0x10(%r12)
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r12)
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rax
movq %r8, 0x8(%rax)
movl %ebp, %ecx
movq %rcx, 0x10(%rax)
movl %r15d, (%rax)
cmpq $0x0, 0xb8(%rsp)
je 0xb93bf
movq 0xb8(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r15
jg 0xb9352
movq (%r12), %rcx
testq %rcx, %rcx
je 0xb9352
movq 0x10(%r12), %rdx
leaq (%rcx,%rcx,2), %rcx
cmpl %eax, -0x18(%rdx,%rcx,8)
jle 0xb93ee
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0xb9399
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %r8, (%rsp)
callq 0x2370
movq (%rsp), %r8
movq 0x98(%rsp), %rdi
movq %rax, 0x10(%r12)
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r12)
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rax
movq %r8, 0x8(%rax)
movl %ebp, %ecx
movq %rcx, 0x10(%rax)
movl %r15d, (%rax)
orq $0x1, %r13
addq %r13, %r15
movl %r14d, %eax
incl %r14d
cmpq %rax, (%rdi)
ja 0xb923c
jmp 0xb9404
leaq (%rdx,%rcx,8), %rsi
leaq (%rdx,%rcx,8), %rax
addq $-0x18, %rax
movl %ebp, %ecx
movq %rcx, -0x8(%rsi)
jmp 0xb9314
leaq (%rdx,%rcx,8), %rsi
leaq (%rdx,%rcx,8), %rax
addq $-0x18, %rax
movl %ebp, %ecx
movq %rcx, -0x8(%rsi)
jmp 0xb93bc
xorl %ebp, %ebp
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %r9
andl (%r9), %eax
cmpl %eax, %ebp
je 0xb9483
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0xb9452
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmovneq %rcx, %rax
movq %rax, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
movq %r9, %rbx
callq 0x2370
movq %rbx, %r9
movq %rax, 0x10(%r12)
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r12)
leaq (%rax,%rax,2), %rax
movl %ebp, %edx
movq %rdx, 0x8(%rcx,%rax,8)
movl (%r9), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdx, 0x10(%rcx,%rax,8)
movl $0x0, (%rcx,%rax,8)
movq (%r12), %r14
testq %r14, %r14
je 0xb9687
xorl %ebx, %ebx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
testl %ebx, %ebx
je 0xb94f7
testq %rdi, %rdi
je 0xb94d3
movq 0x10(%r12), %rax
leal -0x1(%rbx), %ecx
leaq (%rcx,%rcx,2), %rdx
movl (%rdi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jl 0xb94d3
leaq (%rbx,%rbx,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jl 0xb94f4
testq %rsi, %rsi
je 0xb94f7
movq 0x10(%r12), %rax
leal -0x1(%rbx), %ecx
leaq (%rcx,%rcx,2), %rdx
movl (%rsi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jg 0xb94f7
leaq (%rbx,%rbx,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jle 0xb94f7
movl %ebx, %r13d
decq %r14
cmpq %rbx, %r14
jbe 0xb9676
testq %rdi, %rdi
je 0xb9524
movq 0x10(%r12), %rax
leaq (%rbx,%rbx,2), %rdx
movl (%rdi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jge 0xb9524
leal 0x1(%rbx), %edx
leaq (%rdx,%rdx,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jge 0xb9551
testq %rsi, %rsi
je 0xb9676
movq 0x10(%r12), %rax
leaq (%rbx,%rbx,2), %rdx
movl (%rsi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jle 0xb9676
leal 0x1(%rbx), %edx
leaq (%rdx,%rdx,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jg 0xb9676
cmpl $-0x1, %r13d
cmovel %ebx, %r8d
sete %al
cmpl %r13d, %ebx
setb %cl
orb %al, %cl
je 0xb9571
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0xb9676
movl %r8d, (%rsp)
movq 0x10(%r12), %r14
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r13d, %eax
leaq (%rax,%rax,2), %rax
movl (%r14,%rax,8), %r12d
cmpl %r15d, %r12d
jae 0xb95dd
leaq (%r14,%rax,8), %rax
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x70(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0xb87b8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r12d, %r15d
cmovnel %eax, %ebp
incl %r13d
cmpl %ebx, %r13d
jbe 0xb9585
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
movq 0x10(%rsp), %r9
je 0xb965a
movl 0xc(%rsp), %r14d
movq 0xa8(%rsp), %r15
movq 0x8(%r15), %rax
cmpq %rax, (%r15)
movq 0xa0(%rsp), %r12
jne 0xb963d
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%rsp), %r9
movq %rax, 0x10(%r15)
shlq $0x20, %r14
movl %ebp, %eax
orq %r14, %rax
movq (%r15), %rcx
movq 0x10(%r15), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r15)
movq %rax, (%rdx,%rcx,8)
jmp 0xb9662
movq 0xa0(%rsp), %r12
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
movl (%rsp), %r8d
incl %ebx
movq (%r12), %r14
cmpq %rbx, %r14
ja 0xb94ae
jmp 0xb9693
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmpl $0x0, (%r9)
jns 0xb980e
movl %r13d, %eax
andl %r8d, %eax
cmpl $-0x1, %eax
je 0xb980e
movl %r8d, (%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %r13d
je 0xb9739
movl %r13d, %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq %rax, %r14
jbe 0xb973e
movq 0xa0(%rsp), %rcx
movq 0x10(%rcx), %r15
incl %r13d
leaq (%rax,%rax,2), %rax
movl (%r15,%rax,8), %r12d
cmpl %ebp, %r12d
jae 0xb972c
leaq (%r15,%rax,8), %rax
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x70(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0xb87b8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r12d, %ebp
cmovnel %eax, %ebx
movl %r13d, %eax
incl %r13d
cmpq %rax, %r14
ja 0xb96d7
jmp 0xb973e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl (%rsp), %r12d
cmpl $-0x1, %r12d
je 0xb97b4
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %r14
incl %r12d
addq $0x10, %r14
movq 0x20(%rsp), %r13
movl -0x10(%r14), %r15d
cmpl %ebp, %r15d
jae 0xb97ab
movl -0x8(%r14), %eax
movl (%r14), %r10d
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq 0x90(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x70(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %r10
pushq %rax
callq 0xb87b8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r15d, %ebp
cmovnel %eax, %ebx
addq $0x18, %r14
decl %r12d
jne 0xb9760
cmpl $-0x1, %ebx
je 0xb980e
movl 0xc(%rsp), %eax
shlq $0x20, %rax
movl %ebx, %ebx
orq %rax, %rbx
movq 0xa8(%rsp), %r14
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
jne 0xb97fc
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %esi
cmovneq %rcx, %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
movq %rbx, (%rcx,%rax,8)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq