// File: /workspace/github_c_makefile_star2_O3/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 0xf6c0
movl %r8d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %r12
movl 0x150(%rsp), %r10d
movl 0x8(%rsi), %r15d
movl 0x18(%rdi), %eax
movq %rax, 0x88(%rsp)
movsd %xmm0, 0x48(%rsp)
xorl %r8d, %r8d
movq %r9, 0x30(%rsp)
movl %r10d, %r9d
callq 0xcc1b
movq %rax, 0x78(%rsp)
subq $0x8, %rsp
movq %r12, %rdi
movq %r13, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movsd 0x50(%rsp), %xmm0
movl %ebx, %r8d
movl 0x158(%rsp), %eax
pushq %rax
xorl %eax, %eax
pushq %rax
movl 0x158(%rsp), %eax
pushq %rax
callq 0xceeb
addq $0x20, %rsp
movq %rax, 0x38(%rsp)
subq $0x8, %rsp
movq %r12, %rdi
movl 0x148(%rsp), %r12d
movq %r13, 0x68(%rsp)
movq %r13, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movsd 0x50(%rsp), %xmm0
movl %ebx, %r8d
movq 0x38(%rsp), %r9
movl 0x158(%rsp), %eax
pushq %rax
xorl %eax, %eax
pushq %rax
pushq %r12
callq 0xd880
addq $0x20, %rsp
movq %rax, %rbx
movq 0x88(%rsp), %rax
leal (,%rax,4), %edi
movl $0x8, %esi
callq 0x3240
movq %rax, 0x48(%rsp)
testq %r15, %r15
je 0xe95b
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
xorl %ecx, %ecx
movq %rcx, %rsi
shlq $0x6, %rsi
movl 0x28(%rax,%rsi), %edx
testq %rdx, %rdx
je 0xe953
movq 0x30(%rax,%rsi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r9
movq %r9, %r8
movl %r9d, %r10d
shrq $0x22, %r9
shrq $0x20, %r8
andl $0x3, %r8d
imull 0x88(%rsp), %r8d
xorps %xmm0, %xmm0
cvtsi2sd %r10, %xmm0
addl %r9d, %r8d
movq 0x48(%rsp), %r9
ucomisd (%r9,%r8,8), %xmm0
jbe 0xe94b
movq 0x48(%rsp), %r9
movsd %xmm0, (%r9,%r8,8)
incq %rdi
cmpq %rdi, %rdx
jne 0xe909
incq %rcx
cmpq %r15, %rcx
jne 0xe8f2
movl $0x1, %edi
movl $0x18, %esi
callq 0x3240
movq %rax, 0x68(%rsp)
movq %rbx, 0xa0(%rsp)
movq (%rbx), %rax
movq %rax, 0xd8(%rsp)
testq %rax, %rax
movl 0x150(%rsp), %r15d
je 0xf661
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xd0(%rsp)
xorl %eax, %eax
xorl %ebp, %ebp
shlq $0x6, %rax
movq 0xd0(%rsp), %rcx
leaq (%rcx,%rax), %rdx
movq %rdx, 0x40(%rsp)
movq 0x20(%rcx,%rax), %r14
movl 0x1c(%rcx,%rax), %ebx
movq %rbx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x32f0
movq %rax, %r13
testq %rbx, %rbx
movq %rbx, 0x20(%rsp)
movq %rbp, 0x80(%rsp)
je 0xefc9
leaq 0x18(%r13), %rax
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
movq 0x40(%rsp), %r9
movl %ecx, -0x18(%rax)
movq 0x38(%r9), %rdx
movq 0x10(%rdx), %rdx
movl (%r14,%rcx,4), %esi
leaq (%rsi,%rsi,4), %rsi
movl 0x20(%rdx,%rsi,8), %edi
andl %r8d, %edi
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
movsd %xmm0, -0x10(%rax)
movl 0x18(%rdx,%rsi,8), %edx
movl %edx, -0x8(%rax)
movl $0xffffffff, -0x4(%rax) # imm = 0xFFFFFFFF
incq %rcx
movupd %xmm1, (%rax)
movl $0x0, 0x10(%rax)
addq $0x30, %rax
cmpq %rcx, %rbx
jne 0xea0f
testq %rbx, %rbx
je 0xefc9
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
xorl %ecx, %ecx
movsd 0xbaca(%rip), %xmm2     # 0x1a540
movl (%r14,%rcx,4), %esi
shlq $0x6, %rsi
movl 0x28(%rax,%rsi), %r8d
testl %r8d, %r8d
je 0xeafe
leaq (%rax,%rsi), %rdx
movq 0x30(%rax,%rsi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r10
cmpl %r12d, %r10d
jb 0xeaf3
movq %r10, %r9
shrq $0x20, %r9
movl %r9d, %r11d
andl $0x3, %r11d
imull 0x88(%rsp), %r11d
movq 0x48(%rsp), %rbx
leaq (%rbx,%r11,8), %r11
movl %r10d, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
shrq $0x22, %r10
movsd (%r11,%r10,8), %xmm1
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0xeaf3
andl $0x3, %r9d
leaq (%rcx,%rcx,2), %r8
shlq $0x4, %r8
addq %r13, %r8
incl 0x18(%r8,%r9,4)
movl 0x28(%rdx), %r8d
incq %rdi
movl %r8d, %r9d
cmpq %r9, %rdi
jb 0xea93
incq %rcx
movq 0x20(%rsp), %rsi
cmpq %rsi, %rcx
jne 0xea76
testl %esi, %esi
jle 0xefc9
movl $0x30, %edx
movq %r13, %rdi
leaq 0xbb1(%rip), %rcx       # 0xf6d7
callq 0x30c0
movq 0x20(%rsp), %rsi
movl $0x0, 0x14(%r13)
cmpl $0x1, %esi
movsd 0xba05(%rip), %xmm4     # 0x1a548
movsd 0xba05(%rip), %xmm5     # 0x1a550
je 0xebb3
movsd 0x8(%r13), %xmm1
leaq -0x1(%rsi), %rax
leaq 0x44(%r13), %rcx
movl $0x1, %edx
movsd -0xc(%rcx), %xmm0
movsd -0x3c(%rcx), %xmm2
mulsd %xmm4, %xmm2
ucomisd %xmm0, %xmm2
jb 0xeb8d
xorps %xmm2, %xmm2
cvtsi2sd %edx, %xmm2
movapd %xmm1, %xmm3
divsd %xmm2, %xmm3
mulsd %xmm5, %xmm3
ucomisd %xmm0, %xmm3
jae 0xeb9b
movl -0x30(%rcx), %edx
incl %edx
movl %edx, (%rcx)
movl $0x1, %edx
jmp 0xeba6
movl -0x30(%rcx), %edi
movl %edi, (%rcx)
addsd %xmm1, %xmm0
incl %edx
addq $0x30, %rcx
movapd %xmm0, %xmm1
decq %rax
jne 0xeb60
leaq (%rsi,%rsi,2), %rax
shlq $0x4, %rax
movslq -0x1c(%r13,%rax), %rbp
movq %rbp, %r15
incq %r15
movl $0x30, %edx
movq %r13, %rdi
leaq 0xb21(%rip), %rcx       # 0xf6f6
movq %rsi, %r12
callq 0x30c0
movl $0x48, %esi
movq %r15, 0x28(%rsp)
movq %r15, %rdi
callq 0x3240
leaq 0x14(%r13), %r15
movq %r15, %rsi
movq %r12, %rcx
movslq (%rsi), %rdx
leaq (%rdx,%rdx,8), %rdx
incl 0x4(%rax,%rdx,8)
addq $0x30, %rsi
decq %rcx
jne 0xebf9
movq %rax, 0x18(%rsp)
movl 0x28(%rsp), %ebx
movq %rbp, 0x10(%rsp)
testl %ebp, %ebp
js 0xec56
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %r12
xorl %ebp, %ebp
movl %ebp, -0x8(%r12)
movslq -0x4(%r12), %rdi
shlq $0x2, %rdi
callq 0x32f0
movq %rax, (%r12)
movl $0x0, -0x4(%r12)
incq %rbp
addq $0x48, %r12
cmpq %rbp, %rbx
jne 0xec2a
movq %rbx, 0x70(%rsp)
xorl %eax, %eax
movq 0x18(%rsp), %r11
movq 0xa8(%rsp), %r8
movslq (%r15,%rax), %rcx
movl -0x14(%r15,%rax), %edx
leaq (%rcx,%rcx,8), %rcx
movq 0x8(%r11,%rcx,8), %rsi
movslq 0x4(%r11,%rcx,8), %rdi
movl %edx, (%rsi,%rdi,4)
movsd -0xc(%r15,%rax), %xmm0
addsd 0x18(%r11,%rcx,8), %xmm0
movsd %xmm0, 0x18(%r11,%rcx,8)
movl -0x4(%r15,%rax), %edx
addl %edx, 0x10(%r11,%rcx,8)
leal 0x1(%rdi), %edx
movl %edx, 0x4(%r11,%rcx,8)
addq $0x30, %rax
cmpq %rax, %r8
jne 0xec6a
cmpl $0x0, 0x10(%rsp)
movq 0x78(%rsp), %r10
xorpd %xmm4, %xmm4
xorpd %xmm5, %xmm5
movsd 0xb85a(%rip), %xmm6     # 0x1a528
movsd 0xb7ea(%rip), %xmm7     # 0x1a4c0
movq 0x40(%rsp), %r9
movq 0x28(%rsp), %rdx
movq 0x70(%rsp), %rax
js 0xed1a
leaq (,%rax,8), %rax
leaq (%rax,%rax,8), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r11,%rcx), %xmm0
movsd 0x18(%r11,%rcx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%r11,%rcx)
addq $0x48, %rcx
cmpq %rcx, %rax
jne 0xecf5
movapd %xmm4, 0x50(%rsp)
movapd %xmm4, 0x90(%rsp)
testl %edx, %edx
sete 0xf(%rsp)
je 0xf004
leaq 0x20(%r11), %r15
leaq 0x18(%r13), %rbp
xorl %ebx, %ebx
leaq (%rbx,%rbx,8), %rax
leaq (%r11,%rax,8), %rcx
movq %rcx, 0x10(%rsp)
movupd %xmm4, 0x30(%r11,%rax,8)
movupd %xmm4, 0x20(%r11,%rax,8)
movapd %xmm4, 0xf0(%rsp)
movapd %xmm4, 0xe0(%rsp)
movl 0x4(%r11,%rax,8), %r12d
testq %r12, %r12
je 0xede0
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %edi
movl (%r14,%rdi,4), %esi
shll $0x2, %esi
leaq (%r10,%rsi,8), %rsi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
addq %rbp, %rdi
xorl %r8d, %r8d
movupd (%rsi,%r8,2), %xmm0
cvtdq2pd (%rdi,%r8), %xmm1
movupd (%r15,%r8,2), %xmm2
addpd %xmm0, %xmm2
addpd 0xe0(%rsp,%r8,2), %xmm1
movupd %xmm2, (%r15,%r8,2)
movapd %xmm1, 0xe0(%rsp,%r8,2)
addq $0x8, %r8
cmpq $0x10, %r8
jne 0xed9e
incq %rdx
cmpq %r12, %rdx
jne 0xed82
leaq (%r11,%rax,8), %rax
addq $0x20, %rax
xorl %ecx, %ecx
movapd %xmm6, %xmm1
movapd %xmm6, %xmm0
xorl %edx, %edx
xorl %esi, %esi
movl %esi, %edi
movsd (%r15,%rcx,8), %xmm3
ucomisd %xmm0, %xmm3
jbe 0xee0e
movl %ecx, %esi
movl %edi, %edx
movapd %xmm3, %xmm2
jmp 0xee2a
movl %edi, %esi
ucomisd %xmm1, %xmm3
jbe 0xee22
movl %ecx, %edx
movapd %xmm0, %xmm2
movapd %xmm3, %xmm0
jmp 0xee2a
movapd %xmm0, %xmm2
movapd %xmm1, %xmm0
incq %rcx
movapd %xmm0, %xmm1
movapd %xmm2, %xmm0
cmpq $0x4, %rcx
jne 0xedf6
movl %esi, %ecx
movsd (%rax,%rcx,8), %xmm0
movl %edx, %ecx
ucomisd (%rax,%rcx,8), %xmm0
movl $0x0, %eax
cmovnel %esi, %eax
cmovpl %esi, %eax
cmpl $0x1, %edx
jne 0xeefb
cmpl $0x2, %eax
jne 0xeefb
movsd 0xe8(%rsp), %xmm0
ucomisd %xmm5, %xmm0
jbe 0xeefb
movq 0x10(%rsp), %rax
movsd 0x28(%rax), %xmm1
movsd 0x30(%rax), %xmm2
movapd %xmm1, %xmm0
mulsd %xmm7, %xmm0
ucomisd %xmm2, %xmm0
jbe 0xeeb5
movl $0x1, %eax
movl 0x150(%rsp), %ecx
cmpl $0x3, %ecx
jl 0xeefb
movq 0x10(%rsp), %rax
movl 0x10(%rax), %r9d
jmp 0xef6a
movapd %xmm1, %xmm0
mulsd 0xb677(%rip), %xmm0     # 0x1a538
movl $0x2, %eax
ucomisd %xmm2, %xmm0
jbe 0xeefb
movl 0x150(%rsp), %eax
cmpl $0x3, %eax
setl %dl
movq 0x10(%rsp), %rax
movl 0x10(%rax), %r9d
xorl %eax, %eax
cmpl $0x3d091, %r9d          # imm = 0x3D091
setb %cl
orb %cl, %dl
je 0xef6a
movb %cl, %al
incl %eax
movq 0x40(%rsp), %r9
testq %r12, %r12
je 0xef4b
movq 0x10(%rsp), %rcx
movq 0x8(%rcx), %rcx
movl %eax, %edx
xorl %esi, %esi
movl (%rcx,%rsi,4), %edi
leaq (%rdi,%rdi,2), %r8
shlq $0x4, %r8
addq %r13, %r8
cmpl $0x0, 0x18(%r8,%rdx,4)
jle 0xef43
movq 0x38(%r9), %r8
movq 0x10(%r8), %r8
movl (%r14,%rdi,4), %edi
leaq (%rdi,%rdi,4), %rdi
movl 0x18(%r8,%rdi,8), %edi
addl %edi, 0x50(%rsp,%rdx,4)
incl 0x90(%rsp,%rdx,4)
incq %rsi
cmpq %rsi, %r12
jne 0xef0d
movq 0x10(%rsp), %rcx
movl %eax, 0x40(%rcx)
incq %rbx
addq $0x48, %r15
cmpq 0x70(%rsp), %rbx
jne 0xed40
jmp 0xf004
movq 0x11087(%rip), %rax     # 0x1fff8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movsd 0x18(%rax), %xmm0
movsd 0x38(%rax), %xmm3
leaq 0xbef3(%rip), %rsi      # 0x1ae7d
leaq 0xbf54(%rip), %rdx      # 0x1aee5
movl %ebx, %ecx
movl %r12d, %r8d
movb $0x4, %al
callq 0x3290
movq 0x18(%rsp), %r11
movsd 0xb516(%rip), %xmm7     # 0x1a4c0
movsd 0xb576(%rip), %xmm6     # 0x1a528
xorpd %xmm5, %xmm5
xorpd %xmm4, %xmm4
movq 0x78(%rsp), %r10
movl $0x1, %eax
jmp 0xeef6
movq $0x0, 0x28(%rsp)
movl $0x48, %esi
xorl %edi, %edi
callq 0x3240
movq %rax, %r11
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x90(%rsp)
cmpl $0x3, %r15d
jge 0xf023
movb $0x1, 0xf(%rsp)
jmp 0xf1b1
movl 0x150(%rsp), %r15d
cmpl $0x2, %r15d
jg 0xf5f5
movl 0x140(%rsp), %r12d
jmp 0xf1b1
movq %r11, 0x18(%rsp)
callq 0x39a9
movq $0x0, 0x28(%rsp)
movb $0x1, 0xf(%rsp)
movq 0x10fb6(%rip), %r12     # 0x1fff8
leaq 0xbe9c(%rip), %r15      # 0x1aee5
movq 0x20(%rsp), %rbx
movq (%r12), %rdi
leaq 0xbf21(%rip), %rsi      # 0x1af7a
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3290
movl $0x30, %edx
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x660(%rip), %rcx       # 0xf6d7
callq 0x30c0
testq %rbx, %rbx
leaq 0xbf18(%rip), %rbp      # 0x1af9e
movq 0x60(%rsp), %rbx
je 0xf128
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
movl (%r13,%r15), %eax
movl (%r14,%rax,4), %eax
leaq (%rax,%rax,2), %rcx
shlq $0x6, %rax
movq 0x10(%rsp), %rdx
movl (%rdx,%rax), %eax
movq (%r12), %rdi
movq 0x10(%rbx), %rdx
movq (%rdx,%rcx,8), %rcx
leaq 0x10a72(%rip), %rdx     # 0x1fb40
movq (%rdx,%rax,8), %r8
movl 0x1c(%r13,%r15), %r9d
movl 0x20(%r13,%r15), %r10d
movsd 0x8(%r13,%r15), %xmm0
movl 0x10(%r13,%r15), %r11d
movl 0x14(%r13,%r15), %r12d
subq $0x8, %rsp
movq %rbp, %rsi
leaq 0xbdea(%rip), %rdx      # 0x1aee5
movb $0x1, %al
pushq %r12
movq 0x10ef2(%rip), %r12     # 0x1fff8
pushq %r11
pushq %r10
callq 0x3290
movq 0xc8(%rsp), %rcx
addq $0x20, %rsp
addq $0x30, %r15
cmpq %r15, %rcx
jne 0xf0a2
movl $0x30, %edx
movq %r13, %rdi
movq 0x20(%rsp), %rsi
leaq 0x5ba(%rip), %rcx       # 0xf6f6
callq 0x30c0
movq (%r12), %rdi
leaq 0xbe8a(%rip), %rsi      # 0x1afd6
leaq 0xbd92(%rip), %rbp      # 0x1aee5
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3290
leaq 0x109dc(%rip), %rbx     # 0x1fb40
xorl %r14d, %r14d
leaq 0xbe9c(%rip), %r15      # 0x1b00a
movq (%r12), %rdi
movq (%rbx), %rcx
movl 0x90(%rsp,%r14,4), %r8d
movl 0x50(%rsp,%r14,4), %r9d
movq %r15, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3290
incq %r14
addq $0x8, %rbx
cmpq $0x4, %r14
jne 0xf16e
movl 0x150(%rsp), %r15d
movl 0x140(%rsp), %r12d
movq 0x18(%rsp), %r11
movq %r11, 0x18(%rsp)
movl 0x54(%rsp), %ebp
movl 0x58(%rsp), %esi
testl %ebp, %ebp
setne %al
testl %esi, %esi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0x30(%rsp), %rdx
jne 0xf208
cmpl %edx, %ebp
seta %al
cmpl %edx, %esi
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xf4dc
movq %r15, %r14
xorl %eax, %eax
movl %eax, 0x58(%rsp)
movl $0x0, 0x10(%rsp)
movl %eax, 0x98(%rsp)
movl $0x1, %ebp
jmp 0xf20f
movl %esi, 0x10(%rsp)
movq %r15, %r14
movl $0x20, %edi
callq 0x32f0
movq %rax, %rbx
movq 0x20(%rsp), %r15
leal (,%r15,4), %edi
movl $0x4, %esi
callq 0x3240
movq %r15, %rcx
movq %rax, (%rbx)
leaq (,%r15,4), %rdi
leaq (%rax,%r15,4), %rsi
movl $0x1, %edx
movq %rsi, (%rbx,%rdx,8)
incq %rdx
addq %rdi, %rsi
cmpq $0x4, %rdx
jne 0xf24a
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
testl %ebp, %ebp
setne %sil
movl 0x10(%rsp), %r8d
testl %r8d, %r8d
setne %dl
andb %sil, %dl
cmpb $0x1, %dl
movq 0x18(%rsp), %rdi
movq %r14, %r15
movq %rax, 0x70(%rsp)
jne 0xf349
cmpl $0x3, %r15d
jge 0xf5cd
xorpd %xmm0, %xmm0
movq 0x28(%rsp), %r14
movl %r14d, %esi
movq %r13, %rdx
movl $0x1, %r8d
movsd 0xb1cf(%rip), %xmm1     # 0x1a490
movq 0x30(%rsp), %rbp
movl %ebp, %r9d
pushq %r15
pushq 0x8(%rbx)
leaq 0xc8(%rsp), %rax
pushq %rax
pushq $0x2dc6c0               # imm = 0x2DC6C0
movq %rdi, %r15
callq 0xf707
addq $0x20, %rsp
movl %eax, %r12d
movl %eax, 0x54(%rsp)
xorpd %xmm0, %xmm0
movq %r15, %rdi
movl 0x150(%rsp), %r15d
movl %r14d, %esi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
movl $0x2, %r8d
movsd 0xb179(%rip), %xmm1     # 0x1a490
movl %ebp, %r9d
pushq %r15
pushq 0x10(%rbx)
leaq 0xd0(%rsp), %rax
pushq %rax
pushq $0x3d090                # imm = 0x3D090
callq 0xf707
addq $0x20, %rsp
movl %eax, 0x58(%rsp)
movq 0x80(%rsp), %rbp
movq 0x60(%rsp), %r14
jmp 0xf3ae
testl %ebp, %ebp
je 0xf50f
cmpl $0x3, %r15d
movq 0x60(%rsp), %r14
movq 0x80(%rsp), %rbp
jge 0xf5e1
xorpd %xmm0, %xmm0
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movl $0x1, %r8d
movsd 0xb10e(%rip), %xmm1     # 0x1a490
movq 0x30(%rsp), %r9
pushq %r15
pushq 0x8(%rbx)
leaq 0xc8(%rsp), %rax
pushq %rax
pushq $0x2dc6c0               # imm = 0x2DC6C0
callq 0xf707
addq $0x20, %rsp
movl %eax, %r12d
movl %eax, 0x54(%rsp)
movl 0x10(%rsp), %eax
testl %r12d, %r12d
je 0xf3f3
movq 0x8(%rbx), %r9
movsd 0xb8(%rsp), %xmm0
subq $0x8, %rsp
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r13, %rcx
movl %eax, %r12d
movl $0x1, %r8d
pushq %r15
pushq 0x78(%rsp)
pushq 0x48(%rsp)
callq 0xfd21
movl %r12d, %eax
addq $0x20, %rsp
movl 0x140(%rsp), %r12d
testl %eax, %eax
je 0xf439
movq 0x10(%rbx), %r9
movsd 0xc0(%rsp), %xmm0
subq $0x8, %rsp
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r13, %rcx
movl $0x2, %r8d
pushq %r15
pushq 0x78(%rsp)
pushq 0x48(%rsp)
callq 0xfd21
addq $0x20, %rsp
movl 0x5c(%rsp), %eax
testl %eax, %eax
je 0xf47b
movq 0x18(%rbx), %r9
movsd 0xc8(%rsp), %xmm0
subq $0x8, %rsp
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r13, %rcx
movl $0x3, %r8d
pushq %r15
pushq 0x78(%rsp)
pushq 0x48(%rsp)
callq 0xfd21
addq $0x20, %rsp
movq 0x70(%rsp), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3060
movq %r13, %rdi
callq 0x3060
cmpb $0x0, 0xf(%rsp)
jne 0xf4ba
movl 0x28(%rsp), %ebx
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %r14
movq (%r14), %rdi
callq 0x3060
addq $0x48, %r14
decq %rbx
jne 0xf4a9
movq 0x18(%rsp), %rdi
callq 0x3060
incl %ebp
movq %rbp, %rax
cmpq %rbp, 0xd8(%rsp)
ja 0xe9ab
jmp 0xf661
cmpl %edx, %ebp
setb %al
cmpl %edx, %esi
seta %cl
andb %al, %cl
movl $0x1, %ebp
cmpb $0x1, %cl
movl %esi, 0x10(%rsp)
jne 0xf20c
movq %r15, %r14
xorl %ebp, %ebp
movl %ebp, 0x54(%rsp)
movl %ebp, 0x94(%rsp)
jmp 0xf20f
testl %r8d, %r8d
movq 0x60(%rsp), %r14
movq 0x80(%rsp), %rbp
je 0xf56f
cmpl $0x3, %r15d
jge 0xf63e
xorpd %xmm0, %xmm0
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movl $0x2, %r8d
movsd 0xaf4b(%rip), %xmm1     # 0x1a490
movq 0x30(%rsp), %r9
pushq %r15
pushq 0x10(%rbx)
leaq 0xd0(%rsp), %rax
pushq %rax
pushq $0x3d090                # imm = 0x3D090
callq 0xf707
addq $0x20, %rsp
movl %eax, 0x58(%rsp)
jmp 0xf3fb
cmpl $0x0, 0x5c(%rsp)
je 0xf47b
cmpl $0x3, %r15d
jge 0xf652
xorpd %xmm0, %xmm0
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movl $0x3, %r8d
movsd 0xaeed(%rip), %xmm1     # 0x1a490
movq 0x30(%rsp), %r9
pushq %r15
pushq 0x18(%rbx)
leaq 0xd8(%rsp), %rax
pushq %rax
pushq $0xc350                 # imm = 0xC350
callq 0xf707
addq $0x20, %rsp
movl %eax, 0x5c(%rsp)
jmp 0xf43d
callq 0x3a3f
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rcx
jmp 0xf2a4
callq 0x3a1a
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rcx
jmp 0xf368
movq 0x109fc(%rip), %r12     # 0x1fff8
movq (%r12), %rdi
leaq 0xb8ed(%rip), %rsi      # 0x1aef4
leaq 0xb8d7(%rip), %r15      # 0x1aee5
movq %r15, %rdx
movq 0x28(%rsp), %rbx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x3290
testl %ebx, %ebx
jne 0xf62d
movb $0x1, 0xf(%rsp)
jmp 0xf049
movl %ebx, %edi
movq 0x18(%rsp), %rsi
callq 0x3922
jmp 0xf049
callq 0x39f5
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rcx
jmp 0xf52b
callq 0x39d0
movq 0x20(%rsp), %rcx
jmp 0xf584
movq 0x78(%rsp), %rdi
callq 0x3060
movq 0x48(%rsp), %rdi
callq 0x3060
movq 0x38(%rsp), %rdi
callq 0xcbce
movq 0xa0(%rsp), %rdi
callq 0xcbce
cmpl $0x0, 0x148(%rsp)
movq 0x68(%rsp), %rbx
je 0xf6a6
movq %rbx, %rdi
movl %r15d, %esi
callq 0xd506
movq (%rbx), %rsi
movq 0x10(%rbx), %rdi
leaq -0x1673(%rip), %rcx     # 0xe041
movl $0x40, %edx
callq 0x30c0
jmp 0xf6c2
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq