// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xf6c6(%rip), %rsi      # 0x2d546
movq %r15, %rdi
callq 0x4280
testq %rax, %rax
je 0x1e2bf
movq %rax, %r14
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0x7943
leaq 0xf6c0(%rip), %rdi      # 0x2d56a
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
xorl %r12d, %r12d
leaq 0xe39b(%rip), %r13      # 0x2c25d
leaq 0xfd7d(%rip), %rbp      # 0x2dc46
leaq 0xfa4e(%rip), %r15      # 0x2d91e
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r12
jge 0x1df0d
decl %ecx
movq %r13, %rdx
cmpl %ecx, %r12d
je 0x1def1
movq %rbp, %rdx
movq 0x18(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4350
incq %r12
jmp 0x1ded0
leaq 0xe349(%rip), %r13      # 0x2c25d
leaq 0xfd2b(%rip), %rbp      # 0x2dc46
xorl %ecx, %ecx
movl %ecx, (%rsp)
cmpl 0x8bc(%rax), %ecx
jge 0x1e0e2
movq 0x928(%rax), %rdi
movq %rsp, %rsi
callq 0x15b18
movl (%rsp), %edx
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0xf63b(%rip), %rsi      # 0x2d587
xorl %eax, %eax
callq 0x4350
leaq 0xf9cf(%rip), %rdi      # 0x2d929
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
xorl %r15d, %r15d
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jge 0x1dfb6
movq 0x90(%rbx), %rcx
movslq (%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf975(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r15
jmp 0x1df6b
leaq 0xfaed(%rip), %rdi      # 0x2daaa
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
xorl %r15d, %r15d
movsbq %al, %rcx
cmpq %rcx, %r15
jge 0x1e047
xorl %r12d, %r12d
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0x1e042
movsbl %al, %eax
movq 0x98(%rbx), %rcx
movslq (%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%r15,8), %rcx
movsd (%rcx,%r12,8), %xmm0
decl %eax
movl %r12d, %ecx
xorl %eax, %ecx
xorl %r15d, %eax
orl %ecx, %eax
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf8f6(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r12
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
jmp 0x1dfe7
incq %r15
jmp 0x1dfdb
leaq 0xfbaa(%rip), %rdi      # 0x2dbf8
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
movq 0x88(%rbx), %rax
xorl %r15d, %r15d
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jge 0x1e0d8
xorl %r12d, %r12d
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r12
jge 0x1e0d3
movq 0xa0(%rbx), %rdx
movslq (%rsp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%r12,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r15d, %eax
decl %ecx
xorl %r12d, %ecx
orl %eax, %ecx
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf85f(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r12
movq 0x88(%rbx), %rax
jmp 0x1e076
incq %r15
jmp 0x1e066
movl (%rsp), %ecx
incl %ecx
jmp 0x1df1d
xorl %ecx, %ecx
movl %ecx, 0x4(%rsp)
cmpl 0x8c0(%rax), %ecx
jge 0x1e2a8
movq 0x948(%rax), %rdi
leaq 0x4(%rsp), %rsi
callq 0x15b18
movl 0x4(%rsp), %edx
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0xf470(%rip), %rsi      # 0x2d587
xorl %eax, %eax
callq 0x4350
leaq 0xf809(%rip), %rdi      # 0x2d92e
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
xorl %r15d, %r15d
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jge 0x1e17f
movq 0x38(%rbx), %rcx
movslq 0x4(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf7ac(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r15
jmp 0x1e136
leaq 0xf928(%rip), %rdi      # 0x2daae
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
xorl %r15d, %r15d
movsbq %al, %rcx
cmpq %rcx, %r15
jge 0x1e20e
xorl %r12d, %r12d
movsbq %al, %rcx
cmpq %rcx, %r12
jge 0x1e209
movsbl %al, %eax
movq 0x40(%rbx), %rcx
movslq 0x4(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%r15,8), %rcx
movsd (%rcx,%r12,8), %xmm0
decl %eax
movl %r12d, %ecx
xorl %eax, %ecx
xorl %r15d, %eax
orl %ecx, %eax
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf72f(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r12
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
jmp 0x1e1b0
incq %r15
jmp 0x1e1a4
leaq 0xf9e7(%rip), %rdi      # 0x2dbfc
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
movq 0x88(%rbx), %rax
xorl %r15d, %r15d
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jge 0x1e29d
xorl %r12d, %r12d
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r12
jge 0x1e298
movq 0x48(%rbx), %rdx
movslq 0x4(%rsp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%r12,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r15d, %eax
decl %ecx
xorl %r12d, %ecx
orl %eax, %ecx
movq %rbp, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0xf69a(%rip), %rsi      # 0x2d91f
movb $0x1, %al
callq 0x4350
incq %r12
movq 0x88(%rbx), %rax
jmp 0x1e23d
incq %r15
jmp 0x1e22d
movl 0x4(%rsp), %ecx
incl %ecx
jmp 0x1e0e4
movq %r14, %rdi
callq 0x4210
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1ad12(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
leaq 0xf278(%rip), %rsi      # 0x2d548
movq %r15, %rdx
xorl %eax, %eax
callq 0x4350
pushq $0x1
popq %rdi
callq 0x42a0