// File: jmmccracken[P]PAI/ccmth.cpp
// Function: CCMcorr_async(CCM_asyncData)
double CCMcorr_async(CCM_asyncData sThreadData){

    double dResult;
    int iResult;

    if( bFindLag ){
        iResult = FindLagTimeStep(sThreadData.dX,sThreadData.iLibraryLength,sThreadData.iMaxAutoCorrToCheck,sThreadData.dCompareTolerance,bVerboseFlag);
        return( (double) iResult );
    }else if( bFindE ){
        iResult = FindEmbeddingDimension(sThreadData.dX,sThreadData.iLibraryLength,sThreadData.iNumberOfTimeStep2Check,sThreadData.dWeightToleranceLevel,sThreadData.iLagTimeStep,bVerboseFlag);
        return( (double) iResult );
    }else if( bPAICalcPart1 ){
        CCMcorr(sThreadData.dCCMcorr,sThreadData.dX,sThreadData.iLibraryLength,sThreadData.dX,sThreadData.iLibraryLength,sThreadData.iEmbeddingDimension,sThreadData.iLagTimeStep,sThreadData.dEstimatedY,sThreadData.iEstimatedYLength,sThreadData.bL2);
	dResult = sThreadData.dCCMcorr;
        return( dResult );
    }else if( bPAICalcPart2 ){
        CCMcorr2(sThreadData.dCCMcorr,sThreadData.dX,sThreadData.iLibraryLength,sThreadData.dX,sThreadData.iLibraryLength,sThreadData.dY,sThreadData.iLibraryLength,sThreadData.iEmbeddingDimension,sThreadData.iLagTimeStep,sThreadData.iYEmbeddingDimension,sThreadData.iYLagTimeStep,sThreadData.dEstimatedY,sThreadData.iEstimatedYLength,sThreadData.bL2);
	dResult = sThreadData.dCCMcorr;
        return( dResult );
    }else{
	CCMcorr(sThreadData.dCCMcorr,sThreadData.dX,sThreadData.iLibraryLength,sThreadData.dY,sThreadData.iLibraryLength,sThreadData.iEmbeddingDimension,sThreadData.iLagTimeStep,sThreadData.dEstimatedY,sThreadData.iEstimatedYLength,sThreadData.bL2);
	dResult = sThreadData.dCCMcorr;
        return( dResult );
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
testb $0x1, 0x11383(%rip)     # 0x19243
je 0x7ef7
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rdi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
movsd 0x20(%rax), %xmm0
movb 0x11365(%rip), %al      # 0x19240
andb $0x1, %al
movzbl %al, %ecx
callq 0x3470
movl %eax, -0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x8094
testb $0x1, 0x11346(%rip)     # 0x19244
je 0x7f39
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rdi
movl 0x8(%rax), %esi
movl 0x10(%rax), %edx
movsd 0x28(%rax), %xmm0
movl 0x4(%rax), %ecx
movb 0x11324(%rip), %al      # 0x19240
andb $0x1, %al
movzbl %al, %r8d
callq 0x3920
movl %eax, -0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x8094
testb $0x1, 0x11306(%rip)     # 0x19246
je 0x7fa5
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq 0x40(%rax), %rsi
movl 0x8(%rax), %edx
movq 0x40(%rax), %rcx
movl 0x8(%rax), %r8d
movl (%rax), %r9d
movl 0x4(%rax), %ebx
movq 0x50(%rax), %r11
movl 0x14(%rax), %r10d
movb 0x38(%rax), %al
andb $0x1, %al
movl %ebx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x44b0
movq -0x48(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x8094
testb $0x1, 0x1129b(%rip)     # 0x19247
je 0x8036
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq 0x40(%rax), %rsi
movl 0x8(%rax), %edx
movq 0x40(%rax), %rcx
movl 0x8(%rax), %r8d
movq 0x48(%rax), %r9
movl 0x8(%rax), %r13d
movl (%rax), %r12d
movl 0x4(%rax), %r15d
movl 0x18(%rax), %r14d
movl 0x1c(%rax), %ebx
movq 0x50(%rax), %r11
movl 0x14(%rax), %r10d
movb 0x38(%rax), %al
andb $0x1, %al
movl %r13d, (%rsp)
movl %r12d, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movzbl %al, %eax
movl %eax, 0x38(%rsp)
callq 0x49f0
movq -0x48(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x8094
movq -0x48(%rbp), %rax
movq %rax, %rdi
addq $0x30, %rdi
movq 0x40(%rax), %rsi
movl 0x8(%rax), %edx
movq 0x48(%rax), %rcx
movl 0x8(%rax), %r8d
movl (%rax), %r9d
movl 0x4(%rax), %ebx
movq 0x50(%rax), %r11
movl 0x14(%rax), %r10d
movb 0x38(%rax), %al
andb $0x1, %al
movl %ebx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x44b0
movq -0x48(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)