// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: refine_integer_ovlps(all_ul_t*, bubble_type*, ma_ug_t*, ul_str_t*, integer_aln_t*, ul_chain_t*, long, integer_t*, unsigned long*, unsigned long)
int64_t refine_integer_ovlps(all_ul_t *ul_idx, bubble_type *bub, ma_ug_t *ug, ul_str_t *str, integer_aln_t *aln, ul_chain_t *idx, int64_t qid, integer_t *buf, 
uint64_t *cns, uint64_t cns_occ)
{
    if(idx->e<=idx->s) return 0;
    int64_t qk, tk, is_rev, tid, q_end, t_end, z; 
    ul_str_t *q_str, *t_str; uc_block_t *t_b; integer_aln_t *x, *y; 
    tid = aln[idx->s].tn_rev_qk>>33; is_rev = ((aln[idx->s].tn_rev_qk>>32)&1);
    q_str = &(str[qid]); t_str = &(str[tid]); 
    kv_resize(uint64_t, buf->u, buf->u.n + q_str->cn + t_str->cn);
    uint64_t *q_cov_buf = buf->u.a + buf->u.n, *t_cov_buf = buf->u.a + buf->u.n + q_str->cn, k, rg_occ, cn_k, mm;
    memset(q_cov_buf, -1, sizeof((*q_cov_buf))*q_str->cn); memset(t_cov_buf, -1, sizeof((*t_cov_buf))*t_str->cn);
    // if(tid != 392) return 0;
    //beg
    x = &(aln[idx->s]);
    qk = (uint32_t)(x->tn_rev_qk); tk = ((is_rev == 0)? (x->tk):(t_str->cn - x->tk - 1));

    ///direction
    if((qk > 0) && (x->tk > 0)) {
        integer_align_extention(ug, ul_idx, qid, q_str, tid, t_str, is_rev, q_cov_buf, t_cov_buf, x, 1, &q_end, &t_end);
        idx->q_sidx = q_end; idx->t_sidx = ((is_rev == 0)? (t_end):(t_str->cn - t_end - 1));
    } else {
        idx->q_sidx = (uint32_t)(x->tn_rev_qk); idx->t_sidx = x->tk;
    }
    // if(!((idx->q_sidx <= ((uint32_t)(x->tn_rev_qk))) && (idx->t_sidx <= x->tk))) {
    //     fprintf(stderr, "[M::%s] qid::%ld, tid::%ld\n", __func__, qid, tid);
    // }
    assert((idx->q_sidx <= ((uint32_t)(x->tn_rev_qk)))); assert(idx->t_sidx <= x->tk);
    // assert((is_rev && idx->t_sidx >= x->tk) || (is_rev == 0 && idx->t_sidx <= x->tk));

    //end
    x = &(aln[idx->e-1]);
    qk = (uint32_t)(x->tn_rev_qk); tk = ((is_rev == 0)? (x->tk):(t_str->cn - x->tk - 1));
    // if(tid == 316) {
    //     fprintf(stderr, "[end-M::%s::tid->%ld] qk::%ld, tk::%ld, x->tk::%u, t_str->cn::%u\n", 
    //     __func__, tid, qk, tk, x->tk, t_str->cn);
    // }
    ///direction
    if((((uint32_t)qk + 1) < q_str->cn) && ((x->tk + 1) < t_str->cn)) {
        integer_align_extention(ug, ul_idx, qid, q_str, tid, t_str, is_rev, q_cov_buf, t_cov_buf, x, 0, &q_end, &t_end);
        idx->q_eidx = q_end + 1; idx->t_eidx = ((is_rev == 0)? (t_end + 1):(t_str->cn - t_end));
    } else {
        idx->q_eidx = (uint32_t)(x->tn_rev_qk)+1; idx->t_eidx = x->tk+1;
    }

    assert(idx->q_eidx > ((uint32_t)(x->tn_rev_qk))); assert(idx->t_eidx > x->tk);
    // assert((is_rev && idx->t_eidx < x->tk) || (is_rev == 0 && idx->t_eidx > x->tk));

    assert(idx->q_eidx > idx->q_sidx); assert(idx->t_eidx > idx->t_sidx);
    // assert((is_rev && idx->t_eidx < idx->t_sidx) || (is_rev == 0 && idx->t_eidx > idx->t_sidx));
    // if(tid == 284) {
    //     fprintf(stderr, "[M::%s::tid->%ld] idx->q_sidx::%u, idx->q_eidx::%u, idx->t_sidx::%u, idx->t_eidx::%u\n", 
    //     __func__, tid, idx->q_sidx, idx->q_eidx, idx->t_sidx, idx->t_eidx);
    // }

    ///mid
    for (k = idx->s; k < idx->e; k++) {///go through all alignment pairs
        // if(qid == 3113 && tid == 3075) {
        //     fprintf(stderr, "+[M::%s] qid::%ld, tid::%ld, idx->s::%u, idx->e::%u, k::%lu, qk::%u, tk::%u, (idx->v>>1)::%u\n", 
        //     __func__, qid, tid, idx->s, idx->e, k, (uint32_t)(aln[k].tn_rev_qk), aln[k].tk, idx->v>>1);
        // }   
        
        x = &(aln[k]); y = ((k > idx->s)? (&(aln[k-1])):(NULL));
        qk = (uint32_t)(x->tn_rev_qk); 
        q_cov_buf[qk] = buf->u.a[qk]; 

        tk = ((is_rev == 0)? (x->tk):(t_str->cn - x->tk - 1));
        t_b = &(ul_idx->a[tid].bb.a[t_str->a[tk]>>32]);
        assert(((t_b->hid<<1)+t_b->rev)==((uint32_t)t_str->a[tk]));
        t_cov_buf[tk] = ug_occ_w(t_b->ts, t_b->te, &(ug->u.a[t_b->hid]));
    
        q_cov_buf[qk] += ((uint64_t)(0x8000000000000000));
        t_cov_buf[tk] += ((uint64_t)(0x8000000000000000));
        
        if(!y) continue;
        mm = 0;
        if(gap_chain_check(ug, y, x, is_rev, q_str, t_str, ul_idx->a[qid].bb.a, ul_idx->a[tid].bb.a, qid, tid, 0.08, 2000)) {
            mm = ((uint64_t)(0x8000000000000000));
        }
        for (z = ((uint32_t)(y->tn_rev_qk)) + 1; z < qk; z++) {
            q_cov_buf[z] = buf->u.a[z] + mm; 
        }

        z = ((is_rev == 0)? (y->tk):(t_str->cn - x->tk - 1)) + 1;
        tk = ((is_rev == 0)? (x->tk):(t_str->cn - y->tk - 1));
        assert(z <= tk);
        for (; z < tk; z++) {
            t_b = &(ul_idx->a[tid].bb.a[t_str->a[z]>>32]);
            assert(((t_b->hid<<1)+t_b->rev)==((uint32_t)t_str->a[z]));
            t_cov_buf[z] = ug_occ_w(t_b->ts, t_b->te, &(ug->u.a[t_b->hid])) + mm;
        }
    }

    if(cns) {
        int64_t cns_cov_occ = 0, cns_het_occ = 0, match_cns_occ = 0, match_cns_het_occ = 0, hm;
        rg_occ = idx->q_eidx;
        for (k = idx->q_sidx, cn_k = 0; k < rg_occ; k++) {
            assert((q_cov_buf[k]!=(uint64_t)-1) && (q_cov_buf[k] > 0));
            hm = ((q_cov_buf[k]<<1)>>1);
            for (; cn_k < cns_occ; cn_k++) {
                if(cns[cn_k] == k) {
                    cns_cov_occ += hm; 
                    if(q_cov_buf[k]&((uint64_t)(0x8000000000000000))) match_cns_occ += hm; 
                    if(!IF_HOM((((uint32_t)q_str->a[k])>>1), (*bub))) {
                        cns_het_occ += hm;
                        if(q_cov_buf[k]&((uint64_t)(0x8000000000000000))) match_cns_het_occ += hm; 
                    }
                } else if(cns[cn_k] > k) {
                    break;
                }
            }
        }

        if(cns_cov_occ <= 0) return 0;
        if((cns_het_occ > 0) && (match_cns_het_occ <= (cns_het_occ*0.5))) return 0;
        if(match_cns_occ <= (cns_cov_occ*0.5)) return 0;

        k = idx->t_sidx; rg_occ = idx->t_eidx; 
        if(is_rev) {
            k = t_str->cn - idx->t_eidx; rg_occ = t_str->cn - idx->t_sidx;
        }
        cns_cov_occ = match_cns_occ = 0; 
        assert(k < rg_occ);
        for (; k < rg_occ; k++) {
            assert((t_cov_buf[k]!=(uint64_t)-1) && (t_cov_buf[k] > 0));
            hm = ((t_cov_buf[k]<<1)>>1);
            cns_cov_occ += hm; 
            if(t_cov_buf[k]&((uint64_t)(0x8000000000000000))) match_cns_occ += hm; 
        }

        if(cns_cov_occ <= 0 || match_cns_occ <= 0) return 0;
        if(match_cns_occ <= (cns_cov_occ*0.5)) return 0;
    }
    ///not useful for correction
    if((idx->q_sidx + 1 == idx->q_eidx) && (idx->t_sidx + 1 == idx->t_eidx)) {///must matched with at least one cns node
        return 0;
    }

    // /**if(tid == 3074)**/ {
    //     print_integer_ovlps(ug, str, buf->b.a, buf->b.n, idx, 1, qid, buf->o.n);
    //     fprintf(stderr, "[M::%s::tid->%ld] idx->q_sidx::%u, idx->q_eidx::%u, idx->t_sidx::%u, idx->t_eidx::%u\n******************************************************\n", 
    //         __func__, tid, idx->q_sidx, idx->q_eidx, idx->t_sidx, idx->t_eidx);
    // }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, 0x30(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdi, 0x48(%rsp)
movl (%r9), %eax
cmpl %eax, 0x4(%r9)
jbe 0x1b584b
movq %r9, %rbp
movq 0xc8(%rsp), %rbx
movq 0xc0(%rsp), %rdx
imulq $0x18, %rax, %rax
movq 0x10(%r8,%rax), %rax
movq %rax, %rdi
shrq $0x21, %rdi
shrq $0x20, %rax
andl $0x1, %eax
movq %rax, 0x18(%rsp)
movq %rdx, %rax
shlq $0x5, %rax
leaq (%rcx,%rax), %r13
movq %rdi, 0x10(%rsp)
shlq $0x5, %rdi
leaq (%rcx,%rdi), %r14
movq 0x90(%rbx), %rsi
movl 0x18(%rcx,%rax), %edx
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
andq %r10, %rdx
movl 0x18(%rcx,%rdi), %eax
andq %r10, %rax
addq %rsi, %rax
addq %rdx, %rax
cmpq %rax, 0x98(%rbx)
movq %r8, 0x20(%rsp)
jae 0x1b5212
decq %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 %rax, 0x98(%rbx)
movq 0xa0(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq %rax, 0xa0(%rbx)
movq 0x90(%rbx), %rsi
movl 0x18(%r13), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
jmp 0x1b5219
movq 0xa0(%rbx), %rax
leaq (%rax,%rsi,8), %rbx
leaq (%rbx,%rdx,8), %r12
shlq $0x3, %rdx
movq %rbx, %rdi
movl $0xff, %esi
callq 0x20e0
movl 0x18(%r14), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x3, %rdx
movq %r12, %rdi
movl $0xff, %esi
callq 0x20e0
movl (%rbp), %eax
imulq $0x18, %rax, %rcx
movq 0x20(%rsp), %rdx
leaq (%rdx,%rcx), %r15
movl (%rdx,%rcx), %eax
movl 0x10(%rdx,%rcx), %ecx
testq %rcx, %rcx
sete %dl
testl %eax, %eax
sete %sil
orb %dl, %sil
movq %r12, 0x28(%rsp)
movq %rbx, 0x8(%rsp)
je 0x1b528f
movl %ecx, 0x18(%rbp)
movl %eax, 0x20(%rbp)
movq 0x20(%rsp), %r8
jmp 0x1b531e
subq $0x8, %rsp
leaq 0x40(%rsp), %rax
movq %rbx, %r10
leaq 0x88(%rsp), %rbx
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq %r13, %rcx
movq 0x18(%rsp), %r8
movq %r14, %r9
pushq %rax
pushq %rbx
pushq $0x1
pushq %r15
pushq %r12
pushq %r10
movq %r14, %r12
movq 0x50(%rsp), %r14
pushq %r14
callq 0x1b4d5b
addq $0x40, %rsp
movl (%rbx), %ecx
movl %ecx, 0x18(%rbp)
testq %r14, %r14
jne 0x1b52ee
movq 0x38(%rsp), %rax
jmp 0x1b5304
movl 0x18(%r12), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq 0x38(%rsp), %rax
notq %rax
addq %rdx, %rax
movq %r12, %r14
movl %eax, 0x20(%rbp)
cmpl 0x10(%r15), %ecx
movq 0x8(%rsp), %rbx
movq 0x20(%rsp), %r8
ja 0x1b5958
cmpl (%r15), %eax
ja 0x1b58ff
movl 0x4(%rbp), %eax
decl %eax
imulq $0x18, %rax, %rax
leaq (%r8,%rax), %r15
movl (%r8,%rax), %ecx
movl 0x10(%r8,%rax), %edx
leal 0x1(%rdx), %eax
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl 0x18(%r13), %edi
andl %esi, %edi
incl %ecx
cmpl %edi, %eax
jae 0x1b53bf
andl 0x18(%r14), %esi
cmpl %esi, %ecx
jae 0x1b53bf
subq $0x8, %rsp
leaq 0x40(%rsp), %rax
movq %rbx, %r10
leaq 0x88(%rsp), %rbx
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq %r13, %rcx
movq 0x18(%rsp), %r8
movq %r14, %r9
pushq %rax
pushq %rbx
pushq $0x0
pushq %r15
pushq 0x50(%rsp)
pushq %r10
movq %r14, %r12
movq 0x50(%rsp), %r14
pushq %r14
callq 0x1b4d5b
addq $0x40, %rsp
movl (%rbx), %eax
incl %eax
movl %eax, 0x1c(%rbp)
testq %r14, %r14
jne 0x1b53c7
movq 0x38(%rsp), %rcx
incq %rcx
jmp 0x1b53d7
movl %eax, 0x1c(%rbp)
movl %ecx, 0x24(%rbp)
jmp 0x1b53eb
movl 0x18(%r12), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subq 0x38(%rsp), %rcx
movq %r12, %r14
movl %ecx, 0x24(%rbp)
movl 0x10(%r15), %edx
movq 0x8(%rsp), %rbx
movq 0x20(%rsp), %r8
cmpl %edx, %eax
jbe 0x1b5908
cmpl (%r15), %ecx
jbe 0x1b5911
cmpl 0x18(%rbp), %eax
jbe 0x1b5930
movq %r13, 0x40(%rsp)
cmpl 0x20(%rbp), %ecx
jbe 0x1b5939
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x50(%rsp)
movl (%rbp), %edx
imulq $0x58, 0x10(%rsp), %r13
imulq $0x58, 0xc0(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %r14, 0x58(%rsp)
movq %rbp, 0x68(%rsp)
movl 0x4(%rbp), %eax
cmpq %rax, %rdx
jae 0x1b5687
imulq $0x18, %rdx, %rax
leaq (%r8,%rax), %rsi
movl (%rbp), %ecx
cmpq %rcx, %rdx
leaq -0x18(%r8,%rax), %rax
movl $0x0, %r12d
cmovaq %rax, %r12
movl 0x28(%rax), %ebp
movq 0xc8(%rsp), %rax
movq 0xa0(%rax), %rax
movq (%rax,%rbp,8), %rax
movq %rax, (%rbx,%rbp,8)
cmpq $0x0, 0x18(%rsp)
movq %rdx, 0x70(%rsp)
movq %rsi, 0x10(%rsp)
jne 0x1b549c
movl (%rsi), %eax
jmp 0x1b54ad
movl 0x18(%r14), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%rsi), %eax
notl %eax
addl %ecx, %eax
movq %r14, %rcx
movl %eax, %r14d
movq 0x48(%rsp), %rax
movq 0x48(%rax), %rbx
movq 0x30(%rbx,%r13), %r15
movq 0x10(%rcx), %rax
movq (%rax,%r14,8), %rdx
movq %rdx, %rax
shrq $0x20, %rax
imulq $0x24, %rax, %rcx
movl (%r15,%rcx), %eax
movl 0x20(%r15,%rcx), %esi
shrl $0x5, %esi
andl $0x1, %esi
leal (%rsi,%rax,2), %esi
cmpl %edx, %esi
jne 0x1b58a2
addq %r15, %rcx
movl 0xc(%rcx), %edi
movl 0x10(%rcx), %esi
imulq $0x28, %rax, %rdx
movq 0x30(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1b2312
movq 0x28(%rsp), %rcx
movq %rax, (%rcx,%r14,8)
movq 0x8(%rsp), %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, (%rax,%rbp,8)
xorq %rdx, (%rcx,%r14,8)
testq %r12, %r12
movq 0x58(%rsp), %r14
je 0x1b566b
movq 0x60(%rsp), %rax
movq 0x30(%rbx,%rax), %rax
subq $0x30, %rsp
movq %r15, 0x8(%rsp)
movq %rax, (%rsp)
movq $0x7d0, 0x20(%rsp)      # imm = 0x7D0
movq 0x60(%rsp), %rdi
movq %r12, %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x70(%rsp), %r8
movq %r14, %r9
movsd 0x2dfdf(%rip), %xmm0    # 0x1e3558
callq 0x1b4ed5
addq $0x30, %rsp
movq %rax, %r15
testq %rax, %rax
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmovneq %rax, %r15
movl 0x10(%r12), %eax
incl %eax
movq 0x8(%rsp), %rdx
movq 0xc8(%rsp), %rsi
cmpq %rbp, %rax
jae 0x1b55c6
movq 0xa0(%rsi), %rcx
movq (%rcx,%rax,8), %rcx
addq %r15, %rcx
movq %rcx, (%rdx,%rax,8)
incq %rax
jmp 0x1b55aa
movq 0x10(%rsp), %rax
movl (%rax), %eax
cmpq $0x0, 0x18(%rsp)
jne 0x1b55dd
movl (%r12), %ecx
incl %ecx
jmp 0x1b55f4
movl 0x18(%r14), %edx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %edx
movl %edx, %ecx
subl %eax, %ecx
movl (%r12), %eax
notl %eax
addl %edx, %eax
cmpl %eax, %ecx
ja 0x1b58c1
movl %eax, %r12d
movl %ecx, %ebp
cmpq %rbp, %r12
je 0x1b566b
movq 0x48(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax,%r13), %rax
movq 0x10(%r14), %rcx
movq (%rcx,%rbp,8), %rsi
movq %rsi, %rcx
shrq $0x20, %rcx
imulq $0x24, %rcx, %rdx
movl (%rax,%rdx), %ecx
movl 0x20(%rax,%rdx), %edi
shrl $0x5, %edi
andl $0x1, %edi
leal (%rdi,%rcx,2), %edi
cmpl %esi, %edi
jne 0x1b5864
addq %rdx, %rax
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
imulq $0x28, %rcx, %rdx
movq 0x30(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1b2312
addq %r15, %rax
movq 0x28(%rsp), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
jmp 0x1b5601
movq 0x70(%rsp), %rdx
incq %rdx
movq 0x68(%rsp), %rbp
movq 0x8(%rsp), %rbx
movq 0x20(%rsp), %r8
jmp 0x1b5443
movl 0x18(%rbp), %eax
movl 0x1c(%rbp), %ecx
movq 0xd0(%rsp), %r13
testq %r13, %r13
je 0x1b583b
xorl %r9d, %r9d
decq 0x50(%rsp)
movq %rax, %r10
xorl %edx, %edx
xorl %edi, %edi
xorl %esi, %esi
xorl %r8d, %r8d
movq 0x40(%rsp), %r12
cmpq %rcx, %r10
jae 0x1b575f
movq (%rbx,%r10,8), %r11
leaq 0x1(%r11), %rbx
cmpq $0x1, %rbx
jbe 0x1b5883
movq %r11, %r14
andq 0x50(%rsp), %r14
sarq $0x3f, %r11
andq %r14, %r11
movq 0xd8(%rsp), %r15
cmpq %r15, %r9
cmovaq %r9, %r15
movq 0x8(%rsp), %rbx
cmpq %r9, %r15
je 0x1b574f
cmpq %r10, (%r13,%r9,8)
jne 0x1b5748
addq %r14, %rdx
addq %r11, %rsi
movq 0x10(%r12), %rbx
movl (%rbx,%r10,8), %ebx
shrl %ebx
movq 0x78(%rsp), %r13
movq (%r13), %r12
movq 0x80(%r13), %r13
movl (%r12,%rbx,4), %ebx
incq %r13
cmpq %rbx, %r13
jb 0x1b5734
addq %r14, %rdi
addq %r11, %r8
movq 0x40(%rsp), %r12
movq 0x8(%rsp), %rbx
movq 0xd0(%rsp), %r13
jmp 0x1b574a
ja 0x1b5752
incq %r9
jmp 0x1b56f5
movq %r15, %r9
incq %r10
movq 0x58(%rsp), %r14
jmp 0x1b56b7
testq %rdx, %rdx
jle 0x1b584b
testq %rdi, %rdi
jle 0x1b5789
cvtsi2sd %r8, %xmm0
cvtsi2sd %rdi, %xmm1
mulsd 0x2ddc9(%rip), %xmm1    # 0x1e3548
ucomisd %xmm0, %xmm1
jae 0x1b584b
cvtsi2sd %rsi, %xmm0
cvtsi2sd %rdx, %xmm1
mulsd 0x2ddad(%rip), %xmm1    # 0x1e3548
ucomisd %xmm0, %xmm1
jae 0x1b584b
movl 0x20(%rbp), %edx
movl 0x24(%rbp), %esi
cmpq $0x0, 0x18(%rsp)
je 0x1b57c9
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl 0x18(%r14), %edi
movl %edi, %r8d
subl %esi, %r8d
subl %edx, %edi
movl %r8d, %edx
movl %edi, %esi
movq 0x28(%rsp), %r11
cmpl %esi, %edx
jae 0x1b5977
movl %esi, %edi
movl %edx, %r8d
xorl %edx, %edx
xorl %esi, %esi
cmpq %r8, %rdi
je 0x1b5810
movq (%r11,%r8,8), %r9
leaq 0x1(%r9), %r10
cmpq $0x1, %r10
jbe 0x1b58e0
movq %r9, %r10
andq 0x50(%rsp), %r10
addq %r10, %rdx
sarq $0x3f, %r9
andq %r10, %r9
addq %r9, %rsi
incq %r8
jmp 0x1b57df
testq %rdx, %rdx
sete %dil
testq %rsi, %rsi
sete %r8b
orb %dil, %r8b
jne 0x1b584b
cvtsi2sd %rsi, %xmm0
cvtsi2sd %rdx, %xmm1
mulsd 0x2dd13(%rip), %xmm1    # 0x1e3548
ucomisd %xmm0, %xmm1
jae 0x1b584b
incl %eax
cmpl %ecx, %eax
jne 0x1b585f
movl 0x20(%rbp), %eax
incl %eax
cmpl 0x24(%rbp), %eax
jne 0x1b585f
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
jmp 0x1b584d
leaq 0x43125(%rip), %rdi     # 0x1f8990
leaq 0x41c67(%rip), %rsi     # 0x1f74d9
leaq 0x42fbc(%rip), %rcx     # 0x1f8835
movl $0x1428, %edx           # imm = 0x1428
callq 0x2110
leaq 0x43138(%rip), %rdi     # 0x1f89c2
leaq 0x41c48(%rip), %rsi     # 0x1f74d9
leaq 0x42f9d(%rip), %rcx     # 0x1f8835
movl $0x1431, %edx           # imm = 0x1431
callq 0x2110
leaq 0x430ac(%rip), %rdi     # 0x1f8955
leaq 0x41c29(%rip), %rsi     # 0x1f74d9
leaq 0x42f7e(%rip), %rcx     # 0x1f8835
movl $0x1414, %edx           # imm = 0x1414
callq 0x2110
leaq 0x430c0(%rip), %rdi     # 0x1f8988
leaq 0x41c0a(%rip), %rsi     # 0x1f74d9
leaq 0x42f5f(%rip), %rcx     # 0x1f8835
movl $0x1425, %edx           # imm = 0x1425
callq 0x2110
leaq 0x43119(%rip), %rdi     # 0x1f8a00
leaq 0x41beb(%rip), %rsi     # 0x1f74d9
leaq 0x42f40(%rip), %rcx     # 0x1f8835
movl $0x144c, %edx           # imm = 0x144C
callq 0x2110
leaq 0x42fc9(%rip), %rdi     # 0x1f88cf
jmp 0x1b595f
leaq 0x42fd5(%rip), %rdi     # 0x1f88e4
jmp 0x1b5918
leaq 0x42ff5(%rip), %rdi     # 0x1f890d
leaq 0x41bba(%rip), %rsi     # 0x1f74d9
leaq 0x42f0f(%rip), %rcx     # 0x1f8835
movl $0x13fd, %edx           # imm = 0x13FD
callq 0x2110
leaq 0x42fea(%rip), %rdi     # 0x1f8921
jmp 0x1b5940
leaq 0x42ffb(%rip), %rdi     # 0x1f893b
leaq 0x41b92(%rip), %rsi     # 0x1f74d9
leaq 0x42ee7(%rip), %rcx     # 0x1f8835
movl $0x1400, %edx           # imm = 0x1400
callq 0x2110
leaq 0x42eaa(%rip), %rdi     # 0x1f8809
leaq 0x41b73(%rip), %rsi     # 0x1f74d9
leaq 0x42ec8(%rip), %rcx     # 0x1f8835
movl $0x13eb, %edx           # imm = 0x13EB
callq 0x2110
leaq 0x43077(%rip), %rdi     # 0x1f89f5
leaq 0x41b54(%rip), %rsi     # 0x1f74d9
leaq 0x42ea9(%rip), %rcx     # 0x1f8835
movl $0x144a, %edx           # imm = 0x144A
callq 0x2110