LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::computeGradients(FitBit*)
NDAT HMMProblem::computeGradients(FitBit *fb){
    fb->toZero(FBS_GRAD);
    
    NDAT ndat = computeAlphaAndPOParam(fb->xndat, fb->x_data);
    computeBeta(fb->xndat, fb->x_data);

    if(fb->pi != NULL && this->p->block_fitting[0]==0) setGradPI(fb);
    if(fb->A  != NULL && this->p->block_fitting[1]==0) setGradA(fb);
    if(fb->B  != NULL && this->p->block_fitting[2]==0) setGradB(fb);
    return ndat;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x3, %esi
callq 0xaf84
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11908
movl %eax, %ebp
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11c5e
cmpq $0x0, 0x10(%rbx)
je 0x125f0
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x125f0
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x28(%rax)
cmpq $0x0, 0x18(%rbx)
je 0x12613
movq 0x88(%r14), %rax
cmpb $0x0, 0x982(%rax)
jne 0x12613
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x30(%rax)
cmpq $0x0, 0x20(%rbx)
je 0x12636
movq 0x88(%r14), %rax
cmpb $0x0, 0x983(%rax)
jne 0x12636
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x38(%rax)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::computeGradientsBig(FitBit**, int)
NDAT HMMProblem::computeGradientsBig(FitBit **fbs, NCAT nfbs){
    NCAT xndat = this->p->nSeq;
    struct data** x_data = this->p->k_data;
//    NPAR kg_flag = -1;
   
	NCAT x;
    
//    switch(this->p->structure)
//    {
//        case STRUCTURE_SKILL:
//            kg_flag = 0;
//            break;
//        case STRUCTURE_GROUP:
//            kg_flag = 1;
//            break;
//    }

    // there are as many fbs as skills or groups in this setup
    for(x=0; x<nfbs; x++)
        fbs[x]->toZero(FBS_GRAD);
    
    NDAT ndat = computeAlphaAndPOParam(xndat, x_data);
    computeBeta(xndat, x_data);

    
	for(x=0; x<nfbs; x++) {
        if(fbs[x]->pi != NULL && this->p->block_fitting[0]==0) setGradPI(fbs[x]);
        if(fbs[x]->A  != NULL && this->p->block_fitting[1]==0) setGradA (fbs[x]);
        if(fbs[x]->B  != NULL && this->p->block_fitting[2]==0) setGradB (fbs[x]);
    }// for all sequences
    return ndat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x88(%rdi), %rax
movl 0x8dc(%rax), %ecx
movl %ecx, 0x4(%rsp)
movq 0x8f0(%rax), %r13
movl %edx, %ebp
testl %edx, %edx
jle 0x12689
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
movl $0x3, %esi
callq 0xaf84
incq %r12
cmpq %r12, %rbp
jne 0x12673
movq %r14, %rdi
movl 0x4(%rsp), %r12d
movl %r12d, %esi
movq %r13, %rdx
callq 0x11908
movl %eax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x11c5e
testl %r15d, %r15d
jle 0x12729
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x126dd
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x126dd
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x18(%rsi)
je 0x12701
movq 0x88(%r14), %rax
cmpb $0x0, 0x982(%rax)
jne 0x12701
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x20(%rsi)
je 0x12721
movq 0x88(%r14), %rax
cmpb $0x0, 0x983(%rax)
jne 0x12721
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
incq %r15
cmpq %r15, %rbp
jne 0x126b5
movl (%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::fit()
void HMMProblem::fit() {
    NUMBER* loglik_rmse = init1D<NUMBER>(2);
    FitNullSkill(loglik_rmse, false /*do RMSE*/);
    switch(this->p->solver)
    {
        case METHOD_BW: // Conjugate Gradient Descent
            loglik_rmse[0] += BaumWelch();
            break;
        case METHOD_GD: // Gradient Descent
        case METHOD_CGD: // Conjugate Gradient Descent
        case METHOD_GDL: // Gradient Descent, Lagrange
        case METHOD_GBB: // Brzilai Borwein Gradient Method
            loglik_rmse[0] += GradientDescent();
            break;
        default:
            fprintf(stderr,"Solver specified is not supported.\n");
            break;
    }
    this->neg_log_lik = loglik_rmse[0];
    free(loglik_rmse);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x142a2
movq 0x88(%rbx), %rax
movzbl 0x3f(%rax), %eax
leal -0x2(%rax), %ecx
cmpl $0x4, %ecx
jae 0x1426c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
addsd (%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
cmpl $0x1, %eax
jne 0x1427b
movq %rbx, %rdi
callq 0x14550
jmp 0x14253
movq 0x2ad56(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
leaq 0x20296(%rip), %rdi     # 0x34522
movl $0x23, %esi
movl $0x1, %edx
callq 0x4480
movsd (%r14), %xmm0
jmp 0x14258
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::free3Params(double*&, double**&, double**&, signed char)
void HMMProblem::free3Params(NUMBER* &PI, NUMBER** &A, NUMBER** &B, NPAR nS) {
    free(PI);
    free2D<NUMBER>(A, (NDAT)nS);
    free2D<NUMBER>(B, (NDAT)nS);
    PI = NULL;
    A  = NULL;
    B  = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq (%rsi), %rdi
callq 0x42a0
movq (%r15), %rdi
movl %ebx, %esi
callq 0xa5dd
movq (%r14), %rdi
movl %ebx, %esi
callq 0xa5dd
xorl %eax, %eax
movq %rax, (%r12)
movq %rax, (%r15)
movq %rax, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::checkConvergenceBig(FitBit**, int, double, double*)
bool HMMProblem::checkConvergenceBig(FitBit** fbs, NCAT nfbs, NUMBER tol, NUMBER *criterion) {
    NUMBER critetion_bit;
    for(NCAT x=0; x<nfbs; x++)
    {
        critetion_bit = 0;
        for(NPAR i=0; i<fbs[x]->nS; i++)
        {
            if(fbs[x]->pi != NULL) critetion_bit += pow( fbs[x]->pi[i]-fbs[x]->PIm1[i], 2 )/*:0*/;
            for(NPAR j=0; (fbs[x]->A != NULL) && j<fbs[x]->nS; j++) {
                critetion_bit+= pow(fbs[x]->A[i][j] - fbs[x]->Am1[i][j],2);
            }
            for(NPAR k=0; (fbs[x]->B != NULL) && k<fbs[x]->nO; k++) {
                critetion_bit += pow(fbs[x]->B[i][k] - fbs[x]->Bm1[i][k],2);
            }
        }
        *criterion += sqrt(critetion_bit);
    }
    *criterion/=nfbs;
	return (*criterion) < tol; // double the truth or false
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
testl %edx, %edx
movsd %xmm0, 0x10(%rsp)
movl %edx, 0xc(%rsp)
jle 0x17453
movq %rsi, %r14
movl %edx, %r15d
xorl %r12d, %r12d
xorpd %xmm2, %xmm2
xorl %r13d, %r13d
movq (%r14,%r13,8), %rax
movsbq 0x1(%rax), %rcx
xorpd %xmm0, %xmm0
testq %rcx, %rcx
jle 0x17428
movq 0x10(%rax), %rdx
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rdi
xorl %r8d, %r8d
testq %rdx, %rdx
je 0x173ad
movsd (%rdx,%r8,8), %xmm1
movq 0x28(%rax), %r9
subsd (%r9,%r8,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
testq %rsi, %rsi
je 0x173dd
movq (%rsi,%r8,8), %r9
movq 0x30(%rax), %r10
movq (%r10,%r8,8), %r10
xorl %r11d, %r11d
movsd (%r9,%r11,8), %xmm1
subsd (%r10,%r11,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %r11
cmpq %r11, %rcx
jne 0x173c1
testq %rdi, %rdi
je 0x1741c
movl (%rax), %r9d
testb %r9b, %r9b
cmovlel %r12d, %r9d
jle 0x1741c
movzbl %r9b, %r9d
movq (%rdi,%r8,8), %r10
movq 0x38(%rax), %r11
movq (%r11,%r8,8), %r11
xorl %ebp, %ebp
movsd (%r10,%rbp,8), %xmm1
subsd (%r11,%rbp,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rbp
cmpq %rbp, %r9
jne 0x17400
incq %r8
cmpq %rcx, %r8
jne 0x17390
ucomisd %xmm2, %xmm0
jb 0x17434
sqrtsd %xmm0, %xmm0
jmp 0x1743d
callq 0x41a0
xorpd %xmm2, %xmm2
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
incq %r13
cmpq %r15, %r13
jne 0x1736b
jmp 0x17457
movsd (%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0xc(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movsd %xmm0, (%rbx)
seta %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::BaumWelchBit(FitBit*)
FitResult HMMProblem::BaumWelchBit(FitBit *fb) {
    FitResult fr;
    fr.iter = 1;
    fr.pO0  = 0.0;
    fr.pO   = 0.0;
    fr.conv = 0; // converged
    fr.ndat = 0;
    NCAT xndat = fb->xndat;
    struct data **x_data = fb->x_data;
    
    fr.ndat = -1; // no accounting so far
    while( !fr.conv && fr.iter<=this->p->maxiter ) {
        if(fr.iter==1) {
            fr.ndat = computeAlphaAndPOParam(xndat, x_data);
            fr.pO0 = HMMProblem::getSumLogPOPara(xndat, x_data);
            fr.pOmid = fr.pO0;
        }
        fb->copy(FBS_PAR, FBS_PARm1);
        fr.pO = doBaumWelchStep(fb);// PI, A, B);
        
        // check convergence
        fr.conv = fb->checkConvergence(&fr);
        
        if( fr.conv || fr.iter==this->p->maxiter ) {
            //computeAlphaAndPOParam(fb->xndat, fb->x_data);
            fr.pO = HMMProblem::getSumLogPOPara(xndat, x_data);
        }
        fr.iter ++;
        fr.pOmid = fr.pO;
    } // main solver loop
    // recycle memory (Alpha, Beta, p_O_param, Xi, Gamma)
    RecycleFitData(fb->xndat, fb->x_data, this->p);
    fr.iter--;
    return fr;
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, (%rdi)
movq $0x0, 0x8(%rdi)
leaq 0x18(%rdi), %rbp
xorpd %xmm0, %xmm0
movupd %xmm0, 0x18(%rdi)
movl 0xe8(%rdx), %r12d
movq 0xf0(%rdx), %r13
movl $0xffffffff, 0x24(%rdi) # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq 0x88(%r14), %rax
cmpl 0x38(%rax), %ecx
jg 0x17bd3
cmpl $0x1, %ecx
jne 0x17b44
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x11908
movl %eax, 0x24(%rbx)
xorpd %xmm0, %xmm0
testl %r12d, %r12d
jle 0x17b3a
xorl %eax, %eax
movq (%r13,%rax,8), %rcx
cmpl $0x0, 0x4(%rcx)
xorpd %xmm1, %xmm1
jne 0x17b2e
movsd 0x50(%rcx), %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %r12
jne 0x17b1a
movsd %xmm0, 0x8(%rbx)
movsd %xmm0, 0x10(%rbx)
movq %r15, %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0xb03a
movq %r14, %rdi
movq %r15, %rsi
callq 0x17c02
movsd %xmm0, 0x18(%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb196
movzbl %al, %ecx
movl %ecx, 0x20(%rbx)
testb %cl, %cl
jne 0x17b89
movl (%rbx), %ecx
movq 0x88(%r14), %rdx
cmpl 0x38(%rdx), %ecx
jne 0x17bbd
xorpd %xmm0, %xmm0
testl %r12d, %r12d
jle 0x17bb4
xorl %ecx, %ecx
movq (%r13,%rcx,8), %rdx
cmpl $0x0, 0x4(%rdx)
xorpd %xmm1, %xmm1
jne 0x17ba8
movsd 0x50(%rdx), %xmm1
addsd %xmm1, %xmm0
incq %rcx
cmpq %rcx, %r12
jne 0x17b94
movsd %xmm0, 0x18(%rbx)
movl (%rbx), %ecx
jmp 0x17bc2
movsd (%rbp), %xmm0
incl %ecx
movl %ecx, (%rbx)
movsd %xmm0, 0x10(%rbx)
testb %al, %al
je 0x17ae9
movq 0xf0(%r15), %rsi
movl 0xe8(%r15), %edi
movq 0x88(%r14), %rdx
callq 0xa3aa
decl (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::readNullObsRatio(_IO_FILE*, param*, int*)
void HMMProblem::readNullObsRatio(FILE *fid, struct param* param, NDAT *line_no) {
	NPAR i;
	//
	// read null skill ratios
	//
    fscanf(fid, "Null skill ratios\t");
    this->null_obs_ratio =Calloc(NUMBER, (size_t)this->p->nO);
    this->null_skill_obs      = 0;
    this->null_skill_obs_prob = 0;
	for(i=0; i<param->nO; i++) {
        if( i==(param->nO-1) ) // end
            fscanf(fid,"%lf\n",&this->null_obs_ratio[i] );
        else
            fscanf(fid,"%lf\t",&this->null_obs_ratio[i] );
		
        if( this->null_obs_ratio[i] > this->null_skill_obs_prob ) {
            this->null_skill_obs_prob = this->null_obs_ratio[i];
            this->null_skill_obs = i;
        }
	}
    (*line_no)++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x1b489(%rip), %rsi     # 0x3456a
movq %r15, %rdi
xorl %eax, %eax
callq 0x4460
movq 0x88(%r12), %rax
movsbq 0x8b9(%rax), %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, %rdx
movq %rax, 0x18(%r12)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x28(%r12)
movb 0x8b9(%r14), %al
testb %al, %al
jle 0x19194
xorl %ebx, %ebx
xorl %r13d, %r13d
xorl %ebp, %ebp
movsbl %al, %eax
decl %eax
addq %rbx, %rdx
cmpl %eax, %r13d
leaq 0x1b726(%rip), %rsi     # 0x34862
leaq 0x1b71a(%rip), %rax     # 0x3485d
cmoveq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x4460
movq 0x18(%r12), %rdx
movsd (%rdx,%rbx), %xmm0
ucomisd 0x30(%r12), %xmm0
jbe 0x1917d
movsd %xmm0, 0x30(%r12)
movsbl %r13b, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%r12)
incq %rbp
movsbq 0x8b9(%r14), %rax
incl %r13d
addq $0x8, %rbx
cmpq %rax, %rbp
jl 0x1912a
movq (%rsp), %rax
incl (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::checkConvergenceBig0(FitBit**, int, double, double*)
bool HMMProblem::checkConvergenceBig0(FitBit** fbs, NCAT nfbs, NUMBER tol, NUMBER *criterion) {
    for(NCAT x=0; x<nfbs; x++)
    {
        for(NPAR i=0; i<fbs[x]->nS; i++)
        {
            if(fbs[x]->pi != NULL) *criterion += pow( fbs[x]->pi[i]-fbs[x]->PIm1[i], 2 )/*:0*/;
            for(NPAR j=0; (fbs[x]->A != NULL) && j<fbs[x]->nS; j++) {
                *criterion += pow(fbs[x]->A[i][j] - fbs[x]->Am1[i][j],2);
            }
            for(NPAR k=0; (fbs[x]->B != NULL) && k<fbs[x]->nO; k++) {
                *criterion += pow(fbs[x]->B[i][k] - fbs[x]->Bm1[i][k],2);
            }
        }
    }
    *criterion = sqrt(*criterion);
	return (*criterion) < tol; // double the truth or false
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movapd %xmm0, %xmm2
testl %edx, %edx
jle 0x1982b
movl %edx, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rsi,%rdx,8), %rdi
movsbq 0x1(%rdi), %r8
testq %r8, %r8
jle 0x1981f
movq 0x10(%rdi), %r9
movq 0x18(%rdi), %r10
movq 0x20(%rdi), %r11
xorl %r14d, %r14d
testq %r9, %r9
je 0x19794
movsd (%r9,%r14,8), %xmm0
movq 0x28(%rdi), %r15
subsd (%r15,%r14,8), %xmm0
mulsd %xmm0, %xmm0
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
testq %r10, %r10
je 0x197cc
movq (%r10,%r14,8), %r15
movq 0x30(%rdi), %r12
movq (%r12,%r14,8), %r12
movsd (%rbx), %xmm0
xorl %r13d, %r13d
movsd (%r15,%r13,8), %xmm1
subsd (%r12,%r13,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
incq %r13
cmpq %r13, %r8
jne 0x197ac
testq %r11, %r11
je 0x19813
movl (%rdi), %ebp
testb %bpl, %bpl
cmovlel %ecx, %ebp
jle 0x19813
movzbl %bpl, %r15d
movq (%r11,%r14,8), %r12
movq 0x38(%rdi), %r13
movq (%r13,%r14,8), %r13
movsd (%rbx), %xmm0
xorl %ebp, %ebp
movsd (%r12,%rbp,8), %xmm1
subsd (%r13,%rbp,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
incq %rbp
cmpq %rbp, %r15
jne 0x197f2
incq %r14
cmpq %r8, %r14
jne 0x19773
incq %rdx
cmpq %rax, %rdx
jne 0x19752
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1983f
sqrtsd %xmm0, %xmm0
jmp 0x1984e
movsd %xmm2, (%rsp)
callq 0x41a0
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
movsd %xmm0, (%rbx)
seta %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::toFileAlphaBetaObs(char const*, int)
void HMMProblem::toFileAlphaBetaObs(const char *filename, NCAT k) {
    NPAR nS = this->p->nS;
    FILE *fid = fopen(filename,"w");
    
    if(fid == NULL) {
        fprintf(stderr,"Can't write output model file %s\n",filename);
        exit(1);
    }
    
    struct data *dt = this->p->k_data[k];
    
    for(NDAT tt=0; tt<dt->n; tt++) {
        for(NPAR i=0; i<nS; i++) fprintf(fid,"%20.17f\t", dt->alpha[tt][i]);
        for(NPAR i=0; i<nS; i++) fprintf(fid,"%20.17f\t", dt->beta[tt][i]);
        fprintf(fid,"%i\n", this->p->dat_obs[ dt->ix[tt] ]);
    }
   fclose(fid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x88(%rdi), %rax
movzbl 0x8b8(%rax), %r13d
leaq 0x1acb5(%rip), %rsi     # 0x34546
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x19979
movq %rax, %r14
movq 0x88(%rbx), %rax
movq 0x8f0(%rax), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rbp
cmpl $0x0, (%rbp)
jle 0x19963
leaq 0x1afb6(%rip), %r15     # 0x34881
xorl %r12d, %r12d
movq %rbx, (%rsp)
testb %r13b, %r13b
jle 0x19924
xorl %ebx, %ebx
movq 0x28(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4330
incq %rbx
cmpq %rbx, %r13
jne 0x198d9
testb %r13b, %r13b
jle 0x19924
xorl %ebx, %ebx
movq 0x30(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4330
incq %rbx
cmpq %rbx, %r13
jne 0x19902
movq (%rsp), %rbx
movq 0x88(%rbx), %rax
movq 0x870(%rax), %rax
movq 0x10(%rbp), %rcx
movslq (%rcx,%r12,4), %rcx
movsbl (%rax,%rcx), %edx
movq %r14, %rdi
leaq 0x1a22a(%rip), %rsi     # 0x33b76
xorl %eax, %eax
callq 0x4330
incq %r12
movslq (%rbp), %rax
cmpq %rax, %r12
jl 0x198d2
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x4d23
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGK.cpp
// Function: HMMProblemPiGK::HMMProblemPiGK(param*)
HMMProblemPiGK::HMMProblemPiGK(struct param *param) {
    for(NPAR i=0; i<3; i++) this->sizes[i] = param->nK;
//    this->sizes = {param->nK, param->nK, param->nK};
    this->n_params = param->nK * 4 + param->nG;
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1094c
leaq 0x24cd6(%rip), %rax     # 0x3e670
movq %rax, (%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0xc(%rbx)
movl %eax, 0x10(%rbx)
movl %eax, 0x14(%rbx)
movl 0x8c0(%r14), %eax
shll $0x2, %eax
addl 0x8bc(%r14), %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x199e8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x11218
movq %r14, %rdi
callq 0x4430
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGK.cpp
// Function: HMMProblemPiGK::setGradPI(FitBit*)
void HMMProblemPiGK::setGradPI(FitBit *fb){
    if(this->p->block_fitting[0]>0) return;
    NDAT t = 0, ndat = 0;
    NPAR i, o;
    NUMBER combined, deriv_logit;
    struct data* dt;
    for(NCAT x=0; x<fb->xndat; x++) {
        dt = fb->x_data[x];
        if( dt->cnt!=0 ) continue;
        ndat += dt->n;
//    o = dt->obs[t];
        o = this->p->dat_obs[ dt->ix[t] ];//->get( dt->ix[t] );
        for(i=0; i<fb->nS; i++) {
            combined = getPI(dt,i);//sigmoid( logit(this->PI[k][i]) + logit(this->PIg[g][i]) );
            deriv_logit = 1 / safe0num( fb->pi[i] * (1-fb->pi[i]) );
            fb->gradPI[i] -= combined * (1-combined) * deriv_logit * dt->beta[t][i] * ((o<0)?1:getB(dt,i,o)) / safe0num(dt->p_O_param);
        }
    }
    if( this->p->Cslices>0 ) // penalty
        fb->addL2Penalty(FBV_PI, this->p, (NUMBER)ndat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x88(%rdi), %rdx
cmpb $0x0, 0x981(%rdx)
jle 0x1a231
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movl 0xe8(%rsi), %eax
testl %eax, %eax
jle 0x1a38e
movq %rdi, %r14
xorl %r12d, %r12d
xorl %esi, %esi
movq 0xf0(%rbx), %rcx
movq (%rcx,%r12,8), %r15
cmpl $0x0, 0x4(%r15)
jne 0x1a36f
addl (%r15), %esi
cmpb $0x0, 0x1(%rbx)
jle 0x1a36f
movl %esi, 0x10(%rsp)
movq 0x88(%r14), %rax
movq 0x870(%rax), %rax
movq 0x10(%r15), %rcx
movslq (%rcx), %rcx
movb (%rax,%rcx), %r13b
movsbl %r13b, %eax
movl %eax, 0x14(%rsp)
xorl %ebp, %ebp
movq (%r14), %rax
movsbl %bpl, %edx
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rax)
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rbx), %rax
movsd (%rax,%rbp,8), %xmm1
movsd 0x19635(%rip), %xmm0    # 0x338f0
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x8df8
movsd 0x19620(%rip), %xmm2    # 0x338f0
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
movsd 0x8(%rsp), %xmm3
subsd %xmm3, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm1, %xmm0
movq 0x30(%r15), %rax
movq (%rax), %rax
mulsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd %xmm2, %xmm0
testb %r13b, %r13b
js 0x1a31d
movq (%r14), %rax
movsbl %bpl, %edx
movq %r14, %rdi
movq %r15, %rsi
movl 0x14(%rsp), %ecx
callq *0x20(%rax)
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x48(%r15), %xmm0
callq 0x8df8
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x58(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movsbq 0x1(%rbx), %rax
cmpq %rax, %rbp
jl 0x1a294
movl 0xe8(%rbx), %eax
movl 0x10(%rsp), %esi
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x1a24a
movq 0x88(%r14), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
jmp 0x1a392
xorpd %xmm0, %xmm0
cmpb $0x0, 0x42(%rdx)
jle 0x1a222
movq %rbx, %rdi
movl $0x1, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb90a
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGK.cpp
// Function: HMMProblemPiGK::fit()
void HMMProblemPiGK::fit() {
    NUMBER* loglik_rmse = init1D<NUMBER>(2);
    FitNullSkill(loglik_rmse, false /*do not need RMSE/SE*/);
    if(this->p->structure == STRUCTURE_PIgk) {
        loglik_rmse[0] += GradientDescent();
    } else {
        fprintf(stderr,"Solver specified is not supported.\n");
        exit(1);
    }
    this->neg_log_lik = loglik_rmse[0];
    free(loglik_rmse);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x142a2
movq 0x88(%rbx), %rax
cmpb $0x4, 0x3e(%rax)
jne 0x1a8bc
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
addsd (%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
callq 0x4dde
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGKww.cpp
// Function: HMMProblemPiGKww::init(param*)
void HMMProblemPiGKww::init(struct param *param){
//    HMMProblemPiGK::init(param);
    this->ww = init1D<NUMBER>(3);
	this->ww[0] = 0.5;//1;
	this->ww[1] = 0.5;//1;
    this->ww[2] = 0;//0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x3, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, 0x98(%rbx)
movaps 0x19025(%rip), %xmm0    # 0x34a60
movups %xmm0, (%rax)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGKww.cpp
// Function: HMMProblemPiGKww::getPI(data*, signed char)
NUMBER HMMProblemPiGKww::getPI(struct data* dt, NPAR i) {
//    NUMBER p = this->pi[dt->k][i] * 2 * this->ww[0][i], q = this->PIg[dt->g][i] * 2 * this->ww[1][i];
//    return 1/( 1 + (1-p)*(1-q)/(p*q) );

//    NUMBER lw0 = logit(this->ww[0][i]), lw1 = logit(this->ww[1][i]);
//    NUMBER p = this->pi[dt->k][i], q = this->PIg[dt->g][i];
//    return 1/( 1 + pow(1-p,lw0)*pow(1-q,lw1)/(pow(p,lw0)*pow(q,lw1)) );
    
//    NUMBER p = this->pi[dt->k][i] * 2 * this->ww[0], q = this->PIg[dt->g][i] * 2 * this->ww[1];
//    return 1/( 1 + (1-p)*(1-q)/(p*q) );

//    // a logit(k) + b logit(u)
//    NUMBER p = pow((1-this->pi[dt->k][i])/safe0num(this->pi[dt->k][i]), this->ww[0]), q = pow((1-this->PIg[dt->g][i])/safe0num(this->PIg[dt->g][i]), this->ww[1]);
//    return 1/( 1 + p*q/exp(this->ww[2]) );
    
    // logit1(a) logit(k) + logit1(b) logit(u)
    NUMBER p = this->pi[dt->k][i], q = this->PIg[dt->g][i];
    return 1/( 1 + pow( (1-p)/p,1+logit(this->ww[0])) * pow( (1-q)/q,1+logit(this->ww[1])) * ( (0.5-this->ww[2])/safe0num(0.5+this->ww[2]) )/* */  );
    
//    // logit1(a) logit(k) + logit1(b) logit(u)
//    NUMBER p = this->pi[dt->k][i], q = this->PIg[dt->g][i];
//    NUMBER a = 1+sqrt(3)*(this->ww[0]-0.5)/sqrt(1-pow(this->ww[0]-0.5,2)),
//           b = 1+sqrt(3)*(this->ww[1]-0.5)/sqrt(1-pow(this->ww[1]-0.5,2)),
//           c = 1+sqrt(3)*(this->ww[2]-0.5)/sqrt(1-pow(this->ww[2]-0.5,2));
//    
//    return 1/( 1 + pow( (1-p)/p,a) * pow( (1-q)/q,b) * exp(-c)  );
    
    
    
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movslq 0x58(%rsi), %rax
movq 0x38(%rdi), %rcx
movq 0x90(%rdi), %rdi
movq (%rcx,%rax,8), %rax
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm0
movslq 0x5c(%rsi), %rax
movq (%rdi,%rax,8), %rax
movsd (%rax,%rcx,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x17e32(%rip), %xmm1    # 0x338f0
subsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq 0x98(%rbx), %rax
movsd (%rax), %xmm0
callq 0x8e83
movapd %xmm0, %xmm1
addsd 0x17e09(%rip), %xmm1    # 0x338f0
movsd (%rsp), %xmm0
callq 0x4420
movsd %xmm0, (%rsp)
movsd 0x17df2(%rip), %xmm1    # 0x338f0
movsd 0x8(%rsp), %xmm0
subsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movq 0x98(%rbx), %rax
movsd 0x8(%rax), %xmm0
callq 0x8e83
movapd %xmm0, %xmm1
addsd 0x17dc1(%rip), %xmm1    # 0x338f0
movsd 0x8(%rsp), %xmm0
callq 0x4420
mulsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x98(%rbx), %rax
movsd 0x10(%rax), %xmm0
movsd 0x17dc7(%rip), %xmm1    # 0x33920
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
addsd %xmm1, %xmm0
callq 0x8df8
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
mulsd 0x8(%rsp), %xmm1
movsd 0x17d6a(%rip), %xmm0    # 0x338f0
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiGKww.cpp
// Function: HMMProblemPiGKww::computeGradients(FitBit*)
NDAT HMMProblemPiGKww::computeGradients(FitBit *fb){
    fb->toZero(FBS_GRAD);
    
    NDAT ndat = computeAlphaAndPOParam(fb->xndat, fb->x_data);
    computeBeta(fb->xndat, fb->x_data);

    /*vv diff vv*/
    if(fb->pi != NULL && this->p->block_fitting[0]==0) setGradPI(fb);
    if(fb->pi != NULL && this->p->block_fitting[0]==0) setGradWW(fb);
    /*^^ diff ^^*/

    if(fb->A  != NULL && this->p->block_fitting[1]==0) setGradA(fb);
    if(fb->B  != NULL && this->p->block_fitting[2]==0) setGradB(fb);
    return ndat;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x3, %esi
callq 0xaf84
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11908
movl %eax, %ebp
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11c5e
cmpq $0x0, 0x10(%rbx)
je 0x1c61c
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x1c5fd
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x28(%rax)
cmpq $0x0, 0x10(%rbx)
je 0x1c61c
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x1c61c
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0xc8(%rax)
cmpq $0x0, 0x18(%rbx)
je 0x1c63f
movq 0x88(%r14), %rax
cmpb $0x0, 0x982(%rax)
jne 0x1c63f
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x30(%rax)
cmpq $0x0, 0x20(%rbx)
je 0x1c662
movq 0x88(%r14), %rax
cmpb $0x0, 0x983(%rax)
jne 0x1c662
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x38(%rax)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemAGK.cpp
// Function: HMMProblemAGK::HMMProblemAGK(param*)
HMMProblemAGK::HMMProblemAGK(struct param *param) {
    this->sizes[0] = param->nK;
    this->sizes[1] = param->nK;
    this->sizes[2] = param->nK;
    this->n_params = param->nK * 4 + param->nG;
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1094c
leaq 0x20ede(%rip), %rax     # 0x3e858
movq %rax, (%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0xc(%rbx)
movl %eax, 0x10(%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0x14(%rbx)
shll $0x2, %eax
addl 0x8bc(%r14), %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1d9c8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x11218
movq %r14, %rdi
callq 0x4430
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemAGK.cpp
// Function: HMMProblemAGK::destroy()
void HMMProblemAGK::destroy() {
	// destroy model data
    if( this->Ag != NULL) {
        free3D<NUMBER>(this->Ag, this->p->nG, this->p->nS);
        this->Ag = NULL;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x90(%rdi), %rdi
testq %rdi, %rdi
je 0x1e124
movq 0x88(%rbx), %rax
movl 0x8bc(%rax), %esi
movsbl 0x8b8(%rax), %edx
callq 0xca4f
movq $0x0, 0x90(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemAGK.cpp
// Function: HMMProblemAGK::fit()
void HMMProblemAGK::fit() {
    NUMBER* loglik_rmse = init1D<NUMBER>(2);
    FitNullSkill(loglik_rmse, false /*do not need RMSE/SE*/);
    if(this->p->structure==STRUCTURE_Agk)
        loglik_rmse[0] += GradientDescent();
    else {
        fprintf(stderr,"Solver specified is not supported.\n");
        exit(1);
    }
    this->neg_log_lik = loglik_rmse[0];
    free(loglik_rmse);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x142a2
movq 0x88(%rbx), %rax
cmpb $0x6, 0x3e(%rax)
jne 0x1e9d6
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
addsd (%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
callq 0x4f33
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiAGK.cpp
// Function: HMMProblemPiAGK::HMMProblemPiAGK(param*)
HMMProblemPiAGK::HMMProblemPiAGK(struct param *param) {
//    this->sizes = {param->nK, param->nK, param->nK};
    this->sizes[0] = param->nK;
    this->sizes[1] = param->nK;
    this->sizes[2] = param->nK;
    this->n_params = param->nK * 4 + param->nG * 2;
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1094c
leaq 0x1ee66(%rip), %rax     # 0x3e928
movq %rax, (%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0xc(%rbx)
movl %eax, 0x10(%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0x14(%rbx)
shll $0x2, %eax
movl 0x8bc(%r14), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1fb12
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x11218
movq %r14, %rdi
callq 0x4430
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiAGK.cpp
// Function: HMMProblemPiAGK::fit()
void HMMProblemPiAGK::fit() {
    NUMBER* loglik_rmse = init1D<NUMBER>(2);
    FitNullSkill(loglik_rmse, false /*do not need RMSE/SE*/);
    if(this->p->structure==STRUCTURE_PIAgk) {
        loglik_rmse[0] += GradientDescent();
    } else {
        fprintf(stderr,"Solver specified is not supported.\n");
        exit(1);
    }
    this->neg_log_lik = loglik_rmse[0];
    free(loglik_rmse);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x142a2
movq 0x88(%rbx), %rax
cmpb $0x5, 0x3e(%rax)
jne 0x20dfe
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
addsd (%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
callq 0x50b2
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiABGK.cpp
// Function: HMMProblemPiABGK::HMMProblemPiABGK(param*)
HMMProblemPiABGK::HMMProblemPiABGK(struct param *param) {
    //    this->sizes = {param->nK, param->nK, param->nK};
    this->sizes[0] = param->nK;
    this->sizes[1] = param->nK;
    this->sizes[2] = param->nK;
    this->n_params = param->nK * 4 + param->nG * 4;
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1094c
leaq 0x1ca1a(%rip), %rax     # 0x3e9f8
movq %rax, (%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0xc(%rbx)
movl %eax, 0x10(%rbx)
movl 0x8c0(%r14), %eax
movl %eax, 0x14(%rbx)
addl 0x8bc(%r14), %eax
shll $0x2, %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2202c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x11218
movq %r14, %rdi
callq 0x4430
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiABGK.cpp
// Function: HMMProblemPiABGK::destroy()
void HMMProblemPiABGK::destroy() {
	// destroy model data - only additional stuff
	free2D<NUMBER>(this->PIg, this->p->nG);
	free3D<NUMBER>(this->Ag, this->p->nG, this->p->nS);
	free3D<NUMBER>(this->Bg, this->p->nG, this->p->nS);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x88(%rdi), %rax
movq 0x90(%rdi), %rdi
movl 0x8bc(%rax), %esi
callq 0xa5dd
movq 0x88(%rbx), %rax
movq 0x98(%rbx), %rdi
movl 0x8bc(%rax), %esi
movsbl 0x8b8(%rax), %edx
callq 0xca4f
movq 0x88(%rbx), %rax
movq 0xa0(%rbx), %rdi
movl 0x8bc(%rax), %esi
movsbl 0x8b8(%rax), %edx
popq %rbx
jmp 0xca4f
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemPiABGK.cpp
// Function: HMMProblemPiABGK::setGradB(FitBit*)
void HMMProblemPiABGK::setGradB (FitBit *fb){
    if(this->p->block_fitting[2]>0) return;
    NDAT t, ndat = 0;
    NPAR o=0, i;
    NUMBER combined, deriv_logit;
    struct data* dt;
    for(NCAT x=0; x<fb->xndat; x++) {
        dt = fb->x_data[x];
        if( dt->cnt!=0 ) continue;
        ndat += dt->n;
        for(t=0; t<dt->n; t++) {
            o = this->p->dat_obs[ dt->ix[t] ];
            if(o<0)
                continue;
            for(i=0; i<fb->nS; i++) {
                combined = getB(dt,i,o);
                deriv_logit = 1 / safe0num( fb->B[i][o] * (1-fb->B[i][o]) );
                fb->gradB[i][o] -= combined * (1-combined) * deriv_logit * dt->alpha[t][i] * dt->beta[t][i] / safe0num(dt->p_O_param * ((o<0)?1:fb->B[i][o]));
            }
        }
    }
    if( this->p->Cslices>0 ) // penalty
        fb->addL2Penalty(FBV_B, this->p, (NUMBER)ndat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x88(%rdi), %rdx
cmpb $0x0, 0x983(%rdx)
jle 0x22e8b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movl 0xe8(%rsi), %eax
testl %eax, %eax
jle 0x2300e
movq %rdi, %r14
xorl %edx, %edx
xorl %esi, %esi
movq 0xf0(%rbx), %rcx
movq (%rcx,%rdx,8), %r15
cmpl $0x0, 0x4(%r15)
jne 0x22fef
movl (%r15), %ecx
addl %ecx, %esi
testl %ecx, %ecx
jle 0x22fef
movl %esi, 0xc(%rsp)
movq %rdx, 0x10(%rsp)
xorl %ebp, %ebp
movq 0x88(%r14), %rax
movq 0x870(%rax), %rax
movq 0x10(%r15), %rdx
movslq (%rdx,%rbp,4), %rdx
movsbq (%rax,%rdx), %r12
testq %r12, %r12
js 0x22fd1
cmpb $0x0, 0x1(%rbx)
jle 0x22fd1
xorl %r13d, %r13d
movq (%r14), %rax
movsbl %r13b, %edx
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %ecx
callq *0x20(%rax)
movsd %xmm0, (%rsp)
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r12,8), %xmm1
movsd 0x109c0(%rip), %xmm0    # 0x338f0
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x8df8
movsd 0x109ab(%rip), %xmm2    # 0x338f0
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
movsd (%rsp), %xmm2
subsd %xmm2, %xmm0
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
movq 0x28(%r15), %rax
movq 0x30(%r15), %rcx
movq (%rax,%rbp,8), %rax
mulsd (%rax,%r13,8), %xmm0
movq (%rcx,%rbp,8), %rax
mulsd (%rax,%r13,8), %xmm0
movsd %xmm0, (%rsp)
movsd 0x48(%r15), %xmm0
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rax
mulsd (%rax,%r12,8), %xmm0
callq 0x8df8
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x68(%rbx), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r12,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%r12,8)
incq %r13
movsbq 0x1(%rbx), %rax
cmpq %rax, %r13
jl 0x22f02
movl (%r15), %ecx
incq %rbp
movslq %ecx, %rax
cmpq %rax, %rbp
jl 0x22ed1
movl 0xe8(%rbx), %eax
movq 0x10(%rsp), %rdx
movl 0xc(%rsp), %esi
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
jl 0x22ea3
movq 0x88(%r14), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
jmp 0x23012
xorpd %xmm0, %xmm0
cmpb $0x0, 0x42(%rdx)
jle 0x22e7c
movq %rbx, %rdi
movl $0x3, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb90a
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::HMMProblemSlicedAB(param*)
HMMProblemSlicedAB::HMMProblemSlicedAB(struct param *param) {
    NPAR i;
    switch (param->structure) {
        case STRUCTURE_SKABslc: // Expectation Maximization (Baum-Welch)
            for(i=0; i<3; i++) this->sizes[i] = param->nK;
            this->n_params = param->nK * 4 * param->nZ;
            break;
        default:
            fprintf(stderr,"Structure specified is not supported and should have been caught earlier\n");
            break;
    }
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1094c
leaq 0x1a092(%rip), %rax     # 0x3eac8
movq %rax, (%rbx)
cmpb $0xb, 0x3e(%r14)
jne 0x24a77
movl 0x8c0(%r14), %ecx
movl %ecx, 0xc(%rbx)
movl %ecx, 0x10(%rbx)
movl %ecx, 0x14(%rbx)
movsbl 0x8c8(%r14), %ecx
imull 0x8c0(%r14), %ecx
shll $0x2, %ecx
movl %ecx, 0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq *0x70(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x1a55a(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
leaq 0xf959(%rip), %rdi      # 0x343e1
movl $0x49, %esi
movl $0x1, %edx
callq 0x4480
movq (%rbx), %rax
jmp 0x24a66
movq %rax, %r14
movq %rbx, %rdi
callq 0x11218
movq %r14, %rdi
callq 0x4430
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::destroy()
void HMMProblemSlicedAB::destroy() {
    NPAR nS = this->p->nS, nZ = this->p->nZ;
	// destroy model data
	if(this->A  != NULL) free4D<NUMBER>(this->A,  this->sizes[1], this->p->nZ, this->p->nS);
	if(this->B  != NULL) free4D<NUMBER>(this->B,  this->sizes[2], this->p->nZ, this->p->nS);
	if(this->lbPI!=NULL) free(this->lbPI);
	if(this->ubPI!=NULL) free(this->ubPI);
	if(this->lbA!=NULL) free3D<NUMBER>(this->lbA, nZ, nS);
	if(this->ubA!=NULL) free3D<NUMBER>(this->ubA, nZ, nS);
	if(this->lbB!=NULL) free3D<NUMBER>(this->lbB, nZ, nS);
	if(this->ubB!=NULL) free3D<NUMBER>(this->ubB, nZ, nS);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x88(%rdi), %rax
movq 0x90(%rdi), %rdi
movsbl 0x8b8(%rax), %ebx
movsbl 0x8c8(%rax), %ebp
testq %rdi, %rdi
je 0x256e5
movl 0x10(%r14), %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2acf2
movq 0x98(%r14), %rdi
testq %rdi, %rdi
je 0x2570f
movl 0x14(%r14), %esi
movq 0x88(%r14), %rax
movsbl 0x8c8(%rax), %edx
movsbl 0x8b8(%rax), %ecx
callq 0x2acf2
movq 0xa0(%r14), %rdi
testq %rdi, %rdi
je 0x25720
callq 0x42a0
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x25731
callq 0x42a0
movq 0xa8(%r14), %rdi
testq %rdi, %rdi
je 0x25746
movl %ebp, %esi
movl %ebx, %edx
callq 0xca4f
movq 0xc0(%r14), %rdi
testq %rdi, %rdi
je 0x2575b
movl %ebp, %esi
movl %ebx, %edx
callq 0xca4f
movq 0xb0(%r14), %rdi
testq %rdi, %rdi
je 0x25770
movl %ebp, %esi
movl %ebx, %edx
callq 0xca4f
movq 0xc8(%r14), %rdi
testq %rdi, %rdi
je 0x25789
movl %ebp, %esi
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0xca4f
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::getA(int)
NUMBER*** HMMProblemSlicedAB::getA(NCAT x) {
    if( x > (this->sizes[1]-1) ) {
        fprintf(stderr,"While accessing A, skill index %d exceeded last index of the data %d.\n", x, this->sizes[1]-1);
        exit(1);
    }
    return this->A[x];
}

// Assembly:
movq %rdi, %rax
movl 0x10(%rdi), %edi
cmpl %esi, %edi
jle 0x257d9
movq 0x90(%rax), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
pushq %rax
callq 0x5314
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::getB(int)
NUMBER*** HMMProblemSlicedAB::getB(NCAT x) {
    if( x > (this->sizes[2]-1) ) {
        fprintf(stderr,"While accessing B, skill index %d exceeded last index of the data %d.\n", x, this->sizes[2]-1);
        exit(1);
    }
    return this->B[x];
}

// Assembly:
movq %rdi, %rax
movl 0x14(%rdi), %edi
cmpl %esi, %edi
jle 0x257f9
movq 0x98(%rax), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
pushq %rax
callq 0x533b
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::toZero3Params(double*&, double***&, double***&, signed char, signed char, signed char)
void HMMProblemSlicedAB::toZero3Params(NUMBER* &PI, NUMBER*** &A, NUMBER*** &B, NPAR nZ, NPAR nS, NPAR nO) { // sliced
    toZero1D<NUMBER>(PI, (NDAT)nS);
    toZero3D<NUMBER>(A,  (NDAT)nZ, (NDAT)nS, (NDAT)nS);
    toZero3D<NUMBER>(B,  (NDAT)nZ, (NDAT)nS, (NDAT)nO);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %r13d
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, %r15
testb %r13b, %r13b
jle 0x275f7
movq (%rsi), %rdi
leal (,%r13,8), %edx
xorl %esi, %esi
callq 0x4120
testb %bpl, %bpl
jle 0x276af
movq %rbx, 0x18(%rsp)
movb 0x60(%rsp), %r12b
movq (%r15), %rax
movq %rax, 0x20(%rsp)
movzbl %bpl, %eax
movq %rax, 0x8(%rsp)
movl %r13d, %ebp
leaq (,%rbp,8), %r15
xorl %ebx, %ebx
movq %r13, 0x10(%rsp)
testb %r13b, %r13b
jle 0x27655
movq 0x20(%rsp), %rax
movq (%rax,%rbx,8), %r13
xorl %r14d, %r14d
movq (%r13,%r14,8), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x4120
incq %r14
cmpq %r14, %rbp
jne 0x2763e
incq %rbx
cmpq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r13
jne 0x2762d
movq 0x18(%rsp), %rax
movq (%rax), %r15
movsbq %r12b, %rax
movl %eax, %r14d
shlq $0x3, %r14
xorl %ebx, %ebx
testb %r13b, %r13b
jle 0x276a0
xorl %r13d, %r13d
testb %r12b, %r12b
jle 0x27698
movq (%r15,%rbx,8), %rax
movq (%rax,%r13,8), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4120
incq %r13
cmpq %r13, %rbp
jne 0x27681
incq %rbx
cmpq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r13
jne 0x27679
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::cpy3Params(double*&, double***&, double***&, double*&, double***&, double***&, signed char, signed char, signed char)
void HMMProblemSlicedAB::cpy3Params(NUMBER* &soursePI, NUMBER*** &sourseA, NUMBER*** &sourseB, NUMBER* &targetPI, NUMBER*** &targetA, NUMBER*** &targetB, NPAR nZ, NPAR nS, NPAR nO) {  // sliced
    cpy1D<NUMBER>(soursePI, targetPI, (NDAT)nS);
    cpy3D<NUMBER>(sourseA,  targetA,  (NDAT)nZ, (NDAT)nS, (NDAT)nS);
    cpy3D<NUMBER>(sourseB,  targetB,  (NDAT)nZ, (NDAT)nS, (NDAT)nO);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r15
movq %rcx, %rbx
movq %rdx, %r12
movsbq 0x60(%rsp), %rax
movb 0x58(%rsp), %r13b
movq (%rsi), %rsi
movq (%r8), %rdi
movq %rax, (%rsp)
leaq (,%rax,8), %r14
movq %r14, %rdx
callq 0x41c0
testb %r13b, %r13b
jle 0x277a8
movq %rbx, 0x10(%rsp)
movq (%r12), %rbp
movq (%r15), %rbx
movzbl %r13b, %eax
movq %rax, 0x8(%rsp)
movsbq (%rsp), %rax
movl %eax, %r12d
xorl %r13d, %r13d
cmpb $0x0, (%rsp)
jle 0x2774d
xorl %r15d, %r15d
movq (%rbx,%r13,8), %rax
movq (%rax,%r15,8), %rdi
movq (%rbp,%r13,8), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdx
callq 0x41c0
incq %r15
cmpq %r15, %r12
jne 0x2772c
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x27723
movq 0x10(%rsp), %rax
movq (%rax), %r14
movq 0x50(%rsp), %rax
movq (%rax), %rbp
movsbq 0x68(%rsp), %rbx
shlq $0x3, %rbx
xorl %r13d, %r13d
cmpb $0x0, (%rsp)
jle 0x2779e
xorl %r15d, %r15d
movq (%rbp,%r13,8), %rax
movq (%rax,%r15,8), %rdi
movq (%r14,%r13,8), %rax
movq (%rax,%r15,8), %rsi
movq %rbx, %rdx
callq 0x41c0
incq %r15
cmpq %r15, %r12
jne 0x2777d
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x27774
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::BaumWelchBit(FitBitSlicedAB*)
FitResult HMMProblemSlicedAB::BaumWelchBit(FitBitSlicedAB *fb) {
    FitResult fr;
    fr.iter = 1;
    fr.pO0  = 0.0;
    fr.pO   = 0.0;
    fr.conv = 0; // converged
    fr.ndat = 0;
    NCAT xndat = fb->xndat;
    struct data **x_data = fb->x_data;
    
    while( !fr.conv && fr.iter<=this->p->maxiter ) {
        fr.ndat = -1; // no accounting so far
        if(fr.iter==1) {
            computeAlphaAndPOParam(xndat, x_data);
            fr.pO0 = HMMProblemSlicedAB::getSumLogPOPara(xndat, x_data);
            fr.pOmid = fr.pO0;
        }
        fb->copy(FBS_PAR, FBS_PARm1);
        fr.pO = doBaumWelchStep(fb);// PI, A, B);
        
        // check convergence
        fr.conv = fb->checkConvergence(&fr);
        
        if( fr.conv || fr.iter==this->p->maxiter ) {
            //computeAlphaAndPOParam(fb->xndat, fb->x_data);
            fr.pO = HMMProblemSlicedAB::getSumLogPOPara(xndat, x_data);
        }
        fr.iter ++;
        fr.pOmid = fr.pO;
    } // main solver loop
    // recycle memory (Alpha, Beta, p_O_param, Xi, Gamma)
    RecycleFitData(fb->xndat, fb->x_data, this->p);
    fr.iter--;
    return fr;
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, (%rdi)
movq $0x0, 0x8(%rdi)
leaq 0x18(%rdi), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movl 0xd0(%rdx), %ebp
movq 0xd8(%rdx), %r12
movl $0x1, %eax
movq 0x88(%r14), %rcx
cmpl 0x38(%rcx), %eax
jg 0x292b0
movl $0xffffffff, 0x24(%rbx) # imm = 0xFFFFFFFF
cmpl $0x1, %eax
jne 0x29235
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x25910
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x114ae
movsd %xmm0, 0x8(%rbx)
movsd %xmm0, 0x10(%rbx)
movq %r15, %rdi
movl $0x1, %esi
movl $0x2, %edx
callq 0xd4e8
movq %r14, %rdi
movq %r15, %rsi
callq 0x292de
movsd %xmm0, 0x18(%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd644
movzbl %al, %eax
movl %eax, 0x20(%rbx)
testb %al, %al
jne 0x2927a
movl (%rbx), %eax
movq 0x88(%r14), %rcx
cmpl 0x38(%rcx), %eax
jne 0x29297
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x114ae
movsd %xmm0, 0x18(%rbx)
movl (%rbx), %eax
cmpl $0x0, 0x20(%rbx)
sete %cl
jmp 0x2929f
movsd (%r13), %xmm0
movb $0x1, %cl
incl %eax
movl %eax, (%rbx)
movsd %xmm0, 0x10(%rbx)
testb %cl, %cl
jne 0x291f5
movq 0xd8(%r15), %rsi
movl 0xd0(%r15), %edi
movq 0x88(%r14), %rdx
callq 0xa3aa
decl (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/./utils.h
// Function: double**** init4D<double>(int, int, int, int)
T**** init4D(NDAT size1, NDAT size2, NDAT size3, NDAT size4) {
    NDAT i,j, l;
    T**** ar = Calloc(T ***, (size_t)size1);
    for(i=0; i<size1; i++) {
        ar[i] = Calloc(T**, (size_t)size2);
        for(j=0; j<size2; j++) {
            ar[i][j] = Calloc(T*, (size_t)size3);
            for(l=0; l<size3; l++)
                ar[i][j][l] = Calloc(T, (size_t)size4);
        }
    }
    return ar;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r14d
movl %edi, %r13d
movslq %edi, %r12
movl $0x8, %esi
movq %r12, %rdi
callq 0x4130
movq %rax, (%rsp)
testl %r12d, %r12d
jle 0x2acdf
movslq %r14d, %rax
movslq %r15d, %r15
movslq %ebp, %r12
movl %r13d, %ecx
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movl %eax, %eax
movq %rax, 0x20(%rsp)
movl %r15d, %ebp
xorl %r14d, %r14d
movl $0x8, %esi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4130
movq %rax, %r13
movq (%rsp), %rax
movq %r14, 0x18(%rsp)
movq %r13, (%rax,%r14,8)
testl %ebx, %ebx
jle 0x2acd0
xorl %r14d, %r14d
movl $0x8, %esi
movq %r15, %rdi
callq 0x4130
movq %rax, (%r13,%r14,8)
testl %r15d, %r15d
jle 0x2acc6
xorl %ebx, %ebx
movl $0x8, %esi
movq %r12, %rdi
callq 0x4130
movq (%r13,%r14,8), %rcx
movq %rax, (%rcx,%rbx,8)
incq %rbx
cmpq %rbx, %rbp
jne 0x2aca8
incq %r14
cmpq 0x20(%rsp), %r14
jne 0x2ac8f
movq 0x18(%rsp), %r14
incq %r14
cmpq 0x8(%rsp), %r14
jne 0x2ac66
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq