// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/FitBitSlicedA.cpp
// Function: FitBitSlicedA::checkConvergence(FitResult*)
bool FitBitSlicedA::checkConvergence(FitResult *fr) {

	NUMBER criterion = 0;
    bool res = false;
    switch (this->tol_mode) {
        case 'p':
            for(NPAR i=0; i<this->nS; i++)
                if(this->pi != NULL) criterion += pow( this->pi[i]-this->PIm1[i], 2 )/*:0*/;
            
            for(NPAR z=0; z<this->nZ; z++)
                for(NPAR i=0; i<this->nS; i++)
                {
                    for(NPAR j=0; (this->A != NULL) && j<this->nS; j++) {
                        criterion += pow(this->A[z][i][j] - this->Am1[z][i][j],2);
                    }
                    
                }
            for(NPAR i=0; i<this->nS; i++)
            {
                for(NPAR k=0; (this->B != NULL) && k<this->nO; k++) {
                    criterion += pow(this->B[i][k] - this->Bm1[i][k],2);
                }
            }
            res = sqrt(criterion) < this->tol; // double the truth or false
            break;
        case 'l':
            criterion = (fr->pOmid-fr->pO)/fr->ndat;
            res = criterion < this->tol;
            break;
    }
    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0xf0(%rdi), %eax
cmpl $0x6c, %eax
je 0xc5fc
cmpl $0x70, %eax
jne 0xc614
movsbq 0x1(%rbx), %rax
testq %rax, %rax
jle 0xc61b
movq 0x10(%rbx), %rcx
movq 0x28(%rbx), %rdx
xorpd %xmm0, %xmm0
xorl %esi, %esi
testq %rcx, %rcx
je 0xc5f2
movsd (%rcx,%rsi,8), %xmm1
subsd (%rdx,%rsi,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0xc5db
jmp 0xc61f
movsd 0x10(%rsi), %xmm0
subsd 0x18(%rsi), %xmm0
cvtsi2sdl 0x24(%rsi), %xmm1
divsd %xmm1, %xmm0
jmp 0xc72c
xorl %eax, %eax
jmp 0xc73b
xorpd %xmm0, %xmm0
movsbq 0x2(%rbx), %rax
testq %rax, %rax
jle 0xc6a7
movsbq 0x1(%rbx), %rcx
testq %rcx, %rcx
setg %r8b
movq 0x18(%rbx), %rdx
movq 0x30(%rbx), %rsi
testq %rdx, %rdx
setne %dil
andb %r8b, %dil
xorl %r8d, %r8d
testb %cl, %cl
jle 0xc69f
xorl %r9d, %r9d
testb %dil, %dil
je 0xc697
movq (%rdx,%r8,8), %r10
movq (%r10,%r9,8), %r10
movq (%rsi,%r8,8), %r11
movq (%r11,%r9,8), %r11
movl $0x1, %r14d
movapd %xmm0, %xmm1
movsd -0x8(%r10,%r14,8), %xmm0
subsd -0x8(%r11,%r14,8), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
testq %rdx, %rdx
je 0xc697
leaq 0x1(%r14), %r15
cmpq %rcx, %r14
movq %r15, %r14
jl 0xc66c
incq %r9
cmpq %rcx, %r9
jne 0xc651
incq %r8
cmpq %rax, %r8
jne 0xc64a
movsbq 0x1(%rbx), %rax
testq %rax, %rax
jle 0xc717
movq 0x20(%rbx), %rcx
movq 0x38(%rbx), %rdx
testq %rcx, %rcx
setne %r8b
movsbq (%rbx), %rsi
testq %rsi, %rsi
setg %dil
andb %r8b, %dil
xorl %r8d, %r8d
testb %dil, %dil
je 0xc70f
movq (%rcx,%r8,8), %r9
movq (%rdx,%r8,8), %r10
movl $0x1, %r11d
movapd %xmm0, %xmm1
movsd -0x8(%r9,%r11,8), %xmm0
subsd -0x8(%r10,%r11,8), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
testq %rcx, %rcx
je 0xc70f
leaq 0x1(%r11), %r14
cmpq %rsi, %r11
movq %r14, %r11
jl 0xc6e4
incq %r8
cmpq %rax, %r8
jne 0xc6d1
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xc727
sqrtsd %xmm0, %xmm0
jmp 0xc72c
callq 0x41a0
movsd 0xe8(%rbx), %xmm1
ucomisd %xmm0, %xmm1
seta %al
popq %rbx
popq %r14
popq %r15
retq
nop