// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movsd %xmm0, 0x30(%rsp)
movl %esi, 0x14(%rsp)
cmpl $0x2, 0x10(%rdi)
jb 0x7f4c9
movq %rdi, %r14
cmpl $0x0, 0xc(%rdi)
je 0x7f4c9
movq %r9, %r12
movq %rcx, %r13
movq %rdx, %rbp
movq 0xa0(%rsp), %rdi
movl 0x14(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x20e0
movl 0x10(%r14), %eax
cmpq %rax, %rbx
jae 0x7ee32
movq 0x18(%r14), %rax
movq (%rax,%rbx,8), %rax
shrq $0x21, %rax
movq 0xa0(%rsp), %rcx
movb $0x1, (%rcx,%rax)
incq %rbx
jmp 0x7ee0c
movq %r14, 0x8(%rsp)
movq 0xa8(%rsp), %rcx
andq $0x0, (%rcx)
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x8(%rsp), %r14
movl %eax, %ecx
cmpq %rcx, %rbx
jae 0x7eeb5
movq 0x18(%r14), %rax
movq (%rax,%rbx,8), %rdi
movl %r15d, %esi
addl %edi, %r15d
shrq $0x20, %rdi
movl (%r14), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq %rbp, %rdx
movq %r13, %rcx
movq %r12, %r8
movq 0x88(%rsp), %r9
leaq 0x1c(%rsp), %r11
pushq %r11
pushq %rax
pushq %r10
pushq 0xc8(%rsp)
pushq 0xc8(%rsp)
callq 0x7e364
addq $0x30, %rsp
incq %rbx
movl 0x10(%r14), %eax
jmp 0x7ee4d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x8(%rsp), %r15
movl %eax, %eax
cmpq %rax, %rbx
jae 0x7ef22
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rdi
movl %r14d, %esi
addl %edi, %r14d
shrq $0x20, %rdi
movl (%r15), %eax
movl %eax, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
shrl $0x1f, %eax
subq $0x8, %rsp
movq %rbp, %rdx
movq %r13, %rcx
movq %r12, %r8
movq 0x88(%rsp), %r9
pushq $0x0
pushq %rax
pushq %r10
pushq 0xc8(%rsp)
pushq 0xc8(%rsp)
callq 0x7e364
addq $0x30, %rsp
incq %rbx
movl 0x10(%r15), %eax
jmp 0x7eebf
movq %rbp, 0x18(%rsp)
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq 0xa8(%rsp), %rbx
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x66c25
movq %rbx, %r9
movq 0xb0(%rsp), %r8
andq $0x0, (%r8)
pushq $0x1
popq %rax
xorl %ecx, %ecx
xorl %r10d, %r10d
xorl %ebx, %ebx
xorl %edx, %edx
xorl %r14d, %r14d
movl %r14d, %r14d
movl %edx, %ebp
cmpq %r14, (%r9)
jbe 0x7f10d
movq 0x10(%r9), %rsi
movq (%rsi,%r14,8), %r15
movl %r15d, %r13d
andl $0x1, %r13d
cmpq $0x1, %r13
movl $0x0, %r12d
sbbq %r12, %r12
shrq $0x2, %r15
xorl %r15d, %edx
xorl %r13d, %eax
orl %edx, %eax
je 0x7f0c6
movq 0xc0(%rsp), %rax
testq %rax, %rax
je 0x7f035
movslq (%rax), %rdx
cmpq %rdx, %rbx
jge 0x7efc2
movq 0x10(%r8), %rax
jmp 0x7efd9
movq 0x10(%r8), %rax
testq %r10, %r10
je 0x7efd9
imulq $0x18, %r10, %rsi
cmpl %edx, -0x18(%rax,%rsi)
jge 0x7f0e0
cmpq 0x8(%r8), %r10
jne 0x7f014
leaq (%r10,%r10), %rcx
testq %r10, %r10
pushq $0x2
popq %rdx
cmoveq %rdx, %rcx
movq %rcx, 0x8(%r8)
imulq $0x18, %rcx, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xa8(%rsp), %r9
movq 0xb0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %r10
leaq 0x1(%r10), %rcx
movq %rcx, (%r8)
imulq $0x18, %r10, %rsi
leaq (%rax,%rsi), %rdx
movq %rbp, 0x8(%rax,%rsi)
movl %r15d, %edi
movq %rdi, 0x10(%rax,%rsi)
movq %rcx, %r10
movl %ebx, (%rdx)
movq 0xc8(%rsp), %rax
testq %rax, %rax
je 0x7f0c6
movslq (%rax), %rdx
cmpq %rdx, %rbx
jle 0x7f054
movq 0x10(%r8), %rax
jmp 0x7f06b
movq 0x10(%r8), %rax
testq %rcx, %rcx
je 0x7f06b
imulq $0x18, %rcx, %rsi
cmpl %edx, -0x18(%rax,%rsi)
jle 0x7f0f8
cmpq 0x8(%r8), %rcx
jne 0x7f0a6
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%r8)
imulq $0x18, %rdx, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xa8(%rsp), %r9
movq 0xb0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rcx
imulq $0x18, %rcx, %rsi
incq %rcx
movq %rcx, (%r8)
leaq (%rax,%rsi), %rdx
movq %rbp, 0x8(%rax,%rsi)
movl %r15d, %edi
movq %rdi, 0x10(%rax,%rsi)
movl %ebx, (%rdx)
movq %rcx, %r10
orq $0x1, %r12
addq %r12, %rbx
incl %r14d
movl %r15d, %edx
movl %r13d, %eax
movq 0x8(%rsp), %r15
jmp 0x7ef67
leaq (%rax,%rsi), %rdi
leaq (%rax,%rsi), %rdx
addq $-0x18, %rdx
movl %r15d, %eax
movq %rax, -0x8(%rdi)
jmp 0x7f033
leaq (%rax,%rsi), %rdi
leaq (%rax,%rsi), %rdx
addq $-0x18, %rdx
movl %r15d, %eax
movq %rax, -0x8(%rdi)
jmp 0x7f0c1
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl (%r15), %eax
cmpl %eax, %edx
je 0x7f175
movq 0x10(%r8), %rax
cmpq 0x8(%r8), %r10
jne 0x7f150
leaq (%r10,%r10), %rcx
testq %r10, %r10
pushq $0x2
popq %rdx
cmoveq %rdx, %rcx
movq %rcx, 0x8(%r8)
imulq $0x18, %rcx, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xb0(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %r10
imulq $0x18, %r10, %rcx
leaq 0x1(%r10), %rdx
movq %rdx, (%r8)
movq %rbp, 0x8(%rax,%rcx)
movl (%r15), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rsi, 0x10(%rax,%rcx)
andl $0x0, (%rax,%rcx)
movq %rdx, %r10
pushq $-0x1
popq %rbp
xorl %ebx, %ebx
movl %ebp, %r13d
movl %ebp, %r11d
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %r9
movl %ebx, %eax
cmpq %rax, %r10
movq %r10, 0x40(%rsp)
jbe 0x7f366
testl %ebx, %ebx
je 0x7f1e8
testq %r9, %r9
je 0x7f1c5
movq 0x10(%r8), %rcx
leal -0x1(%rbx), %edx
imulq $0x18, %rdx, %rsi
movl (%r9), %edx
cmpl %edx, (%rcx,%rsi)
jl 0x7f1c5
imulq $0x18, %rax, %rsi
cmpl %edx, (%rcx,%rsi)
jl 0x7f1e5
testq %rdi, %rdi
je 0x7f1e8
movq 0x10(%r8), %rcx
leal -0x1(%rbx), %edx
imulq $0x18, %rdx, %rsi
movl (%rdi), %edx
cmpl %edx, (%rcx,%rsi)
jg 0x7f1e8
imulq $0x18, %rax, %rsi
cmpl %edx, (%rcx,%rsi)
jle 0x7f1e8
movl %ebx, %r13d
leaq -0x1(%r10), %rcx
cmpq %rax, %rcx
jbe 0x7f35f
testq %r9, %r9
je 0x7f218
movq 0x10(%r8), %r14
imulq $0x18, %rax, %rdx
movl (%r9), %ecx
cmpl %ecx, (%r14,%rdx)
jge 0x7f218
leal 0x1(%rbx), %edx
imulq $0x18, %rdx, %rdx
cmpl %ecx, (%r14,%rdx)
jge 0x7f246
testq %rdi, %rdi
je 0x7f35f
movq 0x10(%r8), %r14
imulq $0x18, %rax, %rcx
movl (%rdi), %eax
cmpl %eax, (%r14,%rcx)
jle 0x7f35f
leal 0x1(%rbx), %ecx
imulq $0x18, %rcx, %rcx
cmpl %eax, (%r14,%rcx)
jg 0x7f35f
cmpl $-0x1, %r13d
cmovel %ebx, %r11d
sete %al
cmpl %r13d, %ebx
setb %cl
orb %al, %cl
je 0x7f263
movl %ebp, %r13d
jmp 0x7f35f
movq %r11, 0x38(%rsp)
movl %ebp, %r15d
cmpl %ebx, %r13d
ja 0x7f2dc
movl %r13d, %eax
imulq $0x18, %rax, %rax
movl (%r14,%rax), %r12d
cmpl %r15d, %r12d
jae 0x7f2d7
addq %r14, %rax
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x80(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0x7e60c
movq 0x50(%rsp), %r10
movq 0xc0(%rsp), %r8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r12d, %r15d
cmovnel %eax, %ebp
incl %r13d
jmp 0x7f26b
cmpl $-0x1, %ebp
je 0x7f33f
movl 0x14(%rsp), %r14d
movq 0xb8(%rsp), %r15
movq (%r15), %rcx
movq 0x10(%r15), %rax
cmpq 0x8(%r15), %rcx
jne 0x7f328
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r15)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xb0(%rsp), %r8
movq %rax, 0x10(%r15)
movq (%r15), %rcx
shlq $0x20, %r14
movl %ebp, %edx
orq %r14, %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r15)
movq %rdx, (%rax,%rcx,8)
movq (%r8), %r10
pushq $-0x1
popq %rbp
movl %ebp, %r13d
movq 0x8(%rsp), %r15
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %r9
movq 0x38(%rsp), %r11
incl %ebx
jmp 0x7f190
cmpl $0x0, (%r15)
jns 0x7f4c9
movl %r13d, %eax
andl %r11d, %eax
cmpl $-0x1, %eax
je 0x7f4c9
movq %r11, %r12
pushq $-0x1
popq %rbp
movl %ebp, %ebx
cmpl $-0x1, %r13d
jne 0x7f3f8
jmp 0x7f400
movq 0x10(%r8), %rax
imulq $0x18, %r13, %rcx
movl (%rax,%rcx), %r14d
cmpl %ebp, %r14d
jae 0x7f3f5
addq %rcx, %rax
movl 0x8(%rax), %r10d
movl 0x10(%rax), %eax
movq %r15, %rdi
movq 0x20(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x80(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %rax
pushq %r10
callq 0x7e60c
movq 0x50(%rsp), %r10
movq 0xc0(%rsp), %r8
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r14d, %ebp
cmovnel %eax, %ebx
incl %r13d
movl %r13d, %r13d
cmpq %r13, %r10
ja 0x7f38f
cmpl $-0x1, %r12d
je 0x7f472
movq 0x10(%r8), %r14
incl %r12d
imulq $0x18, %r12, %r15
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x7f472
movl (%r14,%r12), %r13d
cmpl %ebp, %r13d
jae 0x7f46c
movl 0x8(%r14,%r12), %eax
movl 0x10(%r14,%r12), %r10d
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x80(%rsp), %r9
movsd 0x30(%rsp), %xmm0
pushq %r10
pushq %rax
callq 0x7e60c
addq $0x10, %rsp
cmpl $-0x1, %eax
cmovnel %r13d, %ebp
cmovnel %eax, %ebx
addq $0x18, %r12
jmp 0x7f414
cmpl $-0x1, %ebx
movq 0xb8(%rsp), %r14
je 0x7f4c9
movl 0x14(%rsp), %eax
shlq $0x20, %rax
movl %ebx, %ebx
orq %rax, %rbx
movq (%r14), %rcx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rcx
jne 0x7f4be
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r14)
movq %rbx, (%rax,%rcx,8)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq