// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/syncmer.c
// Function: sr_read_analysis_thread
static void *sr_read_analysis_thread(void *args)
{
    p_data_t *dat = (p_data_t *) args;
    
    int len, k, w; 
    uint8_t *key;
    char *seq;
    k = dat->sr_db->s, w = dat->sr_db->k;
    assert(k > 0 && k < 32 && w > k);

    MYMALLOC(key, (w - 1) / 4 + 2);
    int r;
    for (r = 0; r < dat->n_reads; ++r) {
        sr_t sr;
        sr.sid = dat->sid[r];
        sr.sname = dat->name[r];

        seq = dat->seq[r];
        len = dat->len[r];

        kvec_t(uint8_t) hoco_s, ho_rl;
        kvec_t(uint32_t) ho_l_rl, n_nucl, m_pos;
        kvec_t(uint64_t) s_mer;
        kvec_t(uint64_t) k_mer;
    
        kv_init(hoco_s);
        kv_init(ho_rl);
        kv_init(ho_l_rl);
        kv_init(n_nucl);
        kv_init(m_pos);
        kv_init(s_mer);
        kv_init(k_mer);

        int q = w - k + 1; // buf q size
        uint64_t m, s, z, mz, shift1 = 2 * (k - 1), mask = (1ULL<<2*k) - 1, kmer[2] = {0, 0}, buf_m[q], buf_s[q];
        int i, j, l, c, neq, rl, hoco_l, buf_pos, mz_pos;

        MYBONE(buf_m, q);
        MYBONE(buf_s, q);
        mz = UINT64_MAX; // minimizer
        l = hoco_l = buf_pos = mz_pos = 0;
        for (i = 0; i < len; ++i) {
            c = seq_nt4_table[(uint8_t) seq[i]];
            m = s = UINT64_MAX;
            if ((hoco_l++ & 3) == 0) kv_push(uint8_t, hoco_s, 0);
            if (c < 4) { // not an ambiguous base
                // hoco_s.a[hoco_s.n - 1] = hoco_s.a[hoco_s.n - 1] << 2 | c;
                if (c) hoco_s.a[hoco_s.n - 1] |= c << ((((hoco_l-1)&3)^3)<<1); // 6 - ((hoco_l - 1) % 4) << 1;
                rl = 1;
#ifdef DO_HOCO_COMPRESSION    
                // hpc
                if (i + 1 < len && seq_nt4_table[(uint8_t)seq[i + 1]] == c) {
                    for (rl = 2; i + rl < len; ++rl)
                        if (seq_nt4_table[(uint8_t)seq[i + rl]] != c)
                            break;
                    i += rl - 1; // put $i at the end of the current homopolymer run
                }
#endif
                if (rl > 255)
                    kv_push(uint32_t, ho_l_rl, rl - 1);
                rl = MIN(rl, 256);
                kv_push(uint8_t, ho_rl, rl - 1);
            
                ++l;
                kmer[0] = (kmer[0] << 2 | c) & mask;           // forward k-mer
                kmer[1] = (kmer[1] >> 2) | (3ULL^c) << shift1; // reverse k-mer
                if (kmer[0] != kmer[1]) { // skip "symmetric k-mers" as we don't know it strand
                    z = kmer[0] < kmer[1]? 0 : 1; // strand
                    if (l >= k) {
                        m = hash64(kmer[z], mask);
                        s = kmer[z] << 1 | z;
                    }
                }
            } else {
                // ambiguous bases are converted to base 'A'
                // ambiguous bases are not homopolymer compressed
                // hoco_s.a[hoco_s.n - 1] <<= 2;
                kv_push(uint8_t, ho_rl, 0);
                kv_push(uint32_t, n_nucl, i);
                l = 0;
            }

            if (buf_pos == mz_pos && mz != UINT64_MAX && l > w) {
                // open syncmer
                z = buf_s[buf_pos] & 1;
                kv_push(uint64_t, s_mer, buf_s[buf_pos]);
                kv_push(uint32_t, m_pos, (hoco_l - w - 1) << 1 | z);
#ifdef DEBUG_KMER_EXTRACTION
                kv_push(uint64_t, k_mer, kmer_hash64(sr.sid, hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#else
                kv_push(uint64_t, k_mer, kmer_hash64(hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#endif
                // remove syncmers at the same position on a read
                // this is possible as a syncmer could start and end with the same smer
                if (m_pos.n >= 2 && m_pos.a[m_pos.n-1] >> 1 == m_pos.a[m_pos.n-2] >> 1) s_mer.n -= 2, m_pos.n -= 2, k_mer.n -= 2;
            }
            
            buf_m[buf_pos] = m;
            buf_s[buf_pos] = s;
            if (m <= mz && m != UINT64_MAX) {
                if (l >= w) {
                    // close syncmer
                    z = s & 1;
                    kv_push(uint64_t, s_mer, s^1);
                    kv_push(uint32_t, m_pos, (hoco_l - w) << 1 | z);
#ifdef DEBUG_KMER_EXTRACTION
                    kv_push(uint64_t, k_mer, kmer_hash64(sr.sid, hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#else
                    kv_push(uint64_t, k_mer, kmer_hash64(hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#endif
                }
                if (m < mz) mz = m, mz_pos = buf_pos;
            }
            if (m >= mz && buf_pos == mz_pos) {
                // m has been processed in the last 'if' statement if m == mz
                neq = m != mz;
                // update minimizer
                // find the first for identical minimizers
                for (j = buf_pos + 1, mz = UINT64_MAX; j < q; ++j)
                    if (mz > buf_m[j]) mz = buf_m[j], mz_pos = j;
                for (j = 0; j <= buf_pos; ++j)
                    if (mz > buf_m[j]) mz = buf_m[j], mz_pos = j;
                if (neq && ((mz_pos == q_next(buf_pos, q) && mz == m) || mz_pos == buf_pos) && mz != UINT64_MAX && l >= w) {
                    // newly added S-mer is a minimizer
                    // close syncmer
                    z = s & 1;
                    kv_push(uint64_t, s_mer, s^1);
                    kv_push(uint32_t, m_pos, (hoco_l - w) << 1 | z);
#ifdef DEBUG_KMER_EXTRACTION
                    kv_push(uint64_t, k_mer, kmer_hash64(sr.sid, hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#else
                    kv_push(uint64_t, k_mer, kmer_hash64(hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#endif
                }
            }
            
            buf_pos = q_next(buf_pos, q);
        }

        // for the last open mer
        if (buf_pos == mz_pos && mz != UINT64_MAX && l >= w) { // not (l > w) as l no self increment yet
            // open syncmer
            z = buf_s[buf_pos] & 1;
            kv_push(uint64_t, s_mer, buf_s[buf_pos]);
            kv_push(uint32_t, m_pos, (hoco_l - w) << 1 | z); // not (hoco_l - w - 1) as hoco_l no self increment yet
#ifdef DEBUG_KMER_EXTRACTION
            kv_push(uint64_t, k_mer, kmer_hash64(sr.sid, hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#else
            kv_push(uint64_t, k_mer, kmer_hash64(hoco_s.a, m_pos.a[m_pos.n-1], w, key));
#endif
            if (m_pos.n >= 2 && m_pos.a[m_pos.n-1] >> 1 == m_pos.a[m_pos.n-2] >> 1) s_mer.n -= 2, m_pos.n -= 2, k_mer.n -= 2;
        }
    
        if (hoco_s.n) MYREALLOC(hoco_s.a, hoco_s.n);
        if (ho_rl.n) MYREALLOC(ho_rl.a, ho_rl.n);
        if (ho_l_rl.n) MYREALLOC(ho_l_rl.a, ho_l_rl.n);
        if (n_nucl.n) MYREALLOC(n_nucl.a, n_nucl.n);
        if (m_pos.n) MYREALLOC(m_pos.a, m_pos.n);
        if (s_mer.n) MYREALLOC(s_mer.a, s_mer.n);
        if (k_mer.n) MYREALLOC(k_mer.a, k_mer.n);

        sr.hoco_l = hoco_l;
        sr.hoco_s = hoco_s.a;
        sr.ho_rl = ho_rl.a;
        sr.ho_l_rl = ho_l_rl.a;
        sr.n_nucl = n_nucl.a;
        sr.n = m_pos.n;
        sr.m_pos = m_pos.a;
        sr.s_mer = s_mer.a;
        sr.k_mer = k_mer.a;
        kv_push(sr_t, *dat->sr_db, sr);

        free(seq);
    }

    free(key);

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq 0x28(%rdi), %rax
movl 0x1c(%rax), %edx
leal -0x1(%rdx), %ecx
cmpl $0x1e, %ecx
ja 0x12896
movl 0x18(%rax), %r14d
cmpl %edx, %r14d
jle 0x12896
movq %rdi, %r13
movq %rdx, -0x168(%rbp)
leal -0x1(%r14), %edi
shrl $0x2, %edi
addl $0x2, %edi
callq 0x2310
movq %rax, -0xf0(%rbp)
cmpl $0x0, (%r13)
jle 0x12879
movl %r14d, %edx
movq -0x168(%rbp), %rcx
subl %ecx, %edx
leal 0x1(%rdx), %eax
addq %rcx, %rcx
leal -0x2(%rcx), %esi
movq %rsi, -0x1a8(%rbp)
movq $-0x1, %rsi
shlq %cl, %rsi
notq %rsi
movq %rsi, -0x178(%rbp)
movq %rdx, -0x128(%rbp)
movslq %edx, %rcx
movq %rcx, -0xb0(%rbp)
leaq 0x8(,%rcx,8), %rcx
movq %rcx, -0x198(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
movq %rax, -0x190(%rbp)
xorl %r12d, %r12d
movq %r14, -0x60(%rbp)
movq %r13, -0x148(%rbp)
movq %rsp, %rbx
movq 0x8(%r13), %rax
movq 0x10(%r13), %rcx
movq (%rax,%r12,8), %rax
movq %rax, -0x160(%rbp)
movq (%rcx,%r12,8), %rax
movq %rax, -0x158(%rbp)
movq 0x18(%r13), %rax
movq (%rax,%r12,8), %rax
movq %rax, -0x110(%rbp)
movq 0x20(%r13), %rax
movslq (%rax,%r12,4), %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0x140(%rbp)
movq %rsp, %rdi
movq -0x190(%rbp), %rax
subq %rax, %rdi
movq %rdi, %rsp
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movq %rdi, -0xa8(%rbp)
movl $0xff, %esi
movq -0x198(%rbp), %r14
movq %r14, %rdx
callq 0x21e0
movq %r15, -0x120(%rbp)
movq %r15, %rdi
movl $0xff, %esi
movq %r14, %rdx
movq %r13, %r14
callq 0x21e0
testq %r13, %r13
movq %r12, -0x118(%rbp)
movq %rbx, -0x1a0(%rbp)
jle 0x124d6
movq $-0x1, %r13
xorl %ebx, %ebx
xorl %r10d, %r10d
movq $0x0, -0x78(%rbp)
movl $0x0, -0x64(%rbp)
xorl %r11d, %r11d
movq $0x0, -0x170(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0x108(%rbp)
xorl %r9d, %r9d
movq $0x0, -0xb8(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x70(%rbp)
xorl %edi, %edi
movq $0x0, -0xc8(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x180(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xe8(%rbp)
movq $0x0, -0x150(%rbp)
movq -0xb0(%rbp), %r8
movq %r14, -0xe0(%rbp)
movslq %r11d, %r15
movq -0x110(%rbp), %rax
movzbl (%rax,%r15), %eax
leaq 0xe3fa(%rip), %rcx      # 0x1fdd0
movzbl (%rax,%rcx), %esi
movl %r9d, %r14d
andl $0x3, %r14d
movq %r9, -0x38(%rbp)
movq %r10, -0x88(%rbp)
movq %rdi, -0x48(%rbp)
jne 0x11a6a
movq -0x170(%rbp), %rax
cmpq %rax, -0xd0(%rbp)
jne 0x11a4d
leaq (%rax,%rax), %r12
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r12
movq -0x78(%rbp), %rdi
movl %esi, -0x98(%rbp)
movq %r12, %rsi
movq %r11, -0x80(%rbp)
callq 0x2350
movl -0x98(%rbp), %esi
movq -0x80(%rbp), %r11
movq -0x88(%rbp), %r10
movq -0x38(%rbp), %r9
movq -0xb0(%rbp), %r8
movq %r12, -0x170(%rbp)
jmp 0x11a51
movq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xd0(%rbp), %rcx
movb $0x0, (%rax,%rcx)
incq %rcx
movq %rcx, -0xd0(%rbp)
cmpb $0x3, %sil
ja 0x11b20
testl %esi, %esi
je 0x11a95
addl %r14d, %r14d
xorb $0x6, %r14b
movl %esi, %eax
movl %r14d, %ecx
shll %cl, %eax
movq -0x78(%rbp), %rcx
movq -0xd0(%rbp), %rdx
orb %al, -0x1(%rdx,%rcx)
leaq 0x1(%r15), %rax
movl $0x1, %r12d
movq -0xe0(%rbp), %rdi
cmpl %edi, %eax
jge 0x11c14
movq -0x110(%rbp), %rcx
movzbl (%rcx,%rax), %eax
leaq 0xe310(%rip), %rcx      # 0x1fdd0
cmpb %sil, (%rax,%rcx)
jne 0x11c14
leal 0x2(%r11), %eax
cmpl %edi, %eax
jge 0x11c0b
movl %edi, %r12d
subl %r11d, %r12d
movl %r11d, %ecx
movl $0x2, %eax
leal (%rcx,%rax), %edx
movslq %edx, %rdx
movl %esi, %r14d
movq -0x110(%rbp), %rsi
movzbl (%rsi,%rdx), %edx
leaq 0xe2d1(%rip), %rsi      # 0x1fdd0
cmpb %r14b, (%rdx,%rsi)
movl %r14d, %esi
jne 0x123f6
leaq (%r15,%rax), %rdx
incq %rdx
incq %rax
cmpq %rdi, %rdx
jl 0x11ae4
jmp 0x123f9
movq -0x108(%rbp), %rax
movq %r11, %r12
cmpq %rax, %r9
jne 0x11b62
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
movq -0xd8(%rbp), %rdi
movq %r14, %rsi
callq 0x2350
movq -0x38(%rbp), %r9
movq %r14, -0x108(%rbp)
movq -0xf8(%rbp), %r14
jmp 0x11b70
movq -0xf8(%rbp), %r14
movq -0xd8(%rbp), %rax
movq -0xa8(%rbp), %r15
movq %rax, -0xd8(%rbp)
movb $0x0, (%rax,%r9)
cmpq -0x180(%rbp), %r14
jne 0x11bc4
leaq (%r14,%r14), %rcx
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, -0x180(%rbp)
leaq (,%rcx,4), %rsi
movq -0xc0(%rbp), %rdi
callq 0x2350
movq -0x38(%rbp), %r9
movq -0xb0(%rbp), %r8
jmp 0x11bd2
movq -0xb0(%rbp), %r8
movq -0xc0(%rbp), %rax
movq -0x88(%rbp), %r10
movq %r12, %r11
movq -0x48(%rbp), %rdi
movq %rax, -0xc0(%rbp)
movl %r11d, (%rax,%r14,4)
incq %r14
movq %r14, -0xf8(%rbp)
xorl %r14d, %r14d
movq $-0x1, %rsi
movq $-0x1, %r12
jmp 0x11d6c
incl %r11d
movl $0x2, %r12d
movq -0xa8(%rbp), %r15
movl $0x100, %eax            # imm = 0x100
cmpl %eax, %r12d
cmovael %eax, %r12d
movq -0x108(%rbp), %rax
cmpq %rax, %r9
jne 0x11c81
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
movq -0xd8(%rbp), %rdi
movl %esi, -0x98(%rbp)
movq %r14, %rsi
movq %r11, -0x80(%rbp)
callq 0x2350
movl -0x98(%rbp), %esi
movq -0x80(%rbp), %r11
movq -0x88(%rbp), %r10
movq -0x38(%rbp), %r9
movq -0xb0(%rbp), %r8
movq %r14, -0x108(%rbp)
jmp 0x11c88
movq -0xd8(%rbp), %rax
movl -0x64(%rbp), %r14d
decb %r12b
movq %rax, -0xd8(%rbp)
movb %r12b, (%rax,%r9)
incl %r14d
movl %esi, %edx
movq -0x140(%rbp), %rax
movq -0x138(%rbp), %rdi
leaq (%rdx,%rax,4), %rsi
andq -0x178(%rbp), %rsi
movq %rsi, -0x140(%rbp)
shrq $0x2, %rdi
xorq $0x3, %rdx
movq -0x1a8(%rbp), %rcx
shlq %cl, %rdx
orq %rdi, %rdx
movq %rdx, -0x138(%rbp)
cmpq %rdx, %rsi
je 0x11f79
cmpl -0x168(%rbp), %r14d
movq -0x48(%rbp), %rdi
jl 0x11d5e
xorl %eax, %eax
cmpq %rdx, %rsi
setae %al
movq -0x140(%rbp,%rax,8), %rdx
movq %rdx, %rcx
leaq (%rax,%rdx,2), %r12
notq %rdx
shlq $0x15, %rcx
addq %rdx, %rcx
movq -0x178(%rbp), %rdx
andq %rdx, %rcx
movq %rcx, %rax
shrq $0x18, %rax
xorq %rcx, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
andq %rdx, %rax
movq %rax, %rcx
shrq $0xe, %rcx
xorq %rax, %rcx
leaq (%rcx,%rcx,4), %rax
leaq (%rcx,%rax,4), %rax
andq %rdx, %rax
movq %rax, %rcx
shrq $0x1c, %rcx
xorq %rax, %rcx
movq %rcx, %rsi
shlq $0x1f, %rsi
addq %rcx, %rsi
andq %rdx, %rsi
jmp 0x11d6c
movq $-0x1, %r12
movq $-0x1, %rsi
movq -0x60(%rbp), %rdx
cmpl %ebx, %r10d
sete %al
cmpq $-0x1, %r13
setne %cl
andb %al, %cl
cmpl %edx, %r14d
setg %al
andb %cl, %al
cmpb $0x1, %al
movl %r14d, -0x64(%rbp)
jne 0x11fae
movq %rdx, %r15
movq %r12, -0x98(%rbp)
movslq %ebx, %rax
movq -0x120(%rbp), %rcx
movq (%rcx,%rax,8), %r14
cmpq -0xc8(%rbp), %rdi
movq %rdi, %r12
movq %r11, -0x80(%rbp)
movq %rsi, -0x100(%rbp)
jne 0x11df3
leaq (%rdi,%rdi), %rcx
testq %rdi, %rdi
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, -0xc8(%rbp)
leaq (,%rcx,8), %rsi
movq -0x50(%rbp), %rdi
callq 0x2350
movq %r12, %rdi
movq -0x30(%rbp), %r8
jmp 0x11dfb
movq -0x30(%rbp), %r8
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq -0x90(%rbp), %rdx
movq %r14, (%rax,%rdi,8)
cmpq %rdx, %r8
movq %rax, -0x50(%rbp)
jne 0x11e41
leaq (%r8,%r8), %rdx
testq %r8, %r8
movl $0x2, %eax
cmoveq %rax, %rdx
movq %rdx, -0x90(%rbp)
leaq (,%rdx,4), %rsi
movq %rcx, %rdi
callq 0x2350
movq -0x30(%rbp), %r8
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rdx
movq -0xa0(%rbp), %rdi
subl %r15d, %eax
andl $0x1, %r14d
leal (%r14,%rax,2), %esi
movl %esi, (%rcx,%r8,4)
cmpq %rdi, %rdx
movq %rcx, -0x58(%rbp)
jne 0x11ea7
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, -0xa0(%rbp)
leaq (,%rsi,8), %rsi
movq -0x70(%rbp), %rdi
movq %rcx, %r12
movq %rdx, %r15
callq 0x2350
movq -0x30(%rbp), %r8
movq %rax, %r14
movl (%r12,%r8,4), %esi
movq -0x48(%rbp), %r12
jmp 0x11eae
movq -0x70(%rbp), %r14
movq %rdx, %r15
leaq 0x1(%r12), %rax
movq %rax, -0x188(%rbp)
leaq 0x1(%r8), %rax
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0xf0(%rbp), %rcx
movq %r8, %r12
callq 0x128b5
leaq 0x1(%r15), %rcx
movq %r14, -0x70(%rbp)
movq %rax, (%r14,%r15,8)
movq -0x30(%rbp), %r15
cmpq $0x2, %r15
jb 0x11f39
movq -0x188(%rbp), %rdi
movq -0x58(%rbp), %rdx
movl -0x4(%rdx,%r12,4), %eax
xorl (%rdx,%r12,4), %eax
cmpl $0x1, %eax
movq -0xb0(%rbp), %r8
movq -0x38(%rbp), %r9
movq -0x88(%rbp), %r10
movq -0x80(%rbp), %r11
movq -0x100(%rbp), %rsi
ja 0x11f94
decq %r12
movq %r12, -0x30(%rbp)
movq -0x48(%rbp), %rdi
decq %rdi
decq -0x40(%rbp)
jmp 0x11f9c
movq %r15, -0x30(%rbp)
movq -0x188(%rbp), %rdi
movq %rcx, -0x40(%rbp)
movq -0x60(%rbp), %rdx
movq -0xb0(%rbp), %r8
movq -0x38(%rbp), %r9
movq -0xa8(%rbp), %r15
movq -0x88(%rbp), %r10
movq -0x80(%rbp), %r11
movq -0x98(%rbp), %r12
movq -0x100(%rbp), %rsi
jmp 0x11fae
movq $-0x1, %r12
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq $-0x1, %rsi
jmp 0x11d70
movq %r15, -0x30(%rbp)
movq %rcx, -0x40(%rbp)
movq -0x60(%rbp), %rdx
movq -0xa8(%rbp), %r15
movq -0x98(%rbp), %r12
incq %r9
movslq %r10d, %r14
movq %rsi, (%r15,%r14,8)
cmpq %r13, %rsi
seta %al
movq -0x120(%rbp), %rcx
movq %r12, (%rcx,%r14,8)
cmpq $-0x1, %rsi
sete %cl
orb %al, %cl
jne 0x12036
cmpl %edx, -0x64(%rbp)
jl 0x12171
movq -0xc8(%rbp), %rax
cmpq %rax, %rdi
movq %r9, -0x38(%rbp)
movq %r11, -0x80(%rbp)
movq %r12, -0x98(%rbp)
movq %rsi, -0x100(%rbp)
jne 0x1203e
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %rdi, %r12
movq -0x50(%rbp), %rdi
callq 0x2350
movq %r12, %rdi
movq -0x98(%rbp), %r12
movq %r15, -0xc8(%rbp)
jmp 0x12042
movq %r13, %rax
jmp 0x1217b
movq -0x50(%rbp), %rax
movq -0x90(%rbp), %r10
movq %r12, %rcx
xorq $0x1, %rcx
movq %rdi, %r12
movq %rcx, (%rax,%rdi,8)
movq -0x30(%rbp), %rdi
cmpq %r10, %rdi
movq -0x58(%rbp), %r8
movq %rax, -0x50(%rbp)
jne 0x12092
leaq (%r10,%r10), %r15
testq %r10, %r10
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,4), %rsi
movq %r8, %rdi
callq 0x2350
movq -0x30(%rbp), %rdi
movq %rax, %r8
movq %r15, %r10
movq -0x60(%rbp), %r11
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %r9
movq %r12, -0x48(%rbp)
movl %edx, %eax
subl %r11d, %eax
movq -0x98(%rbp), %rcx
andl $0x1, %ecx
leal (%rcx,%rax,2), %esi
movl %esi, (%r8,%rdi,4)
movq -0xa0(%rbp), %rax
cmpq %rax, %r9
movq %r8, -0x58(%rbp)
movq %r10, -0x90(%rbp)
jne 0x1210c
leaq (%rax,%rax), %r15
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq -0x70(%rbp), %rdi
movq %r8, %r12
callq 0x2350
movq -0x30(%rbp), %rdi
movq %rax, -0x70(%rbp)
movl (%r12,%rdi,4), %esi
movq %r15, -0xa0(%rbp)
movq -0x60(%rbp), %r12
jmp 0x1210f
movq %r11, %r12
movq -0x48(%rbp), %r15
incq %r15
incq %rdi
movq %rdi, -0x30(%rbp)
movq -0x78(%rbp), %rdi
movl %r12d, %edx
movq -0xf0(%rbp), %rcx
callq 0x128b5
movq -0x70(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq %rax, (%rdx,%rcx,8)
movq %r15, %rdi
incq %rcx
movq %rcx, -0x40(%rbp)
movq -0xb0(%rbp), %r8
movq -0x38(%rbp), %r9
movq -0xa8(%rbp), %r15
movq -0x88(%rbp), %r10
movq -0x80(%rbp), %r11
movq -0x98(%rbp), %r12
movq -0x100(%rbp), %rsi
cmpq %r13, %rsi
cmovbl %r10d, %ebx
movq %rsi, %rax
cmpq %rax, %rsi
jb 0x121f3
cmpl %ebx, %r10d
jne 0x121f3
movq %r9, -0x38(%rbp)
movq %rsi, %r9
movq $-0x1, %r13
movl %r10d, %ebx
cmpl -0x128(%rbp), %r10d
jge 0x121c9
leal 0x1(%r10), %ecx
movq $-0x1, %rdx
movl %r10d, %ebx
movq 0x8(%r15,%r14,8), %r13
incq %r14
cmpq %r13, %rdx
cmovbq %rdx, %r13
cmoval %ecx, %ebx
incl %ecx
movq %r13, %rdx
cmpq %r8, %r14
jl 0x121ad
testl %r10d, %r10d
js 0x12202
leal 0x1(%r10), %ecx
xorl %edx, %edx
movq -0xe0(%rbp), %r14
movq (%r15,%rdx,8), %rsi
cmpq %rsi, %r13
cmoval %edx, %ebx
cmovaeq %rsi, %r13
incq %rdx
cmpq %rdx, %rcx
jne 0x121db
jmp 0x12209
movq %rax, %r13
movq -0xe0(%rbp), %r14
jmp 0x123c2
movq -0xe0(%rbp), %r14
cmpq %rax, %r9
jne 0x12217
movq -0x38(%rbp), %r9
jmp 0x123c2
leal 0x1(%r10), %eax
cmpl -0x128(%rbp), %r10d
movl $0x0, %ecx
cmovel %ecx, %eax
cmpl %eax, %ebx
movq -0x60(%rbp), %rdx
jne 0x1224b
cmpq %r9, %r13
jne 0x1224b
cmpq $-0x1, %r9
je 0x123ea
cmpl %edx, -0x64(%rbp)
jge 0x12264
movq %r9, %r13
jmp 0x1220e
cmpl %r10d, %ebx
setne %al
cmpq $-0x1, %r13
sete %cl
cmpl %edx, -0x64(%rbp)
setl %dl
orb %cl, %dl
orb %al, %dl
jne 0x1220e
movq %r12, %r15
movq %rdi, -0x48(%rbp)
movq -0xc8(%rbp), %rax
cmpq %rax, %rdi
movq %r11, -0x80(%rbp)
jne 0x122a9
movq -0x38(%rbp), %r12
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq -0x50(%rbp), %rdi
callq 0x2350
movq %r14, -0xc8(%rbp)
jmp 0x122b1
movq -0x38(%rbp), %r12
movq -0x50(%rbp), %rax
movq -0x90(%rbp), %r10
movq %r15, %rcx
xorq $0x1, %rcx
movq -0x48(%rbp), %rdx
movq %rcx, (%rax,%rdx,8)
movq -0x30(%rbp), %rdx
cmpq %r10, %rdx
movq -0x58(%rbp), %r8
movq %rax, -0x50(%rbp)
jne 0x12302
leaq (%r10,%r10), %r14
testq %r10, %r10
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,4), %rsi
movq %r8, %rdi
callq 0x2350
movq -0x30(%rbp), %rdx
movq %rax, %r8
movq %r14, %r10
movq %r12, %rcx
movq -0x40(%rbp), %rdi
movq -0xa0(%rbp), %r9
movl %ecx, %eax
subl -0x60(%rbp), %eax
andl $0x1, %r15d
leal (%r15,%rax,2), %esi
movl %esi, (%r8,%rdx,4)
cmpq %r9, %rdi
movq %r8, -0x58(%rbp)
movq %r10, -0x90(%rbp)
jne 0x12369
leaq (%r9,%r9), %r14
testq %r9, %r9
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq -0x70(%rbp), %rdi
movq %r8, %r15
callq 0x2350
movq -0x30(%rbp), %rdx
movq %rax, %r12
movl (%r15,%rdx,4), %esi
movq %r14, -0xa0(%rbp)
jmp 0x1236d
movq -0x70(%rbp), %r12
movq -0x48(%rbp), %r14
incq %r14
incq %rdx
movq %rdx, -0x30(%rbp)
movq -0x78(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0xf0(%rbp), %rcx
callq 0x128b5
movq %r12, -0x70(%rbp)
movq -0x40(%rbp), %rcx
movq %rax, (%r12,%rcx,8)
movq %r14, %rdi
incq %rcx
movq %rcx, -0x40(%rbp)
movq -0xb0(%rbp), %r8
movq -0x38(%rbp), %r9
movq -0xe0(%rbp), %r14
movq -0x88(%rbp), %r10
movq -0x80(%rbp), %r11
cmpl -0x128(%rbp), %r10d
leal 0x1(%r10), %eax
movl %eax, %r10d
movl $0x0, %eax
cmovel %eax, %r10d
incl %r11d
cmpl %r14d, %r11d
jl 0x119c0
jmp 0x124a0
movq $-0x1, %r13
jmp 0x1220e
movl %eax, %r12d
addl %r12d, %r11d
decl %r11d
cmpl $0x100, %r12d           # imm = 0x100
movq -0xa8(%rbp), %r15
jb 0x11c1b
movq -0xe8(%rbp), %rdi
cmpq -0x150(%rbp), %rdi
jne 0x1247b
leaq (%rdi,%rdi), %rcx
testq %rdi, %rdi
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, -0x150(%rbp)
leaq (,%rcx,4), %rsi
movq %rdi, -0xe8(%rbp)
movq -0xb8(%rbp), %rdi
movq %r11, -0x80(%rbp)
callq 0x2350
movq -0xe8(%rbp), %rdi
movl %r14d, %esi
movq -0x80(%rbp), %r11
movq -0x88(%rbp), %r10
movq -0x38(%rbp), %r9
movq -0xb0(%rbp), %r8
jmp 0x12482
movq -0xb8(%rbp), %rax
leal -0x1(%r12), %edx
movq %rax, -0xb8(%rbp)
movl %edx, (%rax,%rdi,4)
incq %rdi
movq %rdi, -0xe8(%rbp)
jmp 0x11c1b
cmpq $-0x1, %r13
sete %al
cmpl %ebx, %r10d
setne %cl
movq -0x60(%rbp), %r15
cmpl %r15d, -0x64(%rbp)
setl %dl
orb %al, %dl
orb %cl, %dl
movq %rdi, -0x48(%rbp)
je 0x1251e
movq -0x118(%rbp), %r12
movq -0x78(%rbp), %rbx
movq -0x70(%rbp), %r15
jmp 0x1267e
movq $0x0, -0x50(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0x88(%rbp)
xorl %r9d, %r9d
xorl %r14d, %r14d
xorl %ebx, %ebx
movq $0x0, -0xb8(%rbp)
movq $0x0, -0x58(%rbp)
xorl %r15d, %r15d
movq -0x148(%rbp), %r13
jmp 0x1278c
movslq %r10d, %rax
movq -0x120(%rbp), %rcx
movq (%rcx,%rax,8), %rbx
movq -0xc8(%rbp), %rax
cmpq %rax, %rdi
movq -0x118(%rbp), %r12
movq %r9, %r14
jne 0x12560
movq %rax, %rsi
shlq $0x4, %rsi
testq %rax, %rax
movl $0x10, %eax
cmoveq %rax, %rsi
movq -0x50(%rbp), %rdi
callq 0x2350
jmp 0x12564
movq -0x50(%rbp), %rax
movq -0x90(%rbp), %rdi
movq -0x48(%rbp), %rcx
movq %rbx, (%rax,%rcx,8)
movq -0x30(%rbp), %r8
cmpq %rdi, %r8
movq -0x58(%rbp), %rdx
movq %rax, -0x50(%rbp)
jne 0x125a7
leaq (,%rdi,8), %rsi
testq %rdi, %rdi
movl $0x8, %eax
cmoveq %rax, %rsi
movq %rdx, %rdi
callq 0x2350
movq -0x30(%rbp), %r8
movq %rax, %rdx
movq %r14, %rcx
movq -0x40(%rbp), %rdi
movq -0xa0(%rbp), %r9
movl %ecx, %eax
subl %r15d, %eax
andl $0x1, %ebx
leal (%rbx,%rax,2), %esi
movl %esi, (%rdx,%r8,4)
cmpq %r9, %rdi
movq %r14, -0x38(%rbp)
movq %rdx, -0x58(%rbp)
jne 0x125fd
movq %r9, %rsi
shlq $0x4, %rsi
testq %r9, %r9
movl $0x10, %eax
cmoveq %rax, %rsi
movq -0x70(%rbp), %rdi
movq %rdx, %rbx
callq 0x2350
movq -0x30(%rbp), %r8
movq %rax, %r13
movl (%rbx,%r8,4), %esi
jmp 0x12601
movq -0x70(%rbp), %r13
movq -0x48(%rbp), %rax
leaq 0x1(%rax), %rbx
leaq 0x1(%r8), %r14
movq -0x78(%rbp), %rdi
movl %r15d, %edx
movq -0xf0(%rbp), %rcx
movq %r8, %r15
callq 0x128b5
movq -0x40(%rbp), %rsi
leaq 0x1(%rsi), %rcx
movq %r13, %rdx
movq %rax, (%r13,%rsi,8)
cmpq $0x2, %r14
jb 0x12667
movq -0x58(%rbp), %rsi
movl -0x4(%rsi,%r15,4), %eax
xorl (%rsi,%r15,4), %eax
cmpl $0x1, %eax
movq -0x38(%rbp), %r9
movq -0xd0(%rbp), %rsi
ja 0x12687
decq %r15
movq %r15, -0x30(%rbp)
decq -0x48(%rbp)
decq -0x40(%rbp)
jmp 0x12693
movq %r14, -0x30(%rbp)
movq %rbx, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq -0x38(%rbp), %r9
movq -0x78(%rbp), %rbx
movq %rdx, %r15
movq -0xd0(%rbp), %rsi
jmp 0x1269a
movq %r14, -0x30(%rbp)
movq %rbx, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq -0x78(%rbp), %rbx
movq %rdx, %r15
testq %rsi, %rsi
movq -0x148(%rbp), %r13
je 0x126b7
movq %rbx, %rdi
movq %r9, %r14
callq 0x2350
movq %r14, %r9
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
movq %r9, %r14
movq %r9, %rsi
callq 0x2350
movq %rax, -0x88(%rbp)
movq -0xe8(%rbp), %rsi
testq %rsi, %rsi
je 0x126ee
shlq $0x2, %rsi
movq -0xb8(%rbp), %rdi
callq 0x2350
jmp 0x126f5
movq -0xb8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xf8(%rbp), %rsi
testq %rsi, %rsi
je 0x1271a
shlq $0x2, %rsi
movq -0xc0(%rbp), %rdi
callq 0x2350
jmp 0x12721
movq -0xc0(%rbp), %rax
movq -0x58(%rbp), %rdi
movq %rax, -0xc0(%rbp)
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x12747
leaq (,%rax,4), %rsi
callq 0x2350
movq %rax, %rdi
jmp 0x1274f
movq $0x0, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq %rdi, -0x58(%rbp)
movq -0x48(%rbp), %rsi
testq %rsi, %rsi
je 0x1276c
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2350
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rsi
testq %rsi, %rsi
je 0x12788
shlq $0x3, %rsi
movq %r15, %rdi
callq 0x2350
movq %rax, %r15
movq -0x30(%rbp), %r9
movq 0x28(%r13), %rcx
movq (%rcx), %rdx
cmpq 0x8(%rcx), %rdx
jne 0x127e6
leaq (%rdx,%rdx), %rax
testq %rdx, %rdx
movl $0x2, %edx
cmoveq %rdx, %rax
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
imulq $0x58, %rax, %rsi
movq %rbx, %r12
movq %r13, %rbx
movq %r15, %r13
movq %r9, %r15
callq 0x2350
movq %r15, %r9
movq %r13, %r15
movq %rbx, %r13
movq %r12, %rbx
movq -0x118(%rbp), %r12
movq 0x28(%r13), %rcx
movq %rax, 0x10(%rcx)
movq (%rcx), %rdx
jmp 0x127ea
movq 0x10(%rcx), %rax
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %r8
leaq 0x1(%rdx), %rsi
movq %rsi, (%rcx)
imulq $0x58, %rdx, %rcx
movq %rdi, (%rax,%rcx)
movq %r8, 0x8(%rax,%rcx)
movl %r14d, 0x10(%rax,%rcx)
movq %rbx, 0x18(%rax,%rcx)
movq -0x88(%rbp), %rdx
movq %rdx, 0x20(%rax,%rcx)
movq -0xb8(%rbp), %rdx
movq %rdx, 0x28(%rax,%rcx)
movq -0xc0(%rbp), %rdx
movq %rdx, 0x30(%rax,%rcx)
movl %r9d, 0x38(%rax,%rcx)
movq -0x58(%rbp), %rdx
movq %rdx, 0x40(%rax,%rcx)
movq -0x50(%rbp), %rdx
movq %rdx, 0x48(%rax,%rcx)
movq %r15, 0x50(%rax,%rcx)
movq -0x110(%rbp), %rdi
callq 0x2060
movq -0x1a0(%rbp), %rsp
incq %r12
movslq (%r13), %rax
cmpq %rax, %r12
jl 0x11831
movq -0xf0(%rbp), %rdi
callq 0x2060
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdb27(%rip), %rdi      # 0x203c4
leaq 0xd7b2(%rip), %rsi      # 0x20056
leaq 0xdb32(%rip), %rcx      # 0x203dd
movl $0xfb, %edx
callq 0x21d0