// File: /workspace/github_cpp_makefile_star2_O2/myudelson[P]hmm-scalable/HMMProblemSlicedAB.cpp
// Function: HMMProblemSlicedAB::toFileGroup(char const*)
void HMMProblemSlicedAB::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," %12.10f%s",this->null_obs_ratio[m],(m==(this->p->nO-1))?"\n":"\t");
	NCAT g;
    NPAR z;
	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");
        for(z=0; z<this->p->nZ; z++){
            fprintf(fid,"A - slice %d\t",z);
            for(i=0; i<this->p->nS; i++)
                for(j=0; j<this->p->nS; j++)
                    fprintf(fid,"%12.10f%s",this->A[g][z][i][j],(i==(this->p->nS-1) && j==(this->p->nS-1))?"\n":"\t");
        }
        for(z=0; z<this->p->nZ; z++){
            fprintf(fid,"B - slice %d \t",z);
            for(i=0; i<this->p->nS; i++)
                for(m=0; m<this->p->nO; m++)
                    fprintf(fid,"%12.10f%s",this->B[g][z][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
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc47c(%rip), %rsi      # 0x2d546
movq %r15, %rdi
callq 0x4280
testq %rax, %rax
je 0x21390
movq %rax, %r14
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0x7943
leaq 0xc476(%rip), %rdi      # 0x2d56a
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
xorl %r12d, %r12d
leaq 0xb151(%rip), %r13      # 0x2c25d
leaq 0xcb33(%rip), %rbp      # 0x2dc46
leaq 0xc804(%rip), %r15      # 0x2d91e
movq 0x88(%rbx), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r12
jge 0x21157
decl %ecx
movq %r13, %rdx
cmpl %ecx, %r12d
je 0x2113b
movq %rbp, %rdx
movq 0x18(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4350
incq %r12
jmp 0x2111a
leaq 0xc7c1(%rip), %r12      # 0x2d91f
xorl %ecx, %ecx
movl %ecx, 0x4(%rsp)
cmpl 0x8bc(%rax), %ecx
jge 0x21379
movq 0x928(%rax), %rdi
leaq 0x4(%rsp), %rsi
callq 0x15b18
movl 0x4(%rsp), %edx
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0xc3f4(%rip), %rsi      # 0x2d587
xorl %eax, %eax
callq 0x4350
leaq 0xc3ed(%rip), %rdi      # 0x2d58e
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x44b0
xorl %r15d, %r15d
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jge 0x21202
movq 0x38(%rbx), %rax
movslq 0x4(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movsd (%rax,%r15,8), %xmm0
decl %ecx
cmpl %ecx, %r15d
leaq 0xca61(%rip), %rdx      # 0x2dc46
leaq 0xb071(%rip), %rax      # 0x2c25d
cmoveq %rax, %rdx
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4350
incq %r15
jmp 0x211b2
xorl %r15d, %r15d
movsbq 0x8c8(%rax), %rcx
cmpq %rcx, %r15
jge 0x212b7
movq %r14, %rdi
leaq 0xca37(%rip), %rsi      # 0x2dc57
movl %r15d, %edx
xorl %eax, %eax
callq 0x4350
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %cl
xorl %r13d, %r13d
movsbq %cl, %rdx
cmpq %rdx, %r13
jge 0x212af
xorl %ebp, %ebp
movsbq %cl, %rdx
cmpq %rdx, %rbp
jge 0x212aa
movsbl %cl, %eax
movq 0x90(%rbx), %rcx
movslq 0x4(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%r15,8), %rcx
movq (%rcx,%r13,8), %rcx
movsd (%rcx,%rbp,8), %xmm0
decl %eax
movl %ebp, %ecx
xorl %eax, %ecx
xorl %r13d, %eax
orl %ecx, %eax
leaq 0xc9c6(%rip), %rdx      # 0x2dc46
leaq 0xafd6(%rip), %rax      # 0x2c25d
cmoveq %rax, %rdx
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4350
incq %rbp
movq 0x88(%rbx), %rax
movb 0x8b8(%rax), %cl
jmp 0x21245
incq %r13
jmp 0x2123a
incq %r15
jmp 0x21205
xorl %r15d, %r15d
movsbq %cl, %rcx
cmpq %rcx, %r15
jge 0x2136e
movq %r14, %rdi
leaq 0xc977(%rip), %rsi      # 0x2dc48
movl %r15d, %edx
xorl %eax, %eax
callq 0x4350
movq 0x88(%rbx), %rax
xorl %r13d, %r13d
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r13
jge 0x21360
xorl %ebp, %ebp
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %rbp
jge 0x2135b
movq 0x98(%rbx), %rdx
movslq 0x4(%rsp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rdx,%r15,8), %rdx
movq (%rdx,%r13,8), %rdx
movsd (%rdx,%rbp,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %r13d, %eax
decl %ecx
xorl %ebp, %ecx
orl %eax, %ecx
leaq 0xc90f(%rip), %rdx      # 0x2dc46
leaq 0xaf1f(%rip), %rax      # 0x2c25d
cmoveq %rax, %rdx
movq %r14, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x4350
incq %rbp
movq 0x88(%rbx), %rax
jmp 0x212f4
incq %r13
jmp 0x212e5
incq %r15
movb 0x8c8(%rax), %cl
jmp 0x212ba
movl 0x4(%rsp), %ecx
incl %ecx
jmp 0x21160
movq %r14, %rdi
callq 0x4210
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x17c41(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
leaq 0xc1a7(%rip), %rsi      # 0x2d548
movq %r15, %rdx
xorl %eax, %eax
callq 0x4350
pushq $0x1
popq %rdi
callq 0x42a0
nop