// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblemPiABGK.cpp
// Function: HMMProblemPiABGK::toFile(char const*)
void HMMProblemPiABGK::toFile(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, g;
    NPAR i,j,m;
	std::map<NCAT,std::string>::iterator it;
	for(g=0;g<this->p->nG; g++) {
		it = this->p->map_group_bwd->find(g);
		fprintf(fid,"%d\t%s\n",g,it->second.c_str());
		fprintf(fid,"PIg\t");
		for(i=0; i<this->p->nS; i++)
			fprintf(fid,"%12.10f%s",this->PIg[g][i],(i==(this->p->nS-1))?"\n":"\t");
		fprintf(fid,"Ag\t");
		for(i=0; i<this->p->nS; i++)
			for(j=0; j<this->p->nS; j++)
				fprintf(fid,"%12.10f%s",this->Ag[g][i][j],(i==(this->p->nS-1) && j==(this->p->nS-1))?"\n":"\t");
		fprintf(fid,"Bg\t");
		for(i=0; i<this->p->nS; i++)
			for(m=0; m<this->p->nO; m++)
				fprintf(fid,"%12.10f%s",this->Bg[g][i][m],(i==(this->p->nS-1) && m==(this->p->nO-1))?"\n":"\t");
    }
	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());
		fprintf(fid,"PIk\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");
		fprintf(fid,"Ak\t");
		for(i=0; i<this->p->nS; i++)
			for(j=0; j<this->p->nS; j++)
				fprintf(fid,"%12.10f%s",this->A[k][i][j],(i==(this->p->nS-1) && j==(this->p->nS-1))?"\n":"\t");
		fprintf(fid,"Bk\t");
		for(i=0; i<this->p->nS; i++)
			for(m=0; m<this->p->nO; m++)
				fprintf(fid,"%12.10f%s",this->B[k][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, 0x8(%rsp)
leaq 0x1215d(%rip), %rsi     # 0x354b6
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x23a7f
movq %rax, %r13
movq 0x8(%rsp), %rbx
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0xa118
leaq 0x12152(%rip), %rdi     # 0x354da
movl $0x12, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b9(%rax), %al
leaq 0x10eaf(%rip), %rbp     # 0x3425d
leaq 0x127f1(%rip), %r14     # 0x35ba6
testb %al, %al
jle 0x23406
xorl %r15d, %r15d
leaq 0x124cb(%rip), %r12     # 0x3588e
movq 0x8(%rsp), %rbx
movsbl %al, %eax
decl %eax
movq %rbp, %rdx
cmpl %eax, %r15d
je 0x233d8
movq %r14, %rdx
movq 0x18(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq %r13, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rax
cmpq %rax, %r15
jl 0x233c8
movq %r13, 0x18(%rsp)
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpl $0x0, 0x8bc(%rax)
jle 0x2373d
leaq 0x12464(%rip), %r13     # 0x3588f
xorl %edx, %edx
movq 0x928(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rax, %rcx
testq %r8, %r8
je 0x23462
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 0x23447
movq %rbp, %r12
cmpq %rax, %rcx
movq 0x18(%rsp), %r15
movq %r14, %rbp
je 0x2347d
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %r15, %rdi
leaq 0x1206c(%rip), %rsi     # 0x354f7
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x123f1(%rip), %rdi     # 0x35899
movq %r15, %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b8(%rax), %al
testb %al, %al
movq %r15, %r14
jle 0x2351a
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x8(%rsp), %rbx
movq 0x90(%rbx), %rcx
movq 0x10(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rbp, %rdx
cmoveq %r12, %rdx
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x234cc
movl $0x3, %esi
movl $0x1, %edx
leaq 0x124dd(%rip), %rdi     # 0x35a08
movq %r14, %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x2360b
xorl %edi, %edi
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b8(%rax), %al
testb %al, %al
leaq 0x10cf4(%rip), %r12     # 0x3425d
leaq 0x12636(%rip), %rdx     # 0x35ba6
movq 0x18(%rsp), %r14
leaq 0x12313(%rip), %rbp     # 0x3588f
movq 0x10(%rsp), %rbx
jle 0x235eb
xorl %r15d, %r15d
movq %rdi, 0x20(%rsp)
movsbl %al, %eax
movq 0x8(%rsp), %rcx
movq 0x98(%rcx), %rcx
movq (%rcx,%rbx,8), %rcx
movq (%rcx,%rdi,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
movl %r15d, %ecx
xorl %eax, %ecx
xorl %edi, %eax
orl %ecx, %eax
movq %rdx, %r13
cmoveq %r12, %rdx
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x4330
movq 0x20(%rsp), %rdi
movq %r13, %rdx
incq %r15
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x2358b
incq %rdi
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rdi
jl 0x2354e
movl $0x3, %esi
movl $0x1, %edx
leaq 0x1253a(%rip), %rdi     # 0x35b56
movq 0x18(%rsp), %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x23704
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b9(%rax), %cl
testb %cl, %cl
leaq 0x10c00(%rip), %rbx     # 0x3425d
leaq 0x12542(%rip), %r14     # 0x35ba6
movq 0x18(%rsp), %rdi
leaq 0x1221f(%rip), %rbp     # 0x3588f
movq 0x10(%rsp), %r13
jle 0x236e4
xorl %r15d, %r15d
movsbl %cl, %ecx
movq 0x8(%rsp), %rdx
movq 0xa0(%rdx), %rdx
movq (%rdx,%r13,8), %rdx
movq (%rdx,%r12,8), %rdx
movsd (%rdx,%r15,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r12d, %eax
decl %ecx
xorl %r15d, %ecx
orl %eax, %ecx
movq %r14, %rdx
cmoveq %rbx, %rdx
movq %rbp, %rsi
movb $0x1, %al
movq %rdi, %r14
callq 0x4330
movq %r14, %rdi
leaq 0x124de(%rip), %r14     # 0x35ba6
incq %r15
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x2367a
incq %r12
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r12
jl 0x23642
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movslq 0x8bc(%rax), %rcx
cmpq %rcx, %rdx
leaq 0x10b34(%rip), %rbp     # 0x3425d
leaq 0x12476(%rip), %r14     # 0x35ba6
leaq 0x12158(%rip), %r13     # 0x3588f
jl 0x2342d
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpl $0x0, 0x8c0(%rax)
jle 0x23a67
movq %rbp, %r15
leaq 0x1212f(%rip), %r13     # 0x3588f
xorl %edx, %edx
movq 0x948(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rax, %rcx
testq %r8, %r8
movq 0x18(%rsp), %rbp
je 0x2379c
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 0x23781
movq %r14, %r12
cmpq %rax, %rcx
je 0x237af
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %rbp, %rdi
leaq 0x11d3a(%rip), %rsi     # 0x354f7
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x120c4(%rip), %rdi     # 0x3589e
movq %rbp, %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b8(%rax), %al
testb %al, %al
movq %rbp, %r14
jle 0x2384c
movq %r15, %rbp
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x8(%rsp), %rbx
movq 0x38(%rbx), %rcx
movq 0x10(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %r12, %rdx
cmoveq %rbp, %rdx
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x23801
movl $0x3, %esi
movl $0x1, %edx
leaq 0x121af(%rip), %rdi     # 0x35a0c
movq %r14, %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x2393a
xorl %edi, %edi
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b8(%rax), %al
testb %al, %al
leaq 0x109c2(%rip), %r12     # 0x3425d
leaq 0x12304(%rip), %rdx     # 0x35ba6
movq 0x18(%rsp), %r14
leaq 0x11fe1(%rip), %rbp     # 0x3588f
movq 0x10(%rsp), %rbx
jle 0x2391a
xorl %r15d, %r15d
movq %rdi, 0x20(%rsp)
movsbl %al, %eax
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx,%rbx,8), %rcx
movq (%rcx,%rdi,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
movl %r15d, %ecx
xorl %eax, %ecx
xorl %edi, %eax
orl %ecx, %eax
movq %rdx, %r13
cmoveq %r12, %rdx
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x4330
movq 0x20(%rsp), %rdi
movq %r13, %rdx
incq %r15
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x238bd
incq %rdi
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rdi
jl 0x23880
movl $0x3, %esi
movl $0x1, %edx
leaq 0x1220f(%rip), %rdi     # 0x35b5a
movq 0x18(%rsp), %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x23a2e
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movb 0x8b9(%rax), %cl
testb %cl, %cl
leaq 0x108d2(%rip), %r13     # 0x3425d
leaq 0x12214(%rip), %r14     # 0x35ba6
movq 0x18(%rsp), %rdi
leaq 0x11ef1(%rip), %rbx     # 0x3588f
movq 0x10(%rsp), %r12
jle 0x23a0e
xorl %r15d, %r15d
movsbl %cl, %ecx
movq 0x8(%rsp), %rdx
movq 0x48(%rdx), %rdx
movq (%rdx,%r12,8), %rdx
movq (%rdx,%rbp,8), %rdx
movsd (%rdx,%r15,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %ebp, %eax
decl %ecx
xorl %r15d, %ecx
orl %eax, %ecx
movq %r14, %rdx
cmoveq %r13, %rdx
movq %rbx, %rsi
movb $0x1, %al
movq %rdi, %r14
callq 0x4330
movq %r14, %rdi
leaq 0x121b4(%rip), %r14     # 0x35ba6
incq %r15
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x239a8
incq %rbp
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rbp
jl 0x23970
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
movslq 0x8c0(%rax), %rcx
cmpq %rcx, %rdx
leaq 0x1080a(%rip), %r15     # 0x3425d
leaq 0x1214c(%rip), %r14     # 0x35ba6
leaq 0x11e2e(%rip), %r13     # 0x3588f
jl 0x23762
movq 0x18(%rsp), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x528f
nop