// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x68(%rdi), %rax
movsbl 0x900(%rax), %ecx
movl %ecx, 0xc(%rsp)
movzbl 0x901(%rax), %r14d
movl 0x908(%rax), %eax
movl %eax, 0x10(%rsp)
leaq 0x528a(%rip), %rsi      # 0x1223e
movq %r15, %rdi
callq 0x2230
testq %rax, %rax
je 0xd36e
movq %rax, %r13
movq 0x68(%rbx), %rsi
movq %rax, %rdi
callq 0x7362
leaq 0x5287(%rip), %rdi      # 0x12262
movl $0x12, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x23d0
leaq 0x4286(%rip), %rbp      # 0x1127a
leaq 0x529a(%rip), %r12      # 0x12295
testb %r14b, %r14b
movq %r14, %r15
jle 0xd040
xorl %r14d, %r14d
movq 0x10(%rbx), %rax
movq 0x68(%rbx), %rcx
movsd (%rax,%r14,8), %xmm0
movsbl 0x901(%rcx), %eax
decl %eax
cmpl %eax, %r14d
movq %r12, %rdx
cmoveq %rbp, %rdx
movq %r13, %rdi
leaq 0x5244(%rip), %rsi      # 0x12275
movb $0x1, %al
callq 0x22b0
incq %r14
cmpq %r14, %r15
jne 0xd006
cmpl $0x0, 0x10(%rsp)
jle 0xd358
movl 0xc(%rsp), %eax
movzbl %al, %ecx
cltq
movsbl %r15b, %edx
leal -0x1(%rax), %esi
movl %esi, 0x4(%rsp)
movl %edx, 0x34(%rsp)
decl %edx
movl %edx, 0x14(%rsp)
leaq -0x1(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movzbl %al, %eax
movq %rax, 0x48(%rsp)
xorl %edx, %edx
movq %r15, 0x50(%rsp)
movq %r13, 0x20(%rsp)
movl %ecx, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x68(%rbx), %rax
movq 0x950(%rax), %rax
movq 0x10(%rax), %rdi
addq $0x8, %rax
movq %rax, %rcx
testq %rdi, %rdi
je 0xd0c9
movq %rax, %rcx
xorl %esi, %esi
cmpl %edx, 0x20(%rdi)
setl %sil
cmovgeq %rdi, %rcx
movq 0x10(%rdi,%rsi,8), %rdi
testq %rdi, %rdi
jne 0xd0b2
movq %rbx, %r15
cmpq %rax, %rcx
leaq 0x51bf(%rip), %rbx      # 0x12295
movq %rbp, %r12
je 0xd0e2
cmpl 0x20(%rcx), %edx
cmovgeq %rcx, %rax
movq 0x28(%rax), %rcx
movq %r13, %rdi
leaq 0x518f(%rip), %rsi      # 0x1227f
movl %edx, (%rsp)
xorl %eax, %eax
callq 0x22b0
movl $0x3, %esi
movl $0x1, %edx
leaq 0x517b(%rip), %rdi      # 0x12286
movq %r13, %rcx
callq 0x23d0
cmpb $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rdx
leaq 0x5166(%rip), %rsi      # 0x1228a
jle 0xd17a
movq %rbx, %rbp
movq %r15, %rbx
movslq (%rsp), %rcx
movq %rcx, 0x28(%rsp)
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movslq 0x38(%rbx), %rcx
imulq 0x28(%rsp), %rcx
addq %r15, %rcx
movsd (%rax,%rcx,8), %xmm0
cmpl %r15d, %edx
movq %rbp, %rdx
cmoveq %r12, %rdx
movq %r13, %rdi
movq %rsi, %r14
movb $0x1, %al
callq 0x22b0
movq %r14, %rsi
movq 0x48(%rsp), %rax
movq 0x38(%rsp), %rdx
incq %r15
cmpl %r15d, %eax
jne 0xd138
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5109(%rip), %rdi      # 0x12294
movq %r13, %rcx
callq 0x23d0
cmpb $0x0, 0xc(%rsp)
movl 0x4(%rsp), %esi
jle 0xd231
xorl %ecx, %ecx
movl $0x1, %ebp
movl %esi, %r15d
movl %ecx, 0x28(%rsp)
xorl %ecx, %r15d
xorl %r14d, %r14d
leaq 0x40bd(%rip), %r12      # 0x1127a
movl (%rsp), %ebx
movq 0x18(%rsp), %r13
movq 0x28(%r13), %rax
movq 0x68(%r13), %rcx
movsbl 0x900(%rcx), %ecx
movl 0x38(%r13), %edx
imull %ebx, %edx
imull %ebp, %ecx
addl %r14d, %edx
addl %ecx, %edx
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm0
movl %esi, %eax
xorl %r14d, %eax
orl %r15d, %eax
leaq 0x509b(%rip), %rdx      # 0x12295
cmoveq %r12, %rdx
movq 0x20(%rsp), %rdi
leaq 0x5080(%rip), %rsi      # 0x1228a
movb $0x1, %al
callq 0x22b0
movl 0x4(%rsp), %esi
movl 0x8(%rsp), %eax
incl %r14d
cmpl %r14d, %eax
jne 0xd1c5
movl 0x28(%rsp), %ecx
incl %ecx
incl %ebp
cmpl %eax, %ecx
jne 0xd1a9
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5055(%rip), %rdi      # 0x12297
movq 0x20(%rsp), %rcx
callq 0x23d0
movl 0x8(%rsp), %ecx
testb %cl, %cl
jle 0xd338
xorl %r11d, %r11d
cmpb $0x0, 0x34(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x400e(%rip), %r9       # 0x1127a
leaq 0x5022(%rip), %r13      # 0x12295
movl 0x4(%rsp), %ecx
movl 0x14(%rsp), %ebp
leaq 0x5008(%rip), %rsi      # 0x1228a
movl (%rsp), %r14d
movq 0x18(%rsp), %r12
jle 0xd328
xorl %r15d, %r15d
movl %ecx, %eax
xorl %r11d, %eax
movq 0x28(%r12), %rcx
movq 0x68(%r12), %rdx
movsbl 0x900(%rdx), %ebx
movsbl 0x901(%rdx), %edx
leal 0x1(%rbx), %r8d
imull %ebx, %r8d
movl 0x38(%r12), %ebx
imull %r14d, %ebx
imull %r11d, %edx
addl %ebx, %edx
addl %r8d, %edx
addl %r15d, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movl %ebp, %ecx
xorl %r15d, %ecx
orl %eax, %ecx
movq %r13, %rdx
cmoveq %r9, %rdx
movb $0x1, %al
movq %rdi, %rbp
movq %r9, %r12
movl %r14d, %ebx
movl %r11d, %r14d
callq 0x22b0
movl 0x4(%rsp), %ecx
movl %r14d, %r11d
movl %ebx, %r14d
movq %r12, %r9
movq 0x18(%rsp), %r12
movq %rbp, %rdi
movl 0x14(%rsp), %ebp
leaq 0x4f73(%rip), %rsi      # 0x1228a
movq 0x50(%rsp), %rdx
incl %r15d
cmpl %r15d, %edx
jne 0xd294
incl %r11d
movl 0x8(%rsp), %ecx
cmpl %ecx, %r11d
jne 0xd25b
movl (%rsp), %edx
incl %edx
cmpl 0x10(%rsp), %edx
movq 0x20(%rsp), %r13
leaq 0x3f2d(%rip), %rbp      # 0x1127a
movq 0x18(%rsp), %rbx
jne 0xd094
movq %r13, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21b0
movq %r15, %rdi
callq 0x2ab6