// File: /workspace/github_cpp_makefile_star2_O3/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 $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x114f3(%rip), %rsi     # 0x34546
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x2366a
movq %rax, %rbp
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0xa125
leaq 0x114ed(%rip), %rdi     # 0x3456a
movl $0x12, %esi
movl $0x1, %edx
movq %rbp, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b9(%rax), %cl
leaq 0x101ba(%rip), %r13     # 0x3325d
leaq 0x11bdc(%rip), %r14     # 0x34c86
testb %cl, %cl
jle 0x230f6
xorl %r15d, %r15d
leaq 0x1189c(%rip), %r12     # 0x34954
movsbl %cl, %eax
decl %eax
movq %r13, %rdx
cmpl %eax, %r15d
je 0x230c8
movq %r14, %rdx
movq 0x18(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbp, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x230b8
cmpl $0x0, 0x8bc(%rax)
movq %rbp, 0x10(%rsp)
jle 0x233ab
leaq 0x11846(%rip), %r12     # 0x34955
xorl %edx, %edx
movq %r12, %r15
movq 0x928(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rbp, %r12
testq %r8, %r8
je 0x2315e
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 0x2312e
cmpq %rax, %rcx
je 0x2315e
movq %r14, %rbp
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
jmp 0x23161
movq %r14, %rbp
movq 0x28(%rax), %rcx
movq %r12, %rdi
leaq 0x11418(%rip), %rsi     # 0x34587
xorl %eax, %eax
movq %rdx, 0x8(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x117d3(%rip), %rdi     # 0x3495f
movq %r12, %r14
movq %r12, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x231f7
movq %r15, %r12
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x90(%rbx), %rcx
movq 0x8(%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
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x231ae
movl $0x3, %esi
movl $0x1, %edx
leaq 0x118e2(%rip), %rdi     # 0x34aea
movq %r14, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x232ac
xorl %ebp, %ebp
testb %al, %al
jle 0x2329c
xorl %r15d, %r15d
movq 0x10(%rsp), %r12
leaq 0x1171b(%rip), %r13     # 0x34955
movq 0x8(%rsp), %r14
movsbl %al, %eax
movq 0x98(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movq (%rcx,%rbp,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
movl %r15d, %ecx
xorl %eax, %ecx
xorl %ebp, %eax
orl %ecx, %eax
leaq 0x11a1d(%rip), %rdx     # 0x34c86
leaq 0xffed(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
movsbq %al, %rcx
cmpq %rcx, %r15
jl 0x2323f
jmp 0x232a0
movsbq %al, %rcx
incq %rbp
cmpq %rcx, %rbp
jl 0x23227
movl $0x3, %esi
movl $0x1, %edx
leaq 0x1197b(%rip), %rdi     # 0x34c38
movq 0x10(%rsp), %rcx
callq 0x4480
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x23379
xorl %ebp, %ebp
movq 0x8(%rsp), %rdx
movb 0x8b9(%rax), %cl
testb %cl, %cl
jle 0x23363
xorl %r15d, %r15d
leaq 0x11990(%rip), %r14     # 0x34c86
movq 0x10(%rsp), %r12
leaq 0x11653(%rip), %r13     # 0x34955
movsbl %cl, %ecx
movq 0xa0(%rbx), %rsi
movq (%rsi,%rdx,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
leaq 0xff27(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
movq 0x8(%rsp), %rdx
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x23302
incq %rbp
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %rbp
jl 0x232e2
jmp 0x2337e
movq 0x8(%rsp), %rdx
incq %rdx
movslq 0x8bc(%rax), %rcx
cmpq %rcx, %rdx
leaq 0xfecb(%rip), %r13      # 0x3325d
leaq 0x118ed(%rip), %r14     # 0x34c86
movq 0x10(%rsp), %rbp
leaq 0x115b0(%rip), %r12     # 0x34955
jl 0x23111
cmpl $0x0, 0x8c0(%rax)
jle 0x23654
leaq 0x11596(%rip), %r12     # 0x34955
xorl %edx, %edx
movq %r12, %r15
movq 0x948(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rbp, %r12
testq %r8, %r8
je 0x23411
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 0x233de
movq %r13, %rbp
cmpq %rax, %rcx
je 0x23414
movq %r14, %r13
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
jmp 0x23417
movq %r13, %rbp
movq %r14, %r13
movq 0x28(%rax), %rcx
movq %r12, %rdi
leaq 0x11162(%rip), %rsi     # 0x34587
xorl %eax, %eax
movq %rdx, 0x8(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x11522(%rip), %rdi     # 0x34964
movq %r12, %r14
movq %r12, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x234aa
movq %r15, %r12
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x38(%rbx), %rcx
movq 0x8(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %r13, %rdx
cmoveq %rbp, %rdx
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x23464
movl $0x3, %esi
movl $0x1, %edx
leaq 0x11633(%rip), %rdi     # 0x34aee
movq %r14, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x23558
xorl %ebp, %ebp
testb %al, %al
jle 0x2354c
xorl %r15d, %r15d
movq 0x10(%rsp), %r12
leaq 0x11468(%rip), %r13     # 0x34955
movq 0x8(%rsp), %r14
movsbl %al, %eax
movq 0x40(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movq (%rcx,%rbp,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
movl %r15d, %ecx
xorl %eax, %ecx
xorl %ebp, %eax
orl %ecx, %eax
leaq 0x1176d(%rip), %rdx     # 0x34c86
leaq 0xfd3d(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
movsbq %al, %rcx
cmpq %rcx, %r15
jl 0x234f2
jmp 0x23550
movsbq %al, %rcx
incq %rbp
cmpq %rcx, %rbp
jl 0x234da
movl $0x3, %esi
movl $0x1, %edx
leaq 0x116d3(%rip), %rdi     # 0x34c3c
movq 0x10(%rsp), %rcx
callq 0x4480
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x23622
xorl %ebp, %ebp
movq 0x8(%rsp), %rdx
movb 0x8b9(%rax), %cl
testb %cl, %cl
jle 0x2360c
xorl %r15d, %r15d
leaq 0x116e4(%rip), %r14     # 0x34c86
movq 0x10(%rsp), %r12
leaq 0x113a7(%rip), %r13     # 0x34955
movsbl %cl, %ecx
movq 0x48(%rbx), %rsi
movq (%rsi,%rdx,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
leaq 0xfc7e(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
movq 0x8(%rsp), %rdx
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r15
jl 0x235ae
incq %rbp
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %rbp
jl 0x2358e
jmp 0x23627
movq 0x8(%rsp), %rdx
incq %rdx
movslq 0x8c0(%rax), %rcx
cmpq %rcx, %rdx
leaq 0xfc22(%rip), %r13      # 0x3325d
leaq 0x11644(%rip), %r14     # 0x34c86
movq 0x10(%rsp), %rbp
leaq 0x11307(%rip), %r12     # 0x34955
jl 0x233c1
movq %rbp, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x525b