// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblemPiGKww.cpp
// Function: HMMProblemPiGKww::toFile(char const*)
void HMMProblemPiGKww::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");
    /*vvdiffvv*/
	fprintf(fid,"Student and skill component ratios\t");
	fprintf(fid,"%12.10f\t%12.10f\t%12.10f\n",this->ww[0],this->ww[1],this->ww[2]);
//	fprintf(fid,"%12.10f\t%12.10f\n",this->ww[0],this->ww[1]);
    /*^^diff^^*/
	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");
    }
	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,"A\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,"B\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, %rbx
leaq 0x19253(%rip), %rsi     # 0x354b6
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x1c794
movq %rax, %r14
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0xa118
leaq 0x1924d(%rip), %rdi     # 0x354da
movl $0x12, %esi
movl $0x1, %edx
movq %r14, 0x8(%rsp)
movq %r14, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b9(%rax), %al
leaq 0x17fa5(%rip), %r13     # 0x3425d
leaq 0x198e7(%rip), %r14     # 0x35ba6
testb %al, %al
jle 0x1c30d
xorl %r15d, %r15d
leaq 0x195c1(%rip), %r12     # 0x3588e
movsbl %al, %eax
decl %eax
movq %r13, %rdx
cmpl %eax, %r15d
je 0x1c2dd
movq %r14, %rdx
movq 0x18(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rax
cmpq %rax, %r15
jl 0x1c2cd
leaq 0x196a4(%rip), %rdi     # 0x359b8
movl $0x23, %esi
movl $0x1, %edx
movq 0x8(%rsp), %r12
movq %r12, %rcx
callq 0x4480
movq 0x98(%rbx), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x19695(%rip), %rsi     # 0x359dc
movq %r12, %rdi
movb $0x3, %al
callq 0x4330
movq 0x88(%rbx), %rax
cmpl $0x0, 0x8bc(%rax)
jle 0x1c483
xorl %edx, %edx
movq 0x928(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rax, %rcx
testq %r8, %r8
je 0x1c39c
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 0x1c381
cmpq %rax, %rcx
je 0x1c3ac
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %r12, %rdi
leaq 0x1913d(%rip), %rsi     # 0x354f7
xorl %eax, %eax
movq %rdx, %r13
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x194c4(%rip), %rdi     # 0x35899
movq %r12, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
leaq 0x197b3(%rip), %rdx     # 0x35ba6
leaq 0x19495(%rip), %rsi     # 0x3588f
leaq 0x17e5c(%rip), %rdi     # 0x3425d
jle 0x1c463
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x90(%rbx), %rcx
movq (%rcx,%r13,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rdx, %rbp
cmoveq %rdi, %rdx
movq %r12, %rdi
movb $0x1, %al
movq %rbx, %r14
movq %r13, %rbx
movq %rsi, %r13
callq 0x4330
movq %r13, %rsi
movq %rbx, %r13
movq %r14, %rbx
movq %rbp, %rdx
leaq 0x17e11(%rip), %rdi     # 0x3425d
incq %r15
movq 0x88(%r14), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x1c406
incq %r13
movq 0x88(%rbx), %rax
movslq 0x8bc(%rax), %rcx
cmpq %rcx, %r13
movq %r13, %rdx
movq %rdi, %r13
jl 0x1c367
movq 0x88(%rbx), %rax
cmpl $0x0, 0x8c0(%rax)
jle 0x1c77e
xorl %edx, %edx
movq %rbx, 0x18(%rsp)
movq %r13, %r15
movq 0x948(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
movq %rax, %rcx
testq %r8, %r8
je 0x1c4d6
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 0x1c4bb
cmpq %rax, %rcx
leaq 0x196c6(%rip), %r14     # 0x35ba6
je 0x1c4ed
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %r12, %rdi
leaq 0x18ffc(%rip), %rsi     # 0x354f7
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x19386(%rip), %rdi     # 0x3589e
movq %r12, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
leaq 0x19359(%rip), %r13     # 0x3588f
jle 0x1c584
movq %r15, %rbp
xorl %r15d, %r15d
movsbl %al, %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 %r14, %rdx
cmoveq %rbp, %rdx
movq %r12, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x1c53e
movl $0x2, %esi
movl $0x1, %edx
leaq 0x18f6d(%rip), %rdi     # 0x35502
movq %r12, %rcx
callq 0x4480
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x1c666
xorl %edi, %edi
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %al
testb %al, %al
leaq 0x17c94(%rip), %r12     # 0x3425d
leaq 0x195d6(%rip), %rdx     # 0x35ba6
movq 0x8(%rsp), %r13
leaq 0x192b3(%rip), %r15     # 0x3588f
movq %rbx, %rcx
movq 0x10(%rsp), %rbx
jle 0x1c648
xorl %ebp, %ebp
movq %rdi, 0x20(%rsp)
movsbl %al, %eax
movq 0x18(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx,%rbx,8), %rcx
movq (%rcx,%rdi,8), %rcx
movsd (%rcx,%rbp,8), %xmm0
decl %eax
movl %ebp, %ecx
xorl %eax, %ecx
xorl %edi, %eax
orl %ecx, %eax
movq %rdx, %r14
cmoveq %r12, %rdx
movq %r13, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4330
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rdi
movq %r14, %rdx
incq %rbp
movq 0x88(%rcx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rbp
jl 0x1c5ed
incq %rdi
movq 0x88(%rcx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rdi
movq %rcx, %rbx
jl 0x1c5b3
movl $0x2, %esi
movl $0x1, %edx
leaq 0x18e8e(%rip), %rdi     # 0x35505
movq 0x8(%rsp), %rcx
callq 0x4480
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x1c753
xorl %r9d, %r9d
movq 0x88(%rbx), %rax
movb 0x8b9(%rax), %cl
testb %cl, %cl
leaq 0x17baf(%rip), %r13     # 0x3425d
leaq 0x194f1(%rip), %r14     # 0x35ba6
movq 0x8(%rsp), %r12
movq 0x10(%rsp), %r15
movq %rbx, %rdx
leaq 0x191c6(%rip), %rbx     # 0x3588f
jle 0x1c735
xorl %ebp, %ebp
movsbl %cl, %ecx
movq 0x18(%rsp), %rdx
movq 0x48(%rdx), %rdx
movq (%rdx,%r15,8), %rdx
movq (%rdx,%r9,8), %rdx
movsd (%rdx,%rbp,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r9d, %eax
decl %ecx
xorl %ebp, %ecx
orl %eax, %ecx
movq %r14, %rdx
cmoveq %r13, %rdx
movq %r12, %rdi
movq %rbx, %rsi
movb $0x1, %al
movq %r9, %r13
callq 0x4330
movq 0x18(%rsp), %rdx
movq %r13, %r9
leaq 0x17b3f(%rip), %r13     # 0x3425d
incq %rbp
movq 0x88(%rdx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %rbp
jl 0x1c6cd
incq %r9
movq 0x88(%rdx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r9
movq %rdx, %rbx
jl 0x1c698
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x88(%rbx), %rax
movslq 0x8c0(%rax), %rcx
cmpq %rcx, %rdx
leaq 0x17aea(%rip), %r13     # 0x3425d
movq 0x8(%rsp), %r12
jl 0x1c49e
movq %r12, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x4e1b