// File: /workspace/github_c_makefile_star2_O2/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 $0xe8, %rsp
movq %rdx, %rbx
movq %rsi, 0x60(%rsp)
movq (%rdi), %rbp
movq 0x8(%rdi), %rax
movq %rax, 0xd0(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0xc8(%rsp)
movl 0x68(%rbp), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x5efb
andq $0x0, (%rbx,%rcx,8)
incq %rcx
jmp 0x5eec
movl 0x4(%rbp), %edx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x3c(%rsp)
movq %rbx, 0xb0(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq $0x0, 0x70(%rsp)
xorl %r15d, %r15d
movq %rbp, 0x88(%rsp)
movslq %edx, %r11
cmpq %r11, %r15
movl %edx, 0x4(%rsp)
jge 0x68ab
movq %r11, 0xc0(%rsp)
movq %r15, 0x8(%rsp)
movslq 0x3c(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0x8(%rbp), %r12d
movslq %r12d, %r15
leaq (,%r15,8), %r14
movq %r14, %rdi
callq 0x11a0
movq %rax, %r13
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x30(%rsp)
movl %r15d, %ebp
imull 0x4(%rsp), %ebp
movl %ebp, %eax
imull %r15d, %eax
movq %rax, 0xe0(%rsp)
movslq %eax, %rdi
shlq $0x3, %rdi
movq %rdi, 0xd8(%rsp)
callq 0x11a0
movq %rax, %r11
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rcx
addl %ecx, %eax
imull %ecx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movslq %ebp, %rdx
testl %r15d, %r15d
movl $0x0, %ecx
cmovgl %r15d, %ecx
movq %rcx, 0x40(%rsp)
movq 0x60(%rsp), %rcx
leaq (%rcx,%rdx,8), %rcx
movl %r15d, %edx
imull %r15d, %edx
movl %edx, 0x90(%rsp)
movq %rax, 0x50(%rsp)
imull %eax, %edx
imulq %r15, %r15
movq %r15, 0xb8(%rsp)
leaq (,%r15,8), %rax
movq %rax, 0x20(%rsp)
movl %edx, %eax
movq %r11, %r8
xorl %r9d, %r9d
movq %r11, 0x28(%rsp)
cmpq 0x8(%rsp), %r9
je 0x607d
movq %r8, %rsi
movl %eax, %edi
xorl %r10d, %r10d
cmpq 0x40(%rsp), %r10
je 0x606c
movslq %edi, %rdx
leaq (%rcx,%rdx,8), %r11
movq %rsi, %r15
xorl %edx, %edx
cmpq %rdx, %r12
je 0x605b
movsd (%r11,%rdx,8), %xmm0
movsd %xmm0, (%r15)
incq %rdx
addq %r14, %r15
jmp 0x6043
incq %r10
addl %r12d, %edi
addq $0x8, %rsi
movq 0x28(%rsp), %r11
jmp 0x6030
incq %r9
addl 0x90(%rsp), %eax
addq 0x20(%rsp), %r8
jmp 0x6021
movq 0x58(%rsp), %rcx
movq 0x50(%rsp), %rax
addl %ecx, %eax
movl 0x90(%rsp), %r10d
movl %eax, 0x1c(%rsp)
imull %eax, %r10d
movq 0xb8(%rsp), %rax
imulq %rcx, %rax
leaq (%r11,%rax,8), %r9
cmpq 0xc0(%rsp), %rcx
jge 0x617f
movl %ecx, %r11d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %ecx, %eax
movq %rcx, 0x78(%rsp)
imull %ecx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
addl 0x8(%rsp), %eax
imull 0x90(%rsp), %eax
movq %r9, 0xa0(%rsp)
movq %r9, %rdx
movl %r10d, 0x80(%rsp)
xorl %ecx, %ecx
movq %rdx, 0x10(%rsp)
movl %eax, %r9d
movq %r12, %r15
movl %r10d, %edi
cmpq 0x40(%rsp), %rcx
je 0x6150
subq $0x1, %r15
jb 0x6137
cmpq %r11, 0x8(%rsp)
movl %r10d, %r8d
cmovbl %eax, %r8d
addl %ebp, %r8d
movslq %r8d, %r8
movq 0x60(%rsp), %rsi
movsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rdx)
incl %r10d
addl %r12d, %eax
addq %r14, %rdx
jmp 0x6105
incq %rcx
movl %edi, %r10d
addl %r12d, %r10d
movl %r9d, %eax
incl %eax
movq 0x10(%rsp), %rdx
addq $0x8, %rdx
jmp 0x60f0
movq 0x78(%rsp), %rcx
incq %rcx
movl 0x80(%rsp), %r10d
addl 0x90(%rsp), %r10d
movq 0xa0(%rsp), %r9
addq 0x20(%rsp), %r9
movq 0x28(%rsp), %r11
jmp 0x60a9
movq 0xb8(%rsp), %rdx
imulq 0x70(%rsp), %rdx
addq %r11, %rdx
addq $0x8, %r14
movq 0xc0(%rsp), %rcx
shlq $0x3, %rcx
movq 0xa8(%rsp), %rax
movq 0x88(%rsp), %rbp
subq $0x1, 0x40(%rsp)
jb 0x61c8
movsd (%rax), %xmm0
movsd %xmm0, (%rdx)
addq %r14, %rdx
addq %rcx, %rax
jmp 0x61b0
movq 0xd8(%rsp), %rdi
callq 0x11a0
movq %rax, %r14
movq 0xe0(%rsp), %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovlel %eax, %ecx
xorl %eax, %eax
movsd 0x68(%rsp), %xmm1
movl 0x4(%rsp), %r15d
cmpq %rax, %rcx
je 0x6206
andq $0x0, (%r14,%rax,8)
incq %rax
jmp 0x61f7
xorpd %xmm3, %xmm3
xorl %edx, %edx
movq 0x28(%rsp), %r11
movslq (%rbp), %rcx
testl %r12d, %r12d
movl $0x0, %eax
cmovgl %r12d, %eax
movslq %r12d, %rsi
movq %rdx, 0x10(%rsp)
cmpq %rcx, %rdx
movq %rsi, 0x80(%rsp)
jge 0x6634
movq %rsi, %rcx
imulq %rsi, %rcx
imulq 0x70(%rsp), %rcx
addq %r11, %rcx
leaq 0x8(,%rsi,8), %rdx
xorl %esi, %esi
cmpq %rsi, %rax
je 0x626c
movsd (%rcx), %xmm0
movsd %xmm0, (%r13,%rsi,8)
incq %rsi
addq %rdx, %rcx
jmp 0x6254
movl %r15d, %r10d
movl %r15d, %edx
movq 0x10(%rsp), %r15
imull %r15d, %edx
xorl %esi, %esi
xorl %edi, %edi
movl %edi, %ecx
cmpq %rcx, 0x8(%rsp)
je 0x62cb
leal (%rdx,%rdi), %ecx
movslq %ecx, %rcx
xorl %r8d, %r8d
cmpq %r8, %rax
je 0x62c4
movq 0x20(%rbp), %r9
movl (%r9,%rcx,4), %r9d
addl %esi, %r9d
imull %r12d, %r9d
movslq %r9d, %r9
addq %r8, %r9
movsd (%r11,%r9,8), %xmm0
addsd (%r13,%r8,8), %xmm0
movsd %xmm0, (%r13,%r8,8)
incq %r8
jmp 0x6291
incl %edi
addl %r12d, %esi
jmp 0x627f
movslq %r10d, %rdx
imull %r15d, %r10d
movslq %r10d, %rsi
movq 0x58(%rsp), %r8
movl %r8d, %edi
imull %r12d, %edi
cmpq %rdx, %r8
jge 0x632b
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x6323
leaq (,%r8,4), %r9
addq 0x20(%rbp), %r9
movl (%r9,%rsi,4), %r9d
addl %edi, %r9d
imull %r12d, %r9d
movslq %r9d, %r9
addq %rcx, %r9
movsd (%r11,%r9,8), %xmm0
addsd (%r13,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
jmp 0x62e8
incq %r8
addl %r12d, %edi
jmp 0x62e1
movsd (%r13), %xmm4
pushq $0x1
popq %rax
movq 0x80(%rsp), %rcx
cmpq %rcx, %rax
jge 0x636a
movsd (%r13,%rax,8), %xmm0
movapd %xmm0, %xmm1
cmplesd %xmm4, %xmm1
movapd %xmm1, %xmm2
andnpd %xmm0, %xmm2
andpd %xmm4, %xmm1
orpd %xmm2, %xmm1
incq %rax
movapd %xmm1, %xmm4
jmp 0x633c
movapd %xmm3, 0x90(%rsp)
xorl %r15d, %r15d
movapd %xmm4, 0x40(%rsp)
movslq %r12d, %rax
cmpq %rax, %r15
jge 0x63ae
movsd (%r13,%r15,8), %xmm0
subsd %xmm4, %xmm0
callq 0x1230
movapd 0x40(%rsp), %xmm4
movq 0x30(%rsp), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movl 0x8(%rbp), %r12d
jmp 0x637c
testl %r12d, %r12d
movl $0x0, %eax
cmovlel %eax, %r12d
xorpd %xmm0, %xmm0
xorl %eax, %eax
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rsi
cmpq %rax, %r12
je 0x63d9
addsd (%rdx,%rax,8), %xmm0
incq %rax
jmp 0x63ca
movsd 0x5c87(%rip), %xmm1     # 0xc068
divsd %xmm0, %xmm1
xorl %eax, %eax
cmpq %rax, %r12
je 0x63ff
movsd (%rdx,%rax,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%rax,8)
incq %rax
jmp 0x63e7
movq 0x50(%rbp), %rax
movsd (%rax,%rsi,8), %xmm0
movaps %xmm0, 0x40(%rsp)
movslq 0x4(%rbp), %rax
movslq %esi, %rcx
imulq %rax, %rcx
movq %rsi, %r12
movq 0x8(%rsp), %r15
leaq (,%r15,4), %rax
addq 0x20(%rbp), %rax
movslq (%rax,%rcx,4), %rax
movsd (%rdx,%rax,8), %xmm0
callq 0x1120
movapd 0x40(%rsp), %xmm4
movapd %xmm4, %xmm1
xorpd 0x5c54(%rip), %xmm1     # 0xc0a0
movq 0x20(%rbp), %rdx
movl 0x4(%rbp), %eax
movl %eax, 0x4(%rsp)
cltq
movl %eax, %ecx
imull %r12d, %ecx
movslq %ecx, %rsi
leaq (%rdx,%r15,4), %rcx
movl (%rcx,%rsi,4), %edi
movslq 0x8(%rbp), %r12
movl %r12d, %ecx
imull %r15d, %ecx
addl %edi, %ecx
imull %r12d, %ecx
addl %edi, %ecx
movslq %ecx, %rcx
movsd (%r14,%rcx,8), %xmm2
subsd %xmm4, %xmm2
movsd %xmm2, (%r14,%rcx,8)
testl %r12d, %r12d
movl $0x0, %ecx
cmovgl %r12d, %ecx
leaq (,%r12,8), %r9
movl %r15d, %r8d
imull %r12d, %r8d
movslq %r8d, %r8
imulq %r9, %r8
addq %r14, %r8
leaq 0x8(,%r12,8), %r9
xorl %r10d, %r10d
movapd 0x90(%rsp), %xmm3
cmpq %r10, %rcx
je 0x64ee
movq 0x30(%rsp), %r11
movsd (%r11,%r10,8), %xmm2
mulsd %xmm4, %xmm2
addsd (%r8), %xmm2
movsd %xmm2, (%r8)
incq %r10
addq %r9, %r8
jmp 0x64c8
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r15
imull %r15d, %r8d
movslq %r8d, %r8
leaq (%rdx,%r8,4), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq %r10, 0x8(%rsp)
je 0x6539
movl (%r8,%r10,4), %r11d
addl %r9d, %r11d
imull %r12d, %r11d
addl %edi, %r11d
movslq %r11d, %r11
movsd (%r14,%r11,8), %xmm2
subsd %xmm4, %xmm2
movsd %xmm2, (%r14,%r11,8)
incq %r10
addl %r12d, %r9d
jmp 0x6509
movl 0x3c(%rsp), %r9d
imull %r12d, %r9d
movq 0x58(%rsp), %r10
cmpq %rax, %r10
jge 0x6575
movl (%r8,%r10,4), %r11d
addl %r9d, %r11d
imull %r12d, %r11d
addl %edi, %r11d
movslq %r11d, %r11
movsd (%r14,%r11,8), %xmm2
subsd %xmm4, %xmm2
movsd %xmm2, (%r14,%r11,8)
incq %r10
addl %r12d, %r9d
jmp 0x6547
leaq (%rdx,%rsi,4), %rdx
xorl %esi, %esi
xorl %edi, %edi
movq 0x30(%rsp), %r10
movq 0x28(%rsp), %r11
cmpq 0x8(%rsp), %rdi
je 0x65ca
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x65c2
movl (%rdx,%rdi,4), %r9d
addl %esi, %r9d
imull %r12d, %r9d
movslq %r9d, %r9
addq %r8, %r9
movsd (%r10,%r8,8), %xmm2
mulsd %xmm4, %xmm2
addsd (%r14,%r9,8), %xmm2
movsd %xmm2, (%r14,%r9,8)
incq %r8
jmp 0x6591
incq %rdi
addl %r12d, %esi
jmp 0x6587
movq 0x58(%rsp), %rdi
movl %edi, %esi
imull %r12d, %esi
cmpq %rax, %rdi
jge 0x6616
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x660e
movl (%rdx,%rdi,4), %r9d
addl %esi, %r9d
imull %r12d, %r9d
movslq %r9d, %r9
addq %r8, %r9
movsd (%r10,%r8,8), %xmm2
mulsd %xmm4, %xmm2
addsd (%r14,%r9,8), %xmm2
movsd %xmm2, (%r14,%r9,8)
incq %r8
jmp 0x65dd
incq %rdi
addl %r12d, %esi
jmp 0x65d5
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm3
incq %r15
movsd 0x68(%rsp), %xmm1
movq %r15, %rdx
movl 0x4(%rsp), %r15d
jmp 0x6211
movq 0x8(%rsp), %rcx
incq %rcx
movq %rcx, 0x78(%rsp)
movl %esi, %ecx
movl %r15d, 0x4(%rsp)
movl %r15d, %edx
imull %r12d, %edx
movslq %edx, %rdx
leaq (%rbx,%rdx,8), %rdx
movl %esi, %edi
imull %esi, %edi
movq 0x50(%rsp), %r9
movl %edi, 0x20(%rsp)
imull %edi, %r9d
leaq (,%rsi,8), %rsi
xorl %r8d, %r8d
xorl %r10d, %r10d
movl %r10d, %edi
cmpq %rdi, 0x8(%rsp)
je 0x66f4
movl %r8d, 0x40(%rsp)
movslq %r8d, %r8
imulq %rsi, %r8
addq %r14, %r8
movq %r9, 0x50(%rsp)
movl %r9d, %r11d
xorl %ebp, %ebp
cmpq %rax, %rbp
je 0x66d5
movslq %r11d, %rdi
leaq (%rdx,%rdi,8), %rdi
movq %r8, %r15
xorl %r9d, %r9d
cmpq %r9, %rcx
je 0x66c9
movsd (%r15), %xmm0
addsd (%rdi,%r9,8), %xmm0
movsd %xmm0, (%rdi,%r9,8)
incq %r9
addq %rsi, %r15
jmp 0x66ab
incq %rbp
addl %r12d, %r11d
addq $0x8, %r8
jmp 0x6699
incl %r10d
movq 0x50(%rsp), %r9
addl 0x20(%rsp), %r9d
movl 0x40(%rsp), %r8d
addl %r12d, %r8d
movq 0x88(%rsp), %rbp
jmp 0x6676
movl %r12d, %r9d
movl 0x4(%rsp), %eax
imull %eax, %r9d
testl %r12d, %r12d
movl $0x0, %edx
cmovgl %r12d, %edx
movq %rdx, 0x90(%rsp)
movl 0x1c(%rsp), %edx
imull 0x20(%rsp), %edx
movl %edx, 0x1c(%rsp)
movq 0x58(%rsp), %rdx
movl %edx, %edi
imull %r12d, %edi
movq 0x78(%rsp), %rdx
cmpl %eax, %edx
jge 0x67fc
movl %edi, 0x50(%rsp)
movslq %edi, %r8
imulq %rsi, %r8
addq %r14, %r8
movl %edx, %r11d
leal -0x1(%rdx), %eax
movq %rdx, 0xa0(%rsp)
imull %edx, %eax
cltd
pushq $0x2
popq %rdi
idivl %edi
addl 0x8(%rsp), %eax
imull 0x20(%rsp), %eax
movl 0x1c(%rsp), %edx
xorl %ebp, %ebp
movq %r8, 0x40(%rsp)
movl %eax, 0x10(%rsp)
movq %rcx, %rdi
movl %edx, %r10d
cmpq 0x90(%rsp), %rbp
je 0x67d2
subq $0x1, %rdi
jb 0x67b8
cmpq %r11, 0x8(%rsp)
movsd (%r8), %xmm0
movl %edx, %r15d
cmovbl %eax, %r15d
addl %r9d, %r15d
movslq %r15d, %r15
addsd (%rbx,%r15,8), %xmm0
movsd %xmm0, (%rbx,%r15,8)
incl %edx
addl %r12d, %eax
addq %rsi, %r8
jmp 0x6785
incq %rbp
movl %r10d, %edx
addl %r12d, %edx
movl 0x10(%rsp), %eax
incl %eax
movq 0x40(%rsp), %r8
addq $0x8, %r8
jmp 0x676c
movq 0xa0(%rsp), %rdx
incl %edx
movl 0x20(%rsp), %eax
addl %eax, 0x1c(%rsp)
movl 0x50(%rsp), %edi
addl %r12d, %edi
movq 0x88(%rsp), %rbp
movl 0x4(%rsp), %eax
jmp 0x6730
testl %r12d, %r12d
movl $0x0, %ecx
cmovlel %ecx, %r12d
cltq
movq 0x80(%rsp), %rdx
imulq %rdx, %rdx
imulq 0x70(%rsp), %rdx
movq %r14, %rcx
addq %rdx, %rcx
addq $0x8, %rsi
shlq $0x3, %rax
movq 0xb0(%rsp), %rdx
movq 0x28(%rsp), %rdi
subq $0x1, %r12
jb 0x6851
movsd (%rcx), %xmm0
addsd (%rdx), %xmm0
movsd %xmm0, (%rdx)
addq %rsi, %rcx
addq %rax, %rdx
jmp 0x6837
addsd %xmm3, %xmm1
movsd %xmm1, 0x68(%rsp)
callq 0x1050
movq %r14, %rdi
callq 0x1050
movq %r13, %rdi
callq 0x1050
movq 0x30(%rsp), %rdi
callq 0x1050
movl 0x4(%rsp), %edx
movq 0x58(%rsp), %rax
incl %eax
movl %eax, 0x3c(%rsp)
addq $0x8, 0x70(%rsp)
addq $0x8, 0xa8(%rsp)
addq $0x8, 0xb0(%rsp)
movq 0x78(%rsp), %r15
jmp 0x5f38
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x70(%rbp)
xorl %eax, %eax
testl %r11d, %r11d
movl $0x0, %ecx
cmovgl %edx, %ecx
shlq $0x3, %r11
movq %rbx, %rdx
movq 0x60(%rsp), %rsi
xorl %edi, %edi
movq 0xc8(%rsp), %r10
cmpq %rcx, %rdi
je 0x6938
movl 0x8(%rbp), %r8d
testl %r8d, %r8d
cmovlel %eax, %r8d
xorl %r9d, %r9d
subq $0x1, %r8
jb 0x692b
movsd (%r10,%rdi,8), %xmm1
addsd %xmm1, %xmm1
mulsd (%rsi,%r9), %xmm1
addsd (%rdx,%r9), %xmm1
movsd %xmm1, (%rdx,%r9)
movsd (%rsi,%r9), %xmm2
movsd (%r10,%rdi,8), %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
addq %r11, %r9
jmp 0x68ec
incq %rdi
addq $0x8, %rsi
addq $0x8, %rdx
jmp 0x68d9
movl 0x4(%rsp), %edi
cmpl $0x2, %edi
pushq $0x1
popq %rsi
movl %esi, %eax
cmovgel %edi, %eax
decl %eax
movl %eax, 0x28(%rsp)
xorl %r8d, %r8d
movq 0xc8(%rsp), %r10
cmpl 0x28(%rsp), %r8d
je 0x6a77
leal 0x1(%r8), %r9d
leal -0x1(%r8), %eax
imull %r8d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movq %rsi, 0x30(%rsp)
movq %rax, 0x40(%rsp)
addl %esi, %eax
movl %eax, 0x8(%rsp)
movl %r9d, 0x10(%rsp)
movl %r9d, %r11d
cmpl %edi, %r11d
jge 0x6a64
movl 0x8(%rbp), %ebp
movq 0x40(%rsp), %rax
leal (%r11,%rax), %esi
leal -0x1(%r11), %eax
imull %r11d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r9d
addl %r8d, %r9d
movl %ebp, %edx
imull %edi, %edx
xorl %r14d, %r14d
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
cmpl %r11d, %r8d
cmovbl %r9d, %esi
addl %edi, %esi
movslq %esi, %r13
movl %ebp, %edi
imull %edi, %edi
imull %edi, %r9d
imull 0x8(%rsp), %edi
cmpl %r15d, %r14d
je 0x6a4c
xorl %esi, %esi
movl %r9d, %eax
cmpl %esi, %ebp
je 0x6a42
leal (%rdi,%rsi), %r12d
cmpl %r11d, %r8d
movsd (%r10,%r13,8), %xmm1
addsd %xmm1, %xmm1
cmovbl %eax, %r12d
addl %edx, %r12d
movslq %r12d, %r12
movq 0x60(%rsp), %rcx
mulsd (%rcx,%r12,8), %xmm1
addsd (%rbx,%r12,8), %xmm1
movsd %xmm1, (%rbx,%r12,8)
movsd (%rcx,%r12,8), %xmm2
movsd (%r10,%r13,8), %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
incl %esi
addl %ebp, %eax
jmp 0x69ee
incl %r14d
incl %r9d
addl %ebp, %edi
jmp 0x69e4
incl %r11d
incl 0x8(%rsp)
movq 0x88(%rsp), %rbp
movl 0x4(%rsp), %edi
jmp 0x698d
movq 0x30(%rsp), %rsi
incl %esi
movl 0x10(%rsp), %eax
movl %eax, %r8d
jmp 0x6958
movq 0x60(%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq 0xd0(%rsp), %rcx
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9e58