// File: myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::checkConvergenceBig(FitBit**, int, double, double*)
bool HMMProblem::checkConvergenceBig(FitBit** fbs, NCAT nfbs, NUMBER tol, NUMBER *criterion) {
    NUMBER critetion_bit;
    for(NCAT x=0; x<nfbs; x++)
    {
        critetion_bit = 0;
        for(NPAR i=0; i<fbs[x]->nS; i++)
        {
            if(fbs[x]->pi != NULL) critetion_bit += pow( fbs[x]->pi[i]-fbs[x]->PIm1[i], 2 )/*:0*/;
            for(NPAR j=0; (fbs[x]->A != NULL) && j<fbs[x]->nS; j++) {
                critetion_bit+= pow(fbs[x]->A[i][j] - fbs[x]->Am1[i][j],2);
            }
            for(NPAR k=0; (fbs[x]->B != NULL) && k<fbs[x]->nO; k++) {
                critetion_bit += pow(fbs[x]->B[i][k] - fbs[x]->Bm1[i][k],2);
            }
        }
        *criterion += sqrt(critetion_bit);
    }
    *criterion/=nfbs;
	return (*criterion) < tol; // double the truth or false
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x243c4
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movb $0x0, -0x35(%rbp)
movsbl -0x35(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jge 0x243a0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x10(%rax)
je 0x24242
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movsbq -0x35(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movsbq -0x35(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movl $0x2, %edi
callq 0xf6b0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movb $0x0, -0x36(%rbp)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
xorl %eax, %eax
cmpq $0x0, 0x18(%rcx)
movb %al, -0x38(%rbp)
je 0x2427a
movsbl -0x36(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x38(%rbp)
movb -0x38(%rbp), %al
testb $0x1, %al
jne 0x24283
jmp 0x242ea
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rax
movsbq -0x35(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x36(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rax), %rax
movsbq -0x35(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x36(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movl $0x2, %edi
callq 0xf6b0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movb -0x36(%rbp), %al
addb $0x1, %al
movb %al, -0x36(%rbp)
jmp 0x24246
movb $0x0, -0x37(%rbp)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
xorl %eax, %eax
cmpq $0x0, 0x20(%rcx)
movb %al, -0x39(%rbp)
je 0x24321
movsbl -0x37(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x2432a
jmp 0x24391
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movsbq -0x35(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x37(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rax), %rax
movsbq -0x35(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x37(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movl $0x2, %edi
callq 0xf6b0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movb -0x37(%rbp), %al
addb $0x1, %al
movb %al, -0x37(%rbp)
jmp 0x242ee
jmp 0x24393
movb -0x35(%rbp), %al
addb $0x1, %al
movb %al, -0x35(%rbp)
jmp 0x241cb
movsd -0x30(%rbp), %xmm0
callq 0x5220
movq -0x28(%rbp), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x241b3
cvtsi2sdl -0x14(%rbp), %xmm1
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm1
movsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)