// File: myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::toFileGroup(char const*)
void HMMProblem::toFileGroup(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," %10.7f%s",this->null_obs_ratio[m],(m==(this->p->nO-1))?"\n":"\t");
	NCAT g;
	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());
		NPAR i,j,m;
		fprintf(fid,"PI\t");
		for(i=0; i<this->p->nS; i++)
			fprintf(fid,"%12.10f%s",this->pi[g][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[g][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[g][i][m],(i==(this->p->nS-1) && m==(this->p->nO-1))?"\n":"\t");
	}
	fclose(fid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x33a04(%rip), %rsi     # 0x5058a
callq 0x5370
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1cbbc
movq 0x3e43b(%rip), %rax     # 0x5afd8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x339e1(%rip), %rsi     # 0x5058c
movb $0x0, %al
callq 0x5440
movl $0x1, %edi
callq 0x5390
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rdi
movq 0x88(%rax), %rsi
callq 0xbc70
movq -0x18(%rbp), %rdi
leaq 0x339d3(%rip), %rsi     # 0x505ae
movb $0x0, %al
callq 0x5440
movb $0x0, -0x19(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x19(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b9(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1cc7a
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x18(%rcx), %rax
movsbq -0x19(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
movsbl -0x19(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b9(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1cc45
leaq 0x32d66(%rip), %rax     # 0x4f9a5
movq %rax, -0x58(%rbp)
jmp 0x1cc52
leaq 0x3402e(%rip), %rax     # 0x50c7a
movq %rax, -0x58(%rbp)
jmp 0x1cc52
movsd -0x48(%rbp), %xmm0
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0x3395b(%rip), %rsi     # 0x505c1
movb $0x1, %al
callq 0x5440
movb -0x19(%rbp), %al
addb $0x1, %al
movb %al, -0x19(%rbp)
jmp 0x1cbe6
leaq -0x28(%rbp), %rdi
callq 0x170b0
movl $0x0, -0x20(%rbp)
movq -0x40(%rbp), %rcx
movl -0x20(%rbp), %eax
movq 0x88(%rcx), %rcx
cmpl 0x8bc(%rcx), %eax
jge 0x1d010
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x928(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x27d20
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x5c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x17160
movq %rax, %rdi
addq $0x8, %rdi
callq 0x5110
movq -0x68(%rbp), %rdi
movl -0x5c(%rbp), %edx
movq %rax, %rcx
leaq 0x338cc(%rip), %rsi     # 0x505cb
movb $0x0, %al
callq 0x5440
movq -0x18(%rbp), %rdi
leaq 0x338c1(%rip), %rsi     # 0x505d2
movb $0x0, %al
callq 0x5440
movb $0x0, -0x31(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1cdbc
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x38(%rcx), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsbq -0x31(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0x70(%rbp)
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1cd87
leaq 0x32c24(%rip), %rax     # 0x4f9a5
movq %rax, -0x80(%rbp)
jmp 0x1cd94
leaq 0x33eec(%rip), %rax     # 0x50c7a
movq %rax, -0x80(%rbp)
jmp 0x1cd94
movsd -0x70(%rbp), %xmm0
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rdx
leaq 0x33bbb(%rip), %rsi     # 0x50963
movb $0x1, %al
callq 0x5440
movb -0x31(%rbp), %al
addb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x1cd1c
movq -0x18(%rbp), %rdi
leaq 0x3380f(%rip), %rsi     # 0x505d6
movb $0x0, %al
callq 0x5440
movb $0x0, -0x31(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1cede
movb $0x0, -0x32(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x32(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1cecf
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq 0x40(%rcx), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsbq -0x31(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsbq -0x32(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0x88(%rbp)
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1ce8e
movq -0x40(%rbp), %rcx
movsbl -0x32(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1ce8e
leaq 0x32b20(%rip), %rax     # 0x4f9a5
movq %rax, -0x98(%rbp)
jmp 0x1ce9e
leaq 0x33de5(%rip), %rax     # 0x50c7a
movq %rax, -0x98(%rbp)
jmp 0x1ce9e
movsd -0x88(%rbp), %xmm0
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0x33aa8(%rip), %rsi     # 0x50963
movb $0x1, %al
callq 0x5440
movb -0x32(%rbp), %al
addb $0x1, %al
movb %al, -0x32(%rbp)
jmp 0x1cdf4
jmp 0x1ced1
movb -0x31(%rbp), %al
addb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x1cdd2
movq -0x18(%rbp), %rdi
leaq 0x336f0(%rip), %rsi     # 0x505d9
movb $0x0, %al
callq 0x5440
movb $0x0, -0x31(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1d000
movb $0x0, -0x33(%rbp)
movq -0x40(%rbp), %rcx
movsbl -0x33(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b9(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1cff1
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x48(%rcx), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsbq -0x31(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsbq -0x33(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsbl -0x31(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1cfb0
movq -0x40(%rbp), %rcx
movsbl -0x33(%rbp), %eax
movq 0x88(%rcx), %rcx
movsbl 0x8b9(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1cfb0
leaq 0x329fe(%rip), %rax     # 0x4f9a5
movq %rax, -0xb0(%rbp)
jmp 0x1cfc0
leaq 0x33cc3(%rip), %rax     # 0x50c7a
movq %rax, -0xb0(%rbp)
jmp 0x1cfc0
movsd -0xa0(%rbp), %xmm0
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0x33986(%rip), %rsi     # 0x50963
movb $0x1, %al
callq 0x5440
movb -0x33(%rbp), %al
addb $0x1, %al
movb %al, -0x33(%rbp)
jmp 0x1cf16
jmp 0x1cff3
movb -0x31(%rbp), %al
addb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x1cef4
jmp 0x1d002
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1cc8a
movq -0x18(%rbp), %rdi
callq 0x52c0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)