// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movl %edx, 0x38(%rsp)
testq %r8, %r8
je 0x2092f1
movq %rcx, %r9
movq %rsi, %r13
movq %r8, 0x28(%rsp)
incq 0x318(%rsi)
movq 0x18(%rdi), %rdx
movq (%rcx), %rcx
movq %rcx, %rax
shrq $0x20, %rax
movq %rdx, 0x58(%rsp)
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
shrl %ecx
movl (%rdx,%rcx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rax
jne 0x209341
movl 0x38(%rsp), %r12d
cmpq $0x1, 0x28(%rsp)
jne 0x208814
leaq 0x78(%rsp), %r8
movq %rax, (%r8)
movq 0x30(%rdi), %rax
imulq $0x58, %r12, %rdi
addq 0x48(%rax), %rdi
movl $0x1, %ecx
movq 0x58(%rsp), %rsi
movq %r9, %rdx
jmp 0x2092ec
movq %r12, %rbp
shlq $0x5, %rbp
movq %rdi, 0x30(%rsp)
addq 0x1d0(%rdi), %rbp
movq $0x0, 0x90(%r13)
testl $0x7fffffff, 0x18(%rbp) # imm = 0x7FFFFFFF
movq %r9, 0x20(%rsp)
je 0x2088e0
movq 0xa0(%r13), %rdi
xorl %ebx, %ebx
movl $0x2, %r14d
movq 0x10(%rbp), %rax
movq (%rax,%rbx,8), %r15
movq 0x90(%r13), %rax
cmpq 0x98(%r13), %rax
jne 0x20889c
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rsi, 0x98(%r13)
shlq $0x3, %rsi
callq 0x2370
movq 0x20(%rsp), %r9
movq %rax, %rdi
movq %rax, 0xa0(%r13)
movq 0x90(%r13), %rax
movq %r15, %rcx
shlq $0x20, %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
orq %rdx, %rcx
leaq (%rcx,%rbx,2), %rcx
andl $0x1, %r15d
orq %rcx, %r15
leaq 0x1(%rax), %rcx
movq %rcx, 0x90(%r13)
movq %r15, (%rdi,%rax,8)
incq %rbx
movl 0x18(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %rbx
jb 0x208853
jmp 0x2088e7
movq 0xa0(%r13), %rdi
movq %rbp, 0x40(%rsp)
movq %r12, 0x50(%rsp)
movl $0x2, %r15d
xorl %r12d, %r12d
movq 0x28(%rsp), %rbp
movl $0x2, %ebx
movq (%r9,%r12,4), %r14
movq 0x90(%r13), %rax
cmpq 0x98(%r13), %rax
jne 0x208949
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r15, %rsi
movq %rsi, 0x98(%r13)
shlq $0x3, %rsi
callq 0x2370
movq 0x20(%rsp), %r9
movq %rax, %rdi
movq %rax, 0xa0(%r13)
movq 0x90(%r13), %rax
movl %r14d, %ecx
andl $-0x2, %ecx
shlq $0x20, %rcx
movl %r14d, %edx
andl $0x1, %edx
orq %rcx, %rdx
addq %r12, %rdx
leaq 0x1(%rax), %rcx
movq %rcx, 0x90(%r13)
movq %rdx, (%rdi,%rax,8)
addq $-0x2, %rbx
addq $0x2, %r12
decq %rbp
jne 0x208904
movl %r14d, %eax
shrl %eax
shlq $0x21, %rax
andl $0x1, %r14d
orq %rax, %r14
subq %rbx, %r14
movq %r14, 0x78(%rsp)
movq 0x90(%r13), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x1ee586
movq $0x0, 0x30(%r13)
movq 0x90(%r13), %rax
movl $0xffffffff, 0x48(%rsp) # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x208c76
movq 0xa0(%r13), %r12
xorl %ebp, %ebp
xorl %r14d, %r14d
leaq 0x1(%r14), %r15
movabsq $0x100000000, %rcx      # imm = 0x100000000
testq %rcx, (%r12,%r14,8)
movq %r15, 0x18(%rsp)
jne 0x208b71
cmpq %rax, %r15
jae 0x208b71
movq (%r12,%r15,8), %rdx
movq (%r12,%r14,8), %rcx
xorq %rdx, %rcx
movq %rcx, %rsi
shrq $0x21, %rsi
jne 0x208b71
movabsq $0x100000000, %rsi      # imm = 0x100000000
testq %rsi, %rdx
je 0x208b69
andl $0x1, %ecx
jne 0x208b69
movq 0x40(%r13), %rax
cmpq 0x38(%r13), %rbp
jne 0x208a6a
leaq (,%rbp,2), %rcx
testq %rbp, %rbp
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x38(%r13)
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x40(%r13)
movq 0x30(%r13), %rbp
movq 0xa0(%r13), %r12
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
incq %rbp
movq %rbp, 0x30(%r13)
movq (%r12,%r14,8), %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
andl $-0x2, %esi
movl %ecx, %edi
andl $0x1, %edi
orl %esi, %edi
movl %edi, 0x4(%rax,%rdx,8)
shrl %ecx
movq %rcx, 0x10(%rax,%rdx,8)
movq (%r12,%r15,8), %r10
movl %r10d, %esi
shrl %esi
movl %esi, (%rax,%rdx,8)
movq 0x30(%rsp), %rdi
movq 0x30(%rdi), %rdi
movq 0x48(%rdi), %rdi
imulq $0x58, 0x50(%rsp), %r8
movq 0x30(%rdi,%r8), %rdi
movq 0x40(%rsp), %r8
movq 0x10(%r8), %r8
movl 0x4(%r8,%rsi,8), %r8d
leaq (%r8,%r8,8), %r9
movl (%rdi,%r9,4), %r8d
movl 0x20(%rdi,%r9,4), %r11d
shrl $0x5, %r11d
andl $0x1, %r11d
leal (%r11,%r8,2), %r11d
movq %r10, %rbx
shrq $0x20, %rbx
andl $-0x2, %ebx
andl $0x1, %r10d
addl %r10d, %ebx
cmpl %r11d, %ebx
jne 0x209303
leaq (%rax,%rdx,8), %rbx
movl (%r12,%r14,8), %eax
andl $0x1, %eax
cmpl %r10d, %eax
je 0x208b37
movq 0x40(%rsp), %rax
movl 0x18(%rax), %eax
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %eax
notl %esi
addl %eax, %esi
movl %esi, (%rbx)
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %rcx
movq %rcx, 0x10(%rbx)
leaq (%rdi,%r9,4), %rax
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
leaq (%r8,%r8,4), %rdx
shlq $0x3, %rdx
movq 0x58(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1fe266
movl %eax, 0x8(%rbx)
testl %eax, %eax
je 0x209322
movq 0x90(%r13), %rax
incq %r15
jmp 0x2089ec
movq 0x18(%rsp), %r14
cmpq %rax, %r14
jb 0x2089cf
testq %rbp, %rbp
je 0x208c76
movq 0x40(%r13), %rdi
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%rdi,%rax,8), %rsi
callq 0x1eef97
movq 0x30(%r13), %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x208c7b
movl $0x1, %r14d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0x28, %r15d
xorl %ebp, %ebp
leaq 0x80(%rsp), %r12
xorl %ecx, %ecx
movl $0xffffffff, 0x48(%rsp) # imm = 0xFFFFFFFF
movq 0x40(%r13), %rdx
cmpq %rax, %r14
je 0x208bf3
leaq (%rcx,%rcx,2), %rax
movq (%rdx,%r15), %rsi
xorq 0x10(%rdx,%rax,8), %rsi
shrq $0x20, %rsi
je 0x208c60
leaq (%rcx,%rcx,2), %rax
leaq (%rdx,%rax,8), %rsi
movq %r14, %rdx
subq %rcx, %rdx
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl 0x38(%rsp), %edi
movq %r13, %r8
movq 0x58(%rsp), %r9
callq 0x1ff87d
testl %eax, %eax
je 0x208c5d
cmpl $-0x1, 0x88(%rsp)
je 0x208c5d
movq 0x90(%rsp), %rax
cmpl $-0x1, 0x48(%rsp)
je 0x208c43
movq %r14, %rcx
cmpq %rax, %rbp
jae 0x208c60
movl 0x80(%rsp), %ecx
movl %ecx, 0x48(%rsp)
movl 0x84(%rsp), %ebx
movq %r14, %rcx
movq %rax, %rbp
jmp 0x208c60
movq %r14, %rcx
incq %r14
movq 0x30(%r13), %rax
addq $0x18, %r15
cmpq %rax, %r14
jbe 0x208bd7
jmp 0x208c7b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rbx, 0x68(%rsp)
movq $0x0, 0x90(%r13)
movq 0xa0(%r13), %r8
movq 0x28(%rsp), %rcx
cmpq %rcx, 0x98(%r13)
jae 0x208cff
leaq -0x1(%rcx), %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 0x28(%rsp), %rcx
movq %rax, %r8
movq %rax, 0xa0(%r13)
movq 0x20(%rsp), %rdx
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x20(%rax), %rdi
movq $-0x1, %r15
xorl %r9d, %r9d
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
movq $-0x1, %r14
xorl %eax, %eax
xorl %r12d, %r12d
movq %r8, 0x18(%rsp)
movq %rdi, 0x38(%rsp)
movq (%rdx,%r12,8), %rsi
movq %rsi, %rbp
shrq $0x20, %rbp
andq %r10, %rbp
addq %rax, %rbp
movl %esi, %eax
shrl %eax
movl (%rdi,%rax,8), %eax
andq %r10, %rax
movq %rbp, %rbx
subq %rax, %rbx
cmovbq %r9, %rbx
movl $0x0, %eax
testq %r12, %r12
je 0x208dad
testq %rsi, %rsi
js 0x208d79
shrq $0x3f, %rsi
movq %rsi, %rax
jmp 0x208dad
xorl $0x1, %esi
movl -0x8(%rdx,%r12,8), %edx
xorl $0x1, %edx
movq 0x60(%rsp), %rdi
callq 0x20871c
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
xorl %r9d, %r9d
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %r8
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
movl %eax, %eax
cmpq $-0x1, %r14
je 0x208dd8
cmpq %r14, %rbx
cmovaq %rbx, %r14
cmpq %r15, %r14
movq %r15, %rbx
cmovbq %r14, %rbx
testq %rax, %rax
cmoveq %r14, %rbx
cmpq %r15, %rbp
leaq 0x1(%r15), %r15
cmovaq %rbp, %r15
jmp 0x208ddb
movq %rbp, %r15
movq %rbx, %rax
shlq $0x20, %rax
orq %r15, %rax
movq %rax, (%r8,%r12,8)
incq %r12
movq %rbx, %r14
movq %r15, %rax
cmpq %r12, %rcx
jne 0x208d3c
movq %rcx, 0x90(%r13)
movl 0x48(%rsp), %r9d
cmpl $-0x1, %r9d
setne %al
cmpl %r9d, 0x68(%rsp)
movq %rcx, %rdi
seta %cl
testb %cl, %al
je 0x208e62
movq (%rdx), %r14
movl %r14d, %esi
movq -0x8(%rdx,%rdi,8), %rbx
movq 0x40(%r13), %r10
movl %r9d, %eax
leaq (%rax,%rax,2), %rax
leaq (%r10,%rax,8), %rax
movq 0x10(%rax), %rcx
movq %rcx, %rdi
shrq $0x20, %rdi
andl $0x1, %edi
movl %ecx, %r11d
btq $0x20, %rcx
movq 0x50(%rsp), %r8
movq %r14, 0x70(%rsp)
jb 0x208e7c
movl (%rax), %eax
movq 0x40(%rsp), %r14
jmp 0x208e90
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %r9
movq %rdi, %rcx
movq 0x50(%rsp), %rdi
jmp 0x2092e0
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq 0x40(%rsp), %r14
andl 0x18(%r14), %ecx
movl (%rax), %eax
notl %eax
addl %ecx, %eax
movq %rbx, 0x48(%rsp)
shrl %esi
movq 0x58(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl %eax, %edx
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %r12
imulq $0x58, %r8, %r9
movq 0x30(%r12,%r9), %r13
movq 0x10(%r14), %rax
movl 0x4(%rax,%rdx,8), %edx
leaq (%rdx,%rdx,8), %rdx
leaq (,%rdx,4), %rdx
addq %r13, %rdx
movzbl 0x20(%rdx), %r8d
btl $0x5, %r8d
movl %edi, %r8d
sbbl $0x0, %r8d
jne 0x208f0a
movl (%rdx), %r8d
leaq (%r8,%r8,4), %r8
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl (%rcx,%r8,8), %ebp
cmpl %ebp, 0x10(%rdx)
jne 0x208f10
movq 0x18(%rsp), %r8
movl (%r8,%r11,8), %r8d
testq %rdi, %rdi
jne 0x208f2e
movl 0x8(%rdx), %ebp
jmp 0x208f36
cmpl $0x0, 0xc(%rdx)
je 0x208ef7
movq 0x18(%rsp), %r8
movl 0x4(%r8,%r11,8), %r8d
testq %rdi, %rdi
jne 0x208f24
movl 0x4(%rdx), %ebp
jmp 0x208f36
movl 0x18(%r12,%r9), %ebp
subl 0x8(%rdx), %ebp
jmp 0x208f36
movl 0x18(%r12,%r9), %ebp
subl 0x4(%rdx), %ebp
shrl %ebx
testq %r11, %r11
jne 0x208f43
movl 0x10(%rdx), %ebp
subl 0xc(%rdx), %ebp
leaq (%rsi,%rsi,4), %r11
movl %ebp, %r14d
xorl %esi, %esi
movq %r8, %rdx
subq %r14, %rdx
cmovaeq %rdx, %rsi
movq 0x68(%rsp), %rdx
decl %edx
leaq (%rdx,%rdx,2), %rdx
leaq (%r10,%rdx,8), %r10
movl 0x10(%r10), %edx
testq %rdi, %rdi
movq %r12, 0x30(%rsp)
jne 0x208f78
movl (%r10), %ebp
jmp 0x208f8f
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x40(%rsp), %rbp
andl 0x18(%rbp), %r12d
movl (%r10), %ebp
notl %ebp
addl %r12d, %ebp
leaq (%rbx,%rbx,4), %r10
movl (%rcx,%r11,8), %r12d
movl %ebp, %ebx
movl 0x4(%rax,%rbx,8), %eax
leaq (%rax,%rax,8), %rax
leaq (,%rax,4), %rax
addq %r13, %rax
movzbl 0x20(%rax), %ebx
btl $0x5, %ebx
movl %edi, %ebx
sbbl $0x0, %ebx
jne 0x208fde
cmpl $0x0, 0xc(%rax)
je 0x208ff1
movq 0x18(%rsp), %rbx
movl (%rbx,%rdx,8), %ebx
testq %rdi, %rdi
jne 0x20900f
movq 0x30(%rsp), %rdi
movl 0x18(%rdi,%r9), %r9d
subl 0x8(%rax), %r9d
jmp 0x209019
movl (%rax), %ebx
leaq (%rbx,%rbx,4), %rbx
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl (%rcx,%rbx,8), %ebp
cmpl %ebp, 0x10(%rax)
jne 0x208fc1
movq 0x18(%rsp), %rbx
movl 0x4(%rbx,%rdx,8), %ebx
testq %rdi, %rdi
jne 0x209015
movq 0x30(%rsp), %rdi
movl 0x18(%rdi,%r9), %r9d
subl 0x4(%rax), %r9d
jmp 0x209019
movl 0x4(%rax), %r9d
jmp 0x209019
movl 0x8(%rax), %r9d
movl (%rcx,%r10,8), %r13d
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
subq %rbx, %r15
incq %rdx
cmpq 0x28(%rsp), %rdx
jne 0x209037
movl 0x10(%rax), %r9d
subl 0xc(%rax), %r9d
andq %rdi, %r12
movl %r9d, %edx
xorl %eax, %eax
subq %rdx, %r15
cmovgq %r15, %rax
cmpl %r14d, %r8d
jbe 0x2090a7
leaq (%rcx,%r11,8), %r9
xorl %r11d, %r11d
movq %r12, %r8
subq %rsi, %r8
cmovaeq %r8, %r11
leaq 0x8d1cd(%rip), %rsi     # 0x296230
movq 0x18(%rsi), %rsi
movq 0x18(%r9), %rbx
testb $0x1, 0x70(%rsp)
jne 0x20907d
movl 0x10(%r9), %r9d
decl %r9d
leaq (%rbx,%r9,8), %rbx
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %r8
movq (%rbx), %r9
shrq $0x21, %r9
movq (%rsi,%r9,8), %r9
cmpq %r9, %r11
cmovgq %r11, %r9
xorl %esi, %esi
cmpq %r12, %r9
setne %sil
movq %r9, %r12
jmp 0x2090b1
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %r8
andq %rdi, %r13
testq %rax, %rax
jle 0x20910e
leaq (%rcx,%r10,8), %r9
xorl %ecx, %ecx
movq %r13, %rdi
subq %rax, %rdi
cmovaeq %rdi, %rcx
leaq 0x8d160(%rip), %rax     # 0x296230
movq 0x18(%rax), %rax
movq 0x18(%r9), %rdi
testb $0x1, 0x48(%rsp)
je 0x2090ea
movl 0x10(%r9), %r9d
decl %r9d
leaq (%rdi,%r9,8), %rdi
movq 0x38(%rsp), %r9
movq (%rdi), %rdi
shrq $0x21, %rdi
movq (%rax,%rdi,8), %rdi
cmpq %rdi, %rcx
cmovgq %rcx, %rdi
xorl %eax, %eax
cmpq %r13, %rdi
setne %al
movq %rdi, %r13
jmp 0x209113
movq 0x38(%rsp), %r9
orq %rax, %rsi
movq 0x28(%rsp), %rcx
je 0x209206
movq %r13, 0x40(%rsp)
movq %r12, (%r8)
cmpq $0x3, %rcx
jb 0x209215
movl $0x2, %ebp
subq %rcx, %rbp
movl $0x1, %r14d
xorl %r13d, %r13d
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq %r12, %rbx
movq (%rdx,%r14,8), %rsi
movq %rsi, %r12
shrq $0x20, %r12
andq %rdi, %r12
addq %rbx, %r12
movl %esi, %eax
shrl %eax
movl (%r9,%rax,8), %eax
andq %rdi, %rax
movq %r12, %rcx
subq %rax, %rcx
movl $0x0, %r15d
cmovaeq %rcx, %r15
testq %rsi, %rsi
js 0x209183
shrq $0x3f, %rsi
jmp 0x2091ae
xorl $0x1, %esi
movl -0x8(%rdx,%r14,8), %edx
xorl $0x1, %edx
movq 0x60(%rsp), %rdi
callq 0x20871c
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq 0x38(%rsp), %r9
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %rdx
movl %eax, %esi
cmpq $-0x1, %r13
movq 0x28(%rsp), %rcx
je 0x2091dc
cmpq %r13, %r15
cmovaq %r15, %r13
cmpq %rbx, %r13
movq %rbx, %r15
cmovbq %r13, %r15
testq %rsi, %rsi
cmoveq %r13, %r15
leaq 0x1(%rbx), %rax
cmpq %rbx, %r12
cmovbeq %rax, %r12
movq %r15, %rax
shlq $0x20, %rax
orq %r12, %rax
movq %rax, (%r8,%r14,8)
leaq (%r14,%rbp), %rax
incq %rax
incq %r14
movq %r12, %rbx
movq %r15, %r13
cmpq $0x1, %rax
jne 0x20914c
jmp 0x20921e
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %r9
jmp 0x2092e0
movl $0x1, %r14d
xorl %r15d, %r15d
cmpq %rcx, %r14
movq 0x40(%rsp), %r13
jae 0x209360
movq (%rdx,%r14,8), %rsi
movq %rsi, %rax
shrq $0x20, %rax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
addq %r12, %rax
movl %esi, %edi
shrl %edi
movl (%r9,%rdi,8), %edi
andq %rcx, %rdi
xorl %ebx, %ebx
subq %rdi, %rax
cmovaeq %rax, %rbx
testq %rsi, %rsi
js 0x209261
shrq $0x3f, %rsi
jmp 0x209282
xorl $0x1, %esi
movl -0x8(%rdx,%r14,8), %edx
xorl $0x1, %edx
movq 0x60(%rsp), %rdi
callq 0x20871c
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %rdx
movl %eax, %esi
leaq (%rbx,%r13), %rax
cmpq $-0x1, %r15
je 0x2092b6
cmpq %r15, %rbx
cmovaq %rbx, %r15
cmpq %r12, %r15
movq %r12, %rbx
cmovbq %r15, %rbx
testq %rsi, %rsi
cmoveq %r15, %rbx
leaq 0x1(%r12), %rcx
cmpq %r12, %rax
cmovaq %rax, %rcx
leaq (%rbx,%r13), %rax
jmp 0x2092b9
movq %rax, %rcx
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %r9
movq %rcx, %rsi
subq %rbx, %rsi
cmpq %r13, %rsi
cmovaeq %rcx, %rax
shlq $0x20, %rbx
orq %rax, %rbx
movq %rbx, (%r8,%r14,8)
movq 0x28(%rsp), %rcx
imulq $0x58, %rdi, %rdi
addq %r9, %rdi
movq 0x58(%rsp), %rsi
callq 0x20848a
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3e714(%rip), %rdi     # 0x247a1e
leaq 0x3c2f8(%rip), %rsi     # 0x245609
leaq 0x3e6a7(%rip), %rcx     # 0x2479bf
movl $0x1cfa, %edx           # imm = 0x1CFA
callq 0x2110
leaq 0x3e736(%rip), %rdi     # 0x247a5f
leaq 0x3c2d9(%rip), %rsi     # 0x245609
leaq 0x3e688(%rip), %rcx     # 0x2479bf
movl $0x1d00, %edx           # imm = 0x1D00
callq 0x2110
leaq 0x3e63f(%rip), %rdi     # 0x247987
leaq 0x3c2ba(%rip), %rsi     # 0x245609
leaq 0x3e669(%rip), %rcx     # 0x2479bf
movl $0x1cd3, %edx           # imm = 0x1CD3
callq 0x2110
leaq 0x3e702(%rip), %rdi     # 0x247a69
leaq 0x3c29b(%rip), %rsi     # 0x245609
leaq 0x3e64a(%rip), %rcx     # 0x2479bf
movl $0x1d9a, %edx           # imm = 0x1D9A
callq 0x2110