// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/HMMProblemSt.cpp
// Function: HMMProblemSt::toFileGroup(char const*)
void HMMProblemSt::toFileGroup(const char *filename) {
    NPAR nS = this->task->nS, nO = this->task->nO;
    NCAT nG = this->task->nG;
	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==(nO-1))?"\n":"\t");
	NCAT g;
	std::map<NCAT,std::string>::iterator it;
	for(g=0;g<nG;g++) {
		it = this->task->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<=nS; i++)
            fprintf(fid,"%12.10f%s",this->param_skill[PI(g,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(g,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(g,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 $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x68(%rdi), %rax
movsbl 0x900(%rax), %ecx
movl %ecx, 0xc(%rsp)
movsbl 0x901(%rax), %r13d
movl 0x904(%rax), %eax
movl %eax, 0x28(%rsp)
leaq 0x5e04(%rip), %rsi      # 0x1332a
movq %r14, %rdi
callq 0x2230
testq %rax, %rax
je 0xd904
movq %rax, %r15
movq 0x68(%rbx), %rsi
movq %rax, %rdi
callq 0x7418
leaq 0x5e01(%rip), %rdi      # 0x1334e
movl $0x12, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x23d0
movq %r13, %r12
testb %r13b, %r13b
jle 0xd5ab
movq %r12, %rax
leal -0x1(%r12), %r14d
movslq %eax, %r13
xorl %ebp, %ebp
movq 0x10(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
cmpq %rbp, %r14
leaq 0x5dfa(%rip), %rdx      # 0x13381
leaq 0x4cec(%rip), %rax      # 0x1227a
cmoveq %rax, %rdx
movq %r15, %rdi
leaq 0x5dc5(%rip), %rsi      # 0x13361
movb $0x1, %al
callq 0x22b0
incq %rbp
cmpq %rbp, %r13
jne 0xd574
movq %rbx, 0x20(%rsp)
movq %r15, 0x10(%rsp)
cmpl $0x0, 0x28(%rsp)
movl 0xc(%rsp), %r13d
jle 0xd8ec
movl %r13d, %ebx
decl %ebx
leal -0x1(%r12), %eax
movl %eax, 0x2c(%rsp)
xorl %edx, %edx
movl %ebx, 0x1c(%rsp)
movq %r12, 0x30(%rsp)
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x930(%rax), %rax
movq 0x10(%rax), %rcx
addq $0x8, %rax
testq %rcx, %rcx
movq 0x10(%rsp), %r14
je 0xd626
movq %rax, %rdi
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rdi
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0xd603
cmpq %rax, %rdi
je 0xd626
cmpl 0x20(%rdi), %edx
cmovgeq %rdi, %rax
movq 0x28(%rax), %rcx
movq %r14, %rdi
leaq 0x5d37(%rip), %rsi      # 0x1336b
movl %edx, 0x4(%rsp)
xorl %eax, %eax
callq 0x22b0
movl $0x3, %esi
movl $0x1, %edx
leaq 0x5d22(%rip), %rdi      # 0x13372
movq %r14, %rcx
callq 0x23d0
testb %r13b, %r13b
js 0xd8aa
xorl %ebp, %ebp
movq 0x20(%rsp), %r14
leaq 0x5d12(%rip), %rbx      # 0x13381
leaq 0x5d00(%rip), %r15      # 0x13376
movl 0x4(%rsp), %r12d
movsbl %bpl, %ebp
movq 0x28(%r14), %rax
movl 0x38(%r14), %ecx
imull %r12d, %ecx
addl %ebp, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
cmpl %ebp, 0x1c(%rsp)
movq %rbx, %rdx
leaq 0x4bd7(%rip), %rax      # 0x1227a
cmoveq %rax, %rdx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x22b0
incb %bpl
cmpb %r13b, %bpl
jle 0xd67b
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5cb1(%rip), %rdi      # 0x13380
movq 0x10(%rsp), %r14
movq %r14, %rcx
callq 0x23d0
testb %r13b, %r13b
js 0xd8c3
movl $0x0, 0x8(%rsp)
xorl %eax, %eax
movl %eax, 0x18(%rsp)
xorl %ebp, %ebp
movl 0x1c(%rsp), %ebx
movl %ebx, %r13d
xorl 0x8(%rsp), %r13d
movq 0x10(%rsp), %r12
movq 0x20(%rsp), %r15
movl 0x4(%rsp), %r14d
movsbl %bpl, %ebp
movq 0x28(%r15), %rax
movq 0x68(%r15), %rcx
movsbl 0x900(%rcx), %ecx
movl 0x38(%r15), %edx
imull %r14d, %edx
movl 0x8(%rsp), %esi
imull %ecx, %esi
addl %ebp, %edx
addl %ecx, %edx
addl %esi, %edx
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm0
movl %ebx, %eax
xorl %ebp, %eax
orl %r13d, %eax
leaq 0x5c33(%rip), %rdx      # 0x13381
leaq 0x4b25(%rip), %rax      # 0x1227a
cmoveq %rax, %rdx
movq %r12, %rdi
leaq 0x5c13(%rip), %rsi      # 0x13376
movb $0x1, %al
callq 0x22b0
incb %bpl
cmpb 0xc(%rsp), %bpl
jle 0xd710
movl 0x18(%rsp), %eax
incb %al
movsbl %al, %ecx
movl %ecx, 0x8(%rsp)
movl 0xc(%rsp), %edx
cmpb %dl, %cl
jle 0xd6ef
movl %edx, %r13d
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5be2(%rip), %rdi      # 0x13383
movq 0x10(%rsp), %rcx
callq 0x23d0
testb %r13b, %r13b
movq 0x30(%rsp), %r12
movq 0x20(%rsp), %rcx
js 0xd8dc
xorl %r8d, %r8d
xorl %eax, %eax
movl %eax, 0x18(%rsp)
testb %r12b, %r12b
movq 0x10(%rsp), %rdi
movl 0x2c(%rsp), %r13d
leaq 0x4a9f(%rip), %r11      # 0x1227a
leaq 0x5b9f(%rip), %r15      # 0x13381
leaq 0x5b8d(%rip), %r14      # 0x13376
movl 0x4(%rsp), %r9d
js 0xd890
xorl %ebp, %ebp
movl 0x1c(%rsp), %eax
xorl %r8d, %eax
movl %eax, 0x8(%rsp)
movsbl %bpl, %ebp
movq 0x28(%rcx), %rax
movq 0x68(%rcx), %rcx
movsbl 0x900(%rcx), %edx
movsbl 0x901(%rcx), %ecx
movq 0x20(%rsp), %rsi
movl 0x38(%rsi), %esi
imull %r9d, %esi
leal 0x1(%rdx), %r9d
imull %edx, %r9d
imull %r8d, %ecx
addl %ebp, %esi
addl %ecx, %esi
addl %r9d, %esi
movslq %esi, %rcx
movsd (%rax,%rcx,8), %xmm0
movl %r13d, %eax
xorl %ebp, %eax
orl 0x8(%rsp), %eax
movq %r15, %rdx
cmoveq %r11, %rdx
movq %r14, %rsi
movb $0x1, %al
movl %r8d, %r12d
movq %rdi, %r14
movq %r11, %rbx
callq 0x22b0
movl 0x4(%rsp), %r9d
movq 0x20(%rsp), %rcx
movq %rbx, %r11
movq %r14, %rdi
leaq 0x5afa(%rip), %r14      # 0x13376
movl %r12d, %r8d
movq 0x30(%rsp), %r12
incb %bpl
cmpb %r12b, %bpl
jle 0xd801
movl 0x18(%rsp), %eax
incb %al
movsbl %al, %r8d
movl 0xc(%rsp), %r13d
cmpb %r13b, %r8b
jle 0xd7c3
jmp 0xd8dc
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5ac5(%rip), %rdi      # 0x13380
movq %r14, %rcx
callq 0x23d0
movl $0x2, %esi
movl $0x1, %edx
leaq 0x5aaf(%rip), %rdi      # 0x13383
movq %r14, %rcx
callq 0x23d0
movl 0x4(%rsp), %edx
incl %edx
cmpl 0x28(%rsp), %edx
jne 0xd5de
movq 0x10(%rsp), %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21b0
movq %r14, %rdi
callq 0x2b28