// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/path.c
// Function: path_rotate_core
static double path_rotate_core(asg_t *g, path_t *path, hmm_annot_db_t *annots, OG_TYPE_t og_type)
{
    uint32_t i, j;
    const uint32_t g_n = athaliana_pltd_g71n;
    const char *const *genes = athaliana_pltd_g71;
    kh_str_t *gene_db;
    kh_s32_t *segs;
    khint32_t k, k1;
    uint64_t v;
    hmm_annot_t *annot, *annot1;
    double coeff = .0;
    int absent;

    assert(g_n < 256);

    // add core genes to table
    gene_db = kh_str_init();
    for (i = 0; i < g_n; ++i) {
        k = kh_str_put(gene_db, genes[i], &absent);
        kh_val(gene_db, k) = (uint64_t) i << 32 | UINT32_MAX;
    }

    // only need segs in the path
    segs = kh_s32_init();
    for (i = 0; i < path->nv; ++i) {
        k = kh_s32_put(segs, path->v[i]>>1, &absent);
        if (absent)
            kh_val(segs, k) = 1;
        else
            kh_val(segs, k) += 1;
    }

    // find (best) positions for core genes
    // on segs included in the path
    for (i = 0; i < annots->n; ++i) {
        annot = &annots->a[i];
        if (annot->og_type == (uint32_t) og_type) {
            k = kh_str_get(gene_db, annot->gname);
            k1 = kh_s32_get(segs, asg_name2id(g, annot->sname)); // sid might not set
            if (k < kh_end(gene_db) && k1 < kh_end(segs) && kh_val(segs, k1) == 1) {
                v = kh_val(gene_db, k);
                annot1 = (uint32_t) v == UINT32_MAX? 0 : &annots->a[(uint32_t) v];
                if (annot1 == 0 || annot1->score < annot->score)
                    kh_val(gene_db, k) = v >> 32 << 32 | i;
            }
        }
    }

    // do rotation if path is circular
    if (path->circ) {
        uint32_t s;
        for (i = 0, s = UINT32_MAX; i < g_n; ++i) {
            k = kh_str_get(gene_db, genes[i]);
            v = kh_val(gene_db, k);
            if ((uint32_t) v != UINT32_MAX) {
                s = (uint32_t) v;
                break;
            }
        }

        if (s != UINT32_MAX) {
            s = asg_name2id(g, annots->a[s].sname);
            // find start seg
            uint32_t t;
            for (i = 0, t = UINT32_MAX; i < path->nv; ++i) {
                if (path->v[i] >> 1 == s) {
                    t = i;
                    break;
                }
            }
            assert(t != UINT32_MAX);
            // do rotation to make t the first seg
            array_left_rotate(path->v, t, path->nv);
        }
    }

    // make gene orders in path
    kvec_t(uint64_t) g_ord;
    uint64_t w;
    kv_init(g_ord);
    for (k = (khint32_t) 0; k < kh_end(gene_db); ++k) {
        if (kh_exist(gene_db, k) && (uint32_t) (v = kh_val(gene_db, k)) != UINT32_MAX) {
            annot = &annots->a[(uint32_t) v];
            w  = (uint64_t) asg_name2id(g, annot->sname) << 40;
            w |= (uint64_t) (annot->alifrom + annot->alito) >> 1 << 8;
            w |= v >> 32;
            kv_push(uint64_t, g_ord, w);
        }
    }

    if (g_ord.n == 0) goto rotate_done;

    qsort(g_ord.a, g_ord.n, sizeof(uint64_t), u64_cmpfunc);

    uint64_t *idx;
    uint32_t last;
    MYCALLOC(idx, g->n_seg);
    for (i = 1, last = 0; i <= g_ord.n; ++i) {
        if (i == g_ord.n || (g_ord.a[i-1] >> 40) != (g_ord.a[i] >> 40))
            idx[g_ord.a[i-1] >> 40] = (uint64_t) last << 32 | (i - last), last = i;
    }

    uint32_t *p_ord, s, p, n, m;
    MYMALLOC(p_ord, g_ord.n);
    m = 0;
    for (i = 0; i < path->nv; ++i) {
        s = path->v[i] >> 1;
        p = idx[s] >> 32;
        n = (uint32_t) idx[s];
        if (n == 0) continue;
        if (path->v[i] & 1) {
            for (j = 0; j < n; ++j)
                p_ord[m++] = g_ord.a[p+n-1-j] & 0xFF;
        } else {
            for (j = 0; j < n; ++j)
                p_ord[m++] = g_ord.a[p+j] & 0xFF;
        }
    }

    assert(m == g_ord.n);

    // wrap gaps
    uint32_t *p_gap;
    MYCALLOC(p_gap, g_n);
    for (i = 0; i < m; ++i)
        ++p_gap[p_ord[i]];
    for (i = 1; i < g_n; ++i)
        p_gap[i] += p_gap[i-1];
    for (i = 0; i < m; ++i)
        p_ord[i] -= p_ord[i] - p_gap[p_ord[i]] + 1;
    free(p_gap);

    // calculate Spearman's rank correlation coefficient
    double ds, srcc;
    ds = .0;
    for (i = 0; i < g_ord.n; ++i)
        ds += ((double) p_ord[i] - i) * ((double) p_ord[i] - i);
    srcc = 1. - 6 * ds / g_ord.n / ((double) g_ord.n * g_ord.n - 1);

#ifdef DEBUG_SRCC
    // calculate Kendall's tau rank correlation coefficient
    double tau;
    ds = .0;
    for (i = 0; i < g_ord.n; ++i)
        for (j = i + 1; j < g_ord.n; ++j)
            ds += p_ord[i] > p_ord[j];
    tau = 1. - 2 * ds / g_ord.n / (g_ord.n - 1);
    fprintf(stderr, "[DEBUG_SRCC::%s] SRCC, %.6f; TAU, %.6f; N, %d\n", __func__, srcc, tau, m);
    for (i = 0; i < m; ++i)
        fprintf(stderr, "[DEBUG_SRCC::%s] %d %d\n", __func__, i, p_ord[i]);
#endif

    coeff = srcc;

    free(idx);
    free(p_ord);

rotate_done:
    kv_destroy(g_ord);
    kh_str_destroy(gene_db);
    kh_s32_destroy(segs);

    return coeff;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, 0x3c(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x48(%rsp)
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x18ab0
movq %rax, %r13
movq $0x0, 0x18(%rax)
movq 0x10(%rax), %rax
xorl %ebx, %ebx
movq %r13, 0x20(%rsp)
movl $0x0, %r12d
testq %rax, %rax
je 0x8f7a
movb (%r13), %cl
movl $0x1, %r12d
shll %cl, %r12d
leaq 0x16bdf(%rip), %rax     # 0x1fb60
movq (%rax,%rbx,8), %r8
movl 0x4(%r13), %eax
movl %r12d, %ecx
shrl %ecx
movl %r12d, %edx
shrl $0x2, %edx
addl %ecx, %edx
cmpl %edx, %eax
movq %rbx, 0x18(%rsp)
jae 0x8fa7
movl %r12d, %ebp
jmp 0x91c8
leal 0x1(%r12), %ecx
bsrl %ecx, %edx
cmpl $0x2, %ecx
movl $0x0, %esi
cmovbl %esi, %edx
andl %r12d, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %edx
cmpl $0x3, %edx
movl $0x2, %ecx
cmovael %edx, %ecx
movl $0x1, %ebp
shll %cl, %ebp
movl %ebp, %edi
shrl %edi
movl %ebp, %esi
shrl $0x2, %esi
addl %edi, %esi
cmpl %esi, %eax
jbe 0x8ff4
movb (%r13), %cl
movl $0x1, %ebp
shll %cl, %ebp
jmp 0x91c8
movl %ecx, 0x10(%rsp)
movq %r8, 0x28(%rsp)
movq 0x18(%r13), %rdi
movq %rbp, 0x8(%rsp)
shrl $0x3, %ebp
andl $-0x4, %ebp
cmpl $0x5, %edx
movl $0x4, %eax
cmovbl %eax, %ebp
movq %rbp, %rsi
callq 0x18c11
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x31b0
testq %r15, %r15
je 0x92d4
movq 0x10(%r13), %rsi
testq %rsi, %rsi
je 0x9057
movb (%r13), %cl
movl $0x1, %ebx
shll %cl, %ebx
movq 0x8(%rsp), %rbp
cmpl %ebp, %ebx
jb 0x905e
jmp 0x9082
xorl %ebx, %ebx
movq 0x8(%rsp), %rbp
movq 0x18(%r13), %rdi
movl %ebp, %edx
shlq $0x4, %rdx
callq 0x18d19
testq %rax, %rax
je 0x9302
movq %rax, 0x10(%r13)
testl %ebx, %ebx
je 0x91aa
leal -0x1(%rbp), %edi
movl $0x20, %eax
subl 0x10(%rsp), %eax
movl %ebx, %r8d
xorl %edx, %edx
movq 0x8(%r13), %r10
movl %edx, %esi
shrl $0x5, %esi
movl (%r10,%rsi,4), %ebx
movl $0x1, %ebp
movl %edx, %ecx
shll %cl, %ebp
btl %edx, %ebx
jae 0x917d
movq 0x10(%r13), %rcx
movq %rdx, %r9
shlq $0x4, %r9
movq (%rcx,%r9), %r11
movq 0x8(%rcx,%r9), %r9
notl %ebp
andl %ebp, %ebx
movl %ebx, (%r10,%rsi,4)
movsbl (%r11), %ecx
testl %ecx, %ecx
je 0x90fd
movb 0x1(%r11), %sil
testb %sil, %sil
je 0x90ff
leaq 0x2(%r11), %rbx
movl %ecx, %ebp
shll $0x5, %ebp
subl %ecx, %ebp
movsbl %sil, %ecx
addl %ebp, %ecx
movb (%rbx), %sil
incq %rbx
testb %sil, %sil
jne 0x90e3
jmp 0x90ff
xorl %ecx, %ecx
imull $0x9e3779b9, %ecx, %esi # imm = 0x9E3779B9
movl %eax, %ecx
shrl %cl, %esi
movl %esi, %r14d
shrl $0x5, %r14d
movl (%r15,%r14,4), %ebx
movl $0x1, %ebp
movl %esi, %ecx
shll %cl, %ebp
btl %esi, %ebx
jae 0x9128
incl %esi
andl %edi, %esi
jmp 0x9109
orl %ebp, %ebx
movl %ebx, (%r15,%r14,4)
cmpl %r8d, %esi
jae 0x916a
movq 0x10(%r13), %rcx
testl %ebp, (%r10,%r14,4)
je 0x916e
movl %esi, %esi
shlq $0x4, %rsi
movq (%rcx,%rsi), %rbx
movq 0x8(%rcx,%rsi), %r12
movq %r11, (%rcx,%rsi)
movq %r9, 0x8(%rcx,%rsi)
notl %ebp
movq 0x8(%r13), %r10
andl %ebp, (%r10,%r14,4)
movq %r12, %r9
movq %rbx, %r11
jmp 0x90ce
movq 0x10(%r13), %rcx
movl %esi, %esi
shlq $0x4, %rsi
movq %r11, (%rcx,%rsi)
movq %r9, 0x8(%rcx,%rsi)
incq %rdx
cmpq %r8, %rdx
jne 0x9093
movq 0x8(%rsp), %rbp
cmpl %ebp, %r8d
jbe 0x91aa
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdi
movl %ebp, %edx
shlq $0x4, %rdx
callq 0x18d19
movq %rax, 0x10(%r13)
movq 0x8(%r13), %rsi
movq 0x18(%r13), %rdi
callq 0x18b4b
movq %r15, 0x8(%r13)
movl 0x10(%rsp), %eax
movl %eax, (%r13)
movq 0x28(%rsp), %r8
movsbl (%r8), %eax
testl %eax, %eax
je 0x91f3
movb 0x1(%r8), %cl
testb %cl, %cl
je 0x91f5
leaq 0x2(%r8), %rdx
movl %eax, %esi
shll $0x5, %esi
subl %eax, %esi
movsbl %cl, %eax
addl %esi, %eax
movb (%rdx), %cl
incq %rdx
testb %cl, %cl
jne 0x91dc
jmp 0x91f5
xorl %eax, %eax
imull $0x9e3779b9, %eax, %r12d # imm = 0x9E3779B9
movb (%r13), %al
xorl %ecx, %ecx
subb %al, %cl
shrl %cl, %r12d
decl %ebp
movq 0x8(%r13), %rax
movq %rax, 0x8(%rsp)
movl %r12d, %r15d
movq %r12, %rbx
movq %rbp, %r12
movl %r15d, %ebp
shrl $0x5, %ebp
movq 0x8(%rsp), %rax
movl (%rax,%rbp,4), %eax
movl $0x1, %r13d
movl %r15d, %ecx
shll %cl, %r13d
btl %r15d, %eax
jae 0x9292
movl %eax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movl %r15d, %ecx
shlq $0x4, %rcx
movq (%rax,%rcx), %rdi
movq %r8, %r14
movq %r8, %rsi
callq 0x3250
testl %eax, %eax
je 0x9297
incl %r15d
movq %r12, %rbp
andl %ebp, %r15d
movq %rbx, %r12
cmpl %r12d, %r15d
movq %r14, %r8
jne 0x9215
movl %r12d, %ebp
shrl $0x5, %ebp
movl $0x1, %r13d
movl %r12d, %ecx
shll %cl, %r13d
movq 0x8(%rsp), %rax
movl (%rax,%rbp,4), %eax
jmp 0x92a1
movl %r15d, %r12d
jmp 0x92a1
movl %r15d, %r12d
movq %r14, %r8
movl 0x10(%rsp), %eax
testl %eax, %r13d
je 0x92ad
movq 0x20(%rsp), %r13
jmp 0x92cf
movq 0x20(%rsp), %rdx
movq 0x10(%rdx), %rax
movl %r12d, %ecx
shlq $0x4, %rcx
movq %r8, (%rax,%rcx)
movq 0x8(%rdx), %rax
orl %r13d, (%rax,%rbp,4)
movq %rdx, %r13
incl 0x4(%rdx)
movq 0x18(%rsp), %rbx
movq %rbx, %rcx
shlq $0x20, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orq %rax, %rcx
movq 0x10(%r13), %rax
movl %r12d, %edx
shlq $0x4, %rdx
movq %rcx, 0x8(%rax,%rdx)
incq %rbx
cmpq $0x47, %rbx
jne 0x8f62
jmp 0x9310
movq 0x18(%r13), %rdi
movq %r15, %rsi
callq 0x18b4b
jmp 0x92cf
xorl %r14d, %r14d
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x18ab0
movq %rax, %r13
movq $0x0, 0x18(%rax)
movq 0x30(%rsp), %rbx
movl 0x8(%rbx), %r15d
testl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
je 0x9615
movq 0x10(%r13), %rcx
xorl %r10d, %r10d
testq %rcx, %rcx
je 0x9360
movb (%r13), %cl
movl $0x1, %r15d
shll %cl, %r15d
jmp 0x9363
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl (%rax,%r10,4), %r11d
movl 0x4(%r13), %eax
movl %r15d, %ecx
shrl %ecx
movl %r15d, %edx
shrl $0x2, %edx
addl %ecx, %edx
cmpl %edx, %eax
jae 0x938c
movl (%r13), %ecx
movl %r15d, %r12d
jmp 0x9557
leal 0x1(%r15), %ecx
bsrl %ecx, %edx
cmpl $0x2, %ecx
cmovbl %r14d, %edx
andl %r15d, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %edx
cmpl $0x3, %edx
movl $0x2, %ecx
cmovael %edx, %ecx
movl $0x1, %r12d
shll %cl, %r12d
movl %r12d, %edi
shrl %edi
movl %r12d, %esi
shrl $0x2, %esi
addl %edi, %esi
cmpl %esi, %eax
jbe 0x93da
movl (%r13), %ecx
movl $0x1, %r12d
shll %cl, %r12d
jmp 0x9557
movl %ecx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x8(%rsp)
movq 0x18(%r13), %rdi
movl %r12d, %ebp
shrl $0x3, %ebp
andl $-0x4, %ebp
cmpl $0x5, %edx
movl $0x4, %eax
cmovbl %eax, %ebp
movq %rbp, %rsi
callq 0x18c11
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x31b0
testq %r14, %r14
je 0x95e1
movq 0x10(%r13), %rsi
testq %rsi, %rsi
je 0x943c
movb (%r13), %cl
movl $0x1, %ebx
shll %cl, %ebx
cmpl %r12d, %ebx
jb 0x943e
jmp 0x9463
xorl %ebx, %ebx
movq 0x18(%r13), %rdi
movl %r12d, %edx
shlq $0x3, %rdx
callq 0x18d19
testq %rax, %rax
je 0x95d5
movq %rax, 0x10(%r13)
testl %ebx, %ebx
je 0x952c
leal -0x1(%r12), %edi
movl $0x20, %eax
subl 0x10(%rsp), %eax
movl %ebx, %r8d
xorl %edx, %edx
movq 0x8(%r13), %r9
movl %edx, %esi
shrl $0x5, %esi
movl (%r9,%rsi,4), %r11d
movl $0x1, %ebx
movl %edx, %ecx
shll %cl, %ebx
btl %edx, %r11d
jae 0x9503
movq 0x10(%r13), %rcx
movq (%rcx,%rdx,8), %r10
notl %ebx
andl %ebx, %r11d
movl %r11d, (%r9,%rsi,4)
imull $0x9e3779b9, %r10d, %esi # imm = 0x9E3779B9
movl %eax, %ecx
shrl %cl, %esi
movl %esi, %r11d
shrl $0x5, %r11d
movl (%r14,%r11,4), %ebx
movl $0x1, %ebp
movl %esi, %ecx
shll %cl, %ebp
btl %esi, %ebx
jae 0x94cd
incl %esi
andl %edi, %esi
jmp 0x94ae
orl %ebp, %ebx
movl %ebx, (%r14,%r11,4)
movl %esi, %ecx
cmpl %r8d, %esi
jae 0x94fb
movq 0x10(%r13), %rsi
testl %ebp, (%r9,%r11,4)
je 0x94ff
movq (%rsi,%rcx,8), %rbx
movq %r10, (%rsi,%rcx,8)
notl %ebp
movq 0x8(%r13), %r9
andl %ebp, (%r9,%r11,4)
movq %rbx, %r10
jmp 0x94a3
movq 0x10(%r13), %rsi
movq %r10, (%rsi,%rcx,8)
incq %rdx
cmpq %r8, %rdx
jne 0x9476
cmpl %r12d, %r8d
jbe 0x952c
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdi
movl %r12d, %edx
shlq $0x3, %rdx
callq 0x18d19
movq %rax, 0x10(%r13)
movq 0x8(%r13), %rsi
movq 0x18(%r13), %rdi
callq 0x18b4b
movq %r14, 0x8(%r13)
movl 0x10(%rsp), %ecx
movl %ecx, (%r13)
movq 0x30(%rsp), %rbx
xorl %r14d, %r14d
movq 0x8(%rsp), %r10
movq 0x18(%rsp), %r11
shrl %r11d
imull $0x9e3779b9, %r11d, %r15d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r15d
decl %r12d
movq 0x8(%r13), %rsi
movl %r15d, %ecx
movl %ecx, %eax
shrl $0x5, %eax
movl (%rsi,%rax,4), %edi
movl $0x1, %edx
shll %cl, %edx
btl %ecx, %edi
jae 0x95b0
movq 0x10(%r13), %r8
movl %ecx, %r9d
cmpl (%r8,%r9,8), %r11d
je 0x95b0
incl %ecx
andl %r12d, %ecx
cmpl %r15d, %ecx
jne 0x9570
movl %r15d, %eax
shrl $0x5, %eax
movl $0x1, %edx
movl %r15d, %ecx
shll %cl, %edx
movl (%rsi,%rax,4), %edi
jmp 0x95b3
movl %ecx, %r15d
movq 0x10(%r13), %rcx
movl %r15d, %esi
testl %edi, %edx
je 0x95c4
incl 0x4(%rcx,%rsi,8)
jmp 0x95fd
movq %r11, (%rcx,%rsi,8)
movq 0x8(%r13), %rcx
orl %edx, (%rcx,%rax,4)
incl 0x4(%r13)
jmp 0x95ee
movq 0x18(%r13), %rdi
movq %r14, %rsi
callq 0x18b4b
movq 0x30(%rsp), %rbx
xorl %r14d, %r14d
movq 0x8(%rsp), %r10
movq 0x10(%r13), %rcx
movl %r15d, %eax
movl $0x1, 0x4(%rcx,%rax,8)
incq %r10
movl 0x8(%rbx), %r15d
movl %r15d, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpq %rax, %r10
jb 0x934c
movq 0x40(%rsp), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x9864
movq 0x40(%rsp), %rax
movq 0x10(%rax), %r15
xorl %r12d, %r12d
movl 0x3c(%rsp), %ebp
movq %r15, 0x50(%rsp)
movq %r14, 0x58(%rsp)
leaq (%r12,%r12,4), %rax
shlq $0x4, %rax
movq %rax, %rdx
movl 0x48(%r15,%rax), %eax
shrl $0x1d, %eax
andl $0x3, %eax
cmpl %ebp, %eax
jne 0x9854
addq %r15, %rdx
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq $0x0, 0x18(%rsp)
movl $0x0, %ecx
movq %rcx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
testq %rax, %rax
movq %rdx, 0x28(%rsp)
je 0x9752
movq 0x20(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movq %rax, 0x10(%rsp)
movq (%rdx), %r14
movsbl (%r14), %eax
testl %eax, %eax
movq %r12, 0x60(%rsp)
je 0x96d6
movb 0x1(%r14), %dl
testb %dl, %dl
je 0x96d8
leaq 0x2(%r14), %rsi
movl %eax, %edi
shll $0x5, %edi
subl %eax, %edi
movsbl %dl, %eax
addl %edi, %eax
movb (%rsi), %dl
incq %rsi
testb %dl, %dl
jne 0x96bf
jmp 0x96d8
xorl %eax, %eax
imull $0x9e3779b9, %eax, %r15d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r15d
movq 0x10(%rsp), %rax
leal -0x1(%rax), %r12d
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rbp
movl %r15d, %ebx
movl %ebx, %eax
shrl $0x5, %eax
movl (%rbp,%rax,4), %eax
btl %ebx, %eax
jae 0x9735
movl %ebx, %eax
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax), %rdi
movq %r14, %rsi
callq 0x3250
testl %eax, %eax
je 0x972e
incl %ebx
andl %r12d, %ebx
cmpl %r15d, %ebx
jne 0x96f9
jmp 0x9735
movl %ebx, %eax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rbx
movl 0x3c(%rsp), %ebp
movq 0x58(%rsp), %r14
movq 0x50(%rsp), %r15
movq 0x60(%rsp), %r12
movq 0x28(%rsp), %rdx
movq 0x8(%rdx), %rsi
movq 0x48(%rsp), %rdi
callq 0x8bd0
movq 0x10(%r13), %rdx
testq %rdx, %rdx
je 0x97b7
movb (%r13), %cl
movl $0x1, %edi
shll %cl, %edi
imull $0x9e3779b9, %eax, %esi # imm = 0x9E3779B9
negb %cl
shrl %cl, %esi
movq %rdi, 0x18(%rsp)
leal -0x1(%rdi), %ecx
movq 0x8(%r13), %r8
movl %esi, %edi
movl %edi, %r9d
shrl $0x5, %r9d
movl (%r8,%r9,4), %r9d
btl %edi, %r9d
jae 0x97b7
movl %edi, %r9d
cmpl (%rdx,%r9,8), %eax
je 0x97b0
incl %edi
andl %ecx, %edi
cmpl %esi, %edi
jne 0x978c
jmp 0x97b7
movl %edi, %eax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x97cf
movq 0x20(%rsp), %rax
movb (%rax), %cl
movl $0x1, %eax
shll %cl, %eax
jmp 0x97d1
xorl %eax, %eax
cmpl %eax, 0x10(%rsp)
jae 0x9854
testq %rdx, %rdx
je 0x97e9
movb (%r13), %cl
movl $0x1, %eax
shll %cl, %eax
jmp 0x97eb
xorl %eax, %eax
cmpl %eax, 0x18(%rsp)
jae 0x9854
movl 0x18(%rsp), %eax
cmpl $0x1, 0x4(%rdx,%rax,8)
jne 0x9854
movl 0x10(%rsp), %eax
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
movq 0x8(%rcx,%rax), %rcx
testq %r15, %r15
je 0x9835
movl %ecx, %edx
cmpl $-0x1, %edx
je 0x9835
leaq (%rdx,%rdx,4), %rdx
shlq $0x4, %rdx
movq 0x28(%rsp), %rsi
movsd 0x38(%rsi), %xmm0
ucomisd 0x38(%r15,%rdx), %xmm0
jbe 0x9854
movq 0x8(%rsp), %rdx
addq %rdx, %rax
addq $0x8, %rax
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rdx, %rcx
orq %r12, %rcx
movq %rcx, (%rax)
incl %r12d
cmpq %r12, %r14
ja 0x9640
movl 0x8(%rbx), %r15d
btl $0x1e, %r15d
jae 0x99dc
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
xorl %edx, %edx
movq %r15, 0x28(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x98d7
movq 0x20(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %r8d
shll %cl, %r8d
leaq 0x162bd(%rip), %rax     # 0x1fb60
movq %rdx, 0x10(%rsp)
movq (%rax,%rdx,8), %r15
movsbl (%r15), %eax
testl %eax, %eax
je 0x98db
movb 0x1(%r15), %dl
testb %dl, %dl
je 0x98dd
leaq 0x2(%r15), %rsi
movl %eax, %edi
shll $0x5, %edi
subl %eax, %edi
movsbl %dl, %eax
addl %edi, %eax
movb (%rsi), %dl
incq %rsi
testb %dl, %dl
jne 0x98c0
jmp 0x98dd
xorl %eax, %eax
jmp 0x994c
xorl %eax, %eax
imull $0x9e3779b9, %eax, %ebp # imm = 0x9E3779B9
negb %cl
shrl %cl, %ebp
movq %r8, 0x18(%rsp)
leal -0x1(%r8), %r14d
movq 0x20(%rsp), %rax
movq 0x8(%rax), %r12
movl %ebp, %ebx
movl %ebx, %eax
shrl $0x5, %eax
movl (%r12,%rax,4), %eax
btl %ebx, %eax
jae 0x992d
movl %ebx, %eax
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax), %rdi
movq %r15, %rsi
callq 0x3250
testl %eax, %eax
je 0x9939
incl %ebx
andl %r14d, %ebx
cmpl %ebp, %ebx
jne 0x98fb
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
jmp 0x9940
movl %ebx, %eax
movq 0x10(%rsp), %rdx
movl %eax, %eax
movq 0x30(%rsp), %rbx
movq 0x28(%rsp), %r15
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
movl 0x8(%rcx,%rax), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x9972
incq %rdx
cmpq $0x47, %rdx
jne 0x9884
jmp 0x99dc
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rsi
movq 0x48(%rsp), %rdi
callq 0x8bd0
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
je 0x99b5
movq 0x10(%rbx), %rdi
movl %r15d, %ecx
xorl %esi, %esi
movl (%rdi,%rsi,4), %edx
shrl %edx
cmpl %eax, %edx
je 0x99d4
incq %rsi
cmpq %rsi, %rcx
jne 0x99a4
leaq 0x1188f(%rip), %rdi     # 0x1b24b
leaq 0x10cc2(%rip), %rsi     # 0x1a685
leaq 0x11891(%rip), %rcx     # 0x1b25b
movl $0x665, %edx            # imm = 0x665
callq 0x3190
movl %r15d, %edx
callq 0x9da1
movl $0x8, %esi
xorl %r12d, %r12d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
xorl %r9d, %r9d
xorl %r8d, %r8d
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0x9a0b
movb (%rcx), %cl
movl $0x1, %edx
shlq %cl, %rdx
jmp 0x9a0d
xorl %edx, %edx
cmpq %rdx, %r12
jae 0x9afc
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq %r12, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r12d, %ecx
jae 0x9af0
movq (%rax,%rsi), %r15
movl %r15d, %eax
cmpq %rdi, %rax
je 0x9af0
movq %rsi, 0x18(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rbp
leaq (%rax,%rax,4), %r14
shlq $0x4, %r14
movq 0x8(%rbp,%r14), %rsi
movq 0x48(%rsp), %rdi
movq %r8, 0x8(%rsp)
movq %r9, %rbx
callq 0x8bd0
movq %rbx, %r9
movq 0x8(%rsp), %r8
movl 0x1c(%rbp,%r14), %ebx
addl 0x18(%rbp,%r14), %ebx
cmpq %r9, %r8
jne 0x9ac5
leaq (%r9,%r9), %r14
testq %r9, %r9
movq %rax, 0x28(%rsp)
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x3330
movq 0x8(%rsp), %r8
movq %rax, %rbp
movq 0x28(%rsp), %rax
movq %r14, %r9
jmp 0x9aca
movq 0x10(%rsp), %rbp
shlq $0x28, %rax
shrl %ebx
shlq $0x8, %rbx
orq %rax, %rbx
shrq $0x20, %r15
orq %rbx, %r15
movq %r15, (%rbp,%r8,8)
incq %r8
movq 0x18(%rsp), %rsi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
incq %r12
addq $0x10, %rsi
jmp 0x99f1
testq %r8, %r8
je 0x9d03
leaq 0x7630(%rip), %rcx      # 0x1113c
movl $0x8, %edx
movq %rbp, %rdi
movq %r8, %rsi
movq %r8, %rbx
callq 0x30c0
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x8, %esi
callq 0x3240
movq %rbx, %rdi
movq %rax, %r15
xorl %edx, %edx
movl $0x1, %eax
movl $0x1, %esi
movq %rbp, %rcx
cmpq %rsi, %rdi
je 0x9b5a
movq (%rbp,%rsi,8), %rsi
xorq (%rcx), %rsi
shrq $0x28, %rsi
je 0x9b72
movl %eax, %esi
subl %edx, %esi
shlq $0x20, %rdx
orq %rdx, %rsi
movq (%rcx), %rdx
shrq $0x28, %rdx
movq %rsi, (%r15,%rdx,8)
movl %eax, %edx
incl %eax
addq $0x8, %rcx
movq %rax, %rsi
cmpq %rax, %rdi
jae 0x9b47
leaq (,%rdi,4), %rdi
callq 0x32f0
movq %rax, %r14
movq 0x30(%rsp), %rdx
movl 0x8(%rdx), %ecx
xorl %eax, %eax
andq $0x3fffffff, %rcx       # imm = 0x3FFFFFFF
je 0x9c1a
movq 0x10(%rdx), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edi, %edi
movl (%rdx,%rdi,4), %r11d
movl %r11d, %r8d
shrl %r8d
movq (%r15,%r8,8), %r10
movq %r10, %r9
andq %rsi, %r9
je 0x9c10
movq %r10, %r8
shrq $0x20, %r8
testb $0x1, %r11b
jne 0x9bed
movl %r8d, %r10d
movzbl (%rbp,%r10,8), %r10d
movl %eax, %r11d
incl %eax
movl %r10d, (%r14,%r11,4)
incq %r8
decq %r9
jne 0x9bd1
jmp 0x9c10
movl %r10d, %r9d
addq %r10, %r8
decq %r8
movl %r8d, %r10d
movzbl (%rbp,%r10,8), %r10d
movl %eax, %r11d
incl %eax
movl %r10d, (%r14,%r11,4)
decq %r8
decq %r9
jne 0x9bf6
incq %rdi
cmpq %rcx, %rdi
jne 0x9bae
movl %eax, %eax
cmpq %rax, %rbx
jne 0x9d82
movl $0x47, %edi
movl $0x4, %esi
callq 0x3240
xorl %ecx, %ecx
movq %rbx, %rsi
movl (%r14,%rcx,4), %edx
incl (%rax,%rdx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0x9c37
movl (%rax), %ecx
movl $0x1, %edx
addl (%rax,%rdx,4), %ecx
movl %ecx, (%rax,%rdx,4)
incq %rdx
cmpq $0x47, %rdx
jne 0x9c4d
xorl %ecx, %ecx
movl (%r14,%rcx,4), %edx
movl (%rax,%rdx,4), %edx
decl %edx
movl %edx, (%r14,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0x9c5e
movq %rax, %rdi
callq 0x3060
xorpd %xmm2, %xmm2
xorl %eax, %eax
movl (%r14,%rax,4), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm2
incq %rax
movl %eax, %ecx
cmpq %rcx, %rbx
ja 0x9c81
mulsd 0x10863(%rip), %xmm2    # 0x1a518
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
divsd %xmm0, %xmm2
mulsd %xmm0, %xmm0
addsd 0x107d3(%rip), %xmm0    # 0x1a4a0
divsd %xmm0, %xmm2
addsd 0x10847(%rip), %xmm2    # 0x1a520
movsd %xmm2, 0x8(%rsp)
movq %r15, %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq %rbp, %rdi
callq 0x3060
movq 0x20(%rsp), %rbx
testq %rbx, %rbx
jne 0x9d1a
jmp 0x9d41
movq %rbp, %rdi
callq 0x3060
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x18b4b
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x18b4b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18b4b
testq %r13, %r13
je 0x9d6d
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rbx
movq %rbx, %rdi
callq 0x18b4b
movq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0x18b4b
movq %rbx, %rdi
movq %r13, %rsi
callq 0x18b4b
movsd 0x8(%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1151a(%rip), %rdi     # 0x1b2a3
leaq 0x108f5(%rip), %rsi     # 0x1a685
leaq 0x114c4(%rip), %rcx     # 0x1b25b
movl $0x696, %edx            # imm = 0x696
callq 0x3190