// File: /workspace/github_cpp_makefile_star2_O3/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 $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r13
leaq 0x18529(%rip), %rsi     # 0x34546
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x1c507
movq %rax, %r14
movq 0x88(%r13), %rsi
movq %rax, %rdi
callq 0xa125
leaq 0x18523(%rip), %rdi     # 0x3456a
movl $0x12, %esi
movl $0x1, %edx
movq %r14, (%rsp)
movq %r14, %rcx
callq 0x4480
movq 0x88(%r13), %rax
movb 0x8b9(%rax), %al
leaq 0x171ec(%rip), %rbx     # 0x3325d
leaq 0x18c0e(%rip), %r14     # 0x34c86
testb %al, %al
jle 0x1c0c5
xorl %r15d, %r15d
leaq 0x188ce(%rip), %r12     # 0x34954
movsbl %al, %eax
decl %eax
movq %rbx, %rdx
cmpl %eax, %r15d
je 0x1c096
movq %r14, %rdx
movq 0x18(%r13), %rax
movsd (%rax,%r15,8), %xmm0
movq (%rsp), %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%r13), %rax
movsbq 0x8b9(%rax), %rax
cmpq %rax, %r15
jl 0x1c086
leaq 0x189ce(%rip), %rdi     # 0x34a9a
movl $0x23, %esi
movl $0x1, %edx
movq (%rsp), %rbp
movq %rbp, %rcx
callq 0x4480
movq 0x98(%r13), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x189c0(%rip), %rsi     # 0x34abe
movq %rbp, %rdi
movb $0x3, %al
callq 0x4330
movq 0x88(%r13), %rax
cmpl $0x0, 0x8bc(%rax)
movq %r13, 0x8(%rsp)
jle 0x1c240
leaq 0x1882d(%rip), %rbx     # 0x34955
xorl %r12d, %r12d
movq 0x928(%rax), %rax
movq 0x10(%rax), %rdx
addq $0x8, %rax
testq %rdx, %rdx
je 0x1c16d
movq %rax, %rcx
movslq 0x20(%rdx), %rsi
xorl %edi, %edi
cmpq %rsi, %r12
setg %dil
cmovleq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0x1c142
cmpq %rax, %rcx
je 0x1c16d
movslq 0x20(%rcx), %rdx
cmpq %rdx, %r12
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %rbp, %rdi
leaq 0x1840c(%rip), %rsi     # 0x34587
movl %r12d, %edx
xorl %eax, %eax
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x187c9(%rip), %rdi     # 0x3495f
movq %rbp, %rcx
callq 0x4480
movq 0x88(%r13), %rax
movb 0x8b8(%rax), %cl
testb %cl, %cl
movq %rbp, %r8
leaq 0x18acf(%rip), %rdx     # 0x34c86
movq %rbx, %rsi
leaq 0x1709c(%rip), %rdi     # 0x3325d
jle 0x1c227
xorl %r15d, %r15d
movsbl %cl, %eax
movq 0x90(%r13), %rcx
movq (%rcx,%r12,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rdx, %rbp
cmoveq %rdi, %rdx
movq %r8, %r14
movq %rdi, %r13
movq %r8, %rdi
movb $0x1, %al
movq %r12, %rbx
movq %rsi, %r12
callq 0x4330
movq %r12, %rsi
movq %rbx, %r12
movq %r13, %rdi
movq 0x8(%rsp), %r13
movq %rbp, %rdx
movq %r14, %r8
incq %r15
movq 0x88(%r13), %rax
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jl 0x1c1c6
incq %r12
movslq 0x8bc(%rax), %rcx
cmpq %rcx, %r12
movq %r8, %rbp
movq %rsi, %rbx
jl 0x1c12b
cmpl $0x0, 0x8c0(%rax)
leaq 0x18a38(%rip), %r13     # 0x34c86
jle 0x1c4f1
leaq 0x186fa(%rip), %r14     # 0x34955
xorl %edx, %edx
movq %r13, %rbx
movq 0x948(%rax), %rax
movq 0x10(%rax), %r8
addq $0x8, %rax
testq %r8, %r8
je 0x1c2ab
movq %rax, %rcx
leaq 0x16fdf(%rip), %r13     # 0x3325d
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 0x1c27e
cmpq %rax, %rcx
je 0x1c2b2
movslq 0x20(%rcx), %rsi
cmpq %rsi, %rdx
cmovgeq %rcx, %rax
jmp 0x1c2b2
leaq 0x16fab(%rip), %r13     # 0x3325d
movq 0x28(%rax), %rcx
movq %rbp, %rdi
leaq 0x182c7(%rip), %rsi     # 0x34587
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
callq 0x4330
movl $0x4, %esi
movl $0x1, %edx
leaq 0x18687(%rip), %rdi     # 0x34964
movq %rbp, %rcx
callq 0x4480
movq 0x8(%rsp), %r12
movq 0x88(%r12), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x1c347
xorl %r15d, %r15d
movsbl %al, %eax
movq 0x38(%r12), %rcx
movq 0x10(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rbx, %rdx
cmoveq %r13, %rdx
movq %rbp, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x4330
incq %r15
movq 0x88(%r12), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x1c2ff
movl $0x2, %esi
movl $0x1, %edx
leaq 0x1823a(%rip), %rdi     # 0x34592
movq %rbp, %rcx
callq 0x4480
movq 0x88(%r12), %rax
movb 0x8b8(%rax), %al
testb %al, %al
jle 0x1c3f9
xorl %r15d, %r15d
testb %al, %al
jle 0x1c3ed
xorl %ebp, %ebp
movq (%rsp), %r12
leaq 0x185cb(%rip), %rbx     # 0x34955
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %r13
movsbl %al, %eax
movq 0x40(%r14), %rcx
movq (%rcx,%r13,8), %rcx
movq (%rcx,%r15,8), %rcx
movsd (%rcx,%rbp,8), %xmm0
decl %eax
movl %ebp, %ecx
xorl %eax, %ecx
xorl %r15d, %eax
orl %ecx, %eax
leaq 0x188cc(%rip), %rdx     # 0x34c86
leaq 0x16e9c(%rip), %rax     # 0x3325d
cmoveq %rax, %rdx
movq %r12, %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x4330
incq %rbp
movq 0x88(%r14), %rax
movb 0x8b8(%rax), %al
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x1c394
jmp 0x1c3f1
movsbq %al, %rcx
incq %r15
cmpq %rcx, %r15
jl 0x1c379
movl $0x2, %esi
movl $0x1, %edx
leaq 0x1818b(%rip), %rdi     # 0x34595
movq (%rsp), %rcx
callq 0x4480
movq 0x8(%rsp), %rax
movq 0x88(%rax), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x1c4c7
xorl %r15d, %r15d
movq 0x10(%rsp), %rdx
movb 0x8b9(%rax), %cl
testb %cl, %cl
jle 0x1c4b1
xorl %ebp, %ebp
leaq 0x16e16(%rip), %r13     # 0x3325d
movq (%rsp), %r12
leaq 0x18503(%rip), %rbx     # 0x34955
movq 0x8(%rsp), %r14
movsbl %cl, %ecx
movq 0x48(%r14), %rsi
movq (%rsi,%rdx,8), %rdx
movq (%rdx,%r15,8), %rdx
movsd (%rdx,%rbp,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r15d, %eax
decl %ecx
xorl %ebp, %ecx
orl %eax, %ecx
leaq 0x18802(%rip), %rdx     # 0x34c86
cmoveq %r13, %rdx
movq %r12, %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x4330
movq 0x10(%rsp), %rdx
incq %rbp
movq 0x88(%r14), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %rbp
jl 0x1c457
incq %r15
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jl 0x1c434
jmp 0x1c4cc
movq 0x10(%rsp), %rdx
incq %rdx
movslq 0x8c0(%rax), %rcx
cmpq %rcx, %rdx
leaq 0x187a6(%rip), %r13     # 0x34c86
movq (%rsp), %rbp
leaq 0x1846a(%rip), %r14     # 0x34955
jl 0x1c25d
movq %rbp, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x4e03
nop