// File: /workspace/github_cpp_makefile_star2_O2/myudelson[P]hmm-scalable/HMMProblemSt.cpp
// Function: HMMProblemSt::createGradientScaleSimplexAffordances(FitBitSt*)
void HMMProblemSt::createGradientScaleSimplexAffordances(FitBitSt *fb) {
    NCAT nK = this->task->nK, nO = this->task->nO, nS = this->task->nS, i;
    fb->sclsmplx_n = nK * (1 + 2 * nS);
    fb->sclsmplx_offsets = init1D<NCAT>(fb->sclsmplx_n);
    fb->sclsmplx_sizes = init1D<NPAR>(fb->sclsmplx_n);
    fb->sclsmplx_blocks = init1D<NCAT>(fb->sclsmplx_n);
    fb->param_blocks = init1D<NCAT>(fb->nPARAM);
    fb->sclsmplx_bound_offsets = init1D<NCAT>(fb->sclsmplx_n);
    NCAT c = 0;
    NDAT offset = 0;
    for(NCAT k=0; k<nK; k++) {
        for(i=0; i<(1+nS); i++) {
            fb->sclsmplx_offsets[c] = offset;
            fb->sclsmplx_bound_offsets[c] = i*nS;
            fb->sclsmplx_sizes[c] = (NPAR)nS;
            fb->sclsmplx_blocks[c] = k; // which [skill] block this simplex is part of
            offset+=nS;
            c++;
        }
        for(i=0; i<nS; i++) {
            fb->sclsmplx_offsets[c] = offset;
            fb->sclsmplx_bound_offsets[c] = (1+nS)*nS + i*nO;
            fb->sclsmplx_sizes[c] = (NPAR)nO;
            fb->sclsmplx_blocks[c] = k; // which [skill] block this simplex is part of
            offset+=nO;
            c++;
        }
        for(i=(k*this->skill1_n);i<((1+k)*this->skill1_n);i++) fb->param_blocks[i]=k;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x68(%rdi), %rax
movl 0x908(%rax), %ebp
movb 0x900(%rax), %cl
movb 0x901(%rax), %al
movsbl %al, %r15d
movsbl %cl, %r12d
leal 0x1(,%r12,2), %edi
imull %ebp, %edi
movl %edi, 0xc0(%rsi)
callq 0xec25
movq %rax, 0x98(%rbx)
movl 0xc0(%rbx), %edi
callq 0x92ec
movq %rax, 0xa8(%rbx)
movl 0xc0(%rbx), %edi
callq 0xec25
movq %rax, 0xb0(%rbx)
movl 0xc(%rbx), %edi
callq 0xec25
movq %rax, 0xb8(%rbx)
movl 0xc0(%rbx), %edi
callq 0xec25
movq %rax, 0xa0(%rbx)
leal 0x1(%r12), %eax
movl %eax, %ecx
imull %r12d, %ecx
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
testl %r12d, %r12d
movl $0x0, %esi
cmovgl %r12d, %esi
testl %ebp, %ebp
cmovlel %edx, %ebp
xorl %r9d, %r9d
xorl %edi, %edi
cmpl %ebp, %edi
je 0xcf01
movslq %edx, %rdx
xorl %r10d, %r10d
movl %eax, %r11d
leal (%r9,%r10), %r8d
subl $0x1, %r11d
jb 0xce81
movq 0x98(%rbx), %r13
movl %r8d, (%r13,%rdx,4)
movq 0xa0(%rbx), %r8
movl %r10d, (%r8,%rdx,4)
movq 0xa8(%rbx), %r8
movb %r12b, (%r8,%rdx)
movq 0xb0(%rbx), %r8
movl %edi, (%r8,%rdx,4)
incq %rdx
addl %r12d, %r10d
jmp 0xce42
movl %ecx, %r9d
movl %esi, %r10d
subl $0x1, %r10d
jb 0xcec4
movq 0x98(%rbx), %r11
movl %r8d, (%r11,%rdx,4)
movq 0xa0(%rbx), %r11
movl %r9d, (%r11,%rdx,4)
movq 0xa8(%rbx), %r11
movb %r15b, (%r11,%rdx)
movq 0xb0(%rbx), %r11
movl %edi, (%r11,%rdx,4)
addl %r15d, %r8d
incq %rdx
addl %r15d, %r9d
jmp 0xce87
movl 0x38(%r14), %r11d
leal 0x1(%rdi), %r10d
movl %r11d, %r9d
imull %edi, %r9d
movslq %r9d, %r9
imull %r10d, %r11d
movslq %r11d, %r11
cmpq %r11, %r9
jge 0xcef6
movq 0xb8(%rbx), %r11
movl %edi, (%r11,%r9,4)
incq %r9
movl 0x38(%r14), %r11d
jmp 0xced6
movl %r8d, %r9d
movl %r10d, %edi
jmp 0xce31
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq