// File: /workspace/github_c_makefile_star2_O1/debbiemarkslab[P]plmc/src/inference.c
// Function: PLMNegLogPosterior
static lbfgsfloatval_t PLMNegLogPosterior(void *instance,
    const lbfgsfloatval_t *x, lbfgsfloatval_t *g, const int n,
    const lbfgsfloatval_t step) {
    /* Compute the the negative log posterior, which is the negative 
       penalized log-(pseudo)likelihood and the objective for MAP inference
    */
    void **d = (void **)instance;
    alignment_t *ali = (alignment_t *) d[0];
    options_t *options = (options_t *) d[1];
    numeric_t *lambdas = (numeric_t *) d[2];

    /* Initialize log-likelihood and gradient */
    lbfgsfloatval_t fx = 0.0;
    for (int i = 0; i < ali->nParams; i++) g[i] = 0;

    /* Negative log-pseudolikelihood */
    #pragma omp parallel for
    for (int i = 0; i < ali->nSites; i++) {
        numeric_t *H = (numeric_t *) malloc(ali->nCodes * sizeof(numeric_t));
        numeric_t *P = (numeric_t *) malloc(ali->nCodes * sizeof(numeric_t));

        numeric_t siteFx = 0.0;
        /* Reshape site parameters and gradient into local blocks */
        numeric_t *Xi = (numeric_t *) malloc(ali->nCodes * ali->nCodes
            * ali->nSites * sizeof(numeric_t));
        for (int j = 0; j < i; j++)
            for (int a = 0; a < ali->nCodes; a++)
                for (int b = 0; b < ali->nCodes; b++)
                    siteE(j, a, b) = xEij(i, j, a, b);
        for (int j = i + 1; j < ali->nSites; j++)
            for (int a = 0; a < ali->nCodes; a++)
                for (int b = 0; b < ali->nCodes; b++)
                    siteE(j, a, b) = xEij(i, j, a, b);
        for (int a = 0; a < ali->nCodes; a++) siteH(i, a) = xHi(i, a);

        numeric_t *Di = (numeric_t *) malloc(ali->nCodes * ali->nCodes
        * ali->nSites * sizeof(numeric_t));
        for (int d = 0; d < ali->nCodes * ali->nCodes * ali->nSites; d++)
            Di[d] = 0.0;

        /* Site negative conditional log likelihoods */
        for (int s = 0; s < ali->nSeqs; s++) {
            /* Compute potentials */
            for (int a = 0; a < ali->nCodes; a++) H[a] = siteH(i, a);
            for (int j = 0; j < i; j++)
                for (int a = 0; a < ali->nCodes; a++)
                    H[a] += siteE(j, a, seq(s, j));
            for (int j = i + 1; j < ali->nSites; j++)
                for (int a = 0; a < ali->nCodes; a++)
                    H[a] += siteE(j, a, seq(s, j));

            /* Conditional distribution given sequence background */
            numeric_t scale = H[0];
            for (int a = 1; a < ali->nCodes; a++)
                scale = (scale >= H[a] ? scale : H[a]);
            for (int a = 0; a < ali->nCodes; a++) P[a] = exp(H[a] - scale);
            numeric_t Z = 0;
            for (int a = 0; a < ali->nCodes; a++) Z += P[a];
            numeric_t Zinv = 1.0 / Z;
            for (int a = 0; a < ali->nCodes; a++) P[a] *= Zinv;


            /* Log-likelihood contributions are scaled by sequence weight */
            numeric_t w = ali->weights[s];	
            siteFx -= w * log(P[seq(s, i)]);

            /* Field gradient */
            siteDH(i, seq(s, i)) -= w;
            for (int a = 0; a < ali->nCodes; a++)
                siteDH(i, a) -= -w * P[a];

            /* Couplings gradient */
            int ix = seq(s, i);
            for (int j = 0; j < i; j++)
                siteDE(j, ix, seq(s, j)) -= w;
            for (int j = i + 1; j < ali->nSites; j++)
                siteDE(j, ix, seq(s, j)) -= w;
            for (int j = 0; j < i; j++)
                for (int a = 0; a < ali->nCodes; a++)
                    siteDE(j, a, seq(s, j)) -= -w * P[a];
            for (int j = i + 1; j < ali->nSites; j++)
                for (int a = 0; a < ali->nCodes; a++)
                    siteDE(j, a, seq(s, j)) -= -w * P[a];
        }

        /* Contribute local loglk and gradient to global */
        #pragma omp critical
        {
        fx += siteFx;
        for (int j = 0; j < i; j++)
            for (int a = 0; a < ali->nCodes; a++)
                for (int b = 0; b < ali->nCodes; b++)
                    dEij(i, j, a, b) += siteDE(j, a, b);
        for (int j = i + 1; j < ali->nSites; j++)
            for (int a = 0; a < ali->nCodes; a++)
                for (int b = 0; b < ali->nCodes; b++)
                    dEij(i, j, a, b) += siteDE(j, a, b);
        for (int a = 0; a < ali->nCodes; a++) dHi(i, a) += siteDH(i, a);
        free(Xi);
        free(Di);
        }

        free(H);
        free(P);
    }

    ali->negLogLk = fx;

    /* Gaussian priors */
    for (int i = 0; i < ali->nSites; i++)
        for (int ai = 0; ai < ali->nCodes; ai++) {
            dHi(i, ai) += lambdaHi(i) * 2.0 * xHi(i, ai);
            fx += lambdaHi(i) * xHi(i, ai) * xHi(i, ai);
        }

    for (int i = 0; i < ali->nSites-1; i++)
        for (int j = i + 1; j < ali->nSites; j++)
            for (int ai = 0; ai < ali->nCodes; ai++)
                for (int aj = 0; aj < ali->nCodes; aj++) {
                    dEij(i, j, ai, aj) += lambdaEij(i, j)
                        * 2.0 * xEij(i, j, ai, aj);
                    fx += lambdaEij(i, j)
                        * xEij(i, j, ai, aj) * xEij(i, j, ai, aj);
                }

    fx = PostCondition(x, g, fx, ali, options);
    return fx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq (%rdi), %r14
movq 0x8(%rdi), %rax
movq %rax, 0xa8(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xa0(%rsp)
movslq 0x68(%r14), %rdx
testq %rdx, %rdx
jle 0x8556
shlq $0x3, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1110
movl 0x4(%r14), %ebp
testl %ebp, %ebp
movq %r14, 0x68(%rsp)
movq %r12, 0x78(%rsp)
xorpd %xmm0, %xmm0
jle 0x8f53
movsd %xmm0, 0x18(%rsp)
movl $0x1, %eax
movl $0x8, %ecx
movq %rcx, 0x80(%rsp)
xorl %ecx, %ecx
movq %rbx, %r15
movq %r12, 0x98(%rsp)
movq %rcx, (%rsp)
movq %r15, 0xc0(%rsp)
movq %rax, 0x20(%rsp)
movslq 0x8(%r14), %r14
movl %r14d, %r13d
leaq (,%r14,8), %r15
movq %r15, %rdi
callq 0x11a0
movq %rax, 0x60(%rsp)
movq %r15, %rdi
callq 0x11a0
movq %rax, 0x30(%rsp)
movl %r14d, %eax
movq %rbp, 0x38(%rsp)
imull %ebp, %eax
movq %r14, 0x8(%rsp)
imull %r14d, %eax
movl %eax, 0x90(%rsp)
movslq %eax, %rdi
shlq $0x3, %rdi
movq %rdi, 0xb8(%rsp)
callq 0x11a0
movq %rax, 0x70(%rsp)
movq (%rsp), %rax
testq %rax, %rax
je 0x86aa
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%rsp), %rdx
leal (%rdx,%rax), %ecx
imull %edx, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
imull %r13d, %eax
addl 0x38(%rsp), %eax
imull %r13d, %eax
movl %r13d, %ecx
imull %r13d, %ecx
movl %ecx, 0x50(%rsp)
movq %r13, %rdx
imulq %r13, %rdx
shlq $0x3, %rdx
leaq (,%r13,8), %rsi
movq 0x70(%rsp), %rdi
xorl %r8d, %r8d
testl %r13d, %r13d
jle 0x869a
movq %rdi, %r9
movl %eax, %r10d
xorl %r11d, %r11d
movq %r13, %r14
movq %r9, %rbp
movl %r10d, %ecx
movslq %ecx, %rcx
movsd (%r12,%rcx,8), %xmm0
movsd %xmm0, (%rbp)
incl %ecx
addq %rsi, %rbp
decq %r14
jne 0x8671
incq %r11
addl 0x8(%rsp), %r10d
addq $0x8, %r9
cmpq %r13, %r11
jne 0x8668
incq %r8
addl 0x50(%rsp), %eax
addq %rdx, %rdi
cmpq (%rsp), %r8
jne 0x865a
movq (%rsp), %rax
incq %rax
movq 0x38(%rsp), %rsi
movslq %esi, %rcx
movq %rax, 0x40(%rsp)
movq %rcx, 0xb0(%rsp)
cmpq %rcx, %rax
jge 0x87f7
movl %r13d, %edi
imull %r13d, %edi
movl %r13d, %edx
imull %esi, %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%rsp), %rcx
addl %ecx, %eax
imull %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl %esi, %eax
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %r11
addl %r11d, %ecx
movl %edi, 0x48(%rsp)
imull %edi, %ecx
movl %ecx, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq %rax, %rcx
imulq %rax, %rcx
movq 0x80(%rsp), %rsi
imulq %rcx, %rsi
addq 0x70(%rsp), %rsi
movq %rsi, 0x28(%rsp)
shlq $0x3, %rcx
movq %rcx, 0x88(%rsp)
imull %r13d, %eax
movl %eax, 0x94(%rsp)
cmpl $0x0, 0x8(%rsp)
jle 0x87cb
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r11d, %eax
imull %r11d, %eax
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
addl (%rsp), %esi
imull 0x94(%rsp), %esi
movq 0x28(%rsp), %r10
movl 0x10(%rsp), %r8d
xorl %ecx, %ecx
movq %r13, %rbp
movl %esi, 0x50(%rsp)
movl %esi, %edi
movq %r10, %r9
movl %r8d, %eax
movq (%rsp), %r12
movq 0x78(%rsp), %r14
cmpq %r11, %r12
movl %eax, %esi
cmovbl %edi, %esi
addl %edx, %esi
movslq %esi, %rsi
movsd (%r14,%rsi,8), %xmm0
movsd %xmm0, (%r9)
incl %eax
addq %r15, %r9
addl %r13d, %edi
decq %rbp
jne 0x8791
incq %rcx
addl %r13d, %r8d
addq $0x8, %r10
movl 0x50(%rsp), %esi
incl %esi
cmpq %r13, %rcx
jne 0x8779
incq %r11
movl 0x10(%rsp), %eax
addl 0x48(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rax
addq 0x88(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq 0x38(%rsp), %r11
jne 0x8746
cmpl $0x0, 0x8(%rsp)
movq 0x70(%rsp), %r12
movq 0xb0(%rsp), %rdi
jle 0x8842
movl %r13d, %eax
imull %r13d, %eax
imull (%rsp), %eax
shlq $0x3, %rdi
movq %r13, %rcx
movq 0x98(%rsp), %rdx
movq %r12, %rsi
cltq
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi,%rax,8)
addq $0x8, %rsi
addl %r13d, %eax
addq %rdi, %rdx
decq %rcx
jne 0x8828
movq 0xb8(%rsp), %rdi
callq 0x11a0
movl 0x90(%rsp), %ecx
testl %ecx, %ecx
movq 0x68(%rsp), %r15
movq 0x60(%rsp), %rbp
movq %rax, 0x8(%rsp)
jle 0x8879
movl %ecx, %edx
shlq $0x3, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1110
cmpl $0x0, (%r15)
movq (%rsp), %r13
xorpd %xmm1, %xmm1
jle 0x8cbc
xorl %r10d, %r10d
movl 0x8(%r15), %eax
testl %eax, %eax
jle 0x88bf
movl %eax, %ecx
imull %eax, %ecx
imull %r13d, %ecx
movq %r12, %rdx
xorl %esi, %esi
movl %ecx, %edi
movsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rbp,%rsi,8)
incq %rsi
addq $0x8, %rdx
addl %eax, %ecx
cmpq %rsi, %rax
jne 0x88a4
testq %r13, %r13
je 0x8910
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
jle 0x8907
movq 0x20(%r15), %rsi
movl 0x4(%r15), %edi
imull %r10d, %edi
addl %edx, %edi
movslq %edi, %rdi
movl (%rsi,%rdi,4), %esi
addl %ecx, %esi
imull %eax, %esi
movslq %esi, %rsi
leaq (%r12,%rsi,8), %rsi
xorl %edi, %edi
movsd (%rsi,%rdi,8), %xmm0
addsd (%rbp,%rdi,8), %xmm0
movsd %xmm0, (%rbp,%rdi,8)
incq %rdi
cmpq %rdi, %rax
jne 0x88ee
incl %edx
addl %eax, %ecx
cmpq %rdx, %r13
jne 0x88c8
movslq 0x4(%r15), %rcx
cmpq %rcx, 0x40(%rsp)
jge 0x897b
movl %ecx, %ecx
movl %r10d, %edx
imull %ecx, %edx
movslq %edx, %rdx
movq 0x20(%rsp), %rdi
movl %edi, %esi
imull %eax, %esi
testl %eax, %eax
jle 0x8971
leaq (,%rdi,4), %r8
addq 0x20(%r15), %r8
movl (%r8,%rdx,4), %r8d
addl %esi, %r8d
imull %eax, %r8d
movslq %r8d, %r8
leaq (%r12,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r8,%r9,8), %xmm0
addsd (%rbp,%r9,8), %xmm0
movsd %xmm0, (%rbp,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x8955
incq %rdi
addl %eax, %esi
cmpq %rcx, %rdi
jne 0x8930
movsd %xmm1, 0x28(%rsp)
movsd (%rbp), %xmm0
cmpl $0x2, %eax
jl 0x89bd
movl $0x1, %ecx
movsd (%rbp,%rcx,8), %xmm1
movapd %xmm1, %xmm3
cmplesd %xmm0, %xmm3
movapd %xmm3, %xmm2
andnpd %xmm1, %xmm2
andpd %xmm0, %xmm3
orpd %xmm2, %xmm3
incq %rcx
movapd %xmm3, %xmm0
cmpq %rcx, %rax
jne 0x8990
jmp 0x89c1
movapd %xmm0, %xmm3
movl 0x8(%r15), %ecx
testl %ecx, %ecx
movq %r10, 0x10(%rsp)
jle 0x8a0e
xorl %r14d, %r14d
movq 0x30(%rsp), %r13
movapd %xmm3, 0x50(%rsp)
movsd (%rbp,%r14,8), %xmm0
subsd %xmm3, %xmm0
callq 0x1230
movapd 0x50(%rsp), %xmm3
movsd %xmm0, (%r13,%r14,8)
incq %r14
movslq 0x8(%r15), %rcx
cmpq %rcx, %r14
jl 0x89dc
movq (%rsp), %r13
movq 0x10(%rsp), %r10
movl %ecx, %eax
xorpd %xmm0, %xmm0
testl %ecx, %ecx
jle 0x8a2e
xorl %edx, %edx
movq 0x30(%rsp), %rsi
addsd (%rsi,%rdx,8), %xmm0
incq %rdx
cmpq %rdx, %rax
jne 0x8a1f
jmp 0x8a33
movq 0x30(%rsp), %rsi
testl %ecx, %ecx
jle 0x8a5b
movsd 0x5629(%rip), %xmm1     # 0xe068
divsd %xmm0, %xmm1
xorl %ecx, %ecx
movsd (%rsi,%rcx,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x8a45
movq 0x50(%r15), %rax
movsd (%rax,%r10,8), %xmm0
movsd %xmm0, 0x48(%rsp)
movslq 0x4(%r15), %rax
movslq %r10d, %r14
imulq %r14, %rax
leaq (,%r13,4), %rcx
addq 0x20(%r15), %rcx
movslq (%rcx,%rax,4), %rax
movq 0x30(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm0
callq 0x1130
movsd 0x48(%rsp), %xmm3
movq 0x20(%r15), %rcx
movl 0x4(%r15), %edx
movl 0x8(%r15), %eax
imull %edx, %r14d
movslq %r14d, %rsi
movq 0x30(%rsp), %r14
leaq (%rcx,%r13,4), %rdi
movq %rsi, 0x50(%rsp)
movl (%rdi,%rsi,4), %edi
movl %eax, %r8d
imull %r13d, %r8d
addl %edi, %r8d
imull %eax, %r8d
addl %edi, %r8d
movslq %r8d, %r8
movq 0x8(%rsp), %rsi
movsd (%rsi,%r8,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%rsi,%r8,8)
testl %eax, %eax
jle 0x8b27
movl %eax, %r8d
imull %r8d, %r8d
imull %r13d, %r8d
movq 0x8(%rsp), %r9
xorl %r10d, %r10d
movl %r8d, %r11d
movsd (%r14,%r10,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%r9,%r11,8), %xmm1
movsd %xmm1, (%r9,%r11,8)
incq %r10
addq $0x8, %r9
addl %eax, %r8d
cmpq %r10, %rax
jne 0x8aff
movslq %edx, %r8
testq %r13, %r13
movsd 0x18(%rsp), %xmm2
movq 0x8(%rsp), %rsi
je 0x8b7a
movl %r8d, %r9d
imull 0x10(%rsp), %r9d
movslq %r9d, %r9
leaq (%rcx,%r9,4), %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
movl (%r9,%r11,4), %ebp
addl %r10d, %ebp
imull %eax, %ebp
addl %edi, %ebp
movslq %ebp, %r14
movsd (%rsi,%r14,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%rsi,%r14,8)
incq %r11
addl %eax, %r10d
cmpq %r11, %r13
jne 0x8b50
cmpq %r8, 0x40(%rsp)
jge 0x8bc7
movl %edx, %r9d
imull 0x10(%rsp), %r9d
movslq %r9d, %r9
leaq (%rcx,%r9,4), %r9
movq 0x20(%rsp), %r11
movl %r11d, %r10d
imull %eax, %r10d
movl (%r9,%r11,4), %ebp
addl %r10d, %ebp
imull %eax, %ebp
addl %edi, %ebp
movslq %ebp, %r14
movsd (%rsi,%r14,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%rsi,%r14,8)
incq %r11
addl %eax, %r10d
cmpq %r11, %rdx
jne 0x8b9d
testq %r13, %r13
movq 0x60(%rsp), %rbp
je 0x8c31
movq 0x50(%rsp), %rsi
leaq (%rcx,%rsi,4), %rdi
xorl %r9d, %r9d
xorl %r10d, %r10d
testl %eax, %eax
movq 0x30(%rsp), %r13
jle 0x8c22
movl (%rdi,%r10,4), %r11d
addl %r9d, %r11d
imull %eax, %r11d
movslq %r11d, %r11
movq 0x8(%rsp), %rsi
leaq (%rsi,%r11,8), %r11
xorl %r14d, %r14d
movsd (%r13,%r14,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%r11,%r14,8), %xmm1
movsd %xmm1, (%r11,%r14,8)
incq %r14
cmpq %r14, %rax
jne 0x8c03
incq %r10
addl %eax, %r9d
movq (%rsp), %r13
cmpq %r13, %r10
jne 0x8be0
cmpq %r8, 0x40(%rsp)
movq 0x30(%rsp), %r10
movq 0x8(%rsp), %r11
jge 0x8c98
movl %edx, %edx
movq 0x50(%rsp), %rsi
leaq (%rcx,%rsi,4), %rcx
movq 0x20(%rsp), %rdi
movl %edi, %esi
imull %eax, %esi
testl %eax, %eax
jle 0x8c8e
movl (%rcx,%rdi,4), %r8d
addl %esi, %r8d
imull %eax, %r8d
movslq %r8d, %r8
leaq (%r11,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r10,%r9,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%r8,%r9,8), %xmm1
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x8c70
incq %rdi
addl %eax, %esi
cmpq %rdx, %rdi
jne 0x8c57
mulsd %xmm0, %xmm3
movsd 0x28(%rsp), %xmm1
subsd %xmm3, %xmm1
movq 0x10(%rsp), %r10
incq %r10
movslq (%r15), %rax
cmpq %rax, %r10
jl 0x888e
jmp 0x8cc2
movsd 0x18(%rsp), %xmm2
testq %r13, %r13
je 0x8d63
movl 0x8(%r15), %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leal (%rcx,%r13), %edx
imull %r13d, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movl %eax, %r12d
imull %eax, %r12d
imull %r12d, %ecx
movq %rax, %rsi
imulq %rax, %rsi
shlq $0x3, %rsi
leaq (,%rax,8), %rdi
movq 0x8(%rsp), %r8
xorl %r9d, %r9d
testl %eax, %eax
jle 0x8d54
movl 0x4(%r15), %r10d
imull %eax, %r10d
addl %ecx, %r10d
movq %r8, %r11
xorl %r14d, %r14d
movq %rax, %r13
movq %r11, %rbp
movl %r10d, %edx
movsd (%rbp), %xmm0
movslq %edx, %rdx
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incl %edx
addq %rdi, %rbp
decq %r13
jne 0x8d29
incq %r14
addl %eax, %r10d
addq $0x8, %r11
cmpq %rax, %r14
jne 0x8d20
incq %r9
addl %r12d, %ecx
addq %rsi, %r8
cmpq (%rsp), %r9
jne 0x8d0b
movslq 0x4(%r15), %rax
movq %rax, 0x18(%rsp)
cmpq %rax, 0x40(%rsp)
jge 0x8e96
movq 0x68(%rsp), %rax
movl 0x8(%rax), %r9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%rsp), %rcx
addl %ecx, %eax
imull %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %r9d, %rsi
movl %r9d, %edi
movq 0x18(%rsp), %rax
imull %eax, %edi
movl %eax, %eax
movq %rax, 0x48(%rsp)
movl %esi, %eax
imull %esi, %eax
movq 0x20(%rsp), %rbp
addl %ebp, %ecx
movl %eax, 0x28(%rsp)
imull %eax, %ecx
movl %ecx, 0x10(%rsp)
movq %rsi, %rcx
imulq %rsi, %rcx
movq 0x80(%rsp), %rax
imulq %rcx, %rax
movq 0x8(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x50(%rsp)
shlq $0x3, %rcx
movq %rcx, 0x38(%rsp)
shlq $0x3, %rsi
testl %r9d, %r9d
jle 0x8e71
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %ebp, %eax
imull %ebp, %eax
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl (%rsp), %r14d
imull 0x28(%rsp), %r14d
movq 0x50(%rsp), %r11
movl 0x10(%rsp), %r15d
xorl %r10d, %r10d
movq %r9, %rcx
movl %r14d, %eax
movq %r11, %r13
movl %r15d, %r8d
movq (%rsp), %r12
cmpq %rbp, %r12
movsd (%r13), %xmm0
movl %r8d, %edx
cmovbl %eax, %edx
addl %edi, %edx
movslq %edx, %rdx
addsd (%rbx,%rdx,8), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incl %r8d
addq %rsi, %r13
addl %r9d, %eax
decq %rcx
jne 0x8e33
incq %r10
addl %r9d, %r15d
addq $0x8, %r11
incl %r14d
cmpq %r9, %r10
jne 0x8e23
incq %rbp
movl 0x28(%rsp), %eax
addl %eax, 0x10(%rsp)
movq 0x50(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
cmpq 0x48(%rsp), %rbp
jne 0x8df0
movq 0x68(%rsp), %r14
movslq 0x8(%r14), %rax
testq %rax, %rax
movq 0xc0(%rsp), %r15
movq 0x18(%rsp), %r8
jle 0x8ee7
movl %eax, %ecx
imull %ecx, %ecx
imull (%rsp), %ecx
shlq $0x3, %r8
movq %rax, %rdx
movq %r15, %rsi
movq 0x8(%rsp), %rdi
movslq %ecx, %rcx
movsd (%rdi,%rcx,8), %xmm0
addsd (%rsi), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rdi
addl %eax, %ecx
addq %r8, %rsi
decq %rdx
jne 0x8ec9
addsd %xmm1, %xmm2
movsd %xmm2, 0x18(%rsp)
movq 0x70(%rsp), %rdi
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1050
movq 0x60(%rsp), %rdi
callq 0x1050
movq 0x30(%rsp), %rdi
callq 0x1050
movslq 0x4(%r14), %rbp
movq 0x20(%rsp), %rax
incq %rax
addq $0x8, 0x80(%rsp)
addq $0x8, 0x98(%rsp)
addq $0x8, %r15
movq 0x40(%rsp), %rdx
movq %rdx, %rcx
cmpq %rbp, %rdx
movq 0x78(%rsp), %r12
jl 0x8595
jmp 0x8f59
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm13
movsd %xmm13, 0x70(%r14)
testl %ebp, %ebp
jle 0x8fdf
movl 0x8(%r14), %eax
movl %ebp, %ecx
leaq (,%rcx,8), %rdx
xorl %esi, %esi
movq %r12, %rdi
movq %rbx, %r8
movq 0xa0(%rsp), %r11
testl %eax, %eax
jle 0x8fcf
movq %rax, %r9
xorl %r10d, %r10d
movsd (%r11,%rsi,8), %xmm0
addsd %xmm0, %xmm0
mulsd (%rdi,%r10), %xmm0
addsd (%r8,%r10), %xmm0
movsd %xmm0, (%r8,%r10)
movsd (%rdi,%r10), %xmm0
movsd (%r11,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm13
addq %rdx, %r10
decq %r9
jne 0x8f92
incq %rsi
addq $0x8, %r8
addq $0x8, %rdi
cmpq %rcx, %rsi
jne 0x8f88
movq %rbx, 0x40(%rsp)
cmpl $0x2, %ebp
jl 0x92cf
leal -0x2(%rbp), %eax
movl %eax, 0x88(%rsp)
movl 0x8(%r14), %ecx
movl %ecx, %r14d
imull %ebp, %r14d
movd %ecx, %xmm0
pshufd $0x50, %xmm0, %xmm1     # xmm1 = xmm0[0,0,1,1]
movd %ebp, %xmm0
pshufd $0x50, %xmm0, %xmm2     # xmm2 = xmm0[0,0,1,1]
movd %r14d, %xmm0
pshufd $0x50, %xmm0, %xmm3     # xmm3 = xmm0[0,0,1,1]
movl %ecx, %eax
imull %ecx, %eax
movl %eax, 0x20(%rsp)
xorl %eax, %eax
movl $0x1, %esi
pcmpeqd %xmm4, %xmm4
movq %rbp, 0x38(%rsp)
movq 0xa0(%rsp), %r12
movq 0x78(%rsp), %rbx
movl %eax, %r8d
leal 0x1(%r8), %edi
movd %eax, %xmm0
pshufd $0x50, %xmm0, %xmm5     # xmm5 = xmm0[0,0,1,1]
movdqa %xmm5, %xmm0
paddd %xmm4, %xmm0
leal -0x1(%r8), %eax
imull %r8d, %eax
movl %eax, %r9d
shrl $0x1f, %r9d
addl %eax, %r9d
sarl %r9d
pmulld %xmm5, %xmm0
movdqa %xmm0, %xmm6
psrld $0x1f, %xmm6
paddd %xmm0, %xmm6
psrad $0x1, %xmm6
movl %esi, 0x60(%rsp)
addl %esi, %r9d
movl 0x20(%rsp), %eax
movl %eax, %r10d
imull %r9d, %r10d
imull %eax, %r9d
movl %edi, 0x18(%rsp)
movl %edi, %r15d
movq %r8, %rdi
testl %ecx, %ecx
movl %r9d, 0x28(%rsp)
movl %r10d, 0x48(%rsp)
jle 0x9293
xorl %eax, %eax
cmpl %r15d, %edi
setb %al
movd %r15d, %xmm0
pshufd $0x50, %xmm0, %xmm9     # xmm9 = xmm0[0,0,1,1]
movdqa %xmm9, %xmm0
paddd %xmm4, %xmm0
leal -0x1(%r15), %esi
imull %r15d, %esi
movl %esi, %ebp
shrl $0x1f, %ebp
addl %esi, %ebp
sarl %ebp
pmulld %xmm9, %xmm0
paddd %xmm6, %xmm9
movdqa %xmm0, %xmm10
psrld $0x1f, %xmm10
paddd %xmm0, %xmm10
psrad $0x1, %xmm10
paddd %xmm5, %xmm10
movdqa %xmm1, %xmm7
pmulld %xmm9, %xmm7
movdqa %xmm1, %xmm8
pmulld %xmm10, %xmm8
movd %eax, %xmm11
pshufd $0x50, %xmm11, %xmm0    # xmm0 = xmm11[0,0,1,1]
pslld $0x1f, %xmm0
blendvps %xmm0, %xmm10, %xmm9
pshufd $0x44, %xmm11, %xmm0    # xmm0 = xmm11[0,1,0,1]
paddd %xmm2, %xmm9
movd %xmm9, %eax
movslq %eax, %r13
pextrd $0x1, %xmm9, %eax
cltq
movq %rax, 0x10(%rsp)
addl %edi, %ebp
movl 0x20(%rsp), %esi
movl %esi, %eax
imull %ebp, %eax
imull %esi, %ebp
xorl %edx, %edx
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
pslld $0x1f, %xmm0
movl %r9d, %esi
movq %rsi, (%rsp)
movl %edx, 0x8(%rsp)
movd %edx, %xmm9
pshufd $0x50, %xmm9, %xmm9     # xmm9 = xmm9[0,0,1,1]
movdqa %xmm7, %xmm10
paddd %xmm9, %xmm10
pmulld %xmm1, %xmm10
movl %ebp, 0x50(%rsp)
movl %eax, 0x30(%rsp)
movl %eax, %esi
xorl %r11d, %r11d
movq 0x40(%rsp), %r9
movq 0x10(%rsp), %rdx
movl %r14d, %r8d
leal (%r10,%r11), %r14d
movd %r11d, %xmm11
pshufd $0x50, %xmm11, %xmm11   # xmm11 = xmm11[0,0,1,1]
cmpl %r15d, %edi
movdqa %xmm11, %xmm12
paddd %xmm8, %xmm12
pmulld %xmm1, %xmm12
paddd %xmm10, %xmm11
paddd %xmm9, %xmm12
blendvps %xmm0, %xmm12, %xmm11
movsd (%r12,%r13,8), %xmm12
paddd %xmm3, %xmm11
movq %r13, %rax
movq %r15, %r13
movq %rdi, %r15
movd %xmm11, %edi
addsd %xmm12, %xmm12
movslq %edi, %rdi
mulsd (%rbx,%rdi,8), %xmm12
movq (%rsp), %rdi
leal (%rdi,%r11), %edi
cmovbl %esi, %r14d
cmovbl %ebp, %edi
addl %r8d, %r14d
movslq %r14d, %r14
addsd (%r9,%r14,8), %xmm12
movsd %xmm12, (%r9,%r14,8)
pextrd $0x1, %xmm11, %r14d
movsd (%r12,%rdx,8), %xmm11
movslq %r14d, %r14
mulsd (%rbx,%r14,8), %xmm11
movl %r8d, %r14d
addl %r8d, %edi
movslq %edi, %rdi
mulsd (%rbx,%rdi,8), %xmm11
movq %r15, %rdi
movq %r13, %r15
movq %rax, %r13
addsd %xmm11, %xmm13
incl %r11d
addl %ecx, %esi
addl %ecx, %ebp
cmpl %r11d, %ecx
jne 0x91b0
movl 0x8(%rsp), %edx
incl %edx
addl %ecx, %r10d
movq (%rsp), %rsi
addl %ecx, %esi
movl 0x30(%rsp), %eax
incl %eax
movl 0x50(%rsp), %ebp
incl %ebp
cmpl %ecx, %edx
jne 0x9176
incl %r15d
movl 0x20(%rsp), %eax
movl 0x48(%rsp), %r10d
addl %eax, %r10d
movl 0x28(%rsp), %r9d
addl %eax, %r9d
movq 0x38(%rsp), %rbp
cmpl %ebp, %r15d
jne 0x90a8
movl 0x60(%rsp), %esi
incl %esi
cmpl 0x88(%rsp), %edi
movl 0x18(%rsp), %eax
jne 0x9044
movq 0x78(%rsp), %rdi
movq 0x40(%rsp), %rsi
movapd %xmm13, %xmm0
movq 0x68(%rsp), %rdx
movq 0xa8(%rsp), %rcx
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc1b6