// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xdab1(%rip), %rsi      # 0x34546
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x26e84
movq %rax, %r14
movq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0xa125
leaq 0xdaab(%rip), %rdi      # 0x3456a
movl $0x12, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x4480
movq %rbx, 0x8(%rsp)
movq 0x88(%rbx), %rax
movb 0x8b9(%rax), %cl
leaq 0xc773(%rip), %r13      # 0x3325d
leaq 0xe195(%rip), %rbx      # 0x34c86
testb %cl, %cl
jle 0x26b42
xorl %r12d, %r12d
leaq 0xde55(%rip), %r15      # 0x34954
movq 0x8(%rsp), %rbp
movsbl %cl, %eax
decl %eax
movq %r13, %rdx
cmpl %eax, %r12d
je 0x26b14
movq %rbx, %rdx
movq 0x18(%rbp), %rax
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x4330
incq %r12
movq 0x88(%rbp), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r12
jl 0x26b04
cmpl $0x0, 0x8bc(%rax)
jle 0x26e6e
xorl %r15d, %r15d
movq %r14, 0x20(%rsp)
movq 0x928(%rax), %rax
movq 0x10(%rax), %rdx
addq $0x8, %rax
testq %rdx, %rdx
je 0x26ba1
movq %rax, %rcx
movslq 0x20(%rdx), %rsi
xorl %edi, %edi
cmpq %rsi, %r15
setg %dil
cmovleq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0x26b6e
movq %r13, %rbp
cmpq %rax, %rcx
je 0x26ba4
movq %rbx, %r13
movslq 0x20(%rcx), %rdx
cmpq %rdx, %r15
cmovgeq %rcx, %rax
jmp 0x26ba7
movq %r13, %rbp
movq %rbx, %r13
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0xd9d2(%rip), %rsi      # 0x34587
movl %r15d, %edx
xorl %eax, %eax
callq 0x4330
movl $0x3, %esi
movl $0x1, %edx
leaq 0xd9be(%rip), %rdi      # 0x3458e
movq %r14, %rcx
callq 0x4480
movq 0x8(%rsp), %r8
movq 0x88(%r8), %rax
movb 0x8b8(%rax), %cl
testb %cl, %cl
leaq 0xdd62(%rip), %rbx      # 0x34955
movq %r15, 0x18(%rsp)
jle 0x26c58
movq %r15, %rdi
movq %r13, %rdx
xorl %r15d, %r15d
movsbl %cl, %eax
movq 0x38(%r8), %rcx
movq (%rcx,%rdi,8), %rcx
movsd (%rcx,%r15,8), %xmm0
decl %eax
cmpl %eax, %r15d
movq %rdx, %r13
cmoveq %rbp, %rdx
movq %r14, %rdi
movq %rbx, %rsi
movb $0x1, %al
movq %r14, %r12
movq %r8, %r14
callq 0x4330
movq %r14, %r8
movq %r12, %r14
movq 0x18(%rsp), %rdi
movq %r13, %rdx
incq %r15
movq 0x88(%r8), %rax
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %r15
jl 0x26c03
cmpb $0x0, 0x8c8(%rax)
jle 0x26e48
movq %r8, %r12
xorl %edx, %edx
movq %r14, %rdi
leaq 0xe023(%rip), %rsi      # 0x34c97
movq %rdx, 0x10(%rsp)
xorl %eax, %eax
callq 0x4330
movq 0x88(%r12), %rax
movb 0x8b8(%rax), %cl
testb %cl, %cl
jle 0x26d28
xorl %ebp, %ebp
testb %cl, %cl
jle 0x26d18
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
leaq 0xdcaa(%rip), %r14      # 0x34955
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbx
movsbl %cl, %eax
movq 0x90(%r15), %rcx
movq (%rcx,%r12,8), %rcx
movq (%rcx,%rbx,8), %rcx
movq (%rcx,%rbp,8), %rcx
movsd (%rcx,%r13,8), %xmm0
decl %eax
movl %r13d, %ecx
xorl %eax, %ecx
xorl %ebp, %eax
orl %ecx, %eax
leaq 0xdfa3(%rip), %rdx      # 0x34c86
leaq 0xc573(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x4330
incq %r13
movq 0x88(%r15), %rax
movb 0x8b8(%rax), %cl
movsbq %cl, %rdx
cmpq %rdx, %r13
jl 0x26cb5
jmp 0x26d1c
movsbq %cl, %rdx
incq %rbp
cmpq %rdx, %rbp
jl 0x26c98
movq 0x10(%rsp), %rdx
incq %rdx
movsbq 0x8c8(%rax), %rcx
cmpq %rcx, %rdx
movq 0x20(%rsp), %r14
movq 0x8(%rsp), %r12
jl 0x26c6a
testb %cl, %cl
jle 0x26e48
xorl %edx, %edx
movq %r14, %rdi
leaq 0xdf29(%rip), %rsi      # 0x34c88
movq %rdx, 0x10(%rsp)
xorl %eax, %eax
callq 0x4330
movq 0x88(%r12), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x26e25
xorl %ebp, %ebp
movb 0x8b9(%rax), %cl
testb %cl, %cl
jle 0x26e11
xorl %r13d, %r13d
leaq 0xdbbb(%rip), %rbx      # 0x34955
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %r12
movq 0x10(%rsp), %r15
movsbl %cl, %ecx
movq 0x98(%r12), %rdx
movq (%rdx,%r14,8), %rdx
movq (%rdx,%r15,8), %rdx
movq (%rdx,%rbp,8), %rdx
movsd (%rdx,%r13,8), %xmm0
movsbl 0x8b8(%rax), %eax
decl %eax
xorl %ebp, %eax
decl %ecx
xorl %r13d, %ecx
orl %eax, %ecx
leaq 0xdea7(%rip), %rdx      # 0x34c86
leaq 0xc477(%rip), %rax      # 0x3325d
cmoveq %rax, %rdx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x4330
incq %r13
movq 0x88(%r12), %rax
movsbq 0x8b9(%rax), %rcx
cmpq %rcx, %r13
jl 0x26da9
incq %rbp
movsbq 0x8b8(%rax), %rcx
cmpq %rcx, %rbp
jl 0x26d82
movq 0x10(%rsp), %rdx
incq %rdx
movsbq 0x8c8(%rax), %rcx
cmpq %rcx, %rdx
movq 0x20(%rsp), %r14
movq 0x8(%rsp), %r12
jl 0x26d55
movq 0x18(%rsp), %r15
incq %r15
movslq 0x8bc(%rax), %rcx
cmpq %rcx, %r15
leaq 0xc3fc(%rip), %r13      # 0x3325d
leaq 0xde1e(%rip), %rbx      # 0x34c86
jl 0x26b57
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4200
movq %r15, %rdi
callq 0x5386