// File: /workspace/github_cpp_makefile_star2_O3/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, 0x28(%rsp)
movl %esi, 0x4(%rsp)
cmpl $0x2, 0x10(%rdi)
jb 0xba6e2
movq %rdi, %r13
cmpl $0x0, 0xc(%rdi)
je 0xba6e2
movq %r9, %r14
movq %rcx, 0x8(%rsp)
movq 0x98(%rsp), %rbp
movq 0x90(%rsp), %r15
movq %rdx, 0x18(%rsp)
movl 0x14(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
cmpl $0x0, 0x10(%r13)
movq %r14, 0x20(%rsp)
je 0xba099
xorl %eax, %eax
movq 0x18(%r13), %rcx
movq (%rcx,%rax,8), %rcx
shrq $0x21, %rcx
movb $0x1, (%r15,%rcx)
incq %rax
movl 0x10(%r13), %ecx
cmpq %rcx, %rax
jb 0xb9f74
movq 0x98(%rsp), %r11
movq $0x0, (%r11)
testl %ecx, %ecx
movq 0x70(%rsp), %r9
movq 0x20(%rsp), %r8
movq 0x8(%rsp), %rcx
je 0xba0a4
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rdi
movl %r15d, %esi
addl %edi, %r15d
shrq $0x20, %rdi
movl (%r13), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq 0x20(%rsp), %rdx
movq %r8, %r12
movq %r9, %rbp
leaq 0xc(%rsp), %r14
pushq %r14
pushq %rax
pushq %r10
pushq %r11
pushq 0xb8(%rsp)
callq 0xb93e3
movq %r12, %r8
movq %rbp, %r9
movq 0x38(%rsp), %rcx
movq 0xc8(%rsp), %r11
addq $0x30, %rsp
incq %rbx
movl 0x10(%r13), %eax
cmpq %rax, %rbx
jb 0xb9fbc
testl %eax, %eax
movq 0x90(%rsp), %r15
je 0xba0a4
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rdi
movl %r14d, %esi
addl %edi, %r14d
shrq $0x20, %rdi
movl (%r13), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq 0x20(%rsp), %rdx
movq %r12, %r8
movq %rbp, %r9
pushq $0x0
pushq %rax
pushq %r10
pushq %r11
pushq %r15
callq 0xb93e3
movq 0x38(%rsp), %rcx
movq 0xc8(%rsp), %r11
addq $0x30, %rsp
incq %rbx
movl 0x10(%r13), %eax
cmpq %rax, %rbx
jb 0xba03a
jmp 0xba0a4
movq $0x0, (%rbp)
movq %rbp, %r11
movq %r13, 0x10(%rsp)
movq (%r11), %rax
movq 0x10(%r11), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x9dc69
movq 0x98(%rsp), %r10
movq 0xa0(%rsp), %r8
movq $0x0, (%r8)
cmpq $0x0, (%r10)
je 0xba296
xorl %r9d, %r9d
movl $0x1, %r14d
xorl %ecx, %ecx
xorl %eax, %eax
movl $0x1, %ebx
xorl %ebp, %ebp
xorl %r15d, %r15d
movl %ebp, %edx
movl %ebx, %esi
movq 0x10(%r10), %rdi
movq (%rdi,%rax,8), %rbp
movl %ebp, %ebx
andl $0x1, %ebx
cmpq $0x1, %rbx
movl $0x0, %r12d
sbbq %r12, %r12
shrq $0x2, %rbp
movl %edx, %eax
xorl %ebp, %eax
xorl %ebx, %esi
orl %eax, %esi
je 0xba253
movl %edx, %r13d
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0xba1ba
movslq (%rax), %rdx
cmpq %rdx, %r15
jge 0xba143
movq 0x10(%r8), %rax
jmp 0xba15a
movq 0x10(%r8), %rax
testq %rcx, %rcx
je 0xba15a
leaq (%rcx,%rcx,2), %rsi
cmpl %edx, -0x18(%rax,%rsi,8)
jge 0xba26b
cmpq 0x8(%r8), %rcx
jne 0xba19b
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%r8)
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x98(%rsp), %r10
movq 0xa0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rcx
leaq 0x1(%rcx), %r9
movq %r9, (%r8)
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
movq %r13, 0x8(%rax)
movl %ebp, %ecx
movq %rcx, 0x10(%rax)
movq %r9, %rcx
movl %r15d, (%rax)
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0xba253
movslq (%rax), %rcx
cmpq %rcx, %r15
jle 0xba1d9
movq 0x10(%r8), %rax
jmp 0xba1f0
movq 0x10(%r8), %rax
testq %r9, %r9
je 0xba1f0
leaq (%r9,%r9,2), %rdx
cmpl %ecx, -0x18(%rax,%rdx,8)
jle 0xba282
cmpq 0x8(%r8), %r9
jne 0xba231
leaq (%r9,%r9), %rcx
testq %r9, %r9
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x8(%r8)
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x98(%rsp), %r10
movq 0xa0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %r9
leaq (%r9,%r9,2), %rcx
leaq 0x1(%r9), %rdx
movq %rdx, (%r8)
leaq (%rax,%rcx,8), %rax
movq %r13, 0x8(%rax)
movl %ebp, %ecx
movq %rcx, 0x10(%rax)
movq %rdx, %r9
movl %r15d, (%rax)
movq %r9, %rcx
orq $0x1, %r12
addq %r12, %r15
movl %r14d, %eax
incl %r14d
cmpq %rax, (%r10)
ja 0xba0f1
jmp 0xba29b
leaq (%rax,%rsi,8), %rdx
leaq (%rax,%rsi,8), %rax
addq $-0x18, %rax
movl %ebp, %esi
movq %rsi, -0x8(%rdx)
jmp 0xba1b7
leaq (%rax,%rdx,8), %rcx
leaq (%rax,%rdx,8), %rax
addq $-0x18, %rax
movl %ebp, %edx
movq %rdx, -0x8(%rcx)
jmp 0xba24d
xorl %r9d, %r9d
xorl %ebp, %ebp
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rbx
andl (%rbx), %eax
cmpl %eax, %ebp
je 0xba314
cmpq 0x8(%r8), %r9
jne 0xba2e7
leaq (%r9,%r9), %rax
testq %r9, %r9
movl $0x2, %ecx
cmovneq %rax, %rcx
movq %rcx, 0x8(%r8)
movq 0x10(%r8), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq 0xa0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %r9
jmp 0xba2eb
movq 0x10(%r8), %rax
leaq (%r9,%r9,2), %rcx
leaq 0x1(%r9), %rdx
movq %rdx, (%r8)
movl %ebp, %esi
movq %rsi, 0x8(%rax,%rcx,8)
movl (%rbx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rsi, 0x10(%rax,%rcx,8)
movl $0x0, (%rax,%rcx,8)
movq %rdx, %r9
movq 0xb0(%rsp), %rdi
xorl %r14d, %r14d
testq %r9, %r9
je 0xba549
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0xb8(%rsp), %rsi
testl %r14d, %r14d
je 0xba384
testq %rdi, %rdi
je 0xba360
movq 0x10(%r8), %rax
leal -0x1(%r14), %ecx
leaq (%rcx,%rcx,2), %rdx
movl (%rdi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jl 0xba360
leaq (%r14,%r14,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jl 0xba381
testq %rsi, %rsi
je 0xba384
movq 0x10(%r8), %rax
leal -0x1(%r14), %ecx
leaq (%rcx,%rcx,2), %rdx
movl (%rsi), %ecx
cmpl %ecx, (%rax,%rdx,8)
jg 0xba384
leaq (%r14,%r14,2), %rdx
cmpl %ecx, (%rax,%rdx,8)
jle 0xba384
movl %r14d, %ebx
leaq -0x1(%r9), %rax
cmpq %r14, %rax
jbe 0xba53b
testq %rdi, %rdi
je 0xba3b4
movq 0x10(%r8), %r10
leaq (%r14,%r14,2), %rcx
movl (%rdi), %eax
cmpl %eax, (%r10,%rcx,8)
jge 0xba3b4
leal 0x1(%r14), %ecx
leaq (%rcx,%rcx,2), %rcx
cmpl %eax, (%r10,%rcx,8)
jge 0xba3e3
testq %rsi, %rsi
je 0xba53b
movq 0x10(%r8), %r10
leaq (%r14,%r14,2), %rcx
movl (%rsi), %eax
cmpl %eax, (%r10,%rcx,8)
jle 0xba53b
leal 0x1(%r14), %ecx
leaq (%rcx,%rcx,2), %rcx
cmpl %eax, (%r10,%rcx,8)
jg 0xba53b
cmpl $-0x1, %ebx
cmovel %r14d, %ebp
sete %al
cmpl %ebx, %r14d
setb %cl
orb %al, %cl
je 0xba401
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xba53b
movl %ebp, (%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebx, %eax
leaq (%rax,%rax,2), %rax
movl (%r10,%rax,8), %r13d
cmpl %ebp, %r13d
jae 0xba48d
leaq (%r10,%rax,8), %rax
movl %ebx, 0x34(%rsp)
movq %r14, %rbx
movq %r10, %r14
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl %edx, %r15d
movq 0x90(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r9, %r12
movq 0x70(%rsp), %r9
movsd 0x28(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0xb96a4
movq %r14, %r10
movq %rbx, %r14
movl 0x44(%rsp), %ebx
movl %r15d, %edx
movq %r12, %r9
movq 0xb0(%rsp), %r8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r13d, %ebp
cmovnel %eax, %edx
incl %ebx
cmpl %r14d, %ebx
jbe 0xba40e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %edx
je 0xba528
movl 0x4(%rsp), %r15d
movq 0xa8(%rsp), %r12
movq (%r12), %rcx
movq 0x10(%r12), %rax
cmpq 0x8(%r12), %rcx
movl (%rsp), %ebp
jne 0xba4fe
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r12)
shlq $0x3, %rsi
movq %rax, %rdi
movl %edx, %r13d
callq 0x2370
movl %r13d, %edx
movq 0xa0(%rsp), %r8
movq %rax, 0x10(%r12)
movq (%r12), %rcx
shlq $0x20, %r15
movl %edx, %edx
orq %r15, %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r12)
movq %rdx, (%rax,%rcx,8)
movq (%r8), %r9
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
jmp 0xba53b
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
movl (%rsp), %ebp
incl %r14d
cmpq %r14, %r9
ja 0xba33a
jmp 0xba556
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jns 0xba6e2
movl %ebx, %eax
andl %ebp, %eax
cmpl $-0x1, %eax
je 0xba6e2
movl %ebp, (%rsp)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $-0x1, %ebx
je 0xba611
movl %ebx, %eax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq %rax, %r9
jbe 0xba617
movq 0x10(%r8), %r13
incl %ebx
leaq (%rax,%rax,2), %rax
movl (%r13,%rax,8), %ebp
cmpl %r15d, %ebp
jae 0xba606
leaq (,%rax,8), %rax
addq %r13, %rax
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r9, %r12
movq 0x70(%rsp), %r9
movsd 0x28(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0xb96a4
movq %r12, %r9
movq 0xb0(%rsp), %r8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %ebp, %r15d
cmovnel %eax, %r14d
movl %ebx, %eax
incl %ebx
cmpq %rax, %r9
ja 0xba59a
jmp 0xba617
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl (%rsp), %r13d
cmpl $-0x1, %r13d
je 0xba684
movq 0x10(%r8), %rbx
incl %r13d
addq $0x10, %rbx
movq 0x8(%rsp), %r12
movl -0x10(%rbx), %ebp
cmpl %r15d, %ebp
jae 0xba67b
movl -0x8(%rbx), %eax
movl (%rbx), %r10d
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq 0x90(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x70(%rsp), %r9
movsd 0x28(%rsp), %xmm0
pushq %r10
pushq %rax
callq 0xb96a4
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %ebp, %r15d
cmovnel %eax, %r14d
addq $0x18, %rbx
decl %r13d
jne 0xba631
cmpl $-0x1, %r14d
movq 0xa8(%rsp), %r15
je 0xba6e2
movl 0x4(%rsp), %eax
shlq $0x20, %rax
movl %r14d, %ebx
orq %rax, %rbx
movq (%r15), %rcx
cmpq 0x8(%r15), %rcx
jne 0xba6d3
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rcx
jmp 0xba6d7
movq 0x10(%r15), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%r15)
movq %rbx, (%rax,%rcx,8)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq