// File: /workspace/github_c_makefile_star2_O3/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 $0xd8, %rsp
movq %rdx, %rbx
movq %rsi, %rcx
movq (%rdi), %r14
movq 0x8(%rdi), %rax
movq %rax, 0xb8(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xa8(%rsp)
movslq 0x68(%r14), %rdx
testq %rdx, %rdx
movq %rsi, 0x38(%rsp)
jle 0x78fa
shlq $0x3, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1110
movq 0x38(%rsp), %rcx
movl 0x4(%r14), %r13d
testl %r13d, %r13d
movq %rbx, 0x80(%rsp)
movq %r14, 0x58(%rsp)
jle 0x83a2
movl 0x8(%r14), %ebp
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movl $0x1, %eax
movl $0x8, %edx
movq %rdx, 0x88(%rsp)
xorl %r14d, %r14d
movq %rcx, 0xb0(%rsp)
movq %rbx, 0xd0(%rsp)
movq %rax, 0x50(%rsp)
movslq %ebp, %rax
movq %rax, 0x48(%rsp)
leaq (,%rax,8), %r15
movq %r15, %rdi
callq 0x11b0
movq %rax, 0x98(%rsp)
movq %r15, %rdi
callq 0x11b0
movq %rax, 0x78(%rsp)
movl %ebp, %r12d
movq %r13, 0x40(%rsp)
imull %r13d, %r12d
movl %r12d, %eax
imull %ebp, %eax
movl %eax, 0xa0(%rsp)
movslq %eax, %rdi
shlq $0x3, %rdi
movq %rdi, 0xc8(%rsp)
callq 0x11b0
movq %rax, 0x28(%rsp)
movl %ebp, %edi
testq %r14, %r14
movq %r14, 0x10(%rsp)
je 0x7a50
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r14d, %eax
imull %r14d, %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movslq %r12d, %rax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,8), %rdx
movq 0x48(%rsp), %r13
movl %r13d, %ecx
imull %r13d, %ecx
movl %ecx, 0x60(%rsp)
imull %ecx, %ebx
imulq %r13, %r13
shlq $0x3, %r13
movq 0x28(%rsp), %rax
xorl %r9d, %r9d
testl %ebp, %ebp
jle 0x7a3c
movq %rax, %r8
movl %ebx, %r11d
xorl %esi, %esi
movslq %r11d, %rcx
leaq (%rdx,%rcx,8), %r14
movq %r8, %r10
xorl %ecx, %ecx
movsd (%r14,%rcx,8), %xmm0
movsd %xmm0, (%r10)
incq %rcx
addq %r15, %r10
cmpq %rcx, %rdi
jne 0x7a17
incq %rsi
addl %ebp, %r11d
addq $0x8, %r8
cmpq %rdi, %rsi
jne 0x7a0b
incq %r9
addl 0x60(%rsp), %ebx
addq %r13, %rax
movq 0x10(%rsp), %r14
cmpq %r14, %r9
jne 0x79ff
leaq 0x1(%r14), %rax
movslq 0x40(%rsp), %rcx
movq %rax, 0x70(%rsp)
movq %rcx, 0xc0(%rsp)
cmpq %rcx, %rax
jge 0x7b8a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rcx
addl %ecx, %eax
imull %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl 0x40(%rsp), %eax
movq %rax, 0x90(%rsp)
movl %ebp, %eax
imull %ebp, %eax
movq 0x50(%rsp), %r9
addl %r9d, %ecx
movl %eax, 0x30(%rsp)
imull %eax, %ecx
movl %ecx, 0x18(%rsp)
movq 0x48(%rsp), %rax
imulq %rax, %rax
movq 0x88(%rsp), %rcx
imulq %rax, %rcx
addq 0x28(%rsp), %rcx
movq %rcx, 0x8(%rsp)
shlq $0x3, %rax
movq %rax, 0x48(%rsp)
testl %ebp, %ebp
jle 0x7b62
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r9d, %eax
imull %r9d, %eax
movl %eax, %r10d
shrl $0x1f, %r10d
addl %eax, %r10d
sarl %r10d
addl 0x10(%rsp), %r10d
imull 0x30(%rsp), %r10d
movq 0x8(%rsp), %r11
movl 0x18(%rsp), %ebx
xorl %ecx, %ecx
movq %rdi, %rax
movl %r10d, 0x60(%rsp)
movq %r11, %r14
movl %ebx, %r8d
movq 0x38(%rsp), %r13
movq 0x10(%rsp), %rsi
cmpq %r9, %rsi
movl %r8d, %edx
cmovbl %r10d, %edx
addl %r12d, %edx
movslq %edx, %rdx
movsd (%r13,%rdx,8), %xmm0
movsd %xmm0, (%r14)
incl %r8d
addq %r15, %r14
addl %ebp, %r10d
decq %rax
jne 0x7b22
incq %rcx
addl %ebp, %ebx
addq $0x8, %r11
movl 0x60(%rsp), %r10d
incl %r10d
cmpq %rdi, %rcx
jne 0x7b0a
incq %r9
movl 0x30(%rsp), %eax
addl %eax, 0x18(%rsp)
movq 0x8(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq 0x90(%rsp), %r9
jne 0x7ad3
testl %ebp, %ebp
movq 0x10(%rsp), %r14
movq 0xc0(%rsp), %rsi
jle 0x7bcf
movl %ebp, %ecx
imull %ecx, %ecx
imull %r14d, %ecx
shlq $0x3, %rsi
movq 0xb0(%rsp), %rax
movq 0x28(%rsp), %rdx
movslq %ecx, %rcx
movsd (%rax), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
addq $0x8, %rdx
addl %ebp, %ecx
addq %rsi, %rax
decq %rdi
jne 0x7bb5
movq 0xc8(%rsp), %rdi
callq 0x11b0
movl 0xa0(%rsp), %ecx
testl %ecx, %ecx
movq 0x40(%rsp), %r13
movq 0x98(%rsp), %r12
movq 0x78(%rsp), %rbx
movq %rax, 0x8(%rsp)
jle 0x7c0e
movl %ecx, %edx
shlq $0x3, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1110
movq 0x58(%rsp), %rax
cmpl $0x0, (%rax)
jle 0x8025
xorpd %xmm1, %xmm1
xorl %r15d, %r15d
movq 0x28(%rsp), %r10
movq 0x70(%rsp), %r9
movl %ebp, %eax
testl %ebp, %ebp
jle 0x7c5c
movl %ebp, %ecx
imull %ebp, %ecx
imull %r14d, %ecx
movq %r10, %rdx
xorl %esi, %esi
movl %ecx, %edi
movsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%r12,%rsi,8)
incq %rsi
addq $0x8, %rdx
addl %ebp, %ecx
cmpq %rsi, %rax
jne 0x7c41
testq %r14, %r14
je 0x7cb6
movl %r13d, %ecx
imull %r15d, %ecx
xorl %edx, %edx
xorl %esi, %esi
testl %ebp, %ebp
jle 0x7cad
movq 0x58(%rsp), %rdi
movq 0x20(%rdi), %rdi
leal (%rcx,%rsi), %r8d
movslq %r8d, %r8
movl (%rdi,%r8,4), %edi
addl %edx, %edi
imull %ebp, %edi
movslq %edi, %rdi
leaq (%r10,%rdi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
addsd (%r12,%r8,8), %xmm0
movsd %xmm0, (%r12,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x7c93
incl %esi
addl %ebp, %edx
cmpq %rsi, %r14
jne 0x7c6c
movslq %r13d, %rcx
cmpq %rcx, %r9
jge 0x7d23
movl %r13d, %ecx
movl %r15d, %edx
imull %r13d, %edx
movslq %edx, %rdx
movq 0x50(%rsp), %rdi
movl %edi, %esi
imull %ebp, %esi
testl %ebp, %ebp
jle 0x7d19
leaq (,%rdi,4), %r8
movq 0x58(%rsp), %r9
addq 0x20(%r9), %r8
movl (%r8,%rdx,4), %r8d
addl %esi, %r8d
imull %ebp, %r8d
movslq %r8d, %r8
leaq (%r10,%r8,8), %r8
xorl %r9d, %r9d
movsd (%r8,%r9,8), %xmm0
addsd (%r12,%r9,8), %xmm0
movsd %xmm0, (%r12,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x7cff
incq %rdi
addl %ebp, %esi
cmpq %rcx, %rdi
jne 0x7cd5
movsd %xmm1, 0x18(%rsp)
movsd (%r12), %xmm0
cmpl $0x2, %ebp
jl 0x7d66
movl $0x1, %ecx
movsd (%r12,%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 0x7d39
jmp 0x7d6a
movapd %xmm0, %xmm3
testl %ebp, %ebp
movq 0x58(%rsp), %rbp
jle 0x7de7
xorl %r14d, %r14d
movapd %xmm3, 0x60(%rsp)
movsd (%r12,%r14,8), %xmm0
subsd %xmm3, %xmm0
callq 0x1240
movapd 0x60(%rsp), %xmm3
movsd %xmm0, (%rbx,%r14,8)
incq %r14
movslq 0x8(%rbp), %rax
cmpq %rax, %r14
jl 0x7d7c
testl %eax, %eax
movq 0x10(%rsp), %r14
jle 0x7de7
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rbx,%rcx,8), %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x7db2
testl %eax, %eax
jle 0x7de7
movsd 0x529d(%rip), %xmm1     # 0xd068
divsd %xmm0, %xmm1
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x7dd1
movq 0x50(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movslq 0x4(%rbp), %rax
movslq %r15d, %rbx
imulq %rbx, %rax
leaq (,%r14,4), %rcx
addq 0x20(%rbp), %rcx
movslq (%rcx,%rax,4), %rax
movq 0x78(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm0
callq 0x1130
movsd 0x30(%rsp), %xmm3
movq 0x20(%rbp), %rax
movl 0x4(%rbp), %r13d
movl 0x8(%rbp), %ebp
imull %r13d, %ebx
movslq %ebx, %rcx
movq 0x78(%rsp), %rbx
leaq (%rax,%r14,4), %rdx
movl (%rdx,%rcx,4), %edx
movl %ebp, %esi
imull %r14d, %esi
addl %edx, %esi
imull %ebp, %esi
addl %edx, %esi
movslq %esi, %rsi
movq 0x8(%rsp), %r10
movsd (%r10,%rsi,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%r10,%rsi,8)
testl %ebp, %ebp
jle 0x7ea4
movl %ebp, %esi
imull %ebp, %esi
imull %r14d, %esi
movq %r10, %rdi
xorl %r8d, %r8d
movl %esi, %r9d
movsd (%rbx,%r8,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%rdi,%r9,8), %xmm1
movsd %xmm1, (%rdi,%r9,8)
incq %r8
addq $0x8, %rdi
addl %ebp, %esi
cmpq %r8, %rbp
jne 0x7e7d
movq %rcx, 0x60(%rsp)
testq %r14, %r14
movsd 0x20(%rsp), %xmm2
movq 0x70(%rsp), %rcx
je 0x7ef7
movl %r13d, %esi
imull %r15d, %esi
movslq %esi, %rsi
leaq (%rax,%rsi,4), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rsi,%r8,4), %r9d
addl %edi, %r9d
imull %ebp, %r9d
addl %edx, %r9d
movslq %r9d, %r9
movsd (%r10,%r9,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%r10,%r9,8)
incq %r8
addl %ebp, %edi
cmpq %r8, %r14
jne 0x7ecc
movq %r15, %r11
movslq %r13d, %rsi
cmpq %rsi, %rcx
jge 0x7f4b
movq %r10, %r15
movl %r13d, %edi
imull %r11d, %edi
movslq %edi, %rdi
leaq (%rax,%rdi,4), %rdi
movq 0x50(%rsp), %r9
movl %r9d, %r8d
imull %ebp, %r8d
movl (%rdi,%r9,4), %r10d
addl %r8d, %r10d
imull %ebp, %r10d
addl %edx, %r10d
movslq %r10d, %r10
movsd (%r15,%r10,8), %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, (%r15,%r10,8)
incq %r9
addl %ebp, %r8d
cmpq %r9, %r13
jne 0x7f1f
testq %r14, %r14
movq %r11, %r15
movq 0x60(%rsp), %r11
je 0x7fa7
leaq (%rax,%r11,4), %rdx
xorl %edi, %edi
xorl %r8d, %r8d
testl %ebp, %ebp
jle 0x7f9d
movl (%rdx,%r8,4), %r9d
addl %edi, %r9d
imull %ebp, %r9d
movslq %r9d, %r9
movq 0x8(%rsp), %r10
leaq (%r10,%r9,8), %r9
xorl %r10d, %r10d
movsd (%rbx,%r10,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%r9,%r10,8), %xmm1
movsd %xmm1, (%r9,%r10,8)
incq %r10
cmpq %r10, %rbp
jne 0x7f7f
incq %r8
addl %ebp, %edi
cmpq %r14, %r8
jne 0x7f61
movq %rcx, %r9
cmpq %rsi, %rcx
movq 0x28(%rsp), %r10
jge 0x8001
leaq (%rax,%r11,4), %rax
movq 0x50(%rsp), %rdx
movl %edx, %ecx
imull %ebp, %ecx
testl %ebp, %ebp
jle 0x7ff7
movl (%rax,%rdx,4), %esi
addl %ecx, %esi
imull %ebp, %esi
movslq %esi, %rsi
movq 0x8(%rsp), %rdi
leaq (%rdi,%rsi,8), %rsi
xorl %edi, %edi
movsd (%rbx,%rdi,8), %xmm1
mulsd %xmm3, %xmm1
addsd (%rsi,%rdi,8), %xmm1
movsd %xmm1, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rbp
jne 0x7fdc
incq %rdx
addl %ebp, %ecx
cmpq %r13, %rdx
jne 0x7fc2
mulsd %xmm0, %xmm3
movsd 0x18(%rsp), %xmm1
subsd %xmm3, %xmm1
incq %r15
movq 0x58(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r15
jl 0x7c2d
jmp 0x802f
xorpd %xmm1, %xmm1
movsd 0x20(%rsp), %xmm2
movl %ebp, %edi
movslq %ebp, %rcx
testq %r14, %r14
je 0x80e7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r14d, %eax
imull %r14d, %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movl %r13d, %eax
imull %ebp, %eax
cltq
movq 0x80(%rsp), %rdx
leaq (%rdx,%rax,8), %rsi
movl %ecx, %eax
imull %ecx, %eax
movl %eax, 0x60(%rsp)
imull %eax, %ebx
movq %rcx, %rax
imulq %rcx, %rax
shlq $0x3, %rax
movq %rax, 0x18(%rsp)
leaq (,%rcx,8), %r9
movq 0x8(%rsp), %r10
xorl %r11d, %r11d
testl %ebp, %ebp
jle 0x80d4
movq %r10, %r12
movl %ebx, %edx
xorl %r8d, %r8d
movslq %edx, %rax
leaq (%rsi,%rax,8), %r14
movq %r12, %r15
xorl %eax, %eax
movsd (%r15), %xmm0
addsd (%r14,%rax,8), %xmm0
movsd %xmm0, (%r14,%rax,8)
incq %rax
addq %r9, %r15
cmpq %rax, %rdi
jne 0x80aa
incq %r8
addl %ebp, %edx
addq $0x8, %r12
cmpq %rdi, %r8
jne 0x809e
incq %r11
addl 0x60(%rsp), %ebx
addq 0x18(%rsp), %r10
cmpq 0x10(%rsp), %r11
jne 0x8092
movq %r13, 0x40(%rsp)
movslq %r13d, %rax
movq %rax, 0xa0(%rsp)
cmpq %rax, 0x70(%rsp)
jge 0x823c
movl %ebp, %edx
movq 0x40(%rsp), %rsi
imull %esi, %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r8
addl %r8d, %eax
imull %r8d, %eax
movl %eax, %r8d
shrl $0x1f, %r8d
addl %eax, %r8d
sarl %r8d
movl %esi, %eax
movq %rax, 0x48(%rsp)
movl %ebp, %eax
imull %ebp, %eax
movq 0x50(%rsp), %r11
addl %r11d, %r8d
movl %eax, 0x20(%rsp)
imull %eax, %r8d
movl %r8d, 0x30(%rsp)
movq %rcx, %rsi
imulq %rcx, %rsi
movq 0x88(%rsp), %rax
imulq %rsi, %rax
movq 0x8(%rsp), %r8
addq %rax, %r8
movq %r8, 0x18(%rsp)
shlq $0x3, %rsi
movq %rsi, 0x90(%rsp)
shlq $0x3, %rcx
testl %ebp, %ebp
jle 0x8214
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r11d, %eax
imull %r11d, %eax
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl 0x10(%rsp), %r12d
imull 0x20(%rsp), %r12d
movq 0x18(%rsp), %r15
movl 0x30(%rsp), %r14d
xorl %r8d, %r8d
movq %rdi, %rax
movl %r12d, 0x60(%rsp)
movq %r15, %r10
movl %r14d, %esi
movq 0x80(%rsp), %r13
movq 0x10(%rsp), %r9
cmpq %r11, %r9
movsd (%r10), %xmm0
movl %esi, %ebx
cmovbl %r12d, %ebx
addl %edx, %ebx
movslq %ebx, %rbx
addsd (%r13,%rbx,8), %xmm0
movsd %xmm0, (%r13,%rbx,8)
incl %esi
addq %rcx, %r10
addl %ebp, %r12d
decq %rax
jne 0x81cf
incq %r8
addl %ebp, %r14d
addq $0x8, %r15
movl 0x60(%rsp), %r12d
incl %r12d
cmpq %rdi, %r8
jne 0x81b4
incq %r11
movl 0x20(%rsp), %eax
addl %eax, 0x30(%rsp)
movq 0x18(%rsp), %rax
addq 0x90(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq 0x48(%rsp), %r11
jne 0x817b
testl %ebp, %ebp
movq 0xd0(%rsp), %rbx
movq 0xa0(%rsp), %r15
jle 0x8288
movl %ebp, %ecx
imull %ecx, %ecx
imull 0x10(%rsp), %ecx
leaq (,%r15,8), %rax
movq %rbx, %rdx
movq 0x8(%rsp), %rsi
movslq %ecx, %rcx
movsd (%rsi,%rcx,8), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
addq $0x8, %rsi
addl %ebp, %ecx
addq %rax, %rdx
decq %rdi
jne 0x826a
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1050
movq 0x98(%rsp), %rdi
callq 0x1050
movq 0x78(%rsp), %rdi
callq 0x1050
movq 0x50(%rsp), %rax
incq %rax
addq $0x8, 0x88(%rsp)
addq $0x8, 0xb0(%rsp)
addq $0x8, %rbx
movq 0x70(%rsp), %rcx
movq %rcx, %r14
cmpq %r15, %rcx
movq 0x40(%rsp), %r13
jl 0x793f
movsd 0x20(%rsp), %xmm0
movq 0x58(%rsp), %r11
movsd %xmm0, 0x70(%r11)
testl %r13d, %r13d
jle 0x8398
movl 0x8(%r11), %eax
movl %r13d, %ecx
movq %rcx, 0x28(%rsp)
leaq (,%rcx,8), %rcx
xorl %edx, %edx
movq 0x38(%rsp), %rsi
movq 0x80(%rsp), %rdi
movq 0xa8(%rsp), %r10
testl %eax, %eax
jle 0x8380
movsd (%r10,%rdx,8), %xmm3
movq %rax, %r8
xorl %r9d, %r9d
addsd %xmm3, %xmm3
mulsd (%rsi,%r9), %xmm3
addsd (%rdi,%r9), %xmm3
movsd %xmm3, (%rdi,%r9)
movsd (%r10,%rdx,8), %xmm3
movsd (%rsi,%r9), %xmm1
movapd %xmm3, %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm2, %xmm0
addq %rcx, %r9
decq %r8
jne 0x8346
incq %rdx
addq $0x8, %rdi
addq $0x8, %rsi
cmpq 0x28(%rsp), %rdx
jne 0x8336
cmpl $0x1, %r13d
jne 0x83b3
movq 0x38(%rsp), %rcx
jmp 0x85c8
movq $0x0, 0x70(%r14)
xorpd %xmm0, %xmm0
jmp 0x85c8
leal -0x1(%r13), %eax
movq %rax, 0x88(%rsp)
movl 0x8(%r11), %r15d
movl %r15d, %eax
imull %r13d, %eax
movl %eax, 0x10(%rsp)
movl %r15d, %eax
imull %r15d, %eax
movl %eax, 0x20(%rsp)
movl $0x1, %r12d
xorl %r10d, %r10d
movq 0x38(%rsp), %rcx
leaq 0x1(%r10), %rax
movq %rax, 0x98(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r10d, %eax
imull %r10d, %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
leal (%rdx,%r13), %eax
movq %rax, 0x70(%rsp)
leal (%r10,%r13), %eax
movq %rax, 0x48(%rsp)
addl %r12d, %edx
movl 0x20(%rsp), %r11d
imull %edx, %r11d
imull %r15d, %edx
addl %r13d, %edx
imull %r15d, %edx
movq %r12, 0x90(%rsp)
testl %r15d, %r15d
movq %rdx, 0x30(%rsp)
movl %r11d, 0x50(%rsp)
jle 0x8581
movq 0x70(%rsp), %rax
addl %r12d, %eax
movslq %eax, %r13
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r12d, %eax
imull %r12d, %eax
movl %eax, %edi
shrl $0x1f, %edi
addl %eax, %edi
sarl %edi
movq 0x48(%rsp), %rax
addl %edi, %eax
movslq %eax, %r9
addl %r10d, %edi
imull %r15d, %edi
movq 0x40(%rsp), %rax
movq %rdi, 0x60(%rsp)
leal (%rax,%rdi), %r8d
imull %r15d, %r8d
movl %edx, %r14d
xorl %eax, %eax
movq %r15, %rdx
movl %r8d, 0x8(%rsp)
movl %r14d, 0x78(%rsp)
movl %r11d, 0x18(%rsp)
xorl %edi, %edi
cmpq %r12, %r10
jae 0x84f9
movq 0xa8(%rsp), %rsi
movsd (%rsi,%r9,8), %xmm1
addsd %xmm1, %xmm1
movq 0x60(%rsp), %rbx
leal (%rbx,%rdi), %ebp
movslq %r8d, %rbx
mulsd (%rcx,%rbx,8), %xmm1
imull %r15d, %ebp
movq 0x80(%rsp), %rcx
addsd (%rcx,%rbx,8), %xmm1
movsd %xmm1, (%rcx,%rbx,8)
movq 0x38(%rsp), %rcx
movsd (%rsi,%r9,8), %xmm1
mulsd (%rcx,%rbx,8), %xmm1
addl %eax, %ebp
jmp 0x8538
movq 0xa8(%rsp), %rsi
movsd (%rsi,%r13,8), %xmm1
addsd %xmm1, %xmm1
movslq %r14d, %rbx
mulsd (%rcx,%rbx,8), %xmm1
movq 0x80(%rsp), %rcx
addsd (%rcx,%rbx,8), %xmm1
movsd %xmm1, (%rcx,%rbx,8)
movq 0x38(%rsp), %rcx
movsd (%rsi,%r13,8), %xmm1
mulsd (%rcx,%rbx,8), %xmm1
movl %r11d, %ebp
addl 0x10(%rsp), %ebp
movslq %ebp, %rbx
mulsd (%rcx,%rbx,8), %xmm1
addsd %xmm1, %xmm0
incq %rdi
incl %r11d
incl %r14d
addl %r15d, %r8d
decq %rdx
jne 0x84a8
incq %rax
movl 0x18(%rsp), %r11d
addl %r15d, %r11d
movl 0x78(%rsp), %r14d
addl %r15d, %r14d
movl 0x8(%rsp), %r8d
incl %r8d
cmpq %r15, %rax
jne 0x8494
incq %r12
movl 0x20(%rsp), %eax
movl 0x50(%rsp), %r11d
addl %eax, %r11d
movq 0x30(%rsp), %rdx
addl %eax, %edx
cmpq 0x28(%rsp), %r12
jne 0x8439
movq 0x90(%rsp), %r12
incq %r12
movq 0x98(%rsp), %r10
cmpq 0x88(%rsp), %r10
movq 0x40(%rsp), %r13
jne 0x83e7
movq %rcx, %rdi
movq 0x80(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0xb8(%rsp), %rcx
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb1ab