// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rcx, %rbx
movq %rdx, (%rsp)
movdqa %xmm0, %xmm7
movq %rsi, %r15
movq %rdi, %r12
cmpl $0x1, 0x58(%rcx)
jne 0xb292
movq (%rsp), %rax
movslq 0x4(%rax), %rax
testq %rax, %rax
jle 0xb292
movq (%rsp), %rcx
movl 0x8(%rcx), %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 0x2350(%rip), %xmm1     # 0xd564
movdqa 0x1e94(%rip), %xmm2     # 0xd0b0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
pmovsxbq 0x2339(%rip), %xmm4     # 0xd566
movq %r15, %r8
testl %ecx, %ecx
jle 0xb286
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 0xb260
movq $0x0, (%r10)
pxor %xmm3, %xmm6
pextrb $0x8, %xmm6, %r11d
testb $0x1, %r11b
je 0xb279
movq $0x0, (%r10,%rax,8)
paddq %xmm4, %xmm5
addq %rsi, %r10
addq $-0x2, %r9
jne 0xb23e
incq %rdi
addq $0x8, %r8
cmpq %rax, %rdi
jne 0xb230
movsd 0x50(%rbx), %xmm0
pxor %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xb43d
movq (%rsp), %rax
movl 0x4(%rax), %eax
cmpl $0x2, %eax
jl 0xb43d
xorl %esi, %esi
movl $0x1, %edx
movsd 0x2214(%rip), %xmm3     # 0xd4d8
pxor %xmm4, %xmm4
movl %esi, %r13d
leal 0x1(%r13), %esi
cmpl %eax, %esi
movl %edx, 0xc(%rsp)
movl %esi, 0x8(%rsp)
jge 0xb428
leal -0x1(%r13), %ecx
imull %r13d, %ecx
movl %ecx, %ebp
shrl $0x1f, %ebp
addl %ecx, %ebp
sarl %ebp
movq (%rsp), %rcx
movl 0x8(%rcx), %ecx
addl %edx, %ebp
movl %esi, %r14d
movapd %xmm3, %xmm0
testl %ecx, %ecx
jle 0xb366
imull %ecx, %eax
leal -0x1(%r14), %esi
imull %r14d, %esi
movl %esi, %edx
shrl $0x1f, %edx
addl %esi, %edx
sarl %edx
movl %ecx, %esi
imull %ecx, %esi
addl %r13d, %edx
imull %esi, %edx
imull %ebp, %esi
xorl %edi, %edi
movapd %xmm3, %xmm0
movl %edx, %r8d
xorl %r9d, %r9d
leal (%rsi,%r9), %r10d
cmpl %r14d, %r13d
cmovbl %r8d, %r10d
addl %eax, %r10d
movslq %r10d, %r10
movsd (%r12,%r10,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incl %r9d
addl %ecx, %r8d
cmpl %r9d, %ecx
jne 0xb332
incl %edi
addl %ecx, %esi
incl %edx
cmpl %ecx, %edi
jne 0xb32c
ucomisd %xmm4, %xmm0
jb 0xb372
sqrtsd %xmm0, %xmm0
jmp 0xb38f
movq %xmm7, 0x10(%rsp)
callq 0x1220
xorpd %xmm4, %xmm4
movsd 0x214f(%rip), %xmm3     # 0xd4d8
movq 0x10(%rsp), %xmm7
movsd 0x50(%rbx), %xmm1
mulsd %xmm0, %xmm1
movq (%rsp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
testl %ecx, %ecx
jle 0xb416
leal -0x1(%r14), %esi
imull %r14d, %esi
movl %esi, %edx
shrl $0x1f, %edx
addl %esi, %edx
sarl %edx
movl %eax, %esi
imull %ecx, %esi
movl %ecx, %edi
imull %ecx, %edi
addl %r13d, %edx
imull %edi, %edx
imull %ebp, %edi
xorl %r8d, %r8d
movl %edx, %r9d
xorl %r10d, %r10d
leal (%rdi,%r10), %r11d
cmpl %r14d, %r13d
movsd 0x50(%rbx), %xmm2
cmovbl %r9d, %r11d
addl %esi, %r11d
movslq %r11d, %r11
mulsd (%r12,%r11,8), %xmm2
divsd %xmm0, %xmm2
addsd (%r15,%r11,8), %xmm2
movsd %xmm2, (%r15,%r11,8)
incl %r10d
addl %ecx, %r9d
cmpl %r10d, %ecx
jne 0xb3d3
incl %r8d
addl %ecx, %edi
incl %edx
cmpl %ecx, %r8d
jne 0xb3cd
addsd %xmm1, %xmm7
incl %r14d
incl %ebp
cmpl %eax, %r14d
jl 0xb2fc
leal -0x1(%rax), %ecx
movl 0xc(%rsp), %edx
incl %edx
movl 0x8(%rsp), %esi
cmpl %ecx, %esi
jl 0xb2c8
movdqa %xmm7, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq