// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/path.c
// Function: asg_annotation
og_component_v *asg_annotation(hmm_annot_db_t *annot_db, asg_t *asg, int no_trn, int no_rrn, double max_eval,
        int n_core, int min_len, int min_score, int fix_og, int verbose)
{
    uint32_t i, j, k, n, m, v, nv, gid, imax, smax, score, n_seg, n_gene, m_gene, n_clust;
    uint32_t l_seeds[4], n_seeds[4], *comp_v;
    uint64_t *gene_score;
    double *a_s, *annot_score, *seg_score, g_n[4], c_means[4];
    OG_TYPE_t og_t, **og_seeds;
    og_component_t *component_s, *component_g;
    og_component_v *sequence_og, *subgraph_og, *component_v;
    clust_dp_t *comp_dps;
    clust_t *clusts;

    n_gene = annot_db->n;
    n_seg = asg->n_seg;

    if (n_gene == 0) return 0;
    
    m_gene = annot_db->n_gene;

    seg_score = get_sequence_annot_score(annot_db, asg, no_trn, no_rrn, max_eval, 0, verbose);
    sequence_og = annot_sequence_og_type(annot_db, asg, no_trn, no_rrn, max_eval, n_core, min_len, min_score, 0, verbose);
    subgraph_og = annot_subgraph_og_type(annot_db, asg, no_trn, no_rrn, max_eval, n_core, min_len, min_score, 0, verbose);

    MYCALLOC(annot_score, m_gene * 4);
    // collect best annotation score for each gene across the entire graph
    for (i = 0; i < n_seg; ++i) {
        component_s = &sequence_og->a[i];
        gene_score = component_s->g;
        for (j = 0; j < component_s->ng; ++j) {
            gid = gene_score[j] >> 34;
            og_t = (gene_score[j] >> 32) & 0x3;
            score = (uint32_t) gene_score[j];
            
            gid += m_gene * og_t;
            if (annot_score[gid] < (double) score)
                annot_score[gid] = score;
        }
    }

    // check if each subgraph is a mito-pltd mixture
    // separate organelle genomes for mixtures
    double g_diff = 0.85; // relaxation for gene socres
    MYCALLOC(component_v, 1);
    for (i = 0; i < subgraph_og->n; ++i) {
        component_g = &subgraph_og->a[i];
        comp_v = component_g->v;
        nv = component_g->nv;

        MYMALLOC(comp_dps, nv);
        for (j = 0; j < nv; ++j) {
            comp_dps[j].index = j;
            comp_dps[j].val = component_g->asmg->vtx[comp_v[j]].cov;
            comp_dps[j].size = component_g->asmg->vtx[comp_v[j]].len;
            comp_dps[j].clust = -1;
            comp_dps[j].og_type = OG_UNCLASSIFIED;
            MYBZERO(comp_dps[j].gene_num, 4);
        }

        // count genes with best annotation scores
        for (j = 0; j < nv; ++j) {
            component_s = &sequence_og->a[comp_v[j]];
            gene_score = component_s->g;
            // count genes with best annotation scores
            n = 0;
            for (k = 0; k < component_s->ng; ++k) {
                og_t = (gene_score[k] >> 32) & 0x3;
                gid = gene_score[k] >> 34;
                score = (uint32_t) gene_score[k];
                a_s = &annot_score[m_gene * og_t];
                if (score >= min_score &&
                        (double) score >= a_s[gid] * g_diff)
                    // the number of best genes
                    ++comp_dps[j].gene_num[og_t];
            }
        }
        
        // do clustering by sequence overage
        n_clust = dbscan_cluster(comp_dps, nv, DBSCAN_EPS, CLUSTV_EPS);
        clusts = make_cluster(comp_dps, nv, n_clust, min_len);

        // organelle type classification for each coverage cluster
        MYBZERO(l_seeds, 4);
        MYBZERO(n_seeds, 4);
        for (j = 0; j < n_clust; ++j) {
            a_s = clusts[j].og_score;
            MYBZERO(a_s, 4);
            MYBZERO(g_n, 4);
            for (m = 0, n = clusts[j].n_dps; m < n; ++m) {
                v = clusts[j].dps[m];
                for (k = 0; k < 4; ++k) {
                    a_s[k] += seg_score[comp_v[v] * 4 + k];
                    g_n[k] += comp_dps[v].gene_num[k];
                }
            }
            imax = max2(a_s, 4, &smax);
            og_t = a_s[imax] == a_s[smax]? OG_UNCLASSIFIED : imax;
            if (og_t == OG_PLTD && 
                    smax == OG_MITO &&
                    g_n[OG_MITO] > 0 &&
                    (a_s[OG_PLTD] < a_s[OG_MITO] * PLTD_TO_MITO_FST[0] ||
                     (a_s[OG_PLTD] < a_s[OG_MITO] * PLTD_TO_MITO_FST[1] && 
                      clusts[j].size > COMMON_MAX_PLTD_SIZE))) {
                // fix OG_TYPE
                og_t = OG_MITO;
                if (verbose > 2)
                    fprintf(stderr, "[M::%s] OG_TYPE changed from PLTD to MITO: CLUST=%d [M=%.3f N=%d L=%d] [MITO=%.3f PLTD=%.3f MINI=%.3f]\n",
                            __func__, j, clusts[j].mean, clusts[j].n_dps, clusts[j].size, a_s[OG_MITO], a_s[OG_PLTD], a_s[OG_MINI]);
            }
            for (m = 0, n = clusts[j].n_dps; m < n; ++m) {
                v = clusts[j].dps[m];
                if (comp_dps[v].gene_num[og_t] > 0) {
                    l_seeds[og_t] += component_g->asmg->vtx[comp_v[v]].len;
                    n_seeds[og_t] += 1;
                }
            }
            clusts[j].og_type = og_t;
        }

        if (verbose > 2) {
            fprintf(stderr, "[M::%s] subgraph sequence coverage clustering [CLUST=%d]:\n", __func__, n_clust);
            for (j = 0; j < n_clust; ++j) {
                a_s = clusts[j].og_score;
                fprintf(stderr, "[M::%s] CLUST=%d OG=%s [M=%.3f N=%d L=%d] [MITO=%.3f PLTD=%.3f MINI=%.3f]\n", 
                        __func__, j, OG_TYPES[clusts[j].og_type], clusts[j].mean, clusts[j].n_dps, clusts[j].size, 
                        a_s[OG_MITO], a_s[OG_PLTD], a_s[OG_MINI]);
            }
            fprintf(stderr, "[M::%s] subgraph sequence [NV=%d]:\n", __func__, nv);
            qsort(comp_dps, nv, sizeof(clust_dp_t), dpVal_cmpfunc);
            for (j = 0; j < nv; ++j) {
                v = comp_dps[j].index;
                og_t = sequence_og->a[comp_v[v]].type;
                fprintf(stderr, "[M::%s] %s [%s #MG=%d #PG=%d] COV=%.3f LEN=%d CLUST=%d\n", __func__,
                        asg->seg[comp_v[v]].name, OG_TYPES[og_t], comp_dps[j].gene_num[OG_MITO], comp_dps[j].gene_num[OG_PLTD], 
                        comp_dps[j].val, comp_dps[j].size, comp_dps[j].clust);
            }
            qsort(comp_dps, nv, sizeof(clust_dp_t), dpIdx_cmpfunc);
            fprintf(stderr, "[M::%s] subgraph organelle initial classification:\n", __func__);
            for (j = 0; j < 4; ++j)
                fprintf(stderr, "[M::%s] %s: SEED=%u SIZE=%u\n", __func__, OG_TYPES[j], n_seeds[j], l_seeds[j]);
        }

        if (l_seeds[OG_MITO] > 0 && l_seeds[OG_PLTD] > 0) {
            if (l_seeds[OG_MITO] > min_len && l_seeds[OG_PLTD] < min_len) {
                l_seeds[OG_PLTD] = 0;
                n_seeds[OG_PLTD] = 0;
            } else if (l_seeds[OG_MITO] < min_len && l_seeds[OG_PLTD] > min_len) {
                l_seeds[OG_MITO] = 0;
                n_seeds[OG_MITO] = 0;
            }
        }

        MYMALLOC(og_seeds, 4);
        MYCALLOC(og_seeds[0], nv * 4);
        for (j = 1; j < 4; ++j)
            og_seeds[j] = og_seeds[j-1] + nv;
        MYBZERO(c_means, 4);
        if (l_seeds[OG_MITO] > 0 && l_seeds[OG_PLTD] > 0) {
            // is a organelle mixture
            if (verbose > 2)
                fprintf(stderr, "[M::%s] processing subgraph as a organelle mixture\n", __func__);
            double min_mito, max_mito, min_pltd, max_pltd;
            min_mito = min_pltd = 0;
            max_mito = max_pltd = DBL_MAX;
            // TODO implement this subroutine to determine boundary of MITO and PLTD coverage
            find_coverage_bound_in_mixture_graph(clusts, n_clust, comp_dps, nv, COMMON_MAX_MITO_SIZE, COMMON_MAX_PLTD_SIZE, 
                    LOG4_5, &min_mito, &max_mito, &min_pltd, &max_pltd, verbose);
            l_seeds[OG_MITO] = find_seeds_in_pure_graph(clusts, n_clust, comp_dps, nv, OG_MITO, min_mito, max_mito, LOG4_5, 
                    min_len, COMMON_MAX_MITO_SIZE, &c_means[OG_MITO], og_seeds[OG_MITO], verbose);
            l_seeds[OG_PLTD] = find_seeds_in_pure_graph(clusts, n_clust, comp_dps, nv, OG_PLTD, min_pltd, max_pltd, LOG4_5, 
                    min_len, COMMON_MAX_PLTD_SIZE, &c_means[OG_PLTD], og_seeds[OG_PLTD], verbose);
        } else if (l_seeds[OG_MITO] > 0) {
            // pure mito
            if (verbose > 2)
                fprintf(stderr, "[M::%s] processing subgraph as a pure MITO\n", __func__);
            l_seeds[OG_MITO] = find_seeds_in_pure_graph(clusts, n_clust, comp_dps, nv, OG_MITO, 0, DBL_MAX, LOG4_5, 
                    min_len, COMMON_MAX_MITO_SIZE, &c_means[OG_MITO], og_seeds[OG_MITO], verbose);
        } else if (l_seeds[OG_PLTD] > 0) {
            // pure pltd
            // similar to mito
            // but also consider genome size
            if (verbose > 2)
                fprintf(stderr, "[M::%s] processing subgraph as a pure PLTD\n", __func__);
            l_seeds[OG_PLTD] = find_seeds_in_pure_graph(clusts, n_clust, comp_dps, nv, OG_PLTD, 0, DBL_MAX, LOG4_5, 
                    min_len, COMMON_MAX_PLTD_SIZE, &c_means[OG_PLTD], og_seeds[OG_PLTD], verbose);
        } else if (l_seeds[OG_MINI] > 0) {
            // is minicircle
            if (verbose > 2)
                fprintf(stderr, "[M::%s] processing subgraph as a MINICIRCLE\n", __func__);
            l_seeds[OG_MINI] = find_seeds_in_pure_graph(clusts, n_clust, comp_dps, nv, OG_MINI, 0, DBL_MAX, LOG4_5, 
                    min_len, COMMON_MAX_MINICIRCLE_SIZE, &c_means[OG_MINI], og_seeds[OG_MINI], verbose);
        }

        if (l_seeds[OG_MITO] > 0)
            slim_graph(asg, sequence_og, component_g, comp_dps, OG_MITO, og_seeds[OG_MITO],
                    c_means[OG_MITO], min_len, component_v, verbose); 
        if (l_seeds[OG_PLTD] > 0)
            slim_graph(asg, sequence_og, component_g, comp_dps, OG_PLTD, og_seeds[OG_PLTD],
                    c_means[OG_PLTD], min_len, component_v, verbose);
        if (l_seeds[OG_MINI] > 0)
            slim_graph(asg, sequence_og, component_g, comp_dps, OG_MINI, og_seeds[OG_MINI],
                    c_means[OG_MINI], min_len, component_v, verbose);

        free(og_seeds[0]);
        free(og_seeds);
        free(comp_dps);
        for (j = 0; j < n_clust; ++j)
            free(clusts[j].dps);
        free(clusts);
    }
    
    free(seg_score);
    free(annot_score);
    og_component_v_destroy(sequence_og);
    og_component_v_destroy(subgraph_og);

    if (fix_og) fix_og_misclassification(component_v, verbose);
    
    qsort(component_v->a, component_v->n, sizeof(og_component_t), og_cmpfunc_r);

    return component_v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpl $0x0, (%rdi)
je 0xd7f1
movq %rsi, %rbx
movq %rdi, %r15
movl 0x150(%rsp), %r10d
movl 0x8(%rsi), %r12d
movl 0x18(%rdi), %eax
movq %rax, 0x88(%rsp)
xorl %r13d, %r13d
movl %edx, %r14d
movl %edx, 0x10(%rsp)
movl %ecx, 0x18(%rsp)
movsd %xmm0, (%rsp)
movl %r8d, %ebp
xorl %r8d, %r8d
movq %r9, 0x48(%rsp)
movl %r10d, %r9d
callq 0xafcb
movq %rax, 0x28(%rsp)
subq $0x8, %rsp
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl 0x20(%rsp), %r14d
movl %r14d, %ecx
movsd 0x8(%rsp), %xmm0
movl %ebp, %r8d
movl 0x158(%rsp), %eax
pushq %rax
pushq $0x0
movl 0x158(%rsp), %eax
pushq %rax
callq 0xb282
addq $0x20, %rsp
movq %rax, 0x58(%rsp)
subq $0x8, %rsp
movq %r15, %rdi
movq %rbx, 0x68(%rsp)
movq %rbx, %rsi
movl 0x148(%rsp), %ebx
movl 0x18(%rsp), %edx
movl %r14d, %ecx
movsd 0x8(%rsp), %xmm0
movl %ebp, %r8d
movq 0x50(%rsp), %rbp
movl %ebp, %r9d
movl 0x158(%rsp), %eax
pushq %rax
pushq $0x0
pushq %rbx
callq 0xbbd1
addq $0x20, %rsp
movq %rax, 0x70(%rsp)
movq 0x88(%rsp), %r14
leal (,%r14,4), %edi
pushq $0x8
popq %rsi
callq 0x3240
movq %r14, %r9
movq %rax, %r15
cmpq %r12, %r13
je 0xcb84
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rcx
movq %r13, %rdx
shlq $0x6, %rdx
movq 0x30(%rcx,%rdx), %rax
movl 0x28(%rcx,%rdx), %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xcb7f
movq (%rax,%rdx,8), %rdi
movq %rdi, %rsi
movl %edi, %r8d
shrq $0x22, %rdi
shrq $0x20, %rsi
andl $0x3, %esi
imull %r9d, %esi
cvtsi2sd %r8, %xmm0
addl %edi, %esi
ucomisd (%r15,%rsi,8), %xmm0
jbe 0xcb7a
movsd %xmm0, (%r15,%rsi,8)
incq %rdx
jmp 0xcb47
incq %r13
jmp 0xcb27
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x3240
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xd0(%rsp)
xorl %ecx, %ecx
movq 0x58(%rsp), %r13
movq %r15, 0x90(%rsp)
movl %ecx, %ecx
cmpq %rcx, 0xd0(%rsp)
jbe 0xd797
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0xd8(%rsp)
shlq $0x6, %rcx
leaq (%rax,%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x20(%rax,%rcx), %r14
movl 0x1c(%rax,%rcx), %r12d
imulq $0x30, %r12, %rdi
movq %rdi, 0x98(%rsp)
callq 0x32f0
movq %rax, (%rsp)
addq $0x18, %rax
xorl %ecx, %ecx
movq 0x88(%rsp), %r11
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
cmpq %rcx, %r12
je 0xcc61
movl %ecx, -0x18(%rax)
movq 0x18(%rsp), %rdx
movq 0x38(%rdx), %rdx
movq 0x10(%rdx), %rdx
movl (%r14,%rcx,4), %esi
imulq $0x28, %rsi, %rsi
movl 0x20(%rdx,%rsi), %edi
andl %r8d, %edi
cvtsi2sd %edi, %xmm0
movsd %xmm0, -0x10(%rax)
movl 0x18(%rdx,%rsi), %edx
movl %edx, -0x8(%rax)
orl $-0x1, -0x4(%rax)
incq %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
andl $0x0, 0x10(%rax)
addq $0x30, %rax
jmp 0xcc14
xorl %eax, %eax
movsd 0x98dd(%rip), %xmm2     # 0x16548
cmpq %r12, %rax
je 0xcce4
movq 0x10(%r13), %rdx
movl (%r14,%rax,4), %esi
shlq $0x6, %rsi
leaq (%rdx,%rsi), %rcx
movq 0x30(%rdx,%rsi), %rdx
xorl %esi, %esi
movl 0x28(%rcx), %edi
cmpq %rdi, %rsi
jae 0xccdf
movq (%rdx,%rsi,8), %r8
cmpl %ebx, %r8d
jb 0xccda
movq %r8, %rdi
shrq $0x20, %rdi
movl %edi, %r9d
andl $0x3, %r9d
imull %r11d, %r9d
leaq (%r15,%r9,8), %r9
movl %r8d, %r10d
cvtsi2sd %r10, %xmm0
shrq $0x22, %r8
movsd (%r9,%r8,8), %xmm1
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0xccda
andl $0x3, %edi
imulq $0x30, %rax, %r8
addq (%rsp), %r8
incl 0x18(%r8,%rdi,4)
incq %rsi
jmp 0xcc87
incq %rax
jmp 0xcc6b
testl %r12d, %r12d
movq %r12, %rbx
movq %r12, 0x20(%rsp)
jle 0xcdbc
movq (%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x30
popq %rbx
movq %rbx, %rdx
leaq 0xafc(%rip), %rcx       # 0xd808
callq 0x30c0
andl $0x0, 0x14(%r12)
movsd 0x8(%r12), %xmm1
pushq $0x1
popq %rsi
movl %esi, %ecx
movsd 0x9825(%rip), %xmm4     # 0x16550
movsd 0x9825(%rip), %xmm5     # 0x16558
movq 0x98(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcd98
movsd 0x8(%r12,%rbx), %xmm0
movsd -0x28(%r12,%rbx), %xmm2
mulsd %xmm4, %xmm2
ucomisd %xmm0, %xmm2
jb 0xcd6e
cvtsi2sd %ecx, %xmm2
movapd %xmm1, %xmm3
divsd %xmm2, %xmm3
mulsd %xmm5, %xmm3
ucomisd %xmm0, %xmm3
jae 0xcd7e
movl -0x1c(%r12,%rbx), %ecx
incl %ecx
movl %ecx, 0x14(%r12,%rbx)
movl %esi, %ecx
jmp 0xcd8e
movl -0x1c(%r12,%rbx), %edx
movl %edx, 0x14(%r12,%rbx)
addsd %xmm1, %xmm0
incl %ecx
addq $0x30, %rbx
movapd %xmm0, %xmm1
jmp 0xcd3b
movl -0x1c(%r12,%rdi), %r13d
incl %r13d
movq %r12, %rdi
movq 0x20(%rsp), %rbx
movq %rbx, %rsi
pushq $0x30
popq %rdx
leaq 0xa72(%rip), %rcx       # 0xd827
callq 0x30c0
jmp 0xcdc3
xorl %r13d, %r13d
movq (%rsp), %r12
movslq %r13d, %rdi
pushq $0x48
popq %rsi
callq 0x3240
movq %rax, 0x10(%rsp)
testl %ebx, %ebx
movl $0x0, %eax
cmovgl %ebx, %eax
imulq $0x30, %rax, %rbx
xorl %eax, %eax
movq 0x28(%rsp), %r8
cmpq %rax, %rbx
je 0xce05
movslq 0x14(%r12,%rax), %rcx
imulq $0x48, %rcx, %rcx
movq 0x10(%rsp), %rdx
incl 0x4(%rdx,%rcx)
addq $0x30, %rax
jmp 0xcde8
testl %r13d, %r13d
movl $0x0, %r15d
movl %r13d, 0xc(%rsp)
cmovgl %r13d, %r15d
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %r12
xorl %r13d, %r13d
cmpq %r13, %r15
je 0xce53
movl %r13d, -0x8(%r12)
movslq -0x4(%r12), %rdi
shlq $0x2, %rdi
callq 0x32f0
movq 0x28(%rsp), %r8
movq %rax, (%r12)
andl $0x0, -0x4(%r12)
incq %r13
addq $0x48, %r12
jmp 0xce23
xorl %eax, %eax
movq (%rsp), %r9
movq 0x10(%rsp), %r10
movl 0xc(%rsp), %r11d
cmpq %rax, %rbx
je 0xceaf
movslq 0x14(%r9,%rax), %rcx
movl (%r9,%rax), %edx
imulq $0x48, %rcx, %rcx
movq 0x8(%r10,%rcx), %rsi
movslq 0x4(%r10,%rcx), %rdi
movl %edx, (%rsi,%rdi,4)
movsd 0x8(%r9,%rax), %xmm0
addsd 0x18(%r10,%rcx), %xmm0
movsd %xmm0, 0x18(%r10,%rcx)
movl 0x10(%r9,%rax), %edx
addl %edx, 0x10(%r10,%rcx)
leal 0x1(%rdi), %edx
movl %edx, 0x4(%r10,%rcx)
addq $0x30, %rax
jmp 0xce63
imulq $0x48, %r15, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0xced9
cvtsi2sdl 0x4(%r10,%rcx), %xmm0
movsd 0x18(%r10,%rcx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%r10,%rcx)
addq $0x48, %rcx
jmp 0xceb5
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, 0xc0(%rsp)
movl %r11d, %eax
movq %rax, 0x78(%rsp)
leaq 0x20(%r10), %r15
leaq 0x18(%r9), %r12
xorl %eax, %eax
cmpq 0x78(%rsp), %rax
je 0xd12c
movq %rax, 0x68(%rsp)
imulq $0x48, %rax, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %rbx
leaq (%rcx,%rax), %r13
addq $0x20, %r13
xorpd %xmm0, %xmm0
movupd %xmm0, 0x30(%rcx,%rax)
movupd %xmm0, 0x20(%rcx,%rax)
movapd %xmm0, 0xf0(%rsp)
movapd %xmm0, 0xe0(%rsp)
movl 0x4(%rcx,%rax), %ebp
xorl %eax, %eax
cmpq %rbp, %rax
je 0xcfa4
movq 0x8(%rbx), %rcx
movl (%rcx,%rax,4), %edx
movl (%r14,%rdx,4), %ecx
shll $0x2, %ecx
leaq (%r8,%rcx,8), %rcx
imulq $0x30, %rdx, %rdx
addq %r12, %rdx
xorl %esi, %esi
cmpq $0x10, %rsi
je 0xcf9f
movsd (%rcx,%rsi,2), %xmm0
addsd (%r15,%rsi,2), %xmm0
movsd %xmm0, (%r15,%rsi,2)
cvtsi2sdl (%rdx,%rsi), %xmm0
addsd 0xe0(%rsp,%rsi,2), %xmm0
movsd %xmm0, 0xe0(%rsp,%rsi,2)
addq $0x4, %rsi
jmp 0xcf6b
incq %rax
jmp 0xcf4b
movq %r13, %rdi
leaq 0x84(%rsp), %rsi
callq 0xb7ff
movl %eax, %ecx
movsd (%r13,%rcx,8), %xmm0
movl 0x84(%rsp), %edx
ucomisd (%r13,%rdx,8), %xmm0
movl $0x0, %ecx
cmovnel %eax, %ecx
cmovpl %eax, %ecx
cmpq $0x1, %rdx
jne 0xd07e
cmpl $0x2, %ecx
movq (%rsp), %r13
movq 0x18(%rsp), %r10
jne 0xd08e
movsd 0xe8(%rsp), %xmm0
ucomisd 0x9505(%rip), %xmm0     # 0x16508
movq 0x28(%rsp), %r8
jbe 0xd093
movsd 0x28(%rbx), %xmm1
movsd 0x30(%rbx), %xmm2
movapd %xmm1, %xmm0
mulsd 0x94d4(%rip), %xmm0     # 0x164f8
ucomisd %xmm2, %xmm0
jbe 0xd042
pushq $0x1
popq %rcx
movl 0x150(%rsp), %eax
cmpl $0x3, %eax
jl 0xd093
movl 0x10(%rbx), %r9d
jmp 0xd0e9
movapd %xmm1, %xmm0
mulsd 0x94f2(%rip), %xmm0     # 0x16540
ucomisd %xmm2, %xmm0
pushq $0x2
popq %rcx
jbe 0xd093
movl 0x150(%rsp), %eax
cmpl $0x3, %eax
setl %dl
movl 0x10(%rbx), %r9d
xorl %ecx, %ecx
cmpl $0x3d091, %r9d          # imm = 0x3D091
setb %al
orb %al, %dl
je 0xd0e9
movb %al, %cl
incl %ecx
jmp 0xd093
movq 0x28(%rsp), %r8
movq (%rsp), %r13
movq 0x18(%rsp), %r10
jmp 0xd093
movq 0x28(%rsp), %r8
movl %ecx, %eax
xorl %edx, %edx
cmpq %rdx, %rbp
je 0xd0d5
movq 0x8(%rbx), %rsi
movl (%rsi,%rdx,4), %esi
imulq $0x30, %rsi, %rdi
addq %r13, %rdi
cmpl $0x0, 0x18(%rdi,%rax,4)
jle 0xd0d0
movq 0x38(%r10), %rdi
movq 0x10(%rdi), %rdi
movl (%r14,%rsi,4), %esi
imulq $0x28, %rsi, %rsi
movl 0x18(%rdi,%rsi), %esi
addl %esi, 0x30(%rsp,%rax,4)
incl 0xc0(%rsp,%rax,4)
incq %rdx
jmp 0xd097
movl %ecx, 0x40(%rbx)
movq 0x68(%rsp), %rax
incq %rax
addq $0x48, %r15
jmp 0xcefe
movq 0xff08(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
movsd 0x18(%rbx), %xmm0
movsd 0x38(%rbx), %xmm3
leaq 0x9d89(%rip), %rsi      # 0x16e8d
leaq 0x9dea(%rip), %rdx      # 0x16ef5
movq 0x68(%rsp), %rcx
movl %ebp, %r8d
movb $0x4, %al
callq 0x3290
movq 0x18(%rsp), %r10
movq 0x28(%rsp), %r8
pushq $0x1
popq %rcx
jmp 0xd093
movl 0x150(%rsp), %r12d
cmpl $0x3, %r12d
movq 0x48(%rsp), %rbp
movq 0x58(%rsp), %r13
movq 0x90(%rsp), %r15
jge 0xd517
movl 0x34(%rsp), %ebx
movl 0x38(%rsp), %r12d
testl %ebx, %ebx
setne %al
testl %r12d, %r12d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd1b5
cmpl %ebp, %ebx
seta %al
cmpl %ebp, %r12d
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd18f
andl $0x0, 0x38(%rsp)
andl $0x0, 0xc8(%rsp)
xorl %r12d, %r12d
jmp 0xd1b2
cmpl %ebp, %ebx
setb %al
cmpl %ebp, %r12d
seta %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd1b2
andl $0x0, 0x34(%rsp)
andl $0x0, 0xc4(%rsp)
xorl %ebx, %ebx
jmp 0xd1b5
pushq $0x1
popq %rbx
pushq $0x20
popq %rdi
callq 0x32f0
movq %rax, %r14
movq 0x20(%rsp), %rbp
leal (,%rbp,4), %edi
pushq $0x4
popq %rsi
callq 0x3240
leaq (,%rbp,4), %rsi
leaq (%rax,%rbp,4), %rcx
pushq $0x1
popq %rdx
movq 0x48(%rsp), %rbp
cmpq $0x4, %rdx
je 0xd1fa
movq %rcx, (%r14,%rdx,8)
incq %rdx
addq %rsi, %rcx
jmp 0xd1e8
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
movapd %xmm0, 0xa0(%rsp)
testl %ebx, %ebx
setne %dl
testl %r12d, %r12d
setne %cl
andb %dl, %cl
cmpb $0x1, %cl
movq %rax, 0x68(%rsp)
jne 0xd2d4
movq 0x20(%rsp), %rbp
movl 0x150(%rsp), %ebx
cmpl $0x3, %ebx
jge 0xd707
xorpd %xmm0, %xmm0
movq 0x10(%rsp), %r12
movq %r12, %rdi
movl 0xc(%rsp), %esi
movq (%rsp), %rdx
movl %ebp, %ecx
pushq $0x1
popq %r8
movsd 0x9236(%rip), %xmm1     # 0x16498
movq 0x48(%rsp), %rbp
movl %ebp, %r9d
pushq %rbx
pushq 0x8(%r14)
leaq 0xb8(%rsp), %rax
pushq %rax
pushq $0x2dc6c0               # imm = 0x2DC6C0
callq 0xd838
addq $0x20, %rsp
movq %rbp, %r9
movl %eax, %ebp
movl %eax, 0x34(%rsp)
xorpd %xmm0, %xmm0
movq %r12, %rdi
movl 0xc(%rsp), %esi
movq (%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq $0x2
popq %r8
movsd 0x91e9(%rip), %xmm1     # 0x16498
pushq %rbx
pushq 0x10(%r14)
leaq 0xc0(%rsp), %rax
pushq %rax
pushq $0x3d090                # imm = 0x3D090
callq 0xd838
addq $0x20, %rsp
movl %eax, %r12d
movl %eax, 0x38(%rsp)
jmp 0xd333
testl %ebx, %ebx
je 0xd37b
movl 0x150(%rsp), %ebx
cmpl $0x3, %ebx
jge 0xd72b
xorpd %xmm0, %xmm0
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq (%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq $0x1
popq %r8
movsd 0x918a(%rip), %xmm1     # 0x16498
movl %ebp, %r9d
pushq %rbx
pushq 0x8(%r14)
leaq 0xb8(%rsp), %rax
pushq %rax
pushq $0x2dc6c0               # imm = 0x2DC6C0
callq 0xd838
addq $0x20, %rsp
movl %eax, %ebp
movl %eax, 0x34(%rsp)
testl %ebp, %ebp
movq 0x18(%rsp), %rdx
je 0xd374
movq 0x8(%r14), %r9
movsd 0xa8(%rsp), %xmm0
subq $0x8, %rsp
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rcx
pushq $0x1
popq %r8
pushq %rbx
pushq 0x60(%rsp)
movq 0x60(%rsp), %rbp
pushq %rbp
callq 0xdd80
addq $0x20, %rsp
jmp 0xd3dc
movq 0x48(%rsp), %rbp
jmp 0xd3dc
testl %r12d, %r12d
movl 0x150(%rsp), %ebx
je 0xd4b6
cmpl $0x3, %ebx
jge 0xd74f
xorpd %xmm0, %xmm0
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq (%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq $0x2
popq %r8
movsd 0x90e2(%rip), %xmm1     # 0x16498
movl %ebp, %r9d
pushq %rbx
pushq 0x10(%r14)
leaq 0xc0(%rsp), %rax
pushq %rax
pushq $0x3d090                # imm = 0x3D090
callq 0xd838
addq $0x20, %rsp
movl %eax, %r12d
movl %eax, 0x38(%rsp)
testl %r12d, %r12d
je 0xd417
movq 0x10(%r14), %r9
movsd 0xb0(%rsp), %xmm0
subq $0x8, %rsp
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
movq 0x8(%rsp), %rcx
pushq $0x2
popq %r8
pushq %rbx
pushq 0x60(%rsp)
pushq %rbp
callq 0xdd80
addq $0x20, %rsp
movq %rbp, %r12
movl 0x3c(%rsp), %eax
movq 0x18(%rsp), %rdx
testl %eax, %eax
movq (%rsp), %rbp
je 0xd45b
movq 0x18(%r14), %r9
movsd 0xb8(%rsp), %xmm0
subq $0x8, %rsp
movq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rcx
pushq $0x3
popq %r8
pushq %rbx
pushq 0x60(%rsp)
pushq %r12
callq 0xdd80
addq $0x20, %rsp
movq 0x68(%rsp), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq %rbp, %rdi
callq 0x3060
imulq $0x48, 0x78(%rsp), %rbx
xorl %r14d, %r14d
movq 0x10(%rsp), %r12
cmpq %r14, %rbx
je 0xd498
movq 0x8(%r12,%r14), %rdi
callq 0x3060
addq $0x48, %r14
jmp 0xd483
movq %r12, %rdi
callq 0x3060
movq 0xd8(%rsp), %rcx
incl %ecx
movl 0x140(%rsp), %ebx
jmp 0xcbb3
movq %rbp, %r12
cmpl $0x0, 0x3c(%rsp)
movq (%rsp), %rbp
je 0xd45b
cmpl $0x3, %ebx
jge 0xd773
xorpd %xmm0, %xmm0
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq (%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq $0x3
popq %r8
movsd 0x8fa9(%rip), %xmm1     # 0x16498
movl %r12d, %r9d
pushq %rbx
pushq 0x18(%r14)
leaq 0xc8(%rsp), %rax
pushq %rax
pushq $0xc350                 # imm = 0xC350
callq 0xd838
addq $0x20, %rsp
movl %eax, 0x3c(%rsp)
jmp 0xd41e
movq 0xfada(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x99dc(%rip), %rsi      # 0x16f04
leaq 0x99c6(%rip), %rdx      # 0x16ef5
movl 0xc(%rsp), %ecx
xorl %eax, %eax
callq 0x3290
movq 0x10(%rsp), %rbx
addq $0x40, %rbx
xorl %r13d, %r13d
cmpq %r13, 0x78(%rsp)
je 0xd5a9
movq 0xfaa4(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
movl (%rbx), %eax
leaq 0xf5e0(%rip), %rcx      # 0x1cb40
movq (%rcx,%rax,8), %r8
movsd -0x28(%rbx), %xmm0
movl -0x3c(%rbx), %r9d
movl -0x30(%rbx), %r10d
movsd -0x18(%rbx), %xmm1
movsd -0x10(%rbx), %xmm2
movsd -0x8(%rbx), %xmm3
subq $0x8, %rsp
leaq 0x99b4(%rip), %rsi      # 0x16f3f
leaq 0x9963(%rip), %rdx      # 0x16ef5
movl %r13d, %ecx
movb $0x4, %al
pushq %r10
callq 0x3290
popq %rcx
popq %rdx
incq %r13
addq $0x48, %rbx
jmp 0xd546
movq 0xfa48(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x99d0(%rip), %rsi      # 0x16f8a
leaq 0x9934(%rip), %rdx      # 0x16ef5
movq 0x20(%rsp), %rbx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3290
movq (%rsp), %rdi
movq %rbx, %rsi
pushq $0x30
popq %rdx
leaq 0x228(%rip), %rcx       # 0xd808
callq 0x30c0
xorl %ebx, %ebx
movq 0x58(%rsp), %r13
cmpq %rbx, 0x98(%rsp)
je 0xd684
movq (%rsp), %rsi
movl (%rsi,%rbx), %eax
movq 0x10(%r13), %rcx
movl (%r14,%rax,4), %eax
imulq $0x18, %rax, %rdx
shlq $0x6, %rax
movl (%rcx,%rax), %eax
movq 0xf9dd(%rip), %rcx      # 0x1cff8
movq (%rcx), %rdi
movq 0x60(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%rdx), %rcx
leaq 0xf50e(%rip), %rdx      # 0x1cb40
movq (%rdx,%rax,8), %r8
movl 0x1c(%rsi,%rbx), %r9d
movl 0x20(%rsi,%rbx), %r10d
movsd 0x8(%rsi,%rbx), %xmm0
movl 0x10(%rsi,%rbx), %r11d
movl 0x14(%rsi,%rbx), %r15d
subq $0x8, %rsp
leaq 0x9953(%rip), %rsi      # 0x16fae
leaq 0x9893(%rip), %rdx      # 0x16ef5
movb $0x1, %al
pushq %r15
movq 0xa0(%rsp), %r15
pushq %r11
pushq %r10
callq 0x3290
addq $0x20, %rsp
addq $0x30, %rbx
jmp 0xd5ec
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
pushq $0x30
popq %rdx
leaq 0x190(%rip), %rcx       # 0xd827
callq 0x30c0
movq 0xf955(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x9939(%rip), %rsi      # 0x16fe6
leaq 0x9841(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
leaq 0xf47e(%rip), %rbx      # 0x1cb40
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0xd150
movq 0xf922(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
movq (%rbx), %rcx
movl 0xc0(%rsp,%r14,4), %r8d
movl 0x30(%rsp,%r14,4), %r9d
leaq 0x992a(%rip), %rsi      # 0x1701a
leaq 0x97fe(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
incq %r14
addq $0x8, %rbx
jmp 0xd6c5
movq 0xf8ea(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x991f(%rip), %rsi      # 0x17037
leaq 0x97d6(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
jmp 0xd240
movq 0xf8c6(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x992f(%rip), %rsi      # 0x1706b
leaq 0x97b2(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
jmp 0xd2ec
movq 0xf8a2(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x9937(%rip), %rsi      # 0x17097
leaq 0x978e(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
jmp 0xd394
movq 0xf87e(%rip), %rax      # 0x1cff8
movq (%rax), %rdi
leaq 0x993f(%rip), %rsi      # 0x170c3
leaq 0x976a(%rip), %rdx      # 0x16ef5
xorl %eax, %eax
callq 0x3290
jmp 0xd4cd
movq 0x28(%rsp), %rdi
callq 0x3060
movq %r15, %rdi
callq 0x3060
movq %r13, %rdi
callq 0xaf8b
movq 0x70(%rsp), %rdi
callq 0xaf8b
cmpl $0x0, 0x148(%rsp)
movq 0x50(%rsp), %rbx
je 0xd7d9
movq %rbx, %rdi
movl 0x150(%rsp), %esi
callq 0xb875
movq (%rbx), %rsi
movq 0x10(%rbx), %rdi
leaq -0x14e0(%rip), %rcx     # 0xc307
pushq $0x40
popq %rdx
callq 0x30c0
jmp 0xd7f3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq