// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %r9, 0x8(%rsp)
movq %r8, %rbx
movl %ecx, 0x18(%rsp)
movq %rdx, 0x50(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, %rbp
movq 0x68(%rdi), %rax
movsbq 0x901(%rax), %r13
movzbl 0x900(%rax), %eax
movq %rax, 0x28(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x2110
movq %rax, %r15
movzbl %r13b, %edx
testq %r13, %r13
movq %rdx, 0x10(%rsp)
jle 0xd984
movq 0x10(%rsp), %rax
leal (,%rax,8), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2100
movq 0x10(%rsp), %rdx
movl 0x18(%rsp), %eax
testb %al, %al
jle 0xdb08
movsbl %al, %eax
leal (,%rdx,8), %ecx
movq %rcx, 0x30(%rsp)
movl %eax, 0x1c(%rsp)
movl %eax, %eax
movq %rax, 0x40(%rsp)
xorl %r14d, %r14d
movq 0x8(%rsp), %rsi
movq %rbx, 0x48(%rsp)
movq %r15, 0x20(%rsp)
testb %dl, %dl
jle 0xd9d9
movq %r15, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x2100
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x50(%rsp), %rax
movq %r14, 0x58(%rsp)
movslq (%rax,%r14,4), %rax
movl %eax, (%rsi)
cmpb $0x0, 0x28(%rsp)
jle 0xdaa1
movslq 0x4(%rsi), %rcx
movq 0x38(%rsp), %rdi
movq (%rdi,%rcx,8), %rcx
movq (%rcx,%rax,8), %rbx
xorl %r12d, %r12d
movsd (%rbx,%r12,8), %xmm0
ucomisd 0x4f32(%rip), %xmm0     # 0x12948
jne 0xda3d
jp 0xda3d
movq (%rbp), %rax
movsbl %r12b, %edx
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq *0x28(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movsd %xmm0, (%rbx,%r12,8)
testb %dl, %dl
movq 0x20(%rsp), %r14
jle 0xda93
movsbl %r12b, %r13d
xorl %r15d, %r15d
movsd (%rbx,%r12,8), %xmm0
movsd %xmm0, 0x60(%rsp)
movq (%rbp), %rax
movsbl %r15b, %ecx
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movl %r13d, %edx
callq *0x38(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
mulsd 0x60(%rsp), %xmm0
addsd (%r14,%r15,8), %xmm0
movsd %xmm0, (%r14,%r15,8)
incq %r15
cmpq %r15, %rdx
jne 0xda4d
incq %r12
cmpq 0x28(%rsp), %r12
jne 0xda08
testb %dl, %dl
movq 0x48(%rsp), %rbx
movq 0x20(%rsp), %r15
jle 0xdac9
xorl %eax, %eax
movsd (%r15,%rax,8), %xmm0
addsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0xdab1
movq 0x58(%rsp), %r14
incq %r14
cmpq 0x40(%rsp), %r14
jne 0xd9bc
cmpb $0x1, 0x18(%rsp)
je 0xdb08
testb %dl, %dl
jle 0xdb08
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%rsp), %xmm0
xorl %eax, %eax
movsd (%rbx,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0xdaf2
movsbl %dl, %esi
movq %rbx, %rdi
callq 0x3d7e
movq %r15, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2240
nop