// File: /workspace/github_cpp_makefile_star2_O2/myudelson[P]hmm-scalable/HMMProblemSt.cpp
// Function: HMMProblemSt::toFileSkill(char const*)
void HMMProblemSt::toFileSkill(const char *filename) {
    NPAR nS = this->task->nS, nO = this->task->nO;
    NCAT nK = this->task->nK;
	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->task);
    
	fprintf(fid,"Null skill ratios\t");
	for(NPAR m=0; m<nO; m++)
		fprintf(fid," %10.7f%s",this->null_obs_ratios[m],(m==(this->task->nO-1))?"\n":"\t");
    
	NCAT k;
	std::map<NCAT,std::string>::iterator it;
	for(k=0;k<nK;k++) {
		it = this->task->map_skill_bwd->find(k);
		fprintf(fid,"%d\t%s\n",k,it->second.c_str());
		NPAR i,j,m;
		fprintf(fid,"PI\t");
		for(i=0; i<nS; i++)
			fprintf(fid,"%12.10f%s",this->param_skill[PI(k,i)],(i==(nS-1))?"\n":"\t");
		fprintf(fid,"A\t");
		for(i=0; i<nS; i++)
			for(j=0; j<nS; j++)
				fprintf(fid,"%12.10f%s",this->param_skill[A(k,i,j)],(i==(nS-1) && j==(nS-1))?"\n":"\t");
		fprintf(fid,"B\t");
		for(i=0; i<nS; i++)
			for(m=0; m<nO; m++)
				fprintf(fid,"%12.10f%s",this->param_skill[B(k,i,m)],(i==(nS-1) && m==(nO-1))?"\n":"\t");
	}
	fclose(fid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x68(%rdi), %rax
movsbl 0x900(%rax), %r12d
movsbl 0x901(%rax), %ebp
movl 0x908(%rax), %eax
movl %eax, 0x24(%rsp)
leaq 0x55c2(%rip), %rsi      # 0x112de
movq %r15, %rdi
callq 0x3220
testq %rax, %rax
je 0xbfde
movq %rax, %r14
movq %r12, 0x10(%rsp)
movzbl %r12b, %eax
movl %eax, 0x4(%rsp)
movq 0x68(%rbx), %rsi
movq %r14, %rdi
callq 0x66a1
leaq 0x55b2(%rip), %rdi      # 0x11302
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %r14, 0x8(%rsp)
movq %r14, %rcx
callq 0x3400
xorl %r14d, %r14d
testb %bpl, %bpl
movl $0x0, %r15d
cmovgl %ebp, %r15d
movslq %r15d, %r13
leaq 0x5598(%rip), %r12      # 0x11315
cmpq %r14, %r13
je 0xbdc2
movq 0x10(%rbx), %rax
movq 0x68(%rbx), %rcx
movsd (%rax,%r14,8), %xmm0
movsbl 0x901(%rcx), %eax
decl %eax
cmpl %eax, %r14d
leaq 0x5592(%rip), %rdx      # 0x11335
leaq 0x44d0(%rip), %rax      # 0x1027a
cmoveq %rax, %rdx
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x32d0
incq %r14
jmp 0xbd7d
movq 0x10(%rsp), %rdx
leal -0x1(%rdx), %r14d
decl %ebp
movl %ebp, 0x28(%rsp)
movl 0x4(%rsp), %eax
testb %al, %al
movl $0x0, %ecx
cmovgl %eax, %ecx
movq %rcx, 0x18(%rsp)
movzbl %r15b, %eax
movl %eax, 0x2c(%rsp)
movslq %edx, %r12
decq %r12
xorl %eax, %eax
movq 0x8(%rsp), %r13
movq %r12, 0x30(%rsp)
movl %eax, (%rsp)
cmpl 0x24(%rsp), %eax
jge 0xbfc7
movq 0x68(%rbx), %rax
movq 0x950(%rax), %rdi
movq %rsp, %rsi
callq 0xefb8
movl (%rsp), %edx
movq 0x28(%rax), %rcx
movq %r13, %rdi
leaq 0x54f0(%rip), %rsi      # 0x1131f
xorl %eax, %eax
callq 0x32d0
leaq 0x54e9(%rip), %rdi      # 0x11326
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x3400
xorl %r15d, %r15d
cmpl %r15d, 0x18(%rsp)
je 0xbe98
movq 0x28(%rbx), %rax
movslq (%rsp), %rcx
movslq 0x38(%rbx), %rdx
imulq %rcx, %rdx
addq %r15, %rdx
movsd (%rax,%rdx,8), %xmm0
cmpl %r15d, %r12d
leaq 0x54be(%rip), %rdx      # 0x11335
leaq 0x43fc(%rip), %rax      # 0x1027a
cmoveq %rax, %rdx
movq %r13, %rdi
leaq 0x549e(%rip), %rsi      # 0x1132a
movb $0x1, %al
callq 0x32d0
incq %r15
jmp 0xbe4e
leaq 0x5495(%rip), %rdi      # 0x11334
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x3400
xorl %ebp, %ebp
pushq $0x1
popq %r15
cmpl 0x18(%rsp), %ebp
je 0xbf26
xorl %r12d, %r12d
cmpl %r12d, 0x4(%rsp)
je 0xbf1f
movl %r14d, %eax
xorl %ebp, %eax
movq 0x28(%rbx), %rcx
movq 0x68(%rbx), %rdx
movl 0x38(%rbx), %esi
imull (%rsp), %esi
movsbl 0x900(%rdx), %edx
imull %r15d, %edx
addl %r12d, %esi
addl %edx, %esi
movslq %esi, %rdx
movsd (%rcx,%rdx,8), %xmm0
movl %r14d, %ecx
xorl %r12d, %ecx
orl %eax, %ecx
leaq 0x5437(%rip), %rdx      # 0x11335
leaq 0x4375(%rip), %rax      # 0x1027a
cmoveq %rax, %rdx
movq %r13, %rdi
leaq 0x5417(%rip), %rsi      # 0x1132a
movb $0x1, %al
callq 0x32d0
incl %r12d
jmp 0xbebc
incl %ebp
incl %r15d
jmp 0xbeb3
leaq 0x540a(%rip), %rdi      # 0x11337
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x3400
xorl %eax, %eax
cmpl 0x18(%rsp), %eax
je 0xbfb8
xorl %r12d, %r12d
movl %r14d, %r13d
xorl %eax, %r13d
movl %eax, 0x10(%rsp)
movsbl %al, %ebp
cmpl %r12d, 0x2c(%rsp)
je 0xbfab
movq 0x28(%rbx), %r15
movl (%rsp), %esi
movsbl %r12b, %ecx
movq %rbx, %rdi
movl %ebp, %edx
callq 0xa35c
cltq
movsd (%r15,%rax,8), %xmm0
movl 0x28(%rsp), %eax
xorl %r12d, %eax
orl %r13d, %eax
leaq 0x53ad(%rip), %rdx      # 0x11335
leaq 0x42eb(%rip), %rax      # 0x1027a
cmoveq %rax, %rdx
movq 0x8(%rsp), %rdi
leaq 0x538b(%rip), %rsi      # 0x1132a
movb $0x1, %al
callq 0x32d0
incl %r12d
jmp 0xbf53
movl 0x10(%rsp), %eax
incl %eax
movq 0x8(%rsp), %r13
jmp 0xbf3d
movl (%rsp), %eax
incl %eax
movq 0x30(%rsp), %r12
jmp 0xbdfe
movq %r13, %rdi
callq 0x31b0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9ff3(%rip), %rax      # 0x15fd8
movq (%rax), %rdi
leaq 0x52f1(%rip), %rsi      # 0x112e0
movq %r15, %rdx
xorl %eax, %eax
callq 0x32d0
pushq $0x1
popq %rdi
callq 0x3240
nop