// File: /workspace/github_c_makefile_star2_O1/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 $0x178, %rsp            # imm = 0x178
movq 0x28(%rdi), %rax
movl 0x1c(%rax), %edx
leal -0x1(%rdx), %ecx
cmpl $0x1e, %ecx
ja 0x11dff
movl 0x18(%rax), %eax
cmpl %edx, %eax
jle 0x11dff
movq %rdi, %r12
movq %rdx, -0x138(%rbp)
movq %rax, -0x78(%rbp)
leal -0x1(%rax), %edi
shrl $0x2, %edi
addl $0x2, %edi
callq 0x2320
movq %rax, -0xe0(%rbp)
cmpl $0x0, (%r12)
jle 0x11de2
movq -0x78(%rbp), %rax
movl %eax, %edx
movq -0x138(%rbp), %rcx
subl %ecx, %edx
leal 0x1(%rdx), %eax
addq %rcx, %rcx
leal -0x2(%rcx), %esi
movq %rsi, -0x198(%rbp)
movq $-0x1, %rsi
shlq %cl, %rsi
notq %rsi
movq %rsi, -0x150(%rbp)
movq %rdx, -0x120(%rbp)
movslq %edx, %rcx
movq %rcx, -0xc8(%rbp)
leaq 0x8(,%rcx,8), %rcx
movq %rcx, -0x168(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
movq %rax, -0x160(%rbp)
xorl %r13d, %r13d
movq %r12, -0x170(%rbp)
movq %rsp, -0x190(%rbp)
movq 0x8(%r12), %rax
movq 0x10(%r12), %rcx
movq (%rax,%r13,8), %rax
movq %rax, -0x188(%rbp)
movq (%rcx,%r13,8), %rax
movq %rax, -0x180(%rbp)
movq 0x18(%r12), %rax
movq (%rax,%r13,8), %rax
movq %rax, -0x118(%rbp)
movq 0x20(%r12), %rax
movslq (%rax,%r13,4), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x130(%rbp)
movq %rsp, %rdi
movq -0x160(%rbp), %rax
subq %rax, %rdi
movq %rdi, %rsp
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq %rdi, -0xa0(%rbp)
movl $0xff, %esi
movq -0x168(%rbp), %rbx
movq %rbx, %rdx
callq 0x21e0
movq %r14, -0xf8(%rbp)
movq %r14, %rdi
movl $0xff, %esi
movq %rbx, %rdx
callq 0x21e0
movq %r15, -0x100(%rbp)
testq %r15, %r15
jle 0x119fb
movq %r13, -0x178(%rbp)
movq $-0x1, %r13
xorl %r15d, %r15d
xorl %r9d, %r9d
movq $0x0, -0xa8(%rbp)
xorl %r11d, %r11d
xorl %eax, %eax
movq $0x0, -0x148(%rbp)
xorl %ebx, %ebx
movq $0x0, -0x98(%rbp)
movq $0x0, -0x110(%rbp)
xorl %r8d, %r8d
movq $0x0, -0xb8(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0xf0(%rbp)
movq $0x0, -0x158(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xe8(%rbp)
movq $0x0, -0x140(%rbp)
movq -0xa0(%rbp), %r10
movq %rax, -0xd8(%rbp)
movslq %eax, %r14
movq -0x118(%rbp), %rax
movzbl (%rax,%r14), %eax
leaq 0xcdd9(%rip), %rcx      # 0x1dd90
movzbl (%rax,%rcx), %edi
movl %r8d, %r12d
andl $0x3, %r12d
movq %r8, -0x50(%rbp)
movq %r9, -0x80(%rbp)
jne 0x11040
movq -0x148(%rbp), %rax
cmpq %rax, %rbx
jne 0x1102b
movq %rbx, -0xb0(%rbp)
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
movl %edi, -0x70(%rbp)
movq -0xa8(%rbp), %rdi
movq %rbx, %rsi
movl %r11d, -0x2c(%rbp)
callq 0x2360
movl -0x70(%rbp), %edi
movl -0x2c(%rbp), %r11d
movq -0xa0(%rbp), %r10
movq -0x80(%rbp), %r9
movq -0x50(%rbp), %r8
movq %rbx, -0x148(%rbp)
movq -0xb0(%rbp), %rbx
jmp 0x11032
movq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movb $0x0, (%rax,%rbx)
incq %rbx
cmpb $0x3, %dil
movq %rbx, -0xb0(%rbp)
ja 0x11107
testl %edi, %edi
je 0x1106e
addl %r12d, %r12d
xorb $0x6, %r12b
movl %edi, %eax
movl %r12d, %ecx
shll %cl, %eax
movq -0xa8(%rbp), %rcx
orb %al, -0x1(%rbx,%rcx)
leaq 0x1(%r14), %rax
movl $0x1, %r12d
cmpl -0x100(%rbp), %eax
jge 0x11206
movq -0x118(%rbp), %rcx
movzbl (%rcx,%rax), %eax
leaq 0xccfa(%rip), %rcx      # 0x1dd90
cmpb %dil, (%rax,%rcx)
jne 0x11206
movq -0xd8(%rbp), %rcx
leal 0x2(%rcx), %eax
movl $0x2, %r12d
cmpl -0x100(%rbp), %eax
jge 0x111fa
movq -0x100(%rbp), %r12
subl %ecx, %r12d
movl %ecx, %ecx
movl $0x2, %eax
leal (%rcx,%rax), %edx
movslq %edx, %rdx
movq -0x118(%rbp), %rsi
movzbl (%rsi,%rdx), %edx
leaq 0xccab(%rip), %rsi      # 0x1dd90
cmpb %dil, (%rdx,%rsi)
jne 0x111f0
leaq (%r14,%rax), %rdx
incq %rdx
incq %rax
cmpq -0x100(%rbp), %rdx
jl 0x110cd
jmp 0x111f3
movq -0x110(%rbp), %rax
cmpq %rax, %r8
jne 0x11146
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
movq -0x98(%rbp), %rdi
movq %rbx, %rsi
callq 0x2360
movq -0x50(%rbp), %r8
movq %rbx, -0x110(%rbp)
movq -0xc8(%rbp), %r14
jmp 0x11154
movq -0xc8(%rbp), %r14
movq -0x98(%rbp), %rax
movq -0x48(%rbp), %r12
movq %rax, -0x98(%rbp)
movb $0x0, (%rax,%r8)
movq -0x158(%rbp), %rax
cmpq %rax, -0xf0(%rbp)
jne 0x111a5
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,4), %rsi
movq -0xd0(%rbp), %rdi
callq 0x2360
movq -0x50(%rbp), %r8
movq %rbx, -0x158(%rbp)
jmp 0x111ac
movq -0xd0(%rbp), %rax
movq -0x80(%rbp), %r9
movq -0xa0(%rbp), %r10
movq %rax, -0xd0(%rbp)
movq -0xf0(%rbp), %rcx
movq -0xd8(%rbp), %rdx
movl %edx, (%rax,%rcx,4)
incq %rcx
movq %rcx, -0xf0(%rbp)
xorl %r11d, %r11d
movq $-0x1, %rdi
movq $-0x1, -0x70(%rbp)
jmp 0x113eb
movl %eax, %r12d
movq -0xd8(%rbp), %rcx
addl %r12d, %ecx
decl %ecx
movq %rcx, -0xd8(%rbp)
cmpl $0x100, %r12d           # imm = 0x100
movq -0xc8(%rbp), %r14
movq -0xe8(%rbp), %rax
jb 0x1129a
movq -0x140(%rbp), %rcx
cmpq %rcx, %rax
jne 0x11273
leaq (%rcx,%rcx), %rbx
testq %rcx, %rcx
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,4), %rsi
movl %edi, -0x70(%rbp)
movq -0xb8(%rbp), %rdi
movl %r11d, -0x2c(%rbp)
callq 0x2360
movl -0x70(%rbp), %edi
movl -0x2c(%rbp), %r11d
movq -0xa0(%rbp), %r10
movq -0x80(%rbp), %r9
movq -0x50(%rbp), %r8
movq %rbx, -0x140(%rbp)
jmp 0x1127a
movq -0xb8(%rbp), %rax
leal -0x1(%r12), %edx
movq %rax, -0xb8(%rbp)
movq -0xe8(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
incq %rcx
movq %rcx, -0xe8(%rbp)
movl $0x100, %eax            # imm = 0x100
cmpl %eax, %r12d
cmovael %eax, %r12d
movq -0x110(%rbp), %rax
cmpq %rax, %r8
jne 0x112f7
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
movl %edi, -0x70(%rbp)
movq -0x98(%rbp), %rdi
movq %rbx, %rsi
movl %r11d, -0x2c(%rbp)
callq 0x2360
movl -0x70(%rbp), %edi
movl -0x2c(%rbp), %r11d
movq -0xa0(%rbp), %r10
movq -0x80(%rbp), %r9
movq -0x50(%rbp), %r8
movq %rbx, -0x110(%rbp)
jmp 0x112fe
movq -0x98(%rbp), %rax
decb %r12b
movq %rax, -0x98(%rbp)
movb %r12b, (%rax,%r8)
incl %r11d
movl %edi, %edx
movq -0x130(%rbp), %rax
movq -0x128(%rbp), %rdi
leaq (%rdx,%rax,4), %rsi
andq -0x150(%rbp), %rsi
movq %rsi, -0x130(%rbp)
shrq $0x2, %rdi
xorq $0x3, %rdx
movq -0x198(%rbp), %rcx
shlq %cl, %rdx
orq %rdi, %rdx
movq %rdx, -0x128(%rbp)
movq $-0x1, %rdi
cmpq %rdx, %rsi
je 0x113df
cmpl -0x138(%rbp), %r11d
movq -0x48(%rbp), %r12
jl 0x111e3
xorl %eax, %eax
cmpq %rdx, %rsi
setae %al
movq -0x130(%rbp,%rax,8), %rdx
movq %rdx, %rcx
leaq (%rax,%rdx,2), %rax
movq %rax, -0x70(%rbp)
notq %rdx
shlq $0x15, %rcx
addq %rdx, %rcx
movq -0x150(%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, %rdi
shlq $0x1f, %rdi
addq %rcx, %rdi
andq %rdx, %rdi
jmp 0x113eb
movq $-0x1, -0x70(%rbp)
movq -0x48(%rbp), %r12
cmpl %r15d, %r9d
sete %al
cmpq $-0x1, %r13
setne %cl
andb %al, %cl
cmpl -0x78(%rbp), %r11d
setg %al
andb %cl, %al
cmpb $0x1, %al
jne 0x115e8
movslq %r9d, %r14
movq -0xf8(%rbp), %rax
movq (%rax,%r14,8), %rbx
movq -0xc0(%rbp), %rax
cmpq %rax, -0x40(%rbp)
movl %r11d, -0x2c(%rbp)
movq %rdi, -0x108(%rbp)
jne 0x1145f
leaq (%rax,%rax), %r12
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq -0x58(%rbp), %rdi
callq 0x2360
movq %r12, -0xc0(%rbp)
movq -0x48(%rbp), %r12
jmp 0x11463
movq -0x58(%rbp), %rax
movq -0x90(%rbp), %rsi
movq -0xf8(%rbp), %rcx
movq (%rcx,%r14,8), %rdx
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq %rsi, -0x38(%rbp)
jne 0x114ad
leaq (%rsi,%rsi), %r14
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,4), %rsi
movq %r12, %rdi
callq 0x2360
movq %rax, %r12
movq %r14, %rsi
movq -0x50(%rbp), %rax
movq -0x88(%rbp), %rdx
subl -0x78(%rbp), %eax
andl $0x1, %ebx
leal (%rbx,%rax,2), %eax
movq -0x38(%rbp), %rcx
movl %eax, (%r12,%rcx,4)
cmpq %rdx, -0x68(%rbp)
movq %rsi, -0x90(%rbp)
jne 0x11507
leaq (%rdx,%rdx), %rbx
testq %rdx, %rdx
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq -0x60(%rbp), %rdi
callq 0x2360
movq %rax, %r14
movq -0x38(%rbp), %rax
movq %rbx, -0x88(%rbp)
jmp 0x1150e
movq %rcx, %rax
movq -0x60(%rbp), %r14
movq -0x40(%rbp), %rcx
incq %rcx
movq %rcx, -0x48(%rbp)
leaq 0x1(%rax), %rcx
movq %rcx, -0x38(%rbp)
movl (%r12,%rax,4), %esi
movq -0xa8(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0xe0(%rbp), %rcx
movq %r12, %rbx
movq %rax, %r12
callq 0x11e1e
movq -0x68(%rbp), %rsi
leaq 0x1(%rsi), %rcx
movq %r14, -0x60(%rbp)
movq %rax, (%r14,%rsi,8)
movq -0x38(%rbp), %r14
cmpq $0x2, %r14
jb 0x1159c
movq -0x48(%rbp), %rsi
movl -0x4(%rbx,%r12,4), %eax
movq %rbx, %rdx
xorl (%rbx,%r12,4), %eax
cmpl $0x1, %eax
movq -0x50(%rbp), %r8
movq -0x80(%rbp), %r9
movq -0xa0(%rbp), %r10
movl -0x2c(%rbp), %r11d
movq -0x108(%rbp), %rdi
ja 0x115d2
decq %r12
movq %r12, -0x38(%rbp)
decq -0x40(%rbp)
decq -0x68(%rbp)
jmp 0x115de
movq %r14, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movq %rcx, -0x68(%rbp)
movq -0xc8(%rbp), %r14
movq %rbx, %r12
movq -0x50(%rbp), %r8
movq -0x80(%rbp), %r9
movq -0xa0(%rbp), %r10
movl -0x2c(%rbp), %r11d
movq -0x108(%rbp), %rdi
jmp 0x115e8
movq %r14, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rcx, -0x68(%rbp)
movq -0xc8(%rbp), %r14
movq %rdx, %r12
incq %r8
movslq %r9d, %rbx
movq %rdi, (%r10,%rbx,8)
cmpq %r13, %rdi
seta %al
movq -0xf8(%rbp), %rcx
movq -0x70(%rbp), %rdx
movq %rdx, (%rcx,%rbx,8)
cmpq $-0x1, %rdi
sete %cl
orb %al, %cl
jne 0x11782
cmpl -0x78(%rbp), %r11d
jl 0x11777
movq %rdi, -0x108(%rbp)
movq -0xc0(%rbp), %rax
cmpq %rax, -0x40(%rbp)
movq %r8, -0x50(%rbp)
movl %r11d, -0x2c(%rbp)
jne 0x11666
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq -0x58(%rbp), %rdi
callq 0x2360
movq %r14, -0xc0(%rbp)
jmp 0x1166a
movq -0x58(%rbp), %rax
movq -0x90(%rbp), %rdi
movq -0x70(%rbp), %rdx
xorq $0x1, %rdx
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq %rdi, -0x38(%rbp)
jne 0x116b1
leaq (%rdi,%rdi), %r14
testq %rdi, %rdi
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,4), %rsi
movq %r12, %rdi
callq 0x2360
movq %rax, %r12
movq %r14, %rdi
movq -0x50(%rbp), %rdx
movq -0x88(%rbp), %rsi
movl %edx, %eax
subl -0x78(%rbp), %eax
movq -0x70(%rbp), %rcx
andl $0x1, %ecx
leal (%rcx,%rax,2), %eax
movq -0x38(%rbp), %rcx
movq %r12, -0x48(%rbp)
movl %eax, (%r12,%rcx,4)
cmpq %rsi, -0x68(%rbp)
movq %rdi, -0x90(%rbp)
jne 0x11716
leaq (%rsi,%rsi), %r14
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq -0x60(%rbp), %rdi
callq 0x2360
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq %r14, -0x88(%rbp)
jmp 0x11719
movq %rcx, %rax
movq -0xc8(%rbp), %r14
incq -0x40(%rbp)
movq -0x48(%rbp), %r12
movl (%r12,%rax,4), %esi
incq %rax
movq %rax, -0x38(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0xe0(%rbp), %rcx
callq 0x11e1e
movq -0x60(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq %rax, (%rdx,%rcx,8)
incq %rcx
movq %rcx, -0x68(%rbp)
movq -0x50(%rbp), %r8
movq -0x80(%rbp), %r9
movq -0xa0(%rbp), %r10
movl -0x2c(%rbp), %r11d
movq -0x108(%rbp), %rdi
cmpq %r13, %rdi
cmovbq %rdi, %r13
cmovbl %r9d, %r15d
movq %r13, %rax
cmpq %r13, %rdi
jb 0x117f2
cmpl %r15d, %r9d
jne 0x117f2
movq $-0x1, %r13
cmpl -0x120(%rbp), %r9d
jge 0x117c7
leal 0x1(%r9), %ecx
movq $-0x1, %rdx
movq 0x8(%r10,%rbx,8), %r13
incq %rbx
cmpq %r13, %rdx
cmovbq %rdx, %r13
cmoval %ecx, %r15d
incl %ecx
movq %r13, %rdx
cmpq %r14, %rbx
jl 0x117aa
testl %r9d, %r9d
js 0x11801
leal 0x1(%r9), %ecx
xorl %edx, %edx
movq -0xb0(%rbp), %rbx
movq (%r10,%rdx,8), %rsi
cmpq %rsi, %r13
cmoval %edx, %r15d
cmovaeq %rsi, %r13
incq %rdx
cmpq %rdx, %rcx
jne 0x117d9
jmp 0x11808
movq %rax, %r13
movq -0xb0(%rbp), %rbx
jmp 0x119b0
movq -0xb0(%rbp), %rbx
cmpq %rax, %rdi
je 0x119b0
leal 0x1(%r9), %eax
cmpl -0x120(%rbp), %r9d
movl $0x0, %ecx
cmovel %ecx, %eax
cmpl %eax, %r15d
jne 0x11843
cmpq %rdi, %r13
jne 0x11843
cmpq $-0x1, %r13
je 0x119a9
cmpl -0x78(%rbp), %r11d
jge 0x11861
jmp 0x119b0
cmpl %r9d, %r15d
setne %al
cmpq $-0x1, %r13
sete %cl
cmpl -0x78(%rbp), %r11d
setl %dl
orb %cl, %dl
orb %al, %dl
jne 0x119b0
movq -0xc0(%rbp), %rax
cmpq %rax, -0x40(%rbp)
movl %r11d, -0x2c(%rbp)
movq %r8, %r14
jne 0x1189f
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq -0x58(%rbp), %rdi
callq 0x2360
movq %rbx, -0xc0(%rbp)
jmp 0x118a3
movq -0x58(%rbp), %rax
movq -0x90(%rbp), %rdi
movq -0x70(%rbp), %rdx
xorq $0x1, %rdx
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq %rdi, -0x38(%rbp)
jne 0x118ea
leaq (%rdi,%rdi), %rbx
testq %rdi, %rdi
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,4), %rsi
movq %r12, %rdi
callq 0x2360
movq %rax, %r12
movq %rbx, %rdi
movq %r14, %rdx
movq -0x88(%rbp), %rsi
movl %edx, %eax
subl -0x78(%rbp), %eax
movq -0x70(%rbp), %rcx
andl $0x1, %ecx
leal (%rcx,%rax,2), %eax
movq -0x38(%rbp), %rcx
movl %eax, (%r12,%rcx,4)
cmpq %rsi, -0x68(%rbp)
movq %r14, -0x50(%rbp)
movq %rdi, -0x90(%rbp)
jne 0x1194d
leaq (%rsi,%rsi), %rbx
testq %rsi, %rsi
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq -0x60(%rbp), %rdi
callq 0x2360
movq %rax, %r14
movq -0x38(%rbp), %rax
movq %rbx, -0x88(%rbp)
jmp 0x11954
movq %rcx, %rax
movq -0x60(%rbp), %r14
movq -0xb0(%rbp), %rbx
incq -0x40(%rbp)
movl (%r12,%rax,4), %esi
incq %rax
movq %rax, -0x38(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0xe0(%rbp), %rcx
callq 0x11e1e
movq %r14, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movq %rax, (%r14,%rcx,8)
incq %rcx
movq %rcx, -0x68(%rbp)
movq -0x50(%rbp), %r8
movq -0x80(%rbp), %r9
movq -0xa0(%rbp), %r10
movl -0x2c(%rbp), %r11d
jmp 0x119b0
movq $-0x1, %r13
movq %r12, -0x48(%rbp)
cmpl -0x120(%rbp), %r9d
leal 0x1(%r9), %eax
movl %eax, %r9d
movl $0x0, %eax
cmovel %eax, %r9d
movq -0xd8(%rbp), %rax
incl %eax
cmpl -0x100(%rbp), %eax
jl 0x10f9a
cmpq $-0x1, %r13
sete %al
movl %r8d, -0x80(%rbp)
movq -0x178(%rbp), %r13
movq -0x68(%rbp), %r12
jmp 0x11aa0
movb $0x1, %al
movq $0x0, -0xe8(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xf0(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x88(%rbp)
xorl %r12d, %r12d
movq $0x0, -0xb8(%rbp)
xorl %r8d, %r8d
movq $0x0, -0x98(%rbp)
xorl %ebx, %ebx
xorl %r11d, %r11d
movq $0x0, -0xa8(%rbp)
movl $0x0, -0x80(%rbp)
xorl %r9d, %r9d
xorl %r15d, %r15d
cmpl %r15d, %r9d
setne %cl
orb %al, %cl
cmpl -0x78(%rbp), %r11d
setl %al
orb %cl, %al
testb $0x1, %al
movq %rbx, -0xb0(%rbp)
je 0x11ac9
movq -0x38(%rbp), %rbx
movq -0x40(%rbp), %rax
jmp 0x11c2f
movslq %r9d, %r15
movq -0xf8(%rbp), %rax
movq (%rax,%r15,8), %r14
movq -0xc0(%rbp), %rax
cmpq %rax, -0x40(%rbp)
movq %r8, -0x50(%rbp)
jne 0x11b06
movq %rax, %rsi
shlq $0x4, %rsi
testq %rax, %rax
movl $0x10, %eax
cmoveq %rax, %rsi
movq -0x58(%rbp), %rdi
callq 0x2360
jmp 0x11b0a
movq -0x58(%rbp), %rax
movq -0x90(%rbp), %rdi
movq -0xf8(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movq -0x40(%rbp), %rdx
movq %rcx, (%rax,%rdx,8)
cmpq %rdi, -0x38(%rbp)
movq %rax, %r15
jne 0x11b50
leaq (,%rdi,8), %rsi
testq %rdi, %rdi
movl $0x8, %eax
cmoveq %rax, %rsi
movq -0x48(%rbp), %rdi
callq 0x2360
movq -0x60(%rbp), %rdi
jmp 0x11b58
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rax
movq -0x88(%rbp), %r8
movl -0x80(%rbp), %ecx
subl -0x78(%rbp), %ecx
andl $0x1, %r14d
leal (%r14,%rcx,2), %edx
movq -0x38(%rbp), %rbx
movq %rax, -0x48(%rbp)
movl %edx, (%rax,%rbx,4)
cmpq %r8, %r12
movq %r12, -0x68(%rbp)
movq %r15, -0x58(%rbp)
jne 0x11ba6
movq %r8, %rsi
shlq $0x4, %rsi
testq %r8, %r8
movl $0x10, %eax
cmoveq %rax, %rsi
callq 0x2360
movq %rax, %r14
movq -0x38(%rbp), %rbx
jmp 0x11ba9
movq %rdi, %r14
movq -0x40(%rbp), %rax
incq %rax
movq %rax, -0x38(%rbp)
leaq 0x1(%rbx), %r15
movq -0x48(%rbp), %r12
movl (%r12,%rbx,4), %esi
movq -0xa8(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0xe0(%rbp), %rcx
callq 0x11e1e
movq -0x68(%rbp), %rsi
leaq 0x1(%rsi), %rcx
movq %r14, -0x60(%rbp)
movq %rax, (%r14,%rsi,8)
cmpq $0x2, %r15
jb 0x11c16
movq -0x38(%rbp), %rdx
movl -0x4(%r12,%rbx,4), %eax
xorl (%r12,%rbx,4), %eax
cmpl $0x1, %eax
movq -0x50(%rbp), %r8
ja 0x11c26
decq %rbx
movq -0x40(%rbp), %rax
decq %rax
movq -0x68(%rbp), %r12
decq %r12
jmp 0x11c2f
movq %r15, %rbx
movq -0x38(%rbp), %rax
movq %rcx, %r12
movq -0x50(%rbp), %r8
jmp 0x11c2f
movq %r15, %rbx
movq %rdx, %rax
movq %rcx, %r12
movq %rax, -0x40(%rbp)
movq -0xb0(%rbp), %rsi
testq %rsi, %rsi
movq -0xa8(%rbp), %r14
movq -0xf0(%rbp), %r15
je 0x11c5e
movq %r14, %rdi
movq %r8, %r14
callq 0x2360
movq %r14, %r8
movq %rax, %r14
movq -0x98(%rbp), %rax
testq %r8, %r8
je 0x11c75
movq %rax, %rdi
movq %r8, %rsi
callq 0x2360
movq -0xb8(%rbp), %rdi
movq %rax, -0x98(%rbp)
movq -0xe8(%rbp), %rsi
testq %rsi, %rsi
je 0x11c9f
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0xb8(%rbp)
movq -0xd0(%rbp), %rax
testq %r15, %r15
je 0x11cba
shlq $0x2, %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x2360
movq %rax, %r15
testq %rbx, %rbx
je 0x11cd7
leaq (,%rbx,4), %rsi
movq -0x48(%rbp), %rdi
callq 0x2360
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rsi
testq %rsi, %rsi
je 0x11cf1
shlq $0x3, %rsi
movq -0x58(%rbp), %rdi
callq 0x2360
movq %rax, -0x58(%rbp)
testq %r12, %r12
je 0x11d0a
shlq $0x3, %r12
movq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x2360
movq %rax, -0x60(%rbp)
movq -0x170(%rbp), %r12
movq 0x28(%r12), %rax
movq 0x8(%rax), %rcx
cmpq %rcx, (%rax)
jne 0x11d49
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rax), %rdi
imulq $0x58, %rdx, %rsi
callq 0x2360
movq 0x28(%r12), %rcx
movq %rax, 0x10(%rcx)
movq 0x28(%r12), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rax)
imulq $0x58, %rcx, %rax
movq -0x188(%rbp), %rcx
movq %rcx, (%rdx,%rax)
movq -0x180(%rbp), %rcx
movq %rcx, 0x8(%rdx,%rax)
movl -0x80(%rbp), %ecx
movl %ecx, 0x10(%rdx,%rax)
movq %r14, 0x18(%rdx,%rax)
movq -0x98(%rbp), %rcx
movq %rcx, 0x20(%rdx,%rax)
movq -0xb8(%rbp), %rcx
movq %rcx, 0x28(%rdx,%rax)
movq %r15, 0x30(%rdx,%rax)
movl %ebx, 0x38(%rdx,%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x40(%rdx,%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x48(%rdx,%rax)
movq -0x60(%rbp), %rcx
movq %rcx, 0x50(%rdx,%rax)
movq -0x118(%rbp), %rdi
callq 0x2060
movq -0x190(%rbp), %rsp
incq %r13
movslq (%r12), %rax
cmpq %rax, %r13
jl 0x10e11
movq -0xe0(%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 0xc52e(%rip), %rdi      # 0x1e334
leaq 0xc1b9(%rip), %rsi      # 0x1dfc6
leaq 0xc539(%rip), %rcx      # 0x1e34d
movl $0xfb, %edx
callq 0x21d0