// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/syncasm.c
// Function: scg_ra_utg_coverage
void scg_ra_utg_coverage(scg_t *g, sr_db_t *sr_db, scg_ra_v *ra_v, int verbose)
{
    if (ra_v->n == 0) {
        fprintf(stderr, "[W::%s] no read alignment, unitig coverage estimation skipped\n", __func__);
        return;
    }

    uint64_t i, j, k, s, n, m, n_vtx, n_scm, m_scm, uid, sid, *a;
    asmg_t *utg_g;
    syncmer_t *scm;

    utg_g = g->utg_asmg;
    n_vtx = utg_g->n_vtx;
    scm = scg_a_scm(g);
    n_scm = scg_n_scm(g);

    /***
    // first round estimation with single copy syncmers
    double *avg_covs;
    kvec_t(double) kcovs;
    
    // FIXME utgs with no single copy mers
    MYCALLOC(avg_covs, n_vtx);
    kv_init(kcovs);
    for (i = 0; i < n_vtx; ++i) {
        a = utg_g->vtx[i].a;
        n = utg_g->vtx[i].n;
        for (j = 0; j < n; ++j) {
            s = a[j] >> 1;
            if (scm_utg_n(g, s) == 1)
                kv_push(double, kcovs, (double) scm[s].cov);
        }
        avg_covs[i] = average_IQR(kcovs.a, kcovs.n, 0);
        avg_covs[i] = MAX(1., avg_covs[i]);
        kcovs.n = 0;
    }
    kv_destroy(kcovs);
    **/
    
    // first round estimation with uniquely mapped reads
    double *avg_covs, *covs, **C, intpart;
    ra_frg_t *ra;
    m_scm = 0;
    for (i = 0; i < n_vtx; ++i)
        m_scm += utg_g->vtx[i].n;
    MYCALLOC(covs, m_scm);
    MYMALLOC(C, n_vtx);
    C[0] = covs;
    for (i = 1; i < n_vtx; ++i)
        C[i] = C[i - 1] + utg_g->vtx[i - 1].n;
    for (i = 0, n = ra_v->n; i < n; ++i) {
        if (modf(ra_v->a[i].s, &intpart) > DBL_EPSILON)
            continue;
        ra = ra_v->a[i].a;
        m = ra_v->a[i].n;
        for (j = 0; j < m; ++j) {
            uid = ra[j].uid >> 1;
            for (k = ra[j].u_beg, s = ra[j].u_end; k <= s; ++k)
                C[uid][k] += 1.;
        }
    }
    MYCALLOC(avg_covs, n_vtx);
    for (i = 0; i < n_vtx; ++i) {
        n = utg_g->vtx[i].n;
        qsort(C[i], n, sizeof(double), dbl_cmpfunc);
        // do not use syncmers not covered
        m = 0;
        while (m < n && C[i][m] < DBL_EPSILON) ++m;
        avg_covs[i] = average_IQR(&C[i][m], n - m, 1);
        avg_covs[i] = MAX(1., avg_covs[i]);
    }
    free(C);
    free(covs);

#ifdef DEBUG_UTG_RA_COV
    fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] unitig coverage estimation first round -\n", __func__);
    for (i = 0; i < n_vtx; ++i)
        fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] u%lu: %u\n", __func__, i, (uint32_t) avg_covs[i]);
#endif

    // find alignment blocks for multiple alignments
    // here assume alignment records were sorted by reads
    kvec_t(ma_t) mas = {0, 0, 0};
    ma_t *ma;
    sid = ra_v->a[0].sid;
    for (i = j = 0; i < ra_v->n; ++i) {
        if (sid != ra_v->a[i].sid) {
            // new read
            kv_pushp(ma_t, mas, &ma);
            make_ma_block(g, &sr_db->a[ra_v->a[j].sid], &ra_v->a[j], i - j, ma);
            j = i;
            sid = ra_v->a[j].sid;
        }
    }
    kv_pushp(ma_t, mas, &ma);
    make_ma_block(g, &sr_db->a[ra_v->a[j].sid], &ra_v->a[j], i - j, ma);

    // second round estimation with mapped reads
    double diff, covt;
    // this is an interface for better EM algorithm
    // currently it converges quickly
    MYMALLOC(covs, n_vtx);
    for (i = 0; i < EM_MAX_ITER; ++i) {
        MYBZERO(covs, n_vtx);
        for (j = 0; j < mas.n; ++j) {
            ma = &mas.a[j];
            for (k = 0; k < ma->b; ++k) {
                a = &ma->u[k * (ma->a)];
                covt = 0.;
                for (n = 0; n < ma->a; ++n)
                    covt += avg_covs[a[n]];
                if (covt == 0.) continue;
                for (n = 0; n < ma->a; ++n)
                    covs[a[n]] += avg_covs[a[n]] / covt * ma->n[k];
            }
        }
        diff = 0.;
        for (j = 0; j < n_vtx; ++j) {
            covt = covs[j] / utg_g->vtx[j].n;
            diff += fabs(covt - avg_covs[j]);
            avg_covs[j] = covt;
        }
        if (verbose > 2)
            fprintf(stderr, "[M::%s] unitig coverage estimation iteration %lu: diff = %.6f\n",
                    __func__, i, diff);
        if (diff < DBL_EPSILON)
            break;
    }
    if (verbose > 2)
        fprintf(stderr, "[M::%s] unitig coverage estimation ended at iteration %lu\n", __func__, i);
    free(covs);

#ifdef DEBUG_UTG_RA_COV
    fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] unitig coverage estimation second round -\n", __func__);
    for (i = 0; i < n_vtx; ++i)
        fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] u%lu: %u\n", __func__, i, (uint32_t) avg_covs[i]);
#endif

    // third round estimation with all syncmers weighted by utg coverage estimated in last round
    uint128_t **idx_u;
    idx_u = g->idx_u;
    MYCALLOC(covs, m_scm);
    MYMALLOC(C, n_vtx);
    C[0] = covs;
    for (i = 1; i < n_vtx; ++i)
        C[i] = C[i - 1] + utg_g->vtx[i - 1].n;
    for (i = 0; i < n_scm; ++i) {
        m = scm_utg_n(g, i);
        if (m == 0) continue;
        covt = 0.;
        for (j = 0; j < m; ++j)
            covt += avg_covs[scm_utg_uid(idx_u[i][j])];
        if (covt < DBL_EPSILON) continue;
        for (j = 0; j < m; ++j) {
            uid = scm_utg_uid(idx_u[i][j]);
            C[uid][scm_utg_pos(idx_u[i][j])] = avg_covs[uid] / covt * scm[i].cov;
        }
    }
    for (i = 0; i < n_vtx; ++i) {
        n = utg_g->vtx[i].n;
        avg_covs[i] = average_IQR(C[i], n, 0);
        avg_covs[i] = MAX(1., avg_covs[i]);
    }
    free(C);
    free(covs);

#ifdef DEBUG_UTG_RA_COV
    fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] unitig coverage estimation third round -\n", __func__);
    for (i = 0; i < n_vtx; ++i)
        fprintf(stderr, "[DEBUG_UTG_RA_COV::%s] u%lu: %u\n", __func__, i, (uint32_t) avg_covs[i]);
#endif

    // update unitig coverage on graph
    for (i = 0; i < n_vtx; ++i)
        utg_g->vtx[i].cov = (uint32_t) avg_covs[i]; 

    for (i = 0; i < mas.n; ++i) {
        free(mas.a[i].n);
        free(mas.a[i].u);
    }
    kv_destroy(mas);

    free(avg_covs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xad18
movq 0x292fd(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x22de6(%rip), %rsi     # 0x2daeb
leaq 0x22e1e(%rip), %rdx     # 0x2db2a
movb $0x0, %al
callq 0x2290
jmp 0xbabb
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xad9b
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xad65
movq -0x68(%rbp), %rdi
movl $0x8, %esi
callq 0x2250
movq %rax, -0xa0(%rbp)
movq -0x58(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2320
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, (%rax)
movq $0x1, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xae3b
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xaddd
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0xaf94
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
leaq -0xb0(%rbp), %rdi
callq 0x21b0
movsd 0x228f0(%rip), %xmm1    # 0x2d778
ucomisd %xmm1, %xmm0
jbe 0xae93
jmp 0xaf83
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x50(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0xaf81
movq -0xb8(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq %rax
movq %rax, -0x70(%rbp)
movq -0xb8(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0xb8(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
ja 0xaf6e
movq -0xa8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x38(%rbp), %rcx
movsd 0x22832(%rip), %xmm0    # 0x2d788
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xaf31
jmp 0xaf70
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xaed3
jmp 0xaf83
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xae4e
movq -0x58(%rbp), %rdi
movl $0x8, %esi
callq 0x2250
movq %rax, -0x98(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xb105
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rsi
movl $0x8, %edx
leaq 0xad8(%rip), %rcx       # 0xbad0
callq 0x20d0
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rcx
xorl %eax, %eax
cmpq -0x48(%rbp), %rcx
movb %al, -0xf1(%rbp)
jae 0xb040
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movsd 0x22746(%rip), %xmm0    # 0x2d778
ucomisd (%rax,%rcx,8), %xmm0
seta %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0xb04c
jmp 0xb05a
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0xb005
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x50(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
movl %eax, %esi
movl $0x1, %edx
callq 0xbb20
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd 0x226dd(%rip), %xmm0    # 0x2d788
ucomisd (%rax,%rcx,8), %xmm0
jbe 0xb0c4
movsd 0x226ce(%rip), %xmm0    # 0x2d788
movsd %xmm0, -0x100(%rbp)
jmp 0xb0dc
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0x100(%rbp), %xmm0
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xafb1
movq -0xa8(%rbp), %rdi
callq 0x2060
movq -0xa0(%rbp), %rdi
callq 0x2060
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x21f0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xb294
movq -0x78(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x28(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
je 0xb281
jmp 0xb182
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0xb1e6
cmpq $0x0, -0xc8(%rbp)
je 0xb1af
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0xb1bd
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0xb1bd
movq -0x108(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
imulq $0x18, -0xc8(%rbp), %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
imulq $0x58, (%rax), %rax
addq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x30(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %r8
callq 0xbca0
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0xb283
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb14f
jmp 0xb296
movq -0xd0(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jne 0xb2fa
cmpq $0x0, -0xc8(%rbp)
je 0xb2c3
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0xb2d1
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0xb2d1
movq -0x110(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
imulq $0x18, -0xc8(%rbp), %rsi
callq 0x2360
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0xd0(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
imulq $0x58, (%rax), %rax
addq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x30(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %r8
callq 0xbca0
movq -0x58(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2320
movq %rax, -0xa0(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
jae 0xb670
movq -0xa0(%rbp), %rdi
movq -0x58(%rbp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x21f0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jae 0xb549
movq -0xc0(%rbp), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jae 0xb536
movq -0xd8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq -0xd8(%rbp), %rdx
movl (%rdx), %edx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0xb483
movq -0x98(%rbp), %rax
movq -0x80(%rbp), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0xe8(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb43b
movsd -0xe8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xb49b
jp 0xb49b
jmp 0xb525
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0xb523
movq -0x98(%rbp), %rax
movq -0x80(%rbp), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd -0xe8(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cvtsi2sd %rax, %xmm2
movq -0xa0(%rbp), %rax
movq -0x80(%rbp), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb4a3
jmp 0xb525
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xb3ea
jmp 0xb538
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb3bb
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xb618
movq -0xa0(%rbp), %rax
movq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
leaq (%rcx,%rcx,4), %rcx
movq (%rax,%rcx,8), %xmm1
movaps 0x2222b(%rip), %xmm2    # 0x2d7c0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2222f(%rip), %xmm2    # 0x2d7d0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
movsd -0xe8(%rbp), %xmm0
movq -0x98(%rbp), %rax
movq -0x30(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movaps 0x22205(%rip), %xmm1    # 0x2d7e0
pand %xmm1, %xmm0
addsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xe8(%rbp), %xmm0
movq -0x98(%rbp), %rax
movq -0x30(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb55c
cmpl $0x2, -0x1c(%rbp)
jle 0xb649
movq 0x289d3(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
movsd -0xe0(%rbp), %xmm0
leaq 0x22503(%rip), %rsi     # 0x2db3e
leaq 0x224e8(%rip), %rdx     # 0x2db2a
movb $0x1, %al
callq 0x2290
movsd 0x22127(%rip), %xmm0    # 0x2d778
ucomisd -0xe0(%rbp), %xmm0
jbe 0xb65d
jmp 0xb670
jmp 0xb65f
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb38f
cmpl $0x2, -0x1c(%rbp)
jle 0xb699
movq 0x2897b(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
leaq 0x224f2(%rip), %rsi     # 0x2db7d
leaq 0x22498(%rip), %rdx     # 0x2db2a
movb $0x0, %al
callq 0x2290
movq -0xa0(%rbp), %rdi
callq 0x2060
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x68(%rbp), %rdi
movl $0x8, %esi
callq 0x2250
movq %rax, -0xa0(%rbp)
movq -0x58(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2320
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, (%rax)
movq $0x1, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xb754
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb6f6
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0xb915
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
subq %rcx, %rax
sarq $0x4, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xb7a2
jmp 0xb904
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0xb81b
movq -0x98(%rbp), %rax
movq -0xf0(%rbp), %rcx
movq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x30(%rbp), %rsi
shlq $0x4, %rsi
movq (%rcx,%rsi), %rdx
movq 0x8(%rcx,%rsi), %rcx
shldq $0x1c, %rdx, %rcx
movabsq $0x3ffffffffff, %rdx    # imm = 0x3FFFFFFFFFF
andq %rdx, %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0xe8(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb7b5
movsd 0x21f55(%rip), %xmm0    # 0x2d778
ucomisd -0xe8(%rbp), %xmm0
jbe 0xb832
jmp 0xb904
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0xb902
movq -0xf0(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %rcx
movq 0x8(%rax,%rdx), %rax
shldq $0x1c, %rcx, %rax
movabsq $0x3ffffffffff, %rcx    # imm = 0x3FFFFFFFFFF
andq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x98(%rbp), %rax
movq -0x70(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd -0xe8(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0x90(%rbp), %rax
movq -0x28(%rbp), %rdx
movq %rdx, %rsi
shlq $0x5, %rsi
movl 0x10(%rax,%rsi), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
movq -0xa8(%rbp), %rax
movq (%rax,%rcx,8), %rax
movq -0xf0(%rbp), %rcx
movq (%rcx,%rdx,8), %rcx
movq -0x30(%rbp), %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rcx
movabsq $0xfffffffff, %rdx      # imm = 0xFFFFFFFFF
andq %rdx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb83a
jmp 0xb904
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb75c
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xb9de
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rax
movl %eax, %esi
xorl %edx, %edx
callq 0xbb20
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd 0x21e04(%rip), %xmm0    # 0x2d788
ucomisd (%rax,%rcx,8), %xmm0
jbe 0xb99d
movsd 0x21df5(%rip), %xmm0    # 0x2d788
movsd %xmm0, -0x118(%rbp)
jmp 0xb9b5
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x118(%rbp)
movsd -0x118(%rbp), %xmm0
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb91d
movq -0xa8(%rbp), %rdi
callq 0x2060
movq -0xa0(%rbp), %rdi
callq 0x2060
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xba50
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
cvttsd2si (%rax,%rcx,8), %rax
movl %eax, %edx
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xb9fe
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jae 0xbaa3
movq -0xc0(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2060
movq -0xc0(%rbp), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x2060
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xba58
movq -0xc0(%rbp), %rdi
callq 0x2060
movq -0x98(%rbp), %rdi
callq 0x2060
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)