// File: /workspace/github_c_makefile_star2_O2/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, 0x54(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, 0x38(%rsp)
xorl %r12d, %r12d
pushq $0x1
popq %rsi
pushq $0x20
popq %rdx
xorl %edi, %edi
callq 0x145b8
andq $0x0, 0x18(%rax)
pushq $0x1
popq %rbx
movq %rax, 0x8(%rsp)
cmpq $0x47, %r12
je 0x7bc7
cmpq $0x0, 0x10(%rax)
je 0x785f
movb (%rax), %cl
movl %ebx, %r15d
shll %cl, %r15d
jmp 0x7862
xorl %r15d, %r15d
leaq 0x152f7(%rip), %rcx     # 0x1cb60
movq (%rcx,%r12,8), %rcx
movq %rcx, 0x28(%rsp)
movl 0x4(%rax), %edi
movl %r15d, %ecx
shrl %ecx
movl %r15d, %edx
shrl $0x2, %edx
addl %ecx, %edx
cmpl %edx, %edi
movq %r12, 0x48(%rsp)
jae 0x788d
jmp 0x78d6
leal 0x1(%r15), %ecx
xorl %edx, %edx
movl %ecx, %esi
cmpl $0x2, %esi
jb 0x78a0
shrl %esi
incl %edx
jmp 0x7895
leal -0x1(%rcx), %esi
andl %ecx, %esi
cmpl $0x1, %esi
sbbl $-0x1, %edx
cmpl $0x3, %edx
pushq $0x2
popq %rcx
cmovael %edx, %ecx
movl %ebx, %ebp
shll %cl, %ebp
movl %ebp, %r9d
shrl %r9d
movl %ebp, %esi
shrl $0x2, %esi
addl %r9d, %esi
cmpl %esi, %edi
jbe 0x79b1
movb (%rax), %cl
movl %ebx, %r15d
shll %cl, %r15d
movq %rax, %r14
decl %r15d
movq 0x28(%rsp), %rdi
callq 0xf20a
imull $0x9e3779b9, %eax, %edi # imm = 0x9E3779B9
movb (%r14), %al
xorl %ecx, %ecx
subb %al, %cl
shrl %cl, %edi
movq 0x8(%r14), %rax
movq %rax, (%rsp)
movl %edi, %ebp
movq %r14, %rax
movq %r15, %r13
movl %ebp, %r14d
shrl $0x5, %r14d
movq (%rsp), %rcx
movl (%rcx,%r14,4), %edx
movl %ebx, %r15d
movl %ebp, %ecx
shll %cl, %r15d
btl %ebp, %edx
jae 0x7971
movl %edx, 0x10(%rsp)
movq %rdi, %r12
movq 0x10(%rax), %rax
movl %ebp, %ecx
shlq $0x4, %rcx
movq (%rax,%rcx), %rdi
movq 0x28(%rsp), %rsi
callq 0x3250
testl %eax, %eax
je 0x7975
incl %ebp
movq %r13, %r15
andl %r15d, %ebp
movq %r12, %rdi
cmpl %edi, %ebp
movq 0x8(%rsp), %rax
jne 0x7902
movl %edi, %r14d
shrl $0x5, %r14d
movl %ebx, %r15d
movl %edi, %ecx
shll %cl, %r15d
movq (%rsp), %rcx
movl (%rcx,%r14,4), %edx
jmp 0x7980
movl %ebp, %edi
jmp 0x7980
movl %ebp, %edi
movq 0x8(%rsp), %rax
movl 0x10(%rsp), %edx
testl %edx, %r15d
movq 0x48(%rsp), %r12
jne 0x7ba1
movq 0x10(%rax), %rdx
movl %edi, %ecx
shlq $0x4, %rcx
movq 0x28(%rsp), %rsi
movq %rsi, (%rdx,%rcx)
movq 0x8(%rax), %rcx
orl %r15d, (%rcx,%r14,4)
incl 0x4(%rax)
jmp 0x7ba1
movq %r15, (%rsp)
movl %ecx, 0x34(%rsp)
movq 0x18(%rax), %rdi
movl %ebp, %r14d
shrl $0x3, %r14d
andl $-0x4, %r14d
cmpl $0x5, %edx
pushq $0x4
popq %rcx
cmovbl %ecx, %r14d
movq %r14, %rsi
movq %rax, %r15
callq 0x14734
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x31b0
testq %r13, %r13
je 0x7a15
movq 0x10(%r15), %rsi
movl %ebp, %eax
movq %rax, 0x58(%rsp)
testq %rsi, %rsi
movq %r15, %r9
je 0x7a1d
movb (%r9), %cl
movl %ebx, %r12d
shll %cl, %r12d
cmpl %ebp, %r12d
jb 0x7a20
jmp 0x7a45
movq %r15, %rax
jmp 0x7b9d
xorl %r12d, %r12d
movq 0x18(%r9), %rdi
movq 0x58(%rsp), %rdx
shlq $0x4, %rdx
movq %r9, %r14
callq 0x1483c
testq %rax, %rax
je 0x7b89
movq %rax, 0x10(%r14)
movq %r14, %r9
movq %rbp, 0x60(%rsp)
leal -0x1(%rbp), %r15d
pushq $0x20
popq %rax
subl 0x34(%rsp), %eax
movl %eax, 0x10(%rsp)
movl %r12d, %eax
movq %rax, (%rsp)
xorl %ecx, %ecx
cmpq (%rsp), %rcx
je 0x7b3f
movq 0x8(%r9), %r12
movl %ecx, %eax
shrl $0x5, %eax
movl (%r12,%rax,4), %edx
movl %ebx, %esi
shll %cl, %esi
btl %ecx, %edx
jae 0x7b37
movq 0x10(%r9), %r8
movq %rcx, 0x20(%rsp)
movq %rcx, %rdi
shlq $0x4, %rdi
movq (%r8,%rdi), %r14
movq 0x8(%r8,%rdi), %rbp
notl %esi
andl %esi, %edx
movl %edx, (%r12,%rax,4)
movq %r14, %rdi
callq 0xf20a
imull $0x9e3779b9, %eax, %eax # imm = 0x9E3779B9
movl 0x10(%rsp), %ecx
shrl %cl, %eax
movl %eax, %edx
shrl $0x5, %edx
movl (%r13,%rdx,4), %edi
movl %ebx, %esi
movl %eax, %ecx
shll %cl, %esi
btl %eax, %edi
jae 0x7ad7
incl %eax
andl %r15d, %eax
jmp 0x7abb
orl %esi, %edi
movl %edi, (%r13,%rdx,4)
movl %eax, %ecx
cmpl (%rsp), %eax
jae 0x7b1c
movq 0x8(%rsp), %r9
movq 0x10(%r9), %rax
testl %esi, (%r12,%rdx,4)
je 0x7b25
shlq $0x4, %rcx
movq (%rax,%rcx), %rdi
movq 0x8(%rax,%rcx), %r8
movq %r14, (%rax,%rcx)
movq %rbp, 0x8(%rax,%rcx)
notl %esi
movq 0x8(%r9), %r12
andl %esi, (%r12,%rdx,4)
movq %r8, %rbp
movq %rdi, %r14
jmp 0x7aa7
movq 0x8(%rsp), %r9
movq 0x10(%r9), %rax
shlq $0x4, %rcx
movq %r14, (%rax,%rcx)
movq %rbp, 0x8(%rax,%rcx)
movq 0x20(%rsp), %rcx
incq %rcx
jmp 0x7a62
movq 0x60(%rsp), %r15
cmpl %r15d, (%rsp)
jbe 0x7b69
movq 0x10(%r9), %rsi
movq 0x18(%r9), %rdi
movq 0x58(%rsp), %rdx
shlq $0x4, %rdx
callq 0x1483c
movq 0x8(%rsp), %r9
movq %rax, 0x10(%r9)
movq 0x8(%r9), %rsi
movq 0x18(%r9), %rdi
movq %r9, %r14
callq 0x1463f
movq %r13, 0x8(%r14)
movl 0x34(%rsp), %eax
movl %eax, (%r14)
jmp 0x78d9
movq 0x18(%r14), %rdi
movq %r13, %rsi
callq 0x1463f
movq %r14, %rax
movq 0x48(%rsp), %r12
movq (%rsp), %rdi
movq %r12, %rsi
shlq $0x20, %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
orq %rcx, %rsi
movq 0x10(%rax), %rcx
movl %edi, %edx
shlq $0x4, %rdx
movq %rsi, 0x8(%rcx,%rdx)
incq %r12
jmp 0x7844
xorl %r12d, %r12d
pushq $0x1
popq %rsi
pushq $0x20
popq %rdx
xorl %edi, %edi
callq 0x145b8
movq %rax, %r13
andq $0x0, 0x18(%rax)
movq 0x18(%rsp), %r10
movl 0x8(%r10), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpq %rax, %r12
jae 0x7e9f
cmpq $0x0, 0x10(%r13)
je 0x7c09
movb (%r13), %cl
movl %ebx, %r15d
shll %cl, %r15d
jmp 0x7c0c
xorl %r15d, %r15d
movq 0x10(%r10), %rax
movl (%rax,%r12,4), %r11d
movl 0x4(%r13), %eax
movl %r15d, %ecx
shrl %ecx
movl %r15d, %edx
shrl $0x2, %edx
addl %ecx, %edx
cmpl %edx, %eax
jae 0x7c35
movl (%r13), %ecx
movl %r15d, %r14d
jmp 0x7dfb
leal 0x1(%r15), %ecx
xorl %edx, %edx
movl %ecx, %esi
cmpl $0x2, %esi
jb 0x7c48
shrl %esi
incl %edx
jmp 0x7c3d
leal -0x1(%rcx), %esi
andl %ecx, %esi
cmpl $0x1, %esi
sbbl $-0x1, %edx
cmpl $0x3, %edx
pushq $0x2
popq %rcx
cmovael %edx, %ecx
movl %ebx, %r14d
shll %cl, %r14d
movl %r14d, %edi
shrl %edi
movl %r14d, %esi
shrl $0x2, %esi
addl %edi, %esi
cmpl %esi, %eax
jbe 0x7c82
movl (%r13), %ecx
movl %ebx, %r14d
shll %cl, %r14d
jmp 0x7dfb
movl %ecx, 0x10(%rsp)
movq %r11, 0x28(%rsp)
movq %r12, (%rsp)
movq 0x18(%r13), %rdi
movl %r14d, %ebp
shrl $0x3, %ebp
andl $-0x4, %ebp
cmpl $0x5, %edx
pushq $0x4
popq %rax
cmovbl %eax, %ebp
movq %rbp, %rsi
callq 0x14734
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x31b0
testq %r12, %r12
je 0x7e7f
movq 0x10(%r13), %rsi
movl %r14d, %eax
movq %rax, 0x20(%rsp)
testq %rsi, %rsi
je 0x7ce6
movb (%r13), %cl
movl %ebx, %ebp
shll %cl, %ebp
cmpl %r14d, %ebp
jb 0x7ce8
jmp 0x7d0b
xorl %ebp, %ebp
movq 0x18(%r13), %rdi
movq 0x20(%rsp), %rax
leaq (,%rax,8), %rdx
callq 0x1483c
testq %rax, %rax
je 0x7e73
movq %rax, 0x10(%r13)
leal -0x1(%r14), %edi
pushq $0x20
popq %rax
subl 0x10(%rsp), %eax
movl %ebp, %r8d
xorl %edx, %edx
cmpq %r8, %rdx
je 0x7db5
movq 0x8(%r13), %r9
movl %edx, %esi
shrl $0x5, %esi
movl (%r9,%rsi,4), %r11d
movl %ebx, %ebp
movl %edx, %ecx
shll %cl, %ebp
btl %edx, %r11d
jae 0x7dad
movq 0x10(%r13), %rcx
movq (%rcx,%rdx,8), %r10
notl %ebp
andl %ebp, %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 (%r12,%r11,4), %r15d
movl %ebx, %ebp
movl %esi, %ecx
shll %cl, %ebp
btl %esi, %r15d
jae 0x7d76
incl %esi
andl %edi, %esi
jmp 0x7d59
orl %ebp, %r15d
movl %r15d, (%r12,%r11,4)
movl %esi, %ecx
cmpl %r8d, %esi
jae 0x7da5
movq 0x10(%r13), %rsi
testl %ebp, (%r9,%r11,4)
je 0x7da9
movq (%rsi,%rcx,8), %r15
movq %r10, (%rsi,%rcx,8)
notl %ebp
movq 0x8(%r13), %r9
andl %ebp, (%r9,%r11,4)
movq %r15, %r10
jmp 0x7d4e
movq 0x10(%r13), %rsi
movq %r10, (%rsi,%rcx,8)
incq %rdx
jmp 0x7d1b
cmpl %r14d, %r8d
jbe 0x7dd4
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdi
movq 0x20(%rsp), %rdx
shlq $0x3, %rdx
callq 0x1483c
movq %rax, 0x10(%r13)
movq 0x8(%r13), %rsi
movq 0x18(%r13), %rdi
callq 0x1463f
movq %r12, 0x8(%r13)
movl 0x10(%rsp), %ecx
movl %ecx, (%r13)
movq 0x18(%rsp), %r10
movq (%rsp), %r12
movq 0x28(%rsp), %r11
shrl %r11d
imull $0x9e3779b9, %r11d, %r15d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r15d
decl %r14d
movq 0x8(%r13), %rsi
movl %r15d, %ecx
movl %ecx, %eax
shrl $0x5, %eax
movl (%rsi,%rax,4), %edi
movl %ebx, %edx
shll %cl, %edx
btl %ecx, %edi
jae 0x7e4e
movq 0x10(%r13), %r8
movl %ecx, %r9d
cmpl (%r8,%r9,8), %r11d
je 0x7e4e
incl %ecx
andl %r14d, %ecx
cmpl %r15d, %ecx
jne 0x7e14
movl %r15d, %eax
shrl $0x5, %eax
movl %ebx, %edx
movl %r15d, %ecx
shll %cl, %edx
movl (%rsi,%rax,4), %edi
jmp 0x7e51
movl %ecx, %r15d
movq 0x10(%r13), %rcx
movl %r15d, %esi
testl %edi, %edx
je 0x7e62
incl 0x4(%rcx,%rsi,8)
jmp 0x7e97
movq %r11, (%rcx,%rsi,8)
movq 0x8(%r13), %rcx
orl %edx, (%rcx,%rax,4)
incl 0x4(%r13)
jmp 0x7e88
movq 0x18(%r13), %rdi
movq %r12, %rsi
callq 0x1463f
movq 0x18(%rsp), %r10
movq (%rsp), %r12
movq 0x10(%r13), %rax
movl %r15d, %ecx
movl $0x1, 0x4(%rax,%rcx,8)
incq %r12
jmp 0x7be4
movq 0x40(%rsp), %rax
movq (%rax), %rbp
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
movl %r15d, %r15d
cmpq %r15, %rbp
jbe 0x7fe3
movq 0x40(%rsp), %rax
movq 0x10(%rax), %r12
imulq $0x50, %r15, %r14
movl 0x48(%r12,%r14), %eax
shrl $0x1d, %eax
andl $0x3, %eax
cmpl 0x54(%rsp), %eax
jne 0x7fdb
addq %r12, %r14
movq (%r14), %rsi
callq 0xf17b
movl %eax, (%rsp)
movq 0x8(%r14), %rsi
movq 0x38(%rsp), %rdi
callq 0x7588
movq 0x10(%r13), %rdx
testq %rdx, %rdx
je 0x7f4c
movb (%r13), %cl
movl %ebx, %esi
shll %cl, %esi
imull $0x9e3779b9, %eax, %r11d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r11d
leal -0x1(%rsi), %ecx
movq 0x8(%r13), %r9
movl %r11d, %r8d
movq 0x8(%rsp), %rdi
movl %r8d, %r10d
shrl $0x5, %r10d
movl (%r9,%r10,4), %r10d
btl %r8d, %r10d
jae 0x7f58
movl %r8d, %r10d
cmpl (%rdx,%r10,8), %eax
je 0x7f55
incl %r8d
andl %ecx, %r8d
cmpl %r11d, %r8d
jne 0x7f25
jmp 0x7f58
xorl %esi, %esi
movq 0x8(%rsp), %rdi
jmp 0x7f58
movl %r8d, %esi
movq 0x10(%rdi), %rax
testq %rax, %rax
movq 0x18(%rsp), %r10
je 0x7fdb
movb (%rdi), %cl
movl (%rsp), %r8d
shrl %cl, %r8d
testl %r8d, %r8d
jne 0x7fdb
testq %rdx, %rdx
je 0x7f85
movb (%r13), %cl
movl %ebx, %r8d
shll %cl, %r8d
jmp 0x7f88
xorl %r8d, %r8d
cmpl %r8d, %esi
jae 0x7fdb
movl %esi, %ecx
cmpl $0x1, 0x4(%rdx,%rcx,8)
jne 0x7fdb
movl (%rsp), %edx
shlq $0x4, %rdx
movq 0x8(%rax,%rdx), %rcx
testq %r12, %r12
je 0x7fc1
movl %ecx, %esi
cmpl $-0x1, %esi
je 0x7fc1
imulq $0x50, %rsi, %rsi
movsd 0x38(%r14), %xmm0
ucomisd 0x38(%r12,%rsi), %xmm0
jbe 0x7fdb
addq %rdx, %rax
addq $0x8, %rax
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rdx, %rcx
orq %r15, %rcx
movq %rcx, (%rax)
incl %r15d
jmp 0x7eaf
movl 0x8(%r10), %r14d
btl $0x1e, %r14d
jae 0x8082
xorl %r15d, %r15d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpq $0x238, %r15            # imm = 0x238
je 0x8082
leaq 0x14b55(%rip), %rax     # 0x1cb60
movq (%r15,%rax), %rsi
callq 0xf17b
movq 0x8(%rsp), %rdi
movq 0x10(%rdi), %rcx
movl %eax, %eax
shlq $0x4, %rax
movl 0x8(%rcx,%rax), %eax
addq $0x8, %r15
cmpq %r12, %rax
je 0x7ffb
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x50, %rax, %rax
movq 0x8(%rcx,%rax), %rsi
movq 0x38(%rsp), %rdi
callq 0x7588
movq 0x18(%rsp), %rdx
andl $0x3fffffff, %r14d      # imm = 0x3FFFFFFF
xorl %esi, %esi
cmpq %rsi, %r14
je 0x841b
movq 0x10(%rdx), %rdi
movl (%rdi,%rsi,4), %ecx
shrl %ecx
cmpl %eax, %ecx
je 0x8075
incq %rsi
jmp 0x805a
movl %r14d, %edx
callq 0x848d
movq 0x8(%rsp), %rdi
pushq $0x8
popq %r8
xorl %r9d, %r9d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
xorl %ebp, %ebp
xorl %r11d, %r11d
xorl %esi, %esi
pushq $0x1
popq %r12
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x80ad
movb (%rdi), %cl
movq %r12, %rdx
shlq %cl, %rdx
jmp 0x80af
xorl %edx, %edx
cmpq %rdx, %r9
jae 0x81a9
movq 0x8(%rdi), %rcx
movq %r9, %rdx
shrq $0x5, %rdx
movl (%rcx,%rdx,4), %ecx
btl %r9d, %ecx
jae 0x819d
movq (%rax,%r8), %r15
movl %r15d, %eax
cmpq %r10, %rax
je 0x819d
movq %r9, 0x20(%rsp)
movq %r8, 0x28(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rbp
imulq $0x50, %rax, %r12
movq %rsi, (%rsp)
movq 0x8(%rbp,%r12), %rsi
movq 0x38(%rsp), %rdi
movq %r11, %r14
callq 0x7588
movq %r14, %r11
movq (%rsp), %rsi
movl 0x1c(%rbp,%r12), %r14d
addl 0x18(%rbp,%r12), %r14d
cmpq %r11, %rsi
jne 0x8162
leaq (%r11,%r11), %r12
testq %r11, %r11
movq %rax, 0x48(%rsp)
pushq $0x2
popq %rax
cmoveq %rax, %r12
leaq (,%r12,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x3330
movq (%rsp), %rsi
movq %rax, %rbp
movq 0x48(%rsp), %rax
movq %r12, %r11
pushq $0x1
popq %r12
jmp 0x816b
pushq $0x1
popq %r12
movq 0x10(%rsp), %rbp
movq 0x20(%rsp), %r9
shlq $0x28, %rax
shrl %r14d
shlq $0x8, %r14
orq %rax, %r14
shrq $0x20, %r15
orq %r14, %r15
movq %r15, (%rbp,%rsi,8)
incq %rsi
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %r8
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
incq %r9
addq $0x10, %r8
jmp 0x809a
testq %rsi, %rsi
je 0x8399
leaq 0x6ba3(%rip), %rcx      # 0xed5c
pushq $0x8
popq %r14
movq %rbp, %rdi
movq %rsi, (%rsp)
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x30c0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
movq %r14, %rsi
callq 0x3240
movq (%rsp), %rsi
movq %rax, %r14
xorl %ecx, %ecx
movq %rbp, %rax
movl %ebx, %edx
cmpq %rdx, %rsi
jb 0x8224
je 0x8204
movq (%rbp,%rdx,8), %rdx
xorq (%rax), %rdx
shrq $0x28, %rdx
je 0x821c
movl %ebx, %edx
subl %ecx, %edx
shlq $0x20, %rcx
orq %rcx, %rdx
movq (%rax), %rcx
shrq $0x28, %rcx
movq %rdx, (%r14,%rcx,8)
movl %ebx, %ecx
incl %ebx
addq $0x8, %rax
jmp 0x81ed
leaq (,%rsi,4), %rdi
callq 0x32f0
movq %rax, %r15
movq 0x18(%rsp), %r11
movl 0x8(%r11), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
xorl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %esi, %esi
cmpq %rax, %rcx
je 0x82be
movq 0x10(%r11), %rdi
movl (%rdi,%rcx,4), %r10d
movl %r10d, %edi
shrl %edi
movq (%r14,%rdi,8), %r9
movq %r9, %r8
andq %rdx, %r8
je 0x82b9
movq %r9, %rdi
shrq $0x20, %rdi
testb $0x1, %r10b
jne 0x8293
subq $0x1, %r8
jb 0x82b9
movl %edi, %r9d
movzbl (%rbp,%r9,8), %r9d
movl %esi, %r10d
incl %esi
movl %r9d, (%r15,%r10,4)
incq %rdi
jmp 0x8276
movl %r9d, %r8d
addq %r9, %rdi
decq %rdi
subq $0x1, %r8
jb 0x82b9
movl %edi, %r9d
movzbl (%rbp,%r9,8), %r9d
movl %esi, %r10d
incl %esi
movl %r9d, (%r15,%r10,4)
decq %rdi
jmp 0x829c
incq %rcx
jmp 0x824b
movl %esi, %eax
cmpq %rax, (%rsp)
jne 0x843a
pushq $0x47
popq %rdi
pushq $0x4
popq %rsi
callq 0x3240
xorl %ecx, %ecx
movq (%rsp), %rsi
cmpq %rcx, %rsi
je 0x82f8
movl (%r15,%rcx,4), %edx
incl (%rax,%rdx,4)
incq %rcx
jmp 0x82db
movl -0x4(%rax,%r12,4), %ecx
addl %ecx, (%rax,%r12,4)
incq %r12
cmpq $0x47, %r12
jne 0x82ec
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x8317
movl (%r15,%rcx,4), %edx
movl (%rax,%rdx,4), %edx
decl %edx
movl %edx, (%r15,%rcx,4)
incq %rcx
jmp 0x8300
movq %rax, %rdi
callq 0x3060
movq (%rsp), %rdx
xorl %eax, %eax
xorpd %xmm3, %xmm3
movsd 0xe1f7(%rip), %xmm0     # 0x16528
xorpd %xmm1, %xmm1
movl %eax, %eax
cmpq %rax, %rdx
jbe 0x8359
movl (%r15,%rax,4), %ecx
cvtsi2sd %rcx, %xmm2
subsd %xmm1, %xmm2
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm3
addsd %xmm0, %xmm1
incl %eax
jmp 0x8335
mulsd 0xe1bf(%rip), %xmm3     # 0x16520
cvtsi2sd %rdx, %xmm0
divsd %xmm0, %xmm3
mulsd %xmm0, %xmm0
addsd 0xe132(%rip), %xmm0     # 0x164a8
divsd %xmm0, %xmm3
addsd 0xe1a6(%rip), %xmm3     # 0x16528
movsd %xmm3, (%rsp)
movq %r14, %rdi
callq 0x3060
movq %r15, %rdi
callq 0x3060
jmp 0x83a2
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq %rbp, %rdi
callq 0x3060
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
je 0x83db
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x1463f
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x1463f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1463f
testq %r13, %r13
je 0x8407
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rbx
movq %rbx, %rdi
callq 0x1463f
movq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0x1463f
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1463f
movsd (%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xee39(%rip), %rdi      # 0x1725b
leaq 0xe26c(%rip), %rsi      # 0x16695
leaq 0xee3b(%rip), %rcx      # 0x1726b
movl $0x665, %edx            # imm = 0x665
callq 0x3190
leaq 0xee72(%rip), %rdi      # 0x172b3
leaq 0xe24d(%rip), %rsi      # 0x16695
leaq 0xee1c(%rip), %rcx      # 0x1726b
movl $0x696, %edx            # imm = 0x696
callq 0x3190