// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: update_integer_seq(ul_resolve_t*, integer_t*, unsigned int, unsigned long*, unsigned long, unsigned int)
void update_integer_seq(ul_resolve_t *uidx, integer_t *buf, uint32_t id, uint64_t *seq, uint64_t seq_n, uint32_t tid)
{
    // if((((uint32_t)-1) - uidx->idx->a[id].rlen) < asm_opt.thread_num) {
    //     fprintf(stderr, "id->%u, c_tid->%u, l_tid->%u\n", id, tid, (((uint32_t)-1) - uidx->idx->a[id].rlen));
    //     exit(0);
    // }
    // assert(uidx->idx->a[id].rlen!=(uint32_t)-1);
    // fprintf(stderr, "dd->%u\n", uidx->idx->a[id].dd);
    // if(id != 1487) return;
    if(seq_n <= 0) return;
    buf->n_correct++;
    ul_str_t *str = &(uidx->pstr.str.a[id]); uc_block_t *z; ul_chain_t sc, msc;
    uint64_t k, i, pp; integer_aln_t *b; ma_ug_t *ug = uidx->l1_ug;
    assert((seq[0]>>32) == (ug->g->seq[((uint32_t)seq[0])>>1].len));
    // fprintf(stderr, "\n[M::%s::id->%u] seq_n::%lu\n", __func__, id, seq_n);
    // print_primary_ul_chain(str, &(uidx->idx->a[id]), ug);
    if(seq_n == 1) {
        pp = ug->g->seq[((uint32_t)seq[0])>>1].len;
        push_integer_seq_exact(&(uidx->idx->a[id]), ug, seq, seq_n, &pp, tid);
        return;
    }
    
    buf->u.n = 0;
    for (k = 0; k < str->cn; k++) {///old seq
        pp = ((uint32_t)str->a[k])>>1; pp <<= 33; pp += ((uint64_t)(0x100000000));
        pp += (k<<1); pp += ((uint32_t)str->a[k])&1;
        kv_push(uint64_t, buf->u, pp);
        // fprintf(stderr, "ok::%lu, ov::%u\n", k, ((uint32_t)str->a[k]));
    }
    for (k = 0; k < seq_n; k++) {///new seq
        pp = ((uint32_t)seq[k])>>1; pp <<= 33; 
        pp += (k<<1); pp += ((uint32_t)seq[k])&1;
        kv_push(uint64_t, buf->u, pp);
        // fprintf(stderr, "nk::%lu, nv::%u\n", k, ((uint32_t)seq[k]));

        // fprintf(stderr, ">>>>>>[M::%s::c_k->%lu] utg%.6d%c(%c::len->%u)\n", __func__, k,
        //             (((uint32_t)seq[k])>>1)+1, "lc"[ug->u.a[(((uint32_t)seq[k])>>1)].circ], 
        //             "+-"[((uint32_t)seq[k])&1], ug->u.a[(((uint32_t)seq[k])>>1)].len);
    }

    radix_sort_srt64(buf->u.a, buf->u.a + buf->u.n);
    for (k = 0, buf->b.n = 0; k < buf->u.n; k++) {
        if(buf->u.a[k]&((uint64_t)(0x100000000))) continue;///skip nodes in the old seq
        for (i = k+1; (i < buf->u.n) && ((buf->u.a[k]>>33) == (buf->u.a[i]>>33)); i++) {
            if((buf->u.a[i]&((uint64_t)(0x100000000))) == 0) continue;///skip nodes in the new seq
            if((buf->u.a[k]&1) != (buf->u.a[i]&1)) continue;///ignore reverse alignment;
            ///a[k] is the new seq (q); a[i] is old seq (t)
            kv_pushp(integer_aln_t, buf->b, &b);
            b->vq = ((buf->u.a[k]>>33)<<1) + (buf->u.a[k]&1);
            b->tn_rev_qk = ((uint32_t)buf->u.a[k])>>1;
            b->tk = ((uint32_t)buf->u.a[i])>>1; 
            z = &(uidx->idx->a[id].bb.a[str->a[b->tk]>>32]);
            assert(((z->hid<<1)+z->rev)==(((buf->u.a[i]>>33)<<1) + (buf->u.a[i]&1)));
            if((buf->u.a[k]&1) != (buf->u.a[i]&1)) {
                b->tk = str->cn - b->tk - 1;
                b->tn_rev_qk |= ((uint64_t)(0x100000000));
            }            
            b->sc = ug_occ_w(z->ts, z->te, &(ug->u.a[z->hid]));
            assert(b->sc > 0);
        }
    }

    msc.v = msc.s = msc.e = (uint32_t)-1; msc.sc = 0;
    if(buf->b.n > 0) {
        radix_sort_integer_aln_t_srt(buf->b.a, buf->b.a + buf->b.n); ///sorted by rev|qk
        for (k = 1, i = 0; k <= buf->b.n; k++) {
            // fprintf(stderr, "[M::%s::z->%lu] rev::%u, qk::%u, tk::%u\n", 
            // __func__, k-1, (uint32_t)(!!(buf->b.a[k-1].tn_rev_qk>>32)), (uint32_t)buf->b.a[k-1].tn_rev_qk, buf->b.a[k-1].tk);
            if(k == buf->b.n || (buf->b.a[i].tn_rev_qk>>32) != (buf->b.a[k].tn_rev_qk>>32)) {
                if(integer_chain(id, buf->b.a + i, k - i, i, buf, ug, NULL, NULL, &sc) && sc.v != (uint32_t)-1) {
                    if(msc.s == (uint32_t)-1 || msc.sc < sc.sc) msc = sc;
                }
                i = k;
            }
        }
    }
    // fprintf(stderr, "[M::%s::id->%u] seq_n::%lu, align_n::%u, buf->b.n::%u\n", 
    // __func__, id, seq_n, msc.e - msc.s, (uint32_t)buf->b.n);

    
    uint64_t l, v, pd, uls, ule, p_ls, p_le, is_rev, qk, tk, bc; integer_aln_t *x; uc_block_t *tb;
    buf->u.n = 0; kv_resize(uint64_t, buf->u, seq_n); 
    // assert((seq[0]>>32) == (ug->g->seq[((uint32_t)seq[0])>>1].len));
    for (k = l = 0, p_ls = p_le = (uint64_t)-1; k < seq_n; k++) {
        v = (uint32_t)seq[k]; pd = (seq[k]<<1)>>33;
        ule = l + pd; uls = ((ule >= ug->g->seq[v>>1].len)?(ule - ug->g->seq[v>>1].len):(0));
        bc = 0;
        if(k > 0){
            bc = (!!(seq[k]&((uint64_t)(0x8000000000000000))));///if connected in the graph
            if(bc) bc = double_check_gconnect(ug->g, ((uint32_t)seq[k])^1, ((uint32_t)seq[k-1])^1, pd);
            // fprintf(stderr, "bc->%lu\n", bc);
        }
        if(p_ls != (uint64_t)-1) {
            ///uls should uls>=p_ls && uls<=p_le
            if(uls < p_ls) uls = p_ls;
            if(bc && uls > p_le) uls = p_le;
            ///ule should ule > p_le
            if(ule <= p_le) ule = p_le + 1;
        }
        buf->u.a[k] = uls; buf->u.a[k] <<= 32; buf->u.a[k] |= ule;
        p_ls = uls; p_le = ule;
        l = ule;
        // fprintf(stderr, "[init_k->%lu] uls::%lu, ule::%lu, pd::%lu\n", k, uls, ule, pd);
    }
    buf->u.n = seq_n;

    int64_t beg_nl, end_nl; ma_utg_t *u;
    v = (uint32_t)seq[0]; u = &(ug->u.a[v>>1]); beg_nl = u->len;
    v = (uint32_t)seq[seq_n-1]; u = &(ug->u.a[v>>1]); end_nl = u->len;
    // fprintf(stderr, "+[M::%s] beg_nl::%lu, end_nl::%lu\n", __func__, beg_nl, end_nl);

    ///q -> new seq; t -> old seq
    if(msc.s != (uint32_t)-1 && msc.e > msc.s) {
        int64_t qoff, toff, beg_cut = 0, end_cut = 0; uint32_t r_end;
        is_rev = ((buf->b.a[msc.s].tn_rev_qk>>32)&1);

        ///beg
        x = &(buf->b.a[msc.s]); 
        qk = (uint32_t)(x->tn_rev_qk); tk = ((is_rev == 0)? (x->tk):(str->cn - x->tk - 1));
        tb = &(uidx->idx->a[id].bb.a[str->a[tk]>>32]);
        if((!!tb->rev) == (!!is_rev)) {
            if(tb->te == ug->u.a[tb->hid].len) r_end = 1;
            else r_end = 0;
        } else {
            if(tb->ts == 0) r_end = 1;
            else r_end = 0;
        }
        if(r_end) {///start from right end
            qoff = (uint32_t)buf->u.a[qk]; toff = (is_rev?(uidx->idx->a[id].rlen-tb->qs):(tb->qe));
        } else {///start from left end
            qoff = buf->u.a[qk]>>32; toff = (is_rev?(uidx->idx->a[id].rlen-tb->qe):(tb->qs));
        }
        
        if(qk == 0) toff = tb->te - tb->ts;
        if(toff < qoff) beg_cut = qoff - toff;
        // fprintf(stderr, "[M::%s::beg::is_rev->%lu] qoff::%ld, toff::%ld, r_end::%u\n", __func__, is_rev, qoff, toff, r_end);
        

        ///end
        x = &(buf->b.a[msc.e-1]);
        qk = (uint32_t)(x->tn_rev_qk); tk = ((is_rev == 0)? (x->tk):(str->cn - x->tk - 1));
        tb = &(uidx->idx->a[id].bb.a[str->a[tk]>>32]);
        if((!!tb->rev) == (!!is_rev)) {
            if(tb->ts == 0) r_end = 0;
            else r_end = 1;
        } else {
            if(tb->te == ug->u.a[tb->hid].len) r_end = 0;
            else r_end = 1;
        }
        if(!r_end) {
            qoff = l - (buf->u.a[qk]>>32); toff = (is_rev?(tb->qe):(uidx->idx->a[id].rlen-tb->qs));
        } else {
            qoff = l - (uint32_t)(buf->u.a[qk]); toff = (is_rev?(tb->qs):(uidx->idx->a[id].rlen-tb->qe));
        }
        if(qk+1==seq_n) toff = tb->te - tb->ts;
        if(toff < qoff) end_cut = qoff - toff;
        // fprintf(stderr, "[M::%s::end::is_rev->%lu] qoff::%ld, toff::%ld, r_end::%u\n", __func__, is_rev, qoff, toff, r_end);

        if(beg_cut > 0) {
            v = (uint32_t)seq[0]; u = &(ug->u.a[v>>1]);
            if(beg_cut < u->len) beg_cut = u->len - beg_cut;
            else beg_cut = 0;
            if(v&1) { 
                beg_nl = (int64_t)(Get_READ_LENGTH(R_INF, (u->a[0]>>33)));
            } else {
                beg_nl = (int64_t)(Get_READ_LENGTH(R_INF, (u->a[u->n-1]>>33)));
            }
            if(beg_cut > beg_nl) beg_nl = beg_cut;
            if(beg_nl == u->len) beg_cut = 0;
            else beg_cut = 1;
        }

        
        if(end_cut > 0) {
            v = (uint32_t)seq[seq_n-1]; u = &(ug->u.a[v>>1]);
            if(end_cut < u->len) end_cut = u->len - end_cut;
            else end_cut = 0;
            if(v&1) { 
                end_nl = Get_READ_LENGTH(R_INF, (u->a[u->n-1]>>33));
            } else {
                end_nl = Get_READ_LENGTH(R_INF, (u->a[0]>>33));
            }
            if(end_cut > end_nl) end_nl = end_cut;
            if(end_nl == u->len) end_cut = 0;
            else end_cut = 1;
        }
        // fprintf(stderr, "++[M::%s] beg_nl::%lu, end_nl::%lu\n", __func__, beg_nl, end_nl);
        if(beg_cut || end_cut) {
            k = 0; uls = 0; ule = beg_nl; 
            buf->u.a[k] = uls; buf->u.a[k] <<= 32; buf->u.a[k] |= ule;
            l = ule; p_ls = uls; p_le = ule;
            for (k += 1; k + 1 < seq_n; k++) {
                v = (uint32_t)seq[k]; pd = (seq[k]<<1)>>33;
                ule = l + pd; uls = ((ule >= ug->g->seq[v>>1].len)?(ule - ug->g->seq[v>>1].len):(0));
                bc = 0;
                if(k > 0){
                    bc = (!!(seq[k]&((uint64_t)(0x8000000000000000))));///if connected in the graph
                    if(bc) bc = double_check_gconnect(ug->g, ((uint32_t)seq[k])^1, ((uint32_t)seq[k-1])^1, pd);
                    // fprintf(stderr, "bc->%lu\n", bc);
                }
                if(p_ls != (uint64_t)-1) {
                    ///uls should uls>=p_ls && uls<=p_le
                    if(uls < p_ls) uls = p_ls;
                    if(bc && uls > p_le) uls = p_le;
                    ///ule should ule > p_le
                    if(ule <= p_le) ule = p_le + 1;
                }
                buf->u.a[k] = uls; buf->u.a[k] <<= 32; buf->u.a[k] |= ule;
                p_ls = uls; p_le = ule;
                l = ule;
            }

            assert(k < seq_n);
            v = (uint32_t)seq[k]; pd = (seq[k]<<1)>>33;
            ule = l + pd; uls = ((ule >= ug->g->seq[v>>1].len)?(ule - ug->g->seq[v>>1].len):(0));
            ule = uls + end_nl;
            bc = 0;
            if(k > 0){
                bc = (!!(seq[k]&((uint64_t)(0x8000000000000000))));///if connected in the graph
                if(bc) bc = double_check_gconnect(ug->g, ((uint32_t)seq[k])^1, ((uint32_t)seq[k-1])^1, pd);
                // fprintf(stderr, "bc->%lu\n", bc);
            }
            if(p_ls != (uint64_t)-1) {
                ///uls should uls>=p_ls && uls<=p_le
                if(uls < p_ls) uls = p_ls;
                if(bc && uls > p_le) uls = p_le;
                ///ule should ule > p_le
                if(ule <= p_le) ule = p_le + 1;
            }
            if(ule - uls < (uint64_t)end_nl) ule = uls + end_nl;
            buf->u.a[k] = uls; buf->u.a[k] <<= 32; buf->u.a[k] |= ule;
            p_ls = uls; p_le = ule;
            l = ule;
        }
    }
    
    push_integer_seq_exact(&(uidx->idx->a[id]), ug, seq, seq_n, buf->u.a, tid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, 0x20(%rsp)
testq %r8, %r8
je 0x1bce8a
movq %rcx, %r9
movq %rsi, %r13
incq 0x318(%rsi)
movq 0x18(%rdi), %rsi
movq (%rcx), %rcx
movq %rcx, %rax
shrq $0x20, %rax
movq %rsi, 0x50(%rsp)
movq 0x18(%rsi), %rsi
movq 0x20(%rsi), %rsi
shrl %ecx
movl (%rsi,%rcx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rax
jne 0x1bceda
movl %edx, %ecx
cmpq $0x1, 0x20(%rsp)
jne 0x1bc41c
leaq 0x88(%rsp), %r8
movq %rax, (%r8)
movq 0x30(%rdi), %rax
imulq $0x58, %rcx, %rdi
addq 0x48(%rax), %rdi
pushq $0x1
popq %rcx
movq 0x50(%rsp), %rsi
movq %r9, %rdx
jmp 0x1bce85
movl %edx, 0x30(%rsp)
movq %rcx, 0x48(%rsp)
shlq $0x5, %rcx
movq %rdi, 0x68(%rsp)
addq 0x1d0(%rdi), %rcx
andq $0x0, 0x90(%r13)
movabsq $0x100000000, %rbp      # imm = 0x100000000
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r9, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movl 0x18(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r14
jae 0x1bc4ee
movq 0x10(%rcx), %rax
movq (%rax,%rbx,4), %r15
movq 0x90(%r13), %rcx
movq 0xa0(%r13), %rax
cmpq 0x98(%r13), %rcx
jne 0x1bc4ba
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x98(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x38(%rsp), %r9
movq %rax, 0xa0(%r13)
movq 0x90(%r13), %rcx
movq %r15, %rdx
shlq $0x20, %rdx
orq %rbp, %rdx
andl $0x1, %r15d
addq %rbx, %r15
addq %rdx, %r15
leaq 0x1(%rcx), %rdx
movq %rdx, 0x90(%r13)
movq %r15, (%rax,%rcx,8)
incq %r14
addq $0x2, %rbx
movq 0x40(%rsp), %rcx
jmp 0x1bc456
xorl %ebx, %ebx
movq 0x20(%rsp), %r14
xorl %r15d, %r15d
subq $0x1, %r14
jb 0x1bc587
movq (%r9,%rbx,4), %r12
movq 0x90(%r13), %rdx
movq 0xa0(%r13), %rax
cmpq 0x98(%r13), %rdx
jne 0x1bc551
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x98(%r13)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x38(%rsp), %r9
movq %rax, 0xa0(%r13)
movq 0x90(%r13), %rdx
movl %r12d, %esi
andl $-0x2, %esi
shlq $0x20, %rsi
leaq (%rsi,%r15,2), %rcx
andl $0x1, %r12d
orq %r12, %rcx
orq %r12, %rsi
addq %rbx, %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, 0x90(%r13)
movq %rsi, (%rax,%rdx,8)
incq %r15
addq $0x2, %rbx
jmp 0x1bc4f8
movq %rcx, 0x88(%rsp)
movq 0x90(%r13), %rax
movq 0xa0(%r13), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x1a3def
andq $0x0, 0x30(%r13)
movq 0x90(%r13), %rax
xorl %r8d, %r8d
xorl %r15d, %r15d
movq 0x20(%rsp), %r9
cmpq %rax, %r15
jae 0x1bc757
movq 0xa0(%r13), %rbx
testq %rbp, (%rbx,%r15,8)
jne 0x1bc74f
movq %r15, %r14
incq %r14
cmpq %rax, %r14
jae 0x1bc74f
movq (%rbx,%r14,8), %rdx
movq (%rbx,%r15,8), %rcx
xorq %rdx, %rcx
movq %rcx, %rsi
shrq $0x21, %rsi
jne 0x1bc74f
incq %r14
testq %rbp, %rdx
je 0x1bc5dd
andl $0x1, %ecx
jne 0x1bc5dd
movq 0x40(%r13), %r12
cmpq 0x38(%r13), %r8
jne 0x1bc645
leaq (%r8,%r8), %rax
testq %r8, %r8
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
movq %rax, 0x38(%r13)
imulq $0x18, %rax, %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rax, 0x40(%r13)
movq 0x30(%r13), %r8
movq 0xa0(%r13), %rbx
imulq $0x18, %r8, %rcx
leaq 0x1(%r8), %rax
movq %rax, 0x28(%rsp)
movq %rax, 0x30(%r13)
movq (%rbx,%r15,8), %rax
movq %rax, %rdx
shrq $0x20, %rdx
andl $-0x2, %edx
movl %eax, %esi
andl $0x1, %esi
orl %edx, %esi
movl %esi, 0x4(%r12,%rcx)
shrl %eax
movq %rax, 0x10(%r12,%rcx)
movq -0x8(%rbx,%r14,8), %r9
movl %r9d, %esi
shrl %esi
movl %esi, (%r12,%rcx)
movq 0x68(%rsp), %rdx
movq 0x30(%rdx), %rdx
movq 0x48(%rdx), %rdx
imulq $0x58, 0x48(%rsp), %rdi
movq 0x30(%rdx,%rdi), %rdx
movq 0x40(%rsp), %rdi
movq 0x10(%rdi), %rdi
movl 0x4(%rdi,%rsi,8), %edi
imulq $0x24, %rdi, %rdi
movl (%rdx,%rdi), %r8d
movl 0x20(%rdx,%rdi), %r10d
shrl $0x5, %r10d
andl $0x1, %r10d
leal (%r10,%r8,2), %r10d
movq %r9, %r11
shrq $0x20, %r11
andl $-0x2, %r11d
andl $0x1, %r9d
addl %r9d, %r11d
cmpl %r10d, %r11d
jne 0x1bce9c
addq %rcx, %r12
movl (%rbx,%r15,8), %ecx
andl $0x1, %ecx
cmpl %r9d, %ecx
je 0x1bc70e
movq 0x40(%rsp), %rcx
movl 0x18(%rcx), %ecx
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
andl %r9d, %ecx
notl %esi
addl %ecx, %esi
movl %esi, (%r12)
orq %rbp, %rax
movq %rax, 0x10(%r12)
addq %rdi, %rdx
movl 0xc(%rdx), %edi
movl 0x10(%rdx), %esi
imulq $0x28, %r8, %rdx
movq 0x50(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1b2312
movl %eax, 0x8(%r12)
testl %eax, %eax
je 0x1bcebb
decq %r14
movq 0x90(%r13), %rax
movq 0x20(%rsp), %r9
movq 0x28(%rsp), %r8
jmp 0x1bc5da
incq %r15
jmp 0x1bc5bd
testq %r8, %r8
je 0x1bc841
pushq $0x1
popq %rbx
movq 0x40(%r13), %rdi
imulq $0x18, %r8, %rsi
addq %rdi, %rsi
callq 0x1a47a8
movq 0x20(%rsp), %r9
pushq $-0x1
popq %rax
pushq $0x28
popq %r15
xorl %ecx, %ecx
leaq 0x90(%rsp), %r12
movl %eax, 0x28(%rsp)
movq %rax, 0x60(%rsp)
xorl %r14d, %r14d
movl 0x30(%rsp), %ebp
cmpq 0x30(%r13), %rbx
ja 0x1bc84d
movq 0x40(%r13), %rsi
je 0x1bc7bc
imulq $0x18, %rcx, %rax
movq (%rsi,%r15), %rdx
xorq 0x10(%rsi,%rax), %rdx
shrq $0x20, %rdx
je 0x1bc835
imulq $0x18, %rcx, %rax
addq %rax, %rsi
movq %rbx, %rdx
subq %rcx, %rdx
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl %ebp, %edi
movq %r13, %r8
movq 0x50(%rsp), %r9
callq 0x1b379d
testl %eax, %eax
je 0x1bc82d
cmpl $-0x1, 0x98(%rsp)
je 0x1bc82d
movq 0xa0(%rsp), %rax
cmpl $-0x1, 0x28(%rsp)
movq 0x20(%rsp), %r9
je 0x1bc80e
movq %rbx, %rcx
cmpq %rax, %r14
jae 0x1bc835
movl 0x90(%rsp), %ecx
movl %ecx, 0x28(%rsp)
movl 0x94(%rsp), %ecx
movq %rcx, 0x60(%rsp)
movq %rbx, %rcx
movq %rax, %r14
jmp 0x1bc835
movq %rbx, %rcx
movq 0x20(%rsp), %r9
incq %rbx
addq $0x18, %r15
jmp 0x1bc799
pushq $-0x1
popq %rax
movl %eax, 0x28(%rsp)
movq %rax, 0x60(%rsp)
andq $0x0, 0x90(%r13)
movq 0xa0(%r13), %r8
cmpq %r9, 0x98(%r13)
jae 0x1bc8c4
leaq -0x1(%r9), %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(%r13)
leaq 0x8(,%rcx,8), %rsi
movq %r8, %rdi
callq 0x2370
movq 0x20(%rsp), %r9
movq %rax, %r8
movq %rax, 0xa0(%r13)
movq 0x38(%rsp), %rdx
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x20(%rax), %rcx
pushq $-0x1
popq %rbx
xorl %r10d, %r10d
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
xorl %edi, %edi
movq %rbx, %r15
movq %r8, 0x30(%rsp)
movq %rcx, 0x58(%rsp)
cmpq %r14, %r9
je 0x1bc9bb
movq (%rdx,%r14,8), %rsi
movq %rsi, %rbp
shrq $0x20, %rbp
andq %r11, %rbp
addq %rdi, %rbp
movl %esi, %eax
shrl %eax
movl (%rcx,%rax,8), %eax
andq %r11, %rax
movq %rbp, %r12
subq %rax, %r12
cmovbq %r10, %r12
movl $0x0, %eax
testq %r14, %r14
je 0x1bc973
testq %rsi, %rsi
js 0x1bc93f
shrq $0x3f, %rsi
movq %rsi, %rax
jmp 0x1bc973
xorl $0x1, %esi
movl -0x8(%rdx,%r14,8), %edx
xorl $0x1, %edx
movq 0x70(%rsp), %rdi
callq 0x1bc34e
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movq 0x58(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x20(%rsp), %r9
movq 0x38(%rsp), %rdx
movl %eax, %eax
cmpq $-0x1, %rbx
je 0x1bc99c
cmpq %rbx, %r12
cmovaq %r12, %rbx
cmpq %r15, %rbx
movq %r15, %r12
cmovbq %rbx, %r12
testq %rax, %rax
cmoveq %rbx, %r12
leaq 0x1(%r15), %rax
cmpq %r15, %rbp
cmovbeq %rax, %rbp
movq %r12, %rax
shlq $0x20, %rax
orq %rbp, %rax
movq %rax, (%r8,%r14,8)
incq %r14
movq %rbp, %rdi
movq %r12, %rbx
movq %rbp, %r15
jmp 0x1bc8f9
movq %r9, 0x90(%r13)
movl 0x28(%rsp), %eax
cmpl $-0x1, %eax
je 0x1bca0e
cmpl %eax, 0x60(%rsp)
jbe 0x1bca0e
movq (%rdx), %r12
movq %r12, 0x78(%rsp)
movq -0x8(%rdx,%r9,8), %r14
movq 0x40(%r13), %r11
movl %eax, %eax
imulq $0x18, %rax, %rcx
leaq (%r11,%rcx), %rax
movq 0x10(%r11,%rcx), %rcx
movq %rcx, %r8
shrq $0x20, %r8
andl $0x1, %r8d
movl %ecx, %ebx
btq $0x20, %rcx
jb 0x1bca25
movl (%rax), %eax
movq 0x40(%rsp), %rdx
jmp 0x1bca38
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %r10
movq 0x48(%rsp), %rdi
jmp 0x1bce76
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq 0x40(%rsp), %rdx
andl 0x18(%rdx), %ecx
movl (%rax), %eax
notl %eax
addl %ecx, %eax
movq %r14, 0x80(%rsp)
shrl %r12d
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl %eax, %esi
movq 0x68(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %rax
imulq $0x58, 0x48(%rsp), %r10
movq %rax, 0x28(%rsp)
movq 0x30(%rax,%r10), %r15
movq 0x10(%rdx), %rax
movl 0x4(%rax,%rsi,8), %esi
imulq $0x24, %rsi, %r9
leaq (%r15,%r9), %rsi
movzbl 0x20(%r15,%r9), %r9d
btl $0x5, %r9d
movl %r8d, %r9d
sbbl $0x0, %r9d
jne 0x1bcab6
movl (%rsi), %r9d
imulq $0x28, %r9, %r9
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl (%rcx,%r9), %ebp
cmpl %ebp, 0x10(%rsi)
jne 0x1bcabc
movq 0x30(%rsp), %rdx
movl (%rdx,%rbx,8), %edx
testq %r8, %r8
jne 0x1bcade
movl 0x8(%rsi), %ebp
jmp 0x1bcaeb
cmpl $0x0, 0xc(%rsi)
je 0x1bcaa4
movq 0x30(%rsp), %rdx
movl 0x4(%rdx,%rbx,8), %edx
testq %r8, %r8
jne 0x1bcacf
movl 0x4(%rsi), %ebp
jmp 0x1bcaeb
movq 0x28(%rsp), %r9
movl 0x18(%r9,%r10), %ebp
subl 0x8(%rsi), %ebp
jmp 0x1bcaeb
movq 0x28(%rsp), %r9
movl 0x18(%r9,%r10), %ebp
subl 0x4(%rsi), %ebp
shrl %r14d
testq %rbx, %rbx
jne 0x1bcaf9
movl 0x10(%rsi), %ebp
subl 0xc(%rsi), %ebp
imulq $0x28, %r12, %rbx
movl %ebp, %r13d
xorl %r9d, %r9d
movq %rdx, %rsi
subq %r13, %rsi
cmovaeq %rsi, %r9
movq 0x60(%rsp), %rsi
decl %esi
imulq $0x18, %rsi, %rsi
leaq (%r11,%rsi), %r12
movl 0x10(%r11,%rsi), %esi
testq %r8, %r8
jne 0x1bcb2c
movl (%r12), %ebp
jmp 0x1bcb44
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movq 0x40(%rsp), %rbp
andl 0x18(%rbp), %r11d
movl (%r12), %ebp
notl %ebp
addl %r11d, %ebp
imulq $0x28, %r14, %r11
movl (%rcx,%rbx), %r14d
movl %ebp, %r12d
movl 0x4(%rax,%r12,8), %eax
imulq $0x24, %rax, %r12
leaq (%r15,%r12), %rax
movzbl 0x20(%r15,%r12), %ebp
btl $0x5, %ebp
movl %r8d, %ebp
sbbl $0x0, %ebp
jne 0x1bcb92
cmpl $0x0, 0xc(%rax)
je 0x1bcba7
movq 0x30(%rsp), %r15
movl (%r15,%rsi,8), %r15d
testq %r8, %r8
jne 0x1bcbc6
movq 0x28(%rsp), %r8
movl 0x18(%r8,%r10), %r10d
subl 0x8(%rax), %r10d
jmp 0x1bcbd0
movl (%rax), %r15d
imulq $0x28, %r15, %r15
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl (%rcx,%r15), %ebp
cmpl %ebp, 0x10(%rax)
jne 0x1bcb74
movq 0x30(%rsp), %r15
movl 0x4(%r15,%rsi,8), %r15d
testq %r8, %r8
jne 0x1bcbcc
movq 0x28(%rsp), %r8
movl 0x18(%r8,%r10), %r10d
subl 0x4(%rax), %r10d
jmp 0x1bcbd0
movl 0x4(%rax), %r10d
jmp 0x1bcbd0
movl 0x8(%rax), %r10d
movl (%rcx,%r11), %r12d
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
subq %r15, %rdi
incq %rsi
cmpq 0x20(%rsp), %rsi
jne 0x1bcbef
movl 0x10(%rax), %r10d
subl 0xc(%rax), %r10d
andq %r8, %r14
movl %r10d, %esi
xorl %eax, %eax
subq %rsi, %rdi
cmovgq %rdi, %rax
cmpl %r13d, %edx
jbe 0x1bcc52
addq %rcx, %rbx
xorl %edx, %edx
movq %r14, %rsi
subq %r9, %rsi
cmovaeq %rsi, %rdx
leaq 0x97617(%rip), %rsi     # 0x254230
movq 0x18(%rsi), %rsi
movq 0x18(%rbx), %rdi
testb $0x1, 0x78(%rsp)
jne 0x1bcc33
movl 0x10(%rbx), %r9d
decl %r9d
leaq (%rdi,%r9,8), %rdi
movq (%rdi), %rdi
shrq $0x21, %rdi
movq (%rsi,%rdi,8), %rsi
cmpq %rsi, %rdx
cmovgq %rdx, %rsi
xorl %r9d, %r9d
cmpq %r14, %rsi
setne %r9b
movq %rsi, %r14
andq %r8, %r12
testq %rax, %rax
jle 0x1bccb9
addq %r11, %rcx
xorl %edi, %edi
movq %r12, %rsi
subq %rax, %rsi
cmovaeq %rsi, %rdi
leaq 0x975c0(%rip), %rax     # 0x254230
movq 0x18(%rax), %rax
movq 0x18(%rcx), %rsi
testb $0x1, 0x80(%rsp)
je 0x1bcc8b
movl 0x10(%rcx), %ecx
decl %ecx
leaq (%rsi,%rcx,8), %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %r8
movq 0x58(%rsp), %r10
movq (%rsi), %rcx
shrq $0x21, %rcx
movq (%rax,%rcx,8), %rcx
cmpq %rcx, %rdi
cmovgq %rdi, %rcx
xorl %eax, %eax
cmpq %r12, %rcx
setne %al
movq %rcx, %r12
jmp 0x1bccc8
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %r8
movq 0x58(%rsp), %r10
orq %rax, %r9
je 0x1bcda1
movq %r12, 0x40(%rsp)
movq %r14, (%r8)
pushq $0x1
popq %rbx
xorl %r15d, %r15d
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq 0x20(%rsp), %r9
leaq 0x1(%rbx), %r12
cmpq %r9, %r12
jae 0x1bcdb5
movq (%rdx,%rbx,8), %rsi
movq %rsi, %rbp
shrq $0x20, %rbp
andq %rdi, %rbp
addq %r14, %rbp
movl %esi, %eax
shrl %eax
movl (%r10,%rax,8), %eax
andq %rdi, %rax
movq %rbp, %rcx
subq %rax, %rcx
movl $0x0, %r13d
cmovaeq %rcx, %r13
testq %rsi, %rsi
js 0x1bcd2d
shrq $0x3f, %rsi
jmp 0x1bcd5c
xorl $0x1, %esi
movl -0x8(%rdx,%rbx,8), %edx
xorl $0x1, %edx
movq 0x70(%rsp), %rdi
callq 0x1bc34e
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq 0x58(%rsp), %r10
movq 0x30(%rsp), %r8
movq 0x20(%rsp), %r9
movq 0x38(%rsp), %rdx
movl %eax, %esi
cmpq $-0x1, %r15
je 0x1bcd85
cmpq %r15, %r13
cmovaq %r13, %r15
cmpq %r14, %r15
movq %r14, %r13
cmovbq %r15, %r13
testq %rsi, %rsi
cmoveq %r15, %r13
leaq 0x1(%r14), %rax
cmpq %r14, %rbp
cmovbeq %rax, %rbp
movq %r13, %rax
shlq $0x20, %rax
orq %rbp, %rax
movq %rax, (%r8,%rbx,8)
movq %r12, %rbx
movq %r13, %r15
movq %rbp, %r14
jmp 0x1bcce9
movq 0x20(%rsp), %r9
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %r10
jmp 0x1bce76
cmpq %r9, %rbx
jae 0x1bcef9
movq (%rdx,%rbx,8), %rsi
movq %rsi, %rax
shrq $0x20, %rax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
addq %r14, %rax
movl %esi, %edi
shrl %edi
movl (%r10,%rdi,8), %edi
andq %rcx, %rdi
xorl %r12d, %r12d
subq %rdi, %rax
cmovaeq %rax, %r12
testq %rsi, %rsi
js 0x1bcdf4
shrq $0x3f, %rsi
jmp 0x1bce19
xorl $0x1, %esi
movl -0x8(%rdx,%rbx,8), %edx
xorl $0x1, %edx
movq 0x70(%rsp), %rdi
callq 0x1bc34e
movq 0x30(%rsp), %r8
movq 0x20(%rsp), %r9
movq 0x38(%rsp), %rdx
movl %eax, %esi
movq 0x40(%rsp), %r11
leaq (%r12,%r11), %rax
cmpq $-0x1, %r15
je 0x1bce51
cmpq %r15, %r12
cmovaq %r12, %r15
cmpq %r14, %r15
movq %r14, %r12
cmovbq %r15, %r12
testq %rsi, %rsi
cmoveq %r15, %r12
leaq 0x1(%r14), %rcx
cmpq %r14, %rax
cmovaq %rax, %rcx
leaq (%r12,%r11), %rax
jmp 0x1bce54
movq %rax, %rcx
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %r10
movq %rcx, %rsi
subq %r12, %rsi
cmpq %r11, %rsi
cmovaeq %rcx, %rax
shlq $0x20, %r12
orq %rax, %r12
movq %r12, (%r8,%rbx,8)
imulq $0x58, %rdi, %rdi
addq %r10, %rdi
movq 0x50(%rsp), %rsi
movq %r9, %rcx
callq 0x1bc0da
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3cb3a(%rip), %rdi     # 0x1f99dd
leaq 0x3a62f(%rip), %rsi     # 0x1f74d9
leaq 0x3cacd(%rip), %rcx     # 0x1f997e
movl $0x1cfa, %edx           # imm = 0x1CFA
callq 0x2110
leaq 0x3cb5c(%rip), %rdi     # 0x1f9a1e
leaq 0x3a610(%rip), %rsi     # 0x1f74d9
leaq 0x3caae(%rip), %rcx     # 0x1f997e
movl $0x1d00, %edx           # imm = 0x1D00
callq 0x2110
leaq 0x3ca65(%rip), %rdi     # 0x1f9946
leaq 0x3a5f1(%rip), %rsi     # 0x1f74d9
leaq 0x3ca8f(%rip), %rcx     # 0x1f997e
movl $0x1cd3, %edx           # imm = 0x1CD3
callq 0x2110
leaq 0x3cb28(%rip), %rdi     # 0x1f9a28
leaq 0x3a5d2(%rip), %rsi     # 0x1f74d9
leaq 0x3ca70(%rip), %rcx     # 0x1f997e
movl $0x1d9a, %edx           # imm = 0x1D9A
callq 0x2110