// File: 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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq 0x68(%rax), %rcx
movb 0x900(%rcx), %cl
movb %cl, -0x11(%rbp)
movq 0x68(%rax), %rcx
movb 0x901(%rcx), %cl
movb %cl, -0x12(%rbp)
movq 0x68(%rax), %rax
movl 0x908(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x7dd5(%rip), %rsi      # 0x1c332
callq 0x3310
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x14593
movq 0xda64(%rip), %rax      # 0x21fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x7db2(%rip), %rsi      # 0x1c334
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3330
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rdi
movq 0x68(%rax), %rsi
callq 0x9790
movq -0x20(%rbp), %rdi
leaq 0x7da7(%rip), %rsi      # 0x1c356
movb $0x0, %al
callq 0x33c0
movb $0x0, -0x21(%rbp)
movsbl -0x21(%rbp), %eax
movsbl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1463a
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq 0x10(%rcx), %rax
movsbq -0x21(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0x50(%rbp)
movsbl -0x21(%rbp), %eax
movq 0x68(%rcx), %rcx
movsbl 0x901(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14608
leaq 0x7398(%rip), %rax      # 0x1b99a
movq %rax, -0x60(%rbp)
jmp 0x14615
leaq 0x7d7a(%rip), %rax      # 0x1c389
movq %rax, -0x60(%rbp)
jmp 0x14615
movsd -0x50(%rbp), %xmm0
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0x7d40(%rip), %rsi      # 0x1c369
movb $0x1, %al
callq 0x33c0
movb -0x21(%rbp), %al
addb $0x1, %al
movb %al, -0x21(%rbp)
jmp 0x145ba
leaq -0x30(%rbp), %rdi
callq 0xf7b0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x14978
movq -0x48(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x950(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x195e0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x64(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xf860
movq %rax, %rdi
addq $0x8, %rdi
callq 0x3100
movq -0x70(%rbp), %rdi
movl -0x64(%rbp), %edx
movq %rax, %rcx
leaq 0x7cc5(%rip), %rsi      # 0x1c373
movb $0x0, %al
callq 0x33c0
movq -0x20(%rbp), %rdi
leaq 0x7cba(%rip), %rsi      # 0x1c37a
movb $0x0, %al
callq 0x33c0
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1476e
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq 0x28(%rdi), %rax
movq %rax, -0x80(%rbp)
movl -0x28(%rbp), %esi
movsbl -0x39(%rbp), %edx
callq 0x11e40
movl %eax, %ecx
movq -0x80(%rbp), %rax
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14730
leaq 0x7273(%rip), %rax      # 0x1b99a
movq %rax, -0x90(%rbp)
jmp 0x14740
leaq 0x7c52(%rip), %rax      # 0x1c389
movq %rax, -0x90(%rbp)
jmp 0x14740
movsd -0x78(%rbp), %xmm0
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rdx
leaq 0x7c24(%rip), %rsi      # 0x1c37e
movb $0x1, %al
callq 0x33c0
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x146cb
movq -0x20(%rbp), %rdi
leaq 0x7c0f(%rip), %rsi      # 0x1c388
movb $0x0, %al
callq 0x33c0
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1486b
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1485c
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x28(%rdi), %rax
movq %rax, -0xa0(%rbp)
movl -0x28(%rbp), %esi
movb -0x39(%rbp), %al
movsbl %al, %edx
movsbl -0x3a(%rbp), %ecx
callq 0x11e70
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x98(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1481b
movsbl -0x3a(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1481b
leaq 0x7188(%rip), %rax      # 0x1b99a
movq %rax, -0xb0(%rbp)
jmp 0x1482b
leaq 0x7b67(%rip), %rax      # 0x1c389
movq %rax, -0xb0(%rbp)
jmp 0x1482b
movsd -0x98(%rbp), %xmm0
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0x7b36(%rip), %rsi      # 0x1c37e
movb $0x1, %al
callq 0x33c0
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x14798
jmp 0x1485e
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x14784
movq -0x20(%rbp), %rdi
leaq 0x7b15(%rip), %rsi      # 0x1c38b
movb $0x0, %al
callq 0x33c0
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x14968
movb $0x0, -0x3b(%rbp)
movsbl -0x3b(%rbp), %eax
movsbl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jge 0x14959
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq 0x28(%rdi), %rax
movq %rax, -0xc0(%rbp)
movl -0x28(%rbp), %esi
movb -0x39(%rbp), %al
movsbl %al, %edx
movsbl -0x3b(%rbp), %ecx
callq 0x11ec0
movl %eax, %ecx
movq -0xc0(%rbp), %rax
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14918
movsbl -0x3b(%rbp), %eax
movsbl -0x12(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14918
leaq 0x708b(%rip), %rax      # 0x1b99a
movq %rax, -0xd0(%rbp)
jmp 0x14928
leaq 0x7a6a(%rip), %rax      # 0x1c389
movq %rax, -0xd0(%rbp)
jmp 0x14928
movsd -0xb8(%rbp), %xmm0
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
leaq 0x7a39(%rip), %rsi      # 0x1c37e
movb $0x1, %al
callq 0x33c0
movb -0x3b(%rbp), %al
addb $0x1, %al
movb %al, -0x3b(%rbp)
jmp 0x14895
jmp 0x1495b
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x14881
jmp 0x1496a
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1464a
movq -0x20(%rbp), %rdi
callq 0x3260
addq $0xd0, %rsp
popq %rbp
retq
nopw (%rax,%rax)