// File: /workspace/github_c_makefile_star2_O1/debbiemarkslab[P]plmc/src/inference.c
// Function: PostCondition
lbfgsfloatval_t PostCondition(const lbfgsfloatval_t *x, lbfgsfloatval_t *g, lbfgsfloatval_t fx, alignment_t *ali, options_t *options) {
    if (options->zeroAPC == 1)
        for (int i = 0; i < ali->nSites; i++)
            for (int ai = 0; ai < ali->nCodes; ai++)
                dHi(i, ai) = 0.0;

    /* Group (L1/L2) regularization  */
    if (options->lambdaGroup > 0)
        for (int i = 0; i < ali->nSites - 1; i++)
            for (int j = i + 1; j < ali->nSites; j++) {
                double l2 = REGULARIZATION_GROUP_EPS;
                for (int ai = 0; ai < ali->nCodes; ai++)
                    for (int aj = 0; aj < ali->nCodes; aj++)
                        l2 += xEij(i, j, ai, aj) * xEij(i, j, ai, aj);
                double l1 = sqrt(l2);
                fx += options->lambdaGroup * l1;
                for (int ai = 0; ai < ali->nCodes; ai++)
                    for (int aj = 0; aj < ali->nCodes; aj++)
                        dEij(i, j, ai, aj) += options->lambdaGroup * xEij(i, j, ai, aj) / l1;
            }

    return fx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq %rdx, %rbp
movdqa %xmm0, %xmm10
movq %rsi, %r15
movq %rdi, %r12
cmpl $0x1, 0x58(%rcx)
jne 0xc295
movslq 0x4(%rbp), %rax
testq %rax, %rax
jle 0xc295
movl 0x8(%rbp), %ecx
leal 0x1(%rcx), %edx
andl $-0x2, %edx
movq %rcx, %rsi
decq %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq %rax, %rsi
shlq $0x4, %rsi
xorl %edi, %edi
pmovsxbq 0x235d(%rip), %xmm1     # 0xe574
movdqa 0x1e91(%rip), %xmm2     # 0xe0b0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
pmovsxbq 0x2346(%rip), %xmm4     # 0xe576
movq %r15, %r8
testl %ecx, %ecx
jle 0xc289
movq %rdx, %r9
movq %r8, %r10
movdqa %xmm1, %xmm5
movdqa %xmm5, %xmm6
pxor %xmm2, %xmm6
pcmpgtq %xmm0, %xmm6
movd %xmm6, %r11d
notl %r11d
testb $0x1, %r11b
je 0xc263
movq $0x0, (%r10)
pxor %xmm3, %xmm6
pextrb $0x8, %xmm6, %r11d
testb $0x1, %r11b
je 0xc27c
movq $0x0, (%r10,%rax,8)
paddq %xmm4, %xmm5
addq %rsi, %r10
addq $-0x2, %r9
jne 0xc241
incq %rdi
addq $0x8, %r8
cmpq %rax, %rdi
jne 0xc233
movsd 0x50(%rbx), %xmm0
pxor %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc567
cmpl $0x2, 0x4(%rbp)
jl 0xc567
xorl %ecx, %ecx
movl $0x1, %edx
movsd 0x2226(%rip), %xmm11    # 0xe4e8
xorpd %xmm12, %xmm12
movq %rbp, 0x28(%rsp)
movl %ecx, %r13d
leal 0x1(%r13), %esi
movl 0x4(%rbp), %ecx
cmpl %ecx, %esi
movl %edx, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
jge 0xc550
movd %r13d, %xmm0
pshufd $0x50, %xmm0, %xmm1     # xmm1 = xmm0[0,0,1,1]
movdqa %xmm1, %xmm0
paddd 0x1ec4(%rip), %xmm0     # 0xe1c0
movdqa %xmm1, 0x40(%rsp)
pmulld %xmm1, %xmm0
movdqa %xmm0, %xmm1
psrld $0x1f, %xmm1
paddd %xmm0, %xmm1
psrad $0x1, %xmm1
movdqa %xmm1, 0x30(%rsp)
leal -0x1(%r13), %eax
imull %r13d, %eax
movl %eax, %edi
shrl $0x1f, %edi
addl %eax, %edi
sarl %edi
addl %edx, %edi
movl %edi, 0xc(%rsp)
movl %edi, 0x8(%rsp)
movl %esi, %r14d
movl 0x8(%rbp), %eax
movapd %xmm11, %xmm1
testl %eax, %eax
jle 0xc43e
imull %eax, %ecx
xorl %edx, %edx
cmpl %r14d, %r13d
setb %dl
movd %r14d, %xmm0
pshufd $0x50, %xmm0, %xmm2     # xmm2 = xmm0[0,0,1,1]
movdqa %xmm2, %xmm0
paddd 0x1e52(%rip), %xmm0     # 0xe1c0
pmulld %xmm2, %xmm0
paddd 0x30(%rsp), %xmm2
movd %eax, %xmm1
pshufd $0x50, %xmm1, %xmm3     # xmm3 = xmm1[0,0,1,1]
pmulld %xmm3, %xmm2
movdqa %xmm0, %xmm4
psrld $0x1f, %xmm4
paddd %xmm0, %xmm4
psrad $0x1, %xmm4
paddd 0x40(%rsp), %xmm4
pmulld %xmm3, %xmm4
movd %edx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movd %ecx, %xmm1
pshufd $0x50, %xmm1, %xmm5     # xmm5 = xmm1[0,0,1,1]
xorl %ecx, %ecx
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
pslld $0x1f, %xmm0
movapd %xmm11, %xmm1
movd %ecx, %xmm6
pshufd $0x50, %xmm6, %xmm6     # xmm6 = xmm6[0,0,1,1]
movdqa %xmm2, %xmm7
paddd %xmm6, %xmm7
pmulld %xmm3, %xmm7
xorl %edx, %edx
movd %edx, %xmm8
pshufd $0x50, %xmm8, %xmm8     # xmm8 = xmm8[0,0,1,1]
movdqa %xmm8, %xmm9
paddd %xmm4, %xmm9
paddd %xmm7, %xmm8
pmulld %xmm3, %xmm9
paddd %xmm6, %xmm9
blendvps %xmm0, %xmm9, %xmm8
paddd %xmm5, %xmm8
movd %xmm8, %esi
movslq %esi, %rsi
pextrd $0x1, %xmm8, %edi
movsd (%r12,%rsi,8), %xmm8
movslq %edi, %rsi
mulsd (%r12,%rsi,8), %xmm8
addsd %xmm8, %xmm1
incl %edx
cmpl %edx, %eax
jne 0xc3df
incl %ecx
cmpl %eax, %ecx
jne 0xc3c7
ucomisd %xmm12, %xmm1
jb 0xc44e
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0xc473
movapd %xmm1, %xmm0
movq %xmm10, 0x10(%rsp)
callq 0x1210
xorpd %xmm12, %xmm12
movsd 0x207c(%rip), %xmm11    # 0xe4e8
movq 0x10(%rsp), %xmm10
movsd 0x50(%rbx), %xmm1
mulsd %xmm0, %xmm1
movl 0x8(%rbp), %eax
testl %eax, %eax
jle 0xc52f
leal -0x1(%r14), %edx
imull %r14d, %edx
movl %edx, %r10d
shrl $0x1f, %r10d
addl %edx, %r10d
sarl %r10d
movq 0x28(%rsp), %rcx
movl 0x4(%rcx), %edx
imull %eax, %edx
movl %eax, %edi
imull %eax, %edi
movl %edi, %esi
addl %r13d, %r10d
imull %edi, %r10d
imull 0x8(%rsp), %edi
imull 0xc(%rsp), %esi
xorl %ecx, %ecx
movl %r10d, %r9d
movl %ecx, 0x24(%rsp)
movl %r10d, 0x10(%rsp)
movl %r9d, %r11d
xorl %ebp, %ebp
leal (%rdi,%rbp), %ecx
leal (%rsi,%rbp), %r8d
cmpl %r14d, %r13d
movsd 0x50(%rbx), %xmm2
cmovbl %r11d, %ecx
cmovbl %r10d, %r8d
addl %edx, %ecx
movslq %ecx, %rcx
mulsd (%r12,%rcx,8), %xmm2
divsd %xmm0, %xmm2
addl %edx, %r8d
movslq %r8d, %rcx
addsd (%r15,%rcx,8), %xmm2
movsd %xmm2, (%r15,%rcx,8)
incl %ebp
addl %eax, %r11d
addl %eax, %r10d
cmpl %ebp, %eax
jne 0xc4d2
movl 0x24(%rsp), %ecx
incl %ecx
addl %eax, %edi
addl %eax, %esi
incl %r9d
movl 0x10(%rsp), %r10d
incl %r10d
cmpl %eax, %ecx
jne 0xc4c4
addsd %xmm1, %xmm10
incl %r14d
movq 0x28(%rsp), %rbp
movl 0x4(%rbp), %ecx
incl 0x8(%rsp)
incl 0xc(%rsp)
cmpl %ecx, %r14d
jl 0xc33d
movl 0x4(%rbp), %eax
decl %eax
movl 0x20(%rsp), %edx
incl %edx
movl 0x1c(%rsp), %ecx
cmpl %eax, %ecx
jl 0xc2cc
movdqa %xmm10, %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop