// File: /workspace/github_cpp_makefile_star2_O2/myudelson[P]hmm-scalable/HMMProblemSt.cpp
// Function: HMMProblemSt::producePCorrect(double***, int*, signed char, double*, context*)
void HMMProblemSt::producePCorrect(NUMBER*** group_skill_map, NCAT* skills, NPAR n_skills, NUMBER* local_pred, struct context *ctx) {
    NPAR m, i, nO = this->task->nO, nS = this->task->nS;
    NCAT k;
    NUMBER *local_pred_inner = init1D<NUMBER>(nO);
    for(m=0; m<nO; m++) local_pred[m] = 0.0;
    
    for(int l=0; l<n_skills; l++) {
        for(m=0; m<nO; m++) local_pred_inner[m] = 0.0;
        k = skills[l];
        ctx->k=k;
        NUMBER* group_skill_map_gk = group_skill_map[ctx->g][k];
        for(i=0; i<nS; i++) {
            if(/*group_skill_map[ctx->g][k]*/group_skill_map_gk[i]==-1) {
                /*group_skill_map[ctx->g][k]*/group_skill_map_gk[i] = getPI(ctx,i);
            }
            for(m=0; m<nO; m++)
                local_pred_inner[m] += /*group_skill_map[ctx->g][k]*/group_skill_map_gk[i] * getB(ctx,i,m);
        }
        for(m=0; m<nO; m++)
            local_pred[m] += local_pred_inner[m];
    }
    if(n_skills>1) {
        for(m=0; m<nO; m++)
            local_pred[m] /= n_skills;
    }
    projectsimplex(local_pred, nO);
    free(local_pred_inner);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r15
movl %ecx, 0xc(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, %rbp
movq 0x68(%rdi), %rax
movsbl 0x901(%rax), %r12d
movb 0x900(%rax), %bl
movl %r12d, %edi
callq 0x6a57
movq %rax, %r14
xorl %eax, %eax
testb %r12b, %r12b
movl %r12d, 0x1c(%rsp)
cmovlel %eax, %r12d
movzbl %r12b, %ecx
movq %rcx, (%rsp)
cmpq %rax, (%rsp)
je 0xc37c
andq $0x0, (%r15,%rax,8)
incq %rax
jmp 0xc36c
movsbl 0xc(%rsp), %ecx
movzbl %bl, %eax
xorl %edx, %edx
testb %al, %al
cmovlel %edx, %eax
testl %ecx, %ecx
movl $0x0, %esi
movl %ecx, 0x18(%rsp)
cmovgl %ecx, %esi
movq %rsi, 0x38(%rsp)
movzbl %al, %eax
movq %rax, 0x48(%rsp)
movq %r15, 0x30(%rsp)
cmpq 0x38(%rsp), %rdx
je 0xc49f
xorl %eax, %eax
cmpq %rax, (%rsp)
je 0xc3c8
andq $0x0, (%r14,%rax,8)
incq %rax
jmp 0xc3b8
movq 0x28(%rsp), %rax
movq %rdx, 0x40(%rsp)
movslq (%rax,%rdx,4), %rax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movslq 0x4(%rcx), %rcx
movq 0x20(%rsp), %rdx
movq (%rdx,%rcx,8), %rcx
movq (%rcx,%rax,8), %rbx
xorl %r15d, %r15d
cmpq 0x48(%rsp), %r15
je 0xc46e
movsd (%rbx,%r15,8), %xmm0
ucomisd 0x4542(%rip), %xmm0     # 0x10948
jne 0xc423
jp 0xc423
movq (%rbp), %rax
movsbl %r15b, %edx
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
callq *0x28(%rax)
movsd %xmm0, (%rbx,%r15,8)
movsbl %r15b, %r13d
xorl %r12d, %r12d
cmpq %r12, (%rsp)
je 0xc469
movsd (%rbx,%r15,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movq (%rbp), %rax
movsbl %r12b, %ecx
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movl %r13d, %edx
callq *0x38(%rax)
mulsd 0x50(%rsp), %xmm0
addsd (%r14,%r12,8), %xmm0
movsd %xmm0, (%r14,%r12,8)
incq %r12
jmp 0xc42a
incq %r15
jmp 0xc3f1
xorl %eax, %eax
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %rdx
cmpq %rax, (%rsp)
je 0xc497
movsd (%r14,%rax,8), %xmm0
addsd (%r15,%rax,8), %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
jmp 0xc47a
incq %rdx
jmp 0xc3ab
cmpb $0x2, 0xc(%rsp)
jl 0xc4c9
cvtsi2sdl 0x18(%rsp), %xmm0
xorl %eax, %eax
cmpq %rax, (%rsp)
je 0xc4c9
movsd (%r15,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r15,%rax,8)
incq %rax
jmp 0xc4ae
movsbl 0x1c(%rsp), %esi
movq %r15, %rdi
callq 0x43e4
movq %r14, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3230