// File: /workspace/github_c_makefile_star2_O1/debbiemarkslab[P]plmc/src/inference.c
// Function: PLMNegLogPosteriorBlock
static lbfgsfloatval_t PLMNegLogPosteriorBlock(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;

    /* Block fields hi */
    numeric_t *hi = (numeric_t *)
        malloc(ali->nSites * ali->nCodes * sizeof(numeric_t));
    numeric_t *gHi = (numeric_t *)
        malloc(ali->nSites * ali->nCodes * sizeof(numeric_t));
    for (int i = 0; i < ali->nSites; i++)
        for (int ai = 0; ai < ali->nCodes; ai++) Hi(i, ai) = xHi(i, ai);
    for (int i = 0; i < ali->nSites * ali->nCodes; i++) gHi[i] = 0;

    /* Block couplings eij */
    numeric_t *eij = (numeric_t *) malloc(ali->nSites * ali->nSites
        * ali->nCodes * ali->nCodes * sizeof(numeric_t));
    numeric_t *gEij = (numeric_t *) malloc(ali->nSites * ali->nSites
        * ali->nCodes * ali->nCodes * sizeof(numeric_t));
    for (int i = 0; i < ali->nSites * ali->nSites * ali->nCodes * ali->nCodes;
        i++) eij[i] = 0.0;
    for (int i = 0; i < ali->nSites * ali->nSites * ali->nCodes * ali->nCodes;
        i++) gEij[i] = 0.0;
    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++)
                    Eij(j, aj, i, ai) = Eij(i, ai, j, aj) = xEij(i, j, ai, aj);


    /* Negative log-pseudolikelihood */
    for (int s = 0; s < ali->nSeqs; s++) {
        /* Form potential for conditional log likelihoods at every site */
        numeric_t *H = (numeric_t *)
            malloc(ali->nCodes * ali->nSites * sizeof(numeric_t));
        numeric_t *Z = (numeric_t *) malloc(ali->nSites * sizeof(numeric_t));

        /* Initialize potentials with fields */
        // memcpy(H, hi, ali->nSites * ali->nCodes * sizeof(numeric_t));
        for(int jx = 0; jx < ali->nSites * ali->nCodes; jx++) H[jx] = hi[jx];

        /* Contribute coupling block due to i, ai */
        for (int i = 0; i < ali->nSites; i++) {
            const letter_t ai = seq(s, i);
            const numeric_t *jB = &(Eij(i, ai, 0, 0));
            for(int jx = 0; jx < ali->nSites * ali->nCodes; jx++)
                H[jx] += jB[jx];
        }

        /* Conditional log likelihoods */
        for (int i = 0; i < ali->nSites * ali->nCodes; i++) H[i] = exp(H[i]);
        for (int i = 0; i < ali->nSites; i++) Z[i] = 0;
        for (int i = 0; i < ali->nSites; i++)
            for (int ai = 0; ai < ali->nSites; ai++) Z[i] += Hp(i, ai);
        for (int i = 0; i < ali->nSites; i++)
            for (int ai = 0; ai < ali->nSites; ai++) Hp(i, ai) /= Z[i];

        numeric_t seqFx = 0;
        for (int i = 0; i < ali->nSites; i++)
            seqFx -= ali->weights[s] * log(Hp(i, seq(s, i)));

        for(int jx = 0; jx < ali->nSites * ali->nCodes; jx++)
            H[jx] *= -ali->weights[s];

        for (int i = 0; i < ali->nSites; i++)
            gHi(i, seq(s, i)) -= ali->weights[s];
        for(int jx = 0; jx < ali->nSites * ali->nCodes; jx++) gHi[jx] -= H[jx];

        for (int i = 0; i < ali->nSites - 1; i++)
            for (int j = i; j < ali->nSites; j++)
                gEij(i, seq(s, i), j, seq(s, j)) -= ali->weights[s];

        for (int i = 0; i < ali->nSites; i++) {
            const letter_t ai = seq(s, i);
            numeric_t *jgBlock = &(gEij(i, ai, 0, 0));
            for (int jx = 0; jx < ali->nSites * ali->nCodes; jx++)
                jgBlock[jx] -= H[jx];
        }

        free(H);
        free(Z);
        fx += seqFx;
    }

    for (int i = 0; i < ali->nSites; i++)
        for (int ai = 0; ai < ali->nCodes; ai++)
            dHi(i, ai) += gHi(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) += gEij(j, aj, i, ai) + gEij(i, ai, j, aj);
    free(hi);
    free(gHi);
    free(eij);
    free(gEij);

    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, 0xb8(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xb0(%rsp)
movslq 0x68(%r14), %rdx
testq %rdx, %rdx
jle 0xa15d
shlq $0x3, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1110
movslq 0x4(%r14), %rbp
movq %r14, 0x40(%rsp)
movslq 0x8(%r14), %r13
movl %r13d, %r15d
imull %ebp, %r15d
movslq %r15d, %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x90(%rsp)
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x78(%rsp)
movq %r13, 0x30(%rsp)
movl %r13d, %r13d
movq %rbp, 0x28(%rsp)
testq %rbp, %rbp
jle 0xa1fb
leaq (,%r13,8), %rax
movq 0x28(%rsp), %rcx
leaq (,%rcx,8), %rcx
xorl %edx, %edx
movq %r12, %rsi
movq 0x90(%rsp), %rdi
testl %r13d, %r13d
jle 0xa1ea
movq %rsi, %r8
xorl %r9d, %r9d
movsd (%r8), %xmm0
movsd %xmm0, (%rdi,%r9,8)
incq %r9
addq %rcx, %r8
cmpq %r9, %r13
jne 0xa1d4
incq %rdx
addq %rax, %rdi
addq $0x8, %rsi
cmpq 0x28(%rsp), %rdx
jne 0xa1c9
testl %r15d, %r15d
jle 0xa213
movl %r15d, %edx
shlq $0x3, %rdx
movq 0x78(%rsp), %rdi
xorl %esi, %esi
callq 0x1110
movq 0x28(%rsp), %rax
movl %eax, %ebp
imull 0x30(%rsp), %ebp
imull %ebp, %ebp
movslq %ebp, %r14
leaq (,%r14,8), %rdi
movq %rdi, 0x8(%rsp)
callq 0x11a0
movq %rax, 0x70(%rsp)
movq 0x8(%rsp), %rdi
callq 0x11a0
movq %rax, 0x48(%rsp)
movl %ebp, %edx
testl %r14d, %r14d
jle 0xa26c
movq %rdx, %r14
leaq (,%rdx,8), %rdx
movq 0x70(%rsp), %rdi
xorl %esi, %esi
callq 0x1110
movq %r14, %rdx
testl %ebp, %ebp
jle 0xa280
shlq $0x3, %rdx
movq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x1110
cmpl $0x2, 0x28(%rsp)
jl 0xa44d
movq 0x28(%rsp), %rcx
leal -0x1(%rcx), %eax
movq %rax, 0x98(%rsp)
movq 0x30(%rsp), %rdx
leaq (,%rdx,8), %rax
movq %rax, 0x88(%rsp)
movq 0x70(%rsp), %rax
leaq (%rax,%rdx,8), %rsi
movq %rdx, %rdi
imulq %rcx, %rdi
leaq 0x1(%rdi), %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
movq %rcx, 0xc0(%rsp)
leaq (,%rdi,8), %r8
movl %r13d, %ecx
imull %r13d, %ecx
movq %rcx, 0x38(%rsp)
imulq %rdx, %rdi
leaq (%rax,%rdi,8), %rcx
shlq $0x3, %rdi
movq %rdi, 0x50(%rsp)
movl %edx, %eax
imull %r13d, %eax
movl %eax, 0x68(%rsp)
movl $0x1, %r14d
xorl %edi, %edi
leaq 0x1(%rdi), %rax
movq %rax, 0xa0(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %edi, %eax
imull %edi, %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
addl %r14d, %edx
imull 0x38(%rsp), %edx
movq %rdx, 0x10(%rsp)
movq %rcx, 0x58(%rsp)
movq %rcx, 0x20(%rsp)
movq %rsi, 0x60(%rsp)
movq %rsi, 0x18(%rsp)
movq %r14, 0x80(%rsp)
cmpl $0x0, 0x30(%rsp)
jle 0xa3d6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r14d, %eax
imull %r14d, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %edi, %ecx
imull 0x68(%rsp), %ecx
movq 0x20(%rsp), %r11
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
xorl %r9d, %r9d
movl %ecx, 0x8(%rsp)
movq %r11, %r10
xorl %esi, %esi
leal (%rdx,%rsi), %ebp
cmpq %r14, %rdi
cmovbl %ecx, %ebp
addl %r15d, %ebp
movslq %ebp, %rbp
movsd (%r12,%rbp,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movsd %xmm0, (%r10)
incq %rsi
addq %r8, %r10
addl %r13d, %ecx
cmpq %rsi, %r13
jne 0xa391
incq %r9
addq %r8, %rax
addq %r13, %rdx
addq $0x8, %r11
movl 0x8(%rsp), %ecx
incl %ecx
cmpq %r13, %r9
jne 0xa388
incq %r14
movq 0x18(%rsp), %rax
addq 0x88(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
addq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq 0x28(%rsp), %r14
jne 0xa353
movq 0x80(%rsp), %r14
incq %r14
movq 0x60(%rsp), %rsi
movq 0xc0(%rsp), %rax
addq %rax, %rsi
movq 0x58(%rsp), %rcx
addq %rax, %rcx
movq 0xa0(%rsp), %rdi
cmpq 0x98(%rsp), %rdi
jne 0xa30b
movq 0x40(%rsp), %r14
cmpl $0x0, (%r14)
jle 0xa8a7
xorpd %xmm1, %xmm1
movq $0x0, 0x30(%rsp)
xorl %r13d, %r13d
movq %r13, 0x18(%rsp)
movsd %xmm1, 0x50(%rsp)
movl 0x8(%r14), %eax
movslq 0x4(%r14), %r13
movl %r13d, %r14d
movl %eax, 0x8(%rsp)
imull %eax, %r14d
movslq %r14d, %rax
movq %rax, 0x10(%rsp)
leaq (,%rax,8), %rdi
callq 0x11a0
movq %rax, %r15
leaq (,%r13,8), %rdi
callq 0x11a0
movq %rax, 0x38(%rsp)
movl %r14d, %ebp
cmpl $0x0, 0x10(%rsp)
jle 0xa4d6
leaq (,%rbp,8), %rdx
movq %r15, %rdi
movq 0x90(%rsp), %rsi
callq 0x1190
testl %r13d, %r13d
movq 0x70(%rsp), %r9
movl 0x8(%rsp), %r10d
jle 0xa542
movq 0x18(%rsp), %rax
imulq %r13, %rax
shlq $0x2, %rax
movq 0x40(%rsp), %rcx
addq 0x20(%rcx), %rax
movl %r13d, %ecx
imull %r10d, %ecx
xorl %edx, %edx
xorl %esi, %esi
testl %r14d, %r14d
jle 0xa537
movl (%rax,%rsi,4), %edi
addl %edx, %edi
imull %ecx, %edi
movslq %edi, %rdi
leaq (%r9,%rdi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
addsd (%r15,%r8,8), %xmm0
movsd %xmm0, (%r15,%r8,8)
incq %r8
cmpq %r8, %rbp
jne 0xa51d
incq %rsi
addl %r10d, %edx
cmpq %r13, %rsi
jne 0xa506
movq 0x40(%rsp), %rcx
movl 0x4(%rcx), %r13d
movl 0x8(%rcx), %ebp
movl %ebp, %eax
imull %r13d, %eax
testl %eax, %eax
jle 0xa589
xorl %r14d, %r14d
movsd (%r15,%r14,8), %xmm0
movq %rcx, %r13
callq 0x1230
movq %r13, %rcx
movsd %xmm0, (%r15,%r14,8)
incq %r14
movl 0x4(%r13), %r13d
movl 0x8(%rcx), %ebp
movl %ebp, %eax
imull %r13d, %eax
cltq
cmpq %rax, %r14
jl 0xa55b
movl %r13d, %r14d
testl %r13d, %r13d
jle 0xa5a5
leaq (,%r14,8), %rdx
movq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x1110
movslq %ebp, %rax
testl %r13d, %r13d
movq 0x40(%rsp), %rbp
movq 0x38(%rsp), %r8
jle 0xa5ea
leaq (,%rax,8), %rcx
movq %r15, %rdx
xorl %esi, %esi
movsd (%r8,%rsi,8), %xmm0
xorl %edi, %edi
addsd (%rdx,%rdi,8), %xmm0
incq %rdi
cmpq %rdi, %r14
jne 0xa5cc
movsd %xmm0, (%r8,%rsi,8)
incq %rsi
addq %rcx, %rdx
cmpq %r14, %rsi
jne 0xa5c4
testl %r13d, %r13d
movq 0x18(%rsp), %r13
jle 0xa626
shlq $0x3, %rax
movq %r15, %rcx
xorl %edx, %edx
movsd (%r8,%rdx,8), %xmm0
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %r14
jne 0xa605
incq %rdx
addq %rax, %rcx
cmpq %r14, %rdx
jne 0xa5fd
movl 0x4(%rbp), %eax
xorpd %xmm2, %xmm2
testl %eax, %eax
jle 0xa68f
xorl %r14d, %r14d
movsd %xmm2, 0x8(%rsp)
movq 0x20(%rbp), %rcx
movq 0x50(%rbp), %rdx
movsd (%rdx,%r13,8), %xmm0
movsd %xmm0, 0x10(%rsp)
imull %r13d, %eax
cltq
addq %r14, %rax
movslq (%rcx,%rax,4), %rax
movslq 0x8(%rbp), %rcx
movslq %r14d, %rdx
imulq %rcx, %rdx
addq %rax, %rdx
movsd (%r15,%rdx,8), %xmm0
callq 0x1130
movsd 0x8(%rsp), %xmm2
mulsd 0x10(%rsp), %xmm0
subsd %xmm0, %xmm2
movl 0x4(%rbp), %eax
incq %r14
cmpl %eax, %r14d
jl 0xa634
movslq 0x8(%rbp), %rdx
movq %rdx, %rcx
movq %rdx, 0x20(%rsp)
imull %eax, %ecx
movl %ecx, %esi
movl %ecx, 0x10(%rsp)
testl %ecx, %ecx
jle 0xa6d4
movq 0x50(%rbp), %rcx
movsd (%rcx,%r13,8), %xmm0
xorpd 0x39f6(%rip), %xmm0     # 0xe0b0
xorl %ecx, %ecx
movsd (%r15,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0xa6bc
movl %eax, %edi
testl %eax, %eax
movq 0x78(%rsp), %r11
jle 0xa728
movq 0x50(%rbp), %rcx
movq 0x30(%rsp), %rdx
imulq %rdi, %rdx
addq 0x20(%rbp), %rdx
movsd (%rcx,%r13,8), %xmm0
movq 0x20(%rsp), %rcx
leaq (,%rcx,8), %r8
movq %r11, %r9
xorl %r10d, %r10d
movslq (%rdx,%r10,4), %rcx
movsd (%r9,%rcx,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%r9,%rcx,8)
incq %r10
addq %r8, %r9
cmpq %r10, %rdi
jne 0xa709
cmpl $0x0, 0x10(%rsp)
jle 0xa74b
xorl %ecx, %ecx
movsd (%r11,%rcx,8), %xmm0
subsd (%r15,%rcx,8), %xmm0
movsd %xmm0, (%r11,%rcx,8)
incq %rcx
cmpq %rcx, %rsi
jne 0xa731
cmpl $0x2, %eax
jl 0xa7ff
leal -0x1(%rax), %ecx
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %rcx
imulq %rdi, %rcx
movq %rcx, 0x28(%rsp)
movq 0x30(%rsp), %r10
imulq %rdi, %r10
movq 0x20(%rsp), %rcx
leaq (,%rcx,8), %r11
xorl %r14d, %r14d
movq %rdi, %r13
xorl %ebp, %ebp
cmpq %rdi, %rbp
jae 0xa7e9
movq 0x40(%rsp), %rcx
movq 0x20(%rcx), %r9
movq 0x50(%rcx), %rcx
movq 0x18(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
leaq (%r9,%rbp,4), %rcx
addq %r10, %r9
movq 0x28(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
addl %r14d, %ecx
imull %eax, %ecx
movslq %ecx, %rdx
addq %rbp, %rdx
imulq %r11, %rdx
addq 0x48(%rsp), %rdx
xorl %ecx, %ecx
movslq (%r9,%rcx,4), %r8
movsd (%rdx,%r8,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%r8,8)
incq %rcx
addq %r11, %rdx
cmpq %rcx, %r13
jne 0xa7ca
incq %rbp
addq $0x4, %r10
addl 0x20(%rsp), %r14d
decq %r13
cmpq 0x8(%rsp), %rbp
jne 0xa788
movsd %xmm2, 0x8(%rsp)
testl %eax, %eax
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r11
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rbp
jle 0xa872
movq %r13, %r8
imulq %rdi, %r8
shlq $0x2, %r8
addq 0x20(%r14), %r8
imull %ebp, %eax
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpl $0x0, 0x10(%rsp)
jle 0xa867
movl (%r8,%r10,4), %ecx
addl %r9d, %ecx
imull %eax, %ecx
movslq %ecx, %rcx
leaq (%r11,%rcx,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
subsd (%r15,%rdx,8), %xmm0
movsd %xmm0, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rsi
jne 0xa84f
incq %r10
addl %ebp, %r9d
cmpq %rdi, %r10
jne 0xa835
movq %r15, %rdi
callq 0x1050
movq 0x38(%rsp), %rdi
callq 0x1050
movsd 0x50(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
incq %r13
movslq (%r14), %rax
addq $0x4, 0x30(%rsp)
cmpq %rax, %r13
jl 0xa46c
jmp 0xa8ab
xorpd %xmm1, %xmm1
movslq 0x4(%r14), %r15
testq %r15, %r15
jle 0xa906
movl 0x8(%r14), %eax
leaq (,%rax,8), %rcx
leaq (,%r15,8), %rdx
xorl %esi, %esi
movq %rbx, %rdi
movq 0x78(%rsp), %r8
testl %eax, %eax
jle 0xa8f7
movq %rdi, %r9
xorl %r10d, %r10d
movsd (%r8,%r10,8), %xmm0
addsd (%r9), %xmm0
movsd %xmm0, (%r9)
incq %r10
addq %rdx, %r9
cmpq %r10, %rax
jne 0xa8dc
incq %rsi
addq %rcx, %r8
addq $0x8, %rdi
cmpq %r15, %rsi
jne 0xa8d2
movq %r12, 0xa8(%rsp)
movsd %xmm1, 0x50(%rsp)
leal -0x1(%r15), %eax
movl %eax, 0x80(%rsp)
cmpl $0x2, %r15d
movq %r15, 0x88(%rsp)
jl 0xaaf1
movl 0x80(%rsp), %eax
movq %rax, 0xa0(%rsp)
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movslq %ecx, %rax
leaq (,%rax,8), %rdx
movq %rdx, 0x28(%rsp)
movq 0x48(%rsp), %rdx
leaq (%rdx,%rax,8), %rsi
movq %rax, %rdi
imulq %r15, %rdi
leaq 0x1(%rdi), %r8
imulq %rax, %r8
leaq (,%rdi,8), %r9
movl %eax, %r10d
imulq %rax, %rdi
movl %eax, %r11d
imull %r15d, %r11d
shlq $0x3, %r8
movq %r8, 0x98(%rsp)
imull %r10d, %r10d
movq %r10, 0x18(%rsp)
leaq (%rdx,%rdi,8), %r8
shlq $0x3, %rdi
movq %rdi, 0x38(%rsp)
movl $0x1, %r13d
xorl %eax, %eax
leaq 0x1(%rax), %rdx
movq %rdx, 0x58(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %eax, %edx
imull %eax, %edx
movl %edx, %edi
shrl $0x1f, %edi
addl %edx, %edi
sarl %edi
addl %r13d, %edi
imull 0x18(%rsp), %edi
movq %rdi, 0x8(%rsp)
movq %r8, 0x68(%rsp)
movq %r8, 0x10(%rsp)
movq %rsi, 0x30(%rsp)
movq %rsi, 0x20(%rsp)
movq %r13, 0x60(%rsp)
testl %ecx, %ecx
jle 0xaa7d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %r13d, %edx
imull %r13d, %edx
movl %edx, %edi
shrl $0x1f, %edi
addl %edx, %edi
sarl %edi
addl %eax, %edi
imull 0x18(%rsp), %edi
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r8
movq 0x20(%rsp), %rsi
xorl %r10d, %r10d
movl %edi, %r12d
movl %edi, %edx
movq %r15, %rbp
xorl %edi, %edi
leal (%r8,%rdi), %r14d
movsd (%rbp), %xmm0
addsd (%rsi,%rdi,8), %xmm0
cmpq %r13, %rax
cmovbl %edx, %r14d
addl %r11d, %r14d
movslq %r14d, %r14
addsd (%rbx,%r14,8), %xmm0
movsd %xmm0, (%rbx,%r14,8)
incq %rdi
addq %r9, %rbp
addl %ecx, %edx
cmpq %rdi, %rcx
jne 0xaa32
incq %r10
addq %r9, %rsi
addq %rcx, %r8
addq $0x8, %r15
movl %r12d, %edi
incl %edi
cmpq %rcx, %r10
jne 0xaa28
incq %r13
movq 0x20(%rsp), %rdx
addq 0x28(%rsp), %rdx
movq %rdx, 0x20(%rsp)
movq 0x8(%rsp), %rdx
addq 0x18(%rsp), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rsp), %rdx
addq 0x38(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq 0x88(%rsp), %r15
cmpq %r15, %r13
jne 0xa9f2
movq 0x60(%rsp), %r13
incq %r13
movq 0x30(%rsp), %rsi
movq 0x98(%rsp), %rax
addq %rax, %rsi
movq 0x68(%rsp), %r8
addq %rax, %r8
movq 0x58(%rsp), %rax
cmpq 0xa0(%rsp), %rax
jne 0xa9b0
movq 0x90(%rsp), %rdi
callq 0x1050
movq 0x78(%rsp), %rdi
callq 0x1050
movq 0x70(%rsp), %rdi
callq 0x1050
movq 0x48(%rsp), %rdi
callq 0x1050
movq 0x40(%rsp), %r10
movsd 0x50(%rsp), %xmm13
movsd %xmm13, 0x70(%r10)
testl %r15d, %r15d
jle 0xabab
movl 0x8(%r10), %eax
leaq (,%r15,8), %rcx
xorl %edx, %edx
movq 0xa8(%rsp), %rsi
movq %rbx, %rdi
movq 0xb0(%rsp), %r11
testl %eax, %eax
jle 0xab9b
movq %rax, %r8
xorl %r9d, %r9d
movsd (%r11,%rdx,8), %xmm0
addsd %xmm0, %xmm0
mulsd (%rsi,%r9), %xmm0
addsd (%rdi,%r9), %xmm0
movsd %xmm0, (%rdi,%r9)
movsd (%rsi,%r9), %xmm0
movsd (%r11,%rdx,8), %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm13
addq %rcx, %r9
decq %r8
jne 0xab5e
incq %rdx
addq $0x8, %rdi
addq $0x8, %rsi
cmpq %r15, %rdx
jne 0xab54
movq %rbx, 0x38(%rsp)
cmpl $0x2, %r15d
jl 0xae9b
movl 0x8(%r10), %eax
movl %r15d, %ecx
imull %eax, %ecx
movd %eax, %xmm0
pshufd $0x50, %xmm0, %xmm1     # xmm1 = xmm0[0,0,1,1]
movd %r15d, %xmm0
pshufd $0x50, %xmm0, %xmm2     # xmm2 = xmm0[0,0,1,1]
movl %ecx, 0x30(%rsp)
movd %ecx, %xmm0
pshufd $0x50, %xmm0, %xmm3     # xmm3 = xmm0[0,0,1,1]
movl %eax, %edx
imull %eax, %edx
movl %edx, 0x48(%rsp)
xorl %edx, %edx
movl $0x1, %esi
pcmpeqd %xmm4, %xmm4
movq 0xb0(%rsp), %rbx
movq 0x38(%rsp), %r12
movl %edx, %r15d
leal 0x1(%r15), %edi
movd %edx, %xmm0
pshufd $0x50, %xmm0, %xmm5     # xmm5 = xmm0[0,0,1,1]
movdqa %xmm5, %xmm0
paddd %xmm4, %xmm0
leal -0x1(%r15), %edx
imull %r15d, %edx
movl %edx, %r8d
shrl $0x1f, %r8d
addl %edx, %r8d
sarl %r8d
pmulld %xmm5, %xmm0
movdqa %xmm0, %xmm6
psrld $0x1f, %xmm6
paddd %xmm0, %xmm6
psrad $0x1, %xmm6
movl %esi, 0x60(%rsp)
addl %esi, %r8d
movl 0x48(%rsp), %edx
movl %edx, %r9d
imull %r8d, %r9d
imull %edx, %r8d
movl %edi, 0x58(%rsp)
movl %edi, %r11d
testl %eax, %eax
movl %r8d, 0x50(%rsp)
movl %r9d, 0x68(%rsp)
jle 0xae5f
xorl %edx, %edx
cmpl %r11d, %r15d
setb %dl
movd %r11d, %xmm0
pshufd $0x50, %xmm0, %xmm9     # xmm9 = xmm0[0,0,1,1]
movdqa %xmm9, %xmm0
paddd %xmm4, %xmm0
leal -0x1(%r11), %esi
imull %r11d, %esi
movl %esi, %r14d
shrl $0x1f, %r14d
addl %esi, %r14d
sarl %r14d
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 %edx, %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, %edx
movslq %edx, %r13
pextrd $0x1, %xmm9, %edx
movslq %edx, %rcx
movq %rcx, 0x28(%rsp)
addl %r15d, %r14d
movl 0x48(%rsp), %edx
movl %edx, %ecx
imull %r14d, %ecx
imull %edx, %r14d
xorl %edx, %edx
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
pslld $0x1f, %xmm0
movl %r8d, %esi
movq %rsi, 0x8(%rsp)
movl %edx, 0x18(%rsp)
movd %edx, %xmm9
pshufd $0x50, %xmm9, %xmm9     # xmm9 = xmm9[0,0,1,1]
movdqa %xmm7, %xmm10
paddd %xmm9, %xmm10
pmulld %xmm1, %xmm10
movl %r14d, 0x10(%rsp)
movl %ecx, 0x20(%rsp)
movl %ecx, %edx
xorl %ebp, %ebp
movq 0xa8(%rsp), %r8
movq 0x28(%rsp), %rcx
movl 0x30(%rsp), %esi
leal (%r9,%rbp), %r10d
movd %ebp, %xmm11
pshufd $0x50, %xmm11, %xmm11   # xmm11 = xmm11[0,0,1,1]
cmpl %r11d, %r15d
movdqa %xmm11, %xmm12
paddd %xmm8, %xmm12
pmulld %xmm1, %xmm12
paddd %xmm10, %xmm11
paddd %xmm9, %xmm12
blendvps %xmm0, %xmm12, %xmm11
movsd (%rbx,%r13,8), %xmm12
paddd %xmm3, %xmm11
movq %r13, %rdi
movq %r11, %r13
movq %r15, %r11
movd %xmm11, %r15d
addsd %xmm12, %xmm12
movslq %r15d, %r15
mulsd (%r8,%r15,8), %xmm12
movq 0x8(%rsp), %r15
leal (%r15,%rbp), %r15d
cmovbl %edx, %r10d
cmovbl %r14d, %r15d
addl %esi, %r10d
movslq %r10d, %r10
addsd (%r12,%r10,8), %xmm12
movsd %xmm12, (%r12,%r10,8)
pextrd $0x1, %xmm11, %r10d
movsd (%rbx,%rcx,8), %xmm11
movslq %r10d, %r10
mulsd (%r8,%r10,8), %xmm11
addl %esi, %r15d
movslq %r15d, %r10
movq %r11, %r15
movq %r13, %r11
movq %rdi, %r13
mulsd (%r8,%r10,8), %xmm11
addsd %xmm11, %xmm13
incl %ebp
addl %eax, %edx
addl %eax, %r14d
cmpl %ebp, %eax
jne 0xad7e
movl 0x18(%rsp), %edx
incl %edx
addl %eax, %r9d
movq 0x8(%rsp), %rsi
addl %eax, %esi
movl 0x20(%rsp), %ecx
incl %ecx
movl 0x10(%rsp), %r14d
incl %r14d
cmpl %eax, %edx
jne 0xad3c
incl %r11d
movl 0x48(%rsp), %edx
movl 0x68(%rsp), %r9d
addl %edx, %r9d
movl 0x50(%rsp), %r8d
addl %edx, %r8d
cmpl 0x88(%rsp), %r11d
jne 0xac66
movl 0x60(%rsp), %esi
incl %esi
movl 0x58(%rsp), %edx
cmpl 0x80(%rsp), %edx
jne 0xac05
movq 0xa8(%rsp), %rdi
movq 0x38(%rsp), %rsi
movapd %xmm13, %xmm0
movq 0x40(%rsp), %rdx
movq 0xb8(%rsp), %rcx
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc1b6