// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::toFileSkill(char const*)
void HMMProblemSlicedAB::toFileSkill(const char *filename) {
	FILE *fid = fopen(filename,"w");
	if(fid == NULL) {
		fprintf(stderr,"Can't write output model file %s\n",filename);
		exit(1);
	}
    // write solved id
    writeSolverInfo(fid, this->p);
    
	fprintf(fid,"Null skill ratios\t");
	for(NPAR m=0; m<this->p->nO; m++)
		fprintf(fid," %12.10f%s",this->null_obs_ratio[m],(m==(this->p->nO-1))?"\n":"\t");
    
	NCAT k;
    NPAR z;
	std::map<NCAT,std::string>::iterator it;
    for(k=0;k<this->p->nK;k++) {
        it = this->p->map_skill_bwd->find(k);
        fprintf(fid,"%d\t%s\n",k,it->second.c_str());
        NPAR i,j,m;
        fprintf(fid,"PI\t");
        for(i=0; i<this->p->nS; i++)
            fprintf(fid,"%12.10f%s",this->pi[k][i],(i==(this->p->nS-1))?"\n":"\t");
        for(z=0;z<this->p->nZ;z++) {
            fprintf(fid,"A - slice %d \t",z);
            for(i=0; i<this->p->nS; i++)
                for(j=0; j<this->p->nS; j++)
                    fprintf(fid,"%12.10f%s",this->A[k][z][i][j],(i==(this->p->nS-1) && j==(this->p->nS-1))?"\n":"\t");
            fprintf(fid,"B - slice %d \t",z);
            for(i=0; i<this->p->nS; i++)
                for(m=0; m<this->p->nO; m++)
                    fprintf(fid,"%12.10f%s",this->B[k][z][i][m],(i==(this->p->nS-1) && m==(this->p->nO-1))?"\n":"\t");
        }
	}
	fclose(fid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbp
leaq 0xde93(%rip), %rsi      # 0x34546
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x26a71
movq %rax, %r14
movq 0x88(%rbp), %rsi
movq %rax, %rdi
callq 0xa125
leaq 0xde8d(%rip), %rdi      # 0x3456a
movl $0x12, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x4480
movq 0x88(%rbp), %rax
movb 0x8b9(%rax), %cl
leaq 0xcb5a(%rip), %r13      # 0x3325d
leaq 0xe57c(%rip), %rbx      # 0x34c86
testb %cl, %cl
jle 0x26756
xorl %r15d, %r15d
leaq 0xe23c(%rip), %r12      # 0x34954
movsbl %cl, %eax
decl %eax
movq %r13, %rdx
cmpl %eax, %r15d
je 0x26728
movq %rbx, %rdx
movq 0x18(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbp), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x26718
cmpl $0x0, 0x8c0(%rax)
jle 0x26a5b
leaq 0xe1eb(%rip), %r9       # 0x34955
xorl %edx, %edx
movq %r14, 0x20(%rsp)
movq %rbp, 0x8(%rsp)
movq 0x948(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
testq %r8, %r8
je 0x267c6
movq %rax, %rcx
movslq 0x20(%r8), %rsi
xorl %edi, %edi
cmpq %rsi, %rdx
setg %dil
cmovleq %r8, %rcx
movq 0x10(%r8,%rdi,8), %r8
testq %r8, %r8
jne 0x2678d
movq %rbp, %r15
movq %r13, %r12
movq %r9, %rbp
movq %rbx, %r13
cmpq %rax, %rcx
je 0x267d2
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
jmp 0x267d2
movq %rbp, %r15
movq %r9, %rbp
movq %r13, %r12
movq %rbx, %r13
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0xdda7(%rip), %rsi      # 0x34587
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
callq 0x4330
movl $0x3, %esi
movl $0x1, %edx
leaq 0xdd91(%rip), %rdi      # 0x3458e
movq %r14, %rcx
callq 0x4480
movq 0x88(%r15), %rax
movb 0x8b8(%rax), %cl
testb %cl, %cl
jle 0x26862
movq %r15, %rbx
xorl %r15d, %r15d
movsbl %cl, %eax
movq 0x38(%rbx), %rcx
movq 0x10(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %r13, %rdx
cmoveq %r12, %rdx
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jl 0x2681c
cmpb $0x0, 0x8c8(%rax)
jle 0x26a29
xorl %edx, %edx
movq %r14, %rdi
leaq 0xe3fe(%rip), %rsi      # 0x34c79
movq %rdx, 0x18(%rsp)
xorl %eax, %eax
callq 0x4330
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x26935
xorl %r15d, %r15d
testb %al, %al
jle 0x26925
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
leaq 0xe09e(%rip), %r14      # 0x34955
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rbx
movsbl %al, %eax
movq 0x90(%rbp), %rcx
movq (%rcx,%r12,8), %rcx
movq (%rcx,%rbx,8), %rcx
movq (%rcx,%r15,8), %rcx
movsd (%rcx,%r13,8), %xmm0
decl %eax
movl %r13d, %ecx
xorl %eax, %ecx
xorl %r15d, %eax
orl %ecx, %eax
leaq 0xe396(%rip), %rdx      # 0x34c86
leaq 0xc966(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x4330
incq %r13
movq 0x88(%rbp), %rax
movb 0x8b8(%rax), %al
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0x268c1
jmp 0x26929
movsbq %al, %rcx
incq %r15
cmpq %rcx, %r15
jl 0x268a4
movq 0x20(%rsp), %rdi
leaq 0xe347(%rip), %rsi      # 0x34c88
movq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x4330
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x26a0b
xorl %r15d, %r15d
movb 0x8b9(%rax), %cl
testb %cl, %cl
jle 0x269f7
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
leaq 0xdfcf(%rip), %r14      # 0x34955
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rbx
movsbl %cl, %ecx
movq 0x98(%rbp), %rdx
movq (%rdx,%r12,8), %rdx
movq (%rdx,%rbx,8), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%r13,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r15d, %eax
decl %ecx
xorl %r13d, %ecx
orl %eax, %ecx
leaq 0xe2c0(%rip), %rdx      # 0x34c86
leaq 0xc890(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x4330
incq %r13
movq 0x88(%rbp), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r13
jl 0x26990
incq %r15
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jl 0x26969
movq 0x18(%rsp), %rdx
incq %rdx
movsbq 0x8c8(%rax), %rcx
cmpq %rcx, %rdx
movq 0x20(%rsp), %r14
jl 0x26871
movq 0x10(%rsp), %rdx
incq %rdx
movslq 0x8c0(%rax), %rcx
cmpq %rcx, %rdx
leaq 0xc81b(%rip), %r13      # 0x3325d
leaq 0xe23d(%rip), %rbx      # 0x34c86
movq 0x8(%rsp), %rbp
leaq 0xdf00(%rip), %r9       # 0x34955
jl 0x26776
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x5362
nop