// File: /workspace/github_cpp_makefile_star2_O3/jmmccracken[P]PAI/ccmth.cpp
// Function: main
int main(int argc, char **argv){

    bool bCmdLineOK = ReadCmdLineArgs(argc,argv);
    if( !bCmdLineOK ){
        return(-1);
    }

    char cBuffer[1024]; //read in buffer
    char *cColValue, //used for read in
         *cRowValues; //used for read in
    int iter = 0;

    int iEstimatedY_Length = iLibraryLength-((iEmbeddingDimension-1)*iLagTimeStep);
    double dX[iLibraryLength],
           dY[iLibraryLength],
           dEstimatedY[iEstimatedY_Length];

    //Populate estimate time series, just in case
    for(int iPre = 0;iPre < iEstimatedY_Length;iPre++ ){
        dEstimatedY[iPre] = nan("");
    }

    //Declare things needed for threading
    double dCCMcorrs[iNumThreads][4];
    future<double> WorkerThreads[iNumThreads][4];
    future_status WorkerStatus[4];
    CCM_asyncData sThreadData;
    sThreadData.iEmbeddingDimension = iEmbeddingDimension;
    sThreadData.iLagTimeStep = iLagTimeStep;
    sThreadData.iYEmbeddingDimension = iYEmbeddingDimension;
    sThreadData.iYLagTimeStep = iYLagTimeStep;
    sThreadData.iLibraryLength = iLibraryLength;
    sThreadData.iMaxAutoCorrToCheck = iMaxAutoCorrToCheck;
    sThreadData.dCompareTolerance = dCompareTolerance;
    sThreadData.iNumberOfTimeStep2Check = iNumberOfTimeStep2Check;
    sThreadData.dWeightToleranceLevel = dWeightToleranceLevel;
    sThreadData.iEstimatedYLength = iEstimatedY_Length;
    sThreadData.dEstimatedY = dEstimatedY;
    sThreadData.bL2 = bL2;

    if( bVerboseFlag ){
            printf("Input data file: %s\nOutput file: %s\nNumber of time series in input file: %i\nLibrary length: %i\nEmbedding dimension: %i\nLag time step: %i\n",cFilename,cOutputname,iNumOfTimeSeries,iLibraryLength,iEmbeddingDimension,iLagTimeStep);
    }

    //open data input file
    FILE *ifstream = fopen(cFilename,"r");
    if(ifstream == NULL){
        fprintf(stderr, "Error: Cannot open %s\n",cFilename);
            return(-1);
    }

    //open [-o] output file
    FILE *ofstream = fopen(cOutputname,"w");
    if(ofstream == NULL){
        fprintf(stderr, "Error: Cannot open %s\n",cOutputname);
        return(-1);
    }

    //open [-eY] output file
    FILE *ofstreamTS = fopen(cTSOutputname,"w");
    if(ofstream == NULL){
        fprintf(stderr, "Error: Cannot open %s\n",cTSOutputname);
        return(-1);
    }

    if( bVerboseFlag ){ printf("Processing %s...\n",cFilename); }
    int iCurrentThreadsUsed = 0,
        iCheckThread = 0;
    bool bFoundOpenThread;
    for(int iTSiter = 0;iTSiter < iNumOfTimeSeries;iTSiter++ ){

        if( bVerboseFlag ){ printf("TS %i:",iTSiter); }
        if( bVerboseFlag ){ printf("Reading TS..."); }
        bFoundOpenThread = false;

        //read in dX and dY
        for( iter=0;iter < iLibraryLength;iter++ ){
                cRowValues = fgets(cBuffer,sizeof(cBuffer),ifstream);
                cColValue = strtok(cRowValues,",");
                if( cColValue != NULL ){
                   dX[iter] = atof(cColValue);
                }else{
                   fprintf(stderr, "Error: %s is not formatted correctly\n",cFilename);
                }

                cColValue = strtok(NULL,";");
                if( cColValue != NULL ){
                   dY[iter] = atof(cColValue);
                }else{
                   fprintf(stderr, "Error: %s is not formatted correctly\n",cFilename);
                }
        }

        if( bVerboseFlag ){ printf("Writing CCMs..."); }

        if( iNumThreads == 0 ){

              if( bPAI ){

                  sThreadData.dX = dX;
                  sThreadData.dY = dY;
                  bPAICalcPart1 = true;
                  fprintf(ofstream,"%.20f,",CCMcorr_async(sThreadData));
                  //printf("%.20f,",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }
                  bPAICalcPart1 = false;
                  bPAICalcPart2 = true;
                  fprintf(ofstream,"%.20f,",CCMcorr_async(sThreadData));
                  //printf("%.20f,",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }
                  bPAICalcPart2 = false;

                  bPAICalcPart1 = true;
                  sThreadData.dX = dY;
                  sThreadData.dY = dX;
                  fprintf(ofstream,"%.20f,",CCMcorr_async(sThreadData));
                  //printf("%.20f\n",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }
                  bPAICalcPart1 = false;
                  bPAICalcPart2 = true;
                  fprintf(ofstream,"%.20f\n",CCMcorr_async(sThreadData));
                  //printf("%.20f\n",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }
                  bPAICalcPart2 = false;

              }else{

                  sThreadData.dX = dX;
                  sThreadData.dY = dY;
                  fprintf(ofstream,"%.20f,",CCMcorr_async(sThreadData));
                  //printf("%.20f,",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }

                  sThreadData.dX = dY;
                  sThreadData.dY = dX;
                  fprintf(ofstream,"%.20f\n",CCMcorr_async(sThreadData));
                  //printf("%.20f\n",CCMcorr_async(sThreadData));
                  if( bSaveEstimatedTS ){
                      for(int iPrintStep = 0;iPrintStep < sThreadData.iEstimatedYLength;iPrintStep++ ){
			fprintf(ofstreamTS,"%.20f\n",sThreadData.dEstimatedY[iPrintStep]);
                      }
                  }

              }

        }else{
            if( iCurrentThreadsUsed < iNumThreads ){

                sThreadData.dX = dX;
                sThreadData.dY = dY;
                WorkerThreads[iCurrentThreadsUsed][0] = async(launch::async,CCMcorr_async,sThreadData);

                sThreadData.dX = dY;
                sThreadData.dY = dX;
                WorkerThreads[iCurrentThreadsUsed][1] = async(launch::async,CCMcorr_async,sThreadData);

                iCurrentThreadsUsed++;

            }else{

                if( bOptThreading ){

                    while( !bFoundOpenThread ){
                        if( WorkerThreads[iCheckThread][0].valid() && WorkerThreads[iCheckThread][1].valid() ){

                            WorkerStatus[0] = WorkerThreads[iCheckThread][0].wait_for(chrono::seconds(iThreadWaitSec));
                            WorkerStatus[1] = WorkerThreads[iCheckThread][1].wait_for(chrono::seconds(iThreadWaitSec));

                            if( (WorkerStatus[0] == future_status::ready) && (WorkerStatus[1] == future_status::ready) ){
				
				fprintf(ofstream,"%.20f,",WorkerThreads[iCheckThread][0].get());
				fprintf(ofstream,"%.20f\n",WorkerThreads[iCheckThread][1].get());
				//printf("%.20f,",WorkerThreads[iCheckThread][0].get());
				//printf("%.20f\n",WorkerThreads[iCheckThread][1].get());

                                sThreadData.dX = dX;
                                sThreadData.dY = dY;
                                WorkerThreads[iCheckThread][0] = async(launch::async,CCMcorr_async,sThreadData);

                                sThreadData.dX = dY;
                                sThreadData.dY = dX;
                                WorkerThreads[iCheckThread][1] = async(launch::async,CCMcorr_async,sThreadData);

                                bFoundOpenThread = true;

                            }

                        }else if(!WorkerThreads[iCheckThread][0].valid()&&!WorkerThreads[iCheckThread][1].valid() ){

                            sThreadData.dX = dX;
                            sThreadData.dY = dY;
                            WorkerThreads[iCheckThread][0] = async(launch::async,CCMcorr_async,sThreadData);

                            sThreadData.dX = dY;
                            sThreadData.dY = dX;
                            WorkerThreads[iCheckThread][1] = async(launch::async,CCMcorr_async,sThreadData);

                            bFoundOpenThread = true;

                        }else{

                            iCheckThread++;
                            if( iCheckThread > iNumThreads ){
                                iCheckThread = 0;
                            }

                        }

                    }

                }else{

                    for(int iThreadIter = 0;iThreadIter < iNumThreads;iThreadIter++ ){

                        if( WorkerThreads[iThreadIter][0].valid() && WorkerThreads[iThreadIter][1].valid() ){
                            dCCMcorrs[iThreadIter][0] = WorkerThreads[iThreadIter][0].get();
                            dCCMcorrs[iThreadIter][1] = WorkerThreads[iThreadIter][1].get();
                        }

                    }

                    iCurrentThreadsUsed = 0;

                    sThreadData.dX = dX;
                    sThreadData.dY = dY;
                    WorkerThreads[iCurrentThreadsUsed][0] = async(launch::async,CCMcorr_async,sThreadData);

                    sThreadData.dX = dY;
                    sThreadData.dY = dX;
                    WorkerThreads[iCurrentThreadsUsed][1] = async(launch::async,CCMcorr_async,sThreadData);

                    for(int iThreadIter = 0;iThreadIter < iNumThreads;iThreadIter++ ){
                        fprintf(ofstream,"%.20f,",dCCMcorrs[iThreadIter][0]);
                        fprintf(ofstream,"%.20f\n",dCCMcorrs[iThreadIter][1]);
                        //printf("%.20f,",dCCMcorrs[iThreadIter][0]);
                        //printf("%.20f\n",dCCMcorrs[iThreadIter][1]);
                        dCCMcorrs[iThreadIter][0] = nan("");
                        dCCMcorrs[iThreadIter][1] = nan("");
                    }

                    iCurrentThreadsUsed++;
                }
            }
        }

        if( bVerboseFlag ){ printf(" done.\n"); }

    }

    for(int iThreadIter = 0;iThreadIter < iNumThreads;iThreadIter++ ){

        if( WorkerThreads[iThreadIter][0].valid() && WorkerThreads[iThreadIter][1].valid() ){
            fprintf(ofstream,"%.20f,",WorkerThreads[iThreadIter][0].get());
            fprintf(ofstream,"%.20f\n",WorkerThreads[iThreadIter][1].get());

        }

    }

    fclose(ifstream);
    fclose(ofstream);
    fclose(ofstreamTS);

    if( bVerboseFlag ){ printf(" Finished.\n"); }

    return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
callq 0x5e2f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x5dc4
movq %rsp, -0xe0(%rbp)
movl 0x8061(%rip), %eax      # 0xd1c0
movl 0x8053(%rip), %ecx      # 0xd1b8
decl %ecx
imull 0x804e(%rip), %ecx      # 0xd1bc
movl %eax, %ebx
subl %ecx, %ebx
movq %rsp, %rcx
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
movl 0x802e(%rip), %r15d     # 0xd1c0
movq %rsp, %rcx
leaq 0xf(,%r15,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
leaq 0xf(,%rbx,8), %rax
andq $-0x10, %rax
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
testl %ebx, %ebx
jle 0x51e4
xorl %r13d, %r13d
leaq 0x3630(%rip), %r14      # 0x87fe
movq %r14, %rdi
callq 0x3060
movsd %xmm0, (%r12,%r13,8)
incq %r13
cmpq %r13, %rbx
jne 0x51ce
movl 0x8026(%rip), %ecx      # 0xd210
movq %rsp, %rdx
movq %rcx, %rax
shlq $0x5, %rax
subq %rax, %rdx
movq %rdx, -0xe8(%rbp)
movq %rdx, %rsp
movq %rsp, %r13
movq %rcx, %r14
shlq $0x6, %r14
subq %r14, %r13
movq %r13, %rsp
movq %rcx, -0x30(%rbp)
testq %rcx, %rcx
je 0x5227
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x30f0
movq %r13, -0x68(%rbp)
movl 0x7f86(%rip), %r9d      # 0xd1b8
movl %r9d, -0xd8(%rbp)
movl 0x7f7c(%rip), %r10d     # 0xd1bc
movl %r10d, -0xd4(%rbp)
movl 0x7f87(%rip), %eax      # 0xd1d4
movl %eax, -0xc0(%rbp)
movl 0x7f7f(%rip), %eax      # 0xd1d8
movl %eax, -0xbc(%rbp)
movl %r15d, -0xd0(%rbp)
movl 0x7f60(%rip), %eax      # 0xd1cc
movl %eax, -0xcc(%rbp)
movsd 0x7f66(%rip), %xmm0     # 0xd1e0
movsd %xmm0, -0xb8(%rbp)
movl 0x7f48(%rip), %eax      # 0xd1d0
movl %eax, -0xc8(%rbp)
movsd 0x7f52(%rip), %xmm0     # 0xd1e8
movsd %xmm0, -0xb0(%rbp)
movl %ebx, -0xc4(%rbp)
movq %r12, -0x88(%rbp)
movb 0x7f87(%rip), %al       # 0xd238
movb %al, -0xa0(%rbp)
cmpb $0x1, 0x7f72(%rip)      # 0xd230
jne 0x52ef
movq 0x7f61(%rip), %rsi      # 0xd228
movq 0x7f4a(%rip), %rdx      # 0xd218
movl 0x7ef0(%rip), %ecx      # 0xd1c4
subq $0x8, %rsp
leaq 0x3281(%rip), %rdi      # 0x8560
movl %r15d, %r8d
xorl %eax, %eax
pushq %r10
callq 0x3040
addq $0x10, %rsp
movq 0x7f32(%rip), %rdi      # 0xd228
leaq 0x32ed(%rip), %rsi      # 0x85ea
callq 0x3210
movq %rax, -0xf8(%rbp)
testq %rax, %rax
movq -0x68(%rbp), %r12
je 0x5dd5
movq 0x7efb(%rip), %rdi      # 0xd218
leaq 0x32df(%rip), %rsi      # 0x8603
callq 0x3210
movq %rax, -0x70(%rbp)
testq %rax, %rax
je 0x5ddc
movq 0x7ee3(%rip), %rdi      # 0xd220
leaq 0x32bf(%rip), %rsi      # 0x8603
callq 0x3210
movq %rax, -0x80(%rbp)
cmpb $0x1, 0x7edc(%rip)      # 0xd230
jne 0x536b
movq 0x7ecb(%rip), %rsi      # 0xd228
leaq 0x32a1(%rip), %rdi      # 0x8605
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0x7e52(%rip)      # 0xd1c4
jle 0x5cef
movb 0x7eb2(%rip), %al       # 0xd230
addq $0x8, -0xe8(%rbp)
leaq 0x10(%r12), %rcx
movq %rcx, -0x100(%rbp)
leaq 0x2d7a(%rip), %r13      # 0x8113
xorl %r15d, %r15d
movq $0x0, -0xf0(%rbp)
movl $0x0, -0x74(%rbp)
testb $0x1, %al
je 0x53c9
leaq 0x325e(%rip), %rdi      # 0x8617
movl %r15d, %esi
xorl %eax, %eax
callq 0x3040
movb 0x7e67(%rip), %al       # 0xd230
testb $0x1, %al
je 0x53db
leaq 0x324a(%rip), %rdi      # 0x861e
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0x7dde(%rip)      # 0xd1c0
jle 0x546a
xorl %ebx, %ebx
leaq -0x500(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
movq -0xf8(%rbp), %rdx
callq 0x32b0
movq %rax, %rdi
leaq 0x325b(%rip), %rsi      # 0x8667
callq 0x32a0
testq %rax, %rax
je 0x545c
movq %rax, %rdi
callq 0x3220
movq -0x60(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
xorl %edi, %edi
leaq 0x3da3(%rip), %rsi      # 0x91d3
callq 0x32a0
testq %rax, %rax
je 0x5463
movq %rax, %rdi
callq 0x3220
movq -0x58(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
movslq 0x7d6b(%rip), %rax      # 0xd1c0
cmpq %rax, %rbx
jl 0x53ea
jmp 0x546a
callq 0x3997
jmp 0x5427
callq 0x39bc
jmp 0x544b
cmpb $0x1, 0x7dbf(%rip)      # 0xd230
jne 0x5481
leaq 0x31d8(%rip), %rdi      # 0x8652
xorl %eax, %eax
callq 0x3040
movl 0x7d89(%rip), %eax      # 0xd210
testl %eax, %eax
leaq 0x31d2(%rip), %rbx      # 0x8662
je 0x556e
cmpl %eax, -0x74(%rbp)
jge 0x57a5
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0xebc(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movslq -0x74(%rbp), %rbx
shlq $0x6, %rbx
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x8(%r12,%rbx), %rdi
movaps %xmm0, (%r12,%rbx)
testq %rdi, %rdi
je 0x5506
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5506
callq 0x6a92
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0xe55(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
addq %r12, %rbx
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x18(%rbx), %rdi
movaps %xmm0, 0x10(%rbx)
testq %rdi, %rdi
je 0x5566
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5566
callq 0x6a92
incl -0x74(%rbp)
jmp 0x5bf3
movl %r15d, -0x34(%rbp)
movb 0x7cbd(%rip), %al       # 0xd235
movq -0x60(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, -0x90(%rbp)
cmpb $0x1, %al
jne 0x5857
movb $0x1, 0x7c99(%rip)      # 0xd236
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
movq -0x70(%rbp), %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x7c61(%rip)      # 0xd232
movq -0x80(%rbp), %r15
jne 0x560a
cmpl $0x0, -0xc4(%rbp)
jle 0x560a
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x55e2
movb $0x0, 0x7c25(%rip)      # 0xd236
movb $0x1, 0x7c1f(%rip)      # 0xd237
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
leaq 0x3024(%rip), %rsi      # 0x8662
movq -0x70(%rbp), %rdi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x7be2(%rip)      # 0xd232
movq -0x80(%rbp), %r15
jne 0x5689
cmpl $0x0, -0xc4(%rbp)
jle 0x5689
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x5661
movb $0x0, 0x7ba7(%rip)      # 0xd237
movb $0x1, 0x7b9f(%rip)      # 0xd236
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
leaq 0x2f8f(%rip), %rsi      # 0x8662
movq -0x70(%rbp), %rdi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x7b4d(%rip)      # 0xd232
movq -0x80(%rbp), %r15
jne 0x571e
cmpl $0x0, -0xc4(%rbp)
jle 0x571e
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x56f6
movb $0x0, 0x7b11(%rip)      # 0xd236
movb $0x1, 0x7b0b(%rip)      # 0xd237
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
movq -0x70(%rbp), %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x7ad2(%rip)      # 0xd232
movq -0x80(%rbp), %r15
jne 0x5799
cmpl $0x0, -0xc4(%rbp)
jle 0x5799
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x5771
movb $0x0, 0x7a97(%rip)      # 0xd237
jmp 0x5af1
cmpb $0x1, 0x7a85(%rip)      # 0xd231
movl %r15d, -0x34(%rbp)
jne 0x5955
movq -0xf0(%rbp), %rax
movq %rax, -0xf0(%rbp)
cltq
shlq $0x6, %rax
movq %r12, %rcx
addq %rax, %r12
leaq (%rcx,%rax), %rbx
addq $0x10, %rbx
cmpq $0x0, (%r12)
movq 0x10(%r12), %rax
je 0x582d
testq %rax, %rax
je 0x5836
movslq 0x79d8(%rip), %rax      # 0xd1c8
movq %rax, -0x50(%rbp)
movq %r12, %rdi
leaq -0x50(%rbp), %r15
movq %r15, %rsi
callq 0x6a16
movl %eax, %r13d
movslq 0x79bb(%rip), %rax      # 0xd1c8
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6a16
orl %r13d, %eax
leaq 0x28ed(%rip), %r13      # 0x8113
jne 0x57d8
jmp 0x5afa
testq %rax, %rax
je 0x5c24
movq -0xf0(%rbp), %rax
cmpl 0x79cd(%rip), %eax      # 0xd210
leal 0x1(%rax), %eax
movl $0x0, %ecx
cmovgel %ecx, %eax
movq -0x68(%rbp), %r12
jmp 0x57bd
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
movq -0x70(%rbp), %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x79a7(%rip)      # 0xd232
movq -0x80(%rbp), %r15
jne 0x58c4
cmpl $0x0, -0xc4(%rbp)
jle 0x58c4
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x589c
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
subq $0x60, %rsp
movl $0xb, %ecx
movq %rsp, %rdi
leaq -0xd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x6381
addq $0x60, %rsp
movq -0x70(%rbp), %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
cmpb $0x1, 0x7924(%rip)      # 0xd232
jne 0x5af1
cmpl $0x0, -0xc4(%rbp)
movl -0x34(%rbp), %r15d
jle 0x5bf3
xorl %ebx, %ebx
movq -0x88(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movq -0x80(%rbp), %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
incq %rbx
movslq -0xc4(%rbp), %rax
cmpq %rax, %rbx
jl 0x5927
jmp 0x5bf3
testl %eax, %eax
jle 0x59ad
movq -0x100(%rbp), %r12
movq -0xe8(%rbp), %rbx
xorl %r13d, %r13d
cmpq $0x0, -0x10(%r12)
je 0x599a
cmpq $0x0, (%r12)
je 0x599a
leaq -0x10(%r12), %rdi
callq 0x6a30
movsd %xmm0, -0x8(%rbx)
movq %r12, %rdi
callq 0x6a30
movsd %xmm0, (%rbx)
movl 0x7876(%rip), %eax      # 0xd210
incq %r13
movslq %eax, %rcx
addq $0x20, %rbx
addq $0x40, %r12
cmpq %rcx, %r13
jl 0x596a
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x9ab(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq -0x68(%rbp), %r12
movq 0x8(%r12), %rdi
movaps %xmm0, (%r12)
testq %rdi, %rdi
je 0x5a13
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5a13
callq 0x6a92
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x949(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x18(%r12), %rdi
movaps %xmm0, 0x10(%r12)
testq %rdi, %rdi
je 0x5a72
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5a72
callq 0x6a92
movl $0x1, -0x74(%rbp)
cmpl $0x0, 0x7790(%rip)      # 0xd210
jle 0x5aea
movq -0xe8(%rbp), %rbx
xorl %r12d, %r12d
movq -0x70(%rbp), %r15
leaq 0x2bcb(%rip), %r13      # 0x8662
movsd -0x8(%rbx), %xmm0
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
movsd (%rbx), %xmm0
movq %r15, %rdi
leaq 0x265c(%rip), %rsi      # 0x8113
movb $0x1, %al
callq 0x3260
leaq 0x2d39(%rip), %rdi      # 0x87fe
callq 0x3060
movsd %xmm0, -0x8(%rbx)
movsd %xmm0, (%rbx)
incq %r12
movslq 0x7733(%rip), %rax      # 0xd210
addq $0x20, %rbx
cmpq %rax, %r12
jl 0x5a97
movq -0x68(%rbp), %r12
leaq 0x2622(%rip), %r13      # 0x8113
movl -0x34(%rbp), %r15d
jmp 0x5bf3
movq %r12, %rdi
callq 0x6a30
movq -0x70(%rbp), %r15
movq %r15, %rdi
leaq 0x2b52(%rip), %rsi      # 0x8662
movb $0x1, %al
callq 0x3260
movq %rbx, %rdi
callq 0x6a30
movq %r15, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x3260
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0x82f(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x8(%r12), %rdi
movups %xmm0, (%r12)
testq %rdi, %rdi
movl -0x34(%rbp), %r15d
je 0x5b8f
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5b8f
callq 0x6a92
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0x7cc(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x18(%r12), %rdi
movups %xmm0, 0x10(%r12)
testq %rdi, %rdi
je 0x5bef
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5bef
callq 0x6a92
movq -0x68(%rbp), %r12
movb 0x7637(%rip), %al       # 0xd230
cmpb $0x1, %al
jne 0x5c0f
leaq 0x2e00(%rip), %rdi      # 0x8a04
callq 0x3280
movb 0x7621(%rip), %al       # 0xd230
incl %r15d
cmpl 0x75ab(%rip), %r15d     # 0xd1c4
jl 0x53ae
jmp 0x5cef
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0x737(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x8(%r12), %rdi
movups %xmm0, (%r12)
testq %rdi, %rdi
movl -0x34(%rbp), %r15d
je 0x5c87
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5c87
callq 0x6a92
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
leaq 0x6d4(%rip), %rdx       # 0x6381
leaq -0xd8(%rbp), %rcx
callq 0x68df
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0x18(%r12), %rdi
movups %xmm0, 0x10(%r12)
testq %rdi, %rdi
je 0x5bef
callq 0x6a92
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x5bef
jmp 0x5bea
movl 0x751b(%rip), %eax      # 0xd210
testl %eax, %eax
movq -0x70(%rbp), %r15
jle 0x5d60
movq -0x68(%rbp), %rcx
leaq 0x10(%rcx), %rbx
xorl %r13d, %r13d
leaq 0x2404(%rip), %r12      # 0x8113
cmpq $0x0, -0x10(%rbx)
je 0x5d51
cmpq $0x0, (%rbx)
je 0x5d51
leaq -0x10(%rbx), %rdi
callq 0x6a30
movq %r15, %rdi
leaq 0x2933(%rip), %rsi      # 0x8662
movb $0x1, %al
callq 0x3260
movq %rbx, %rdi
callq 0x6a30
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x3260
movl 0x74bf(%rip), %eax      # 0xd210
incq %r13
movslq %eax, %rcx
addq $0x40, %rbx
cmpq %rcx, %r13
jl 0x5d0f
movq -0xf8(%rbp), %rdi
callq 0x31c0
movq %r15, %rdi
callq 0x31c0
movq -0x80(%rbp), %rdi
callq 0x31c0
xorl %ebx, %ebx
cmpb $0x0, 0x74aa(%rip)      # 0xd230
je 0x5d94
leaq 0x2c6a(%rip), %rdi      # 0x89f9
callq 0x3280
movq -0x68(%rbp), %r12
movq -0x30(%rbp), %r14
movq -0xe0(%rbp), %r15
testq %r14, %r14
je 0x5dc1
shlq $0x6, %r14
movq -0x8(%r12,%r14), %rdi
testq %rdi, %rdi
je 0x5dbb
callq 0x6a92
addq $-0x10, %r14
jne 0x5dac
movq %r15, %rsp
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3a06
jmp 0x5de1
callq 0x39e1
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x5d98
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
jmp 0x5e02
movq %rax, %rbx
movq -0x30(%rbp), %rax
testq %rax, %rax
movq -0x68(%rbp), %r15
je 0x5e27
movq -0x8(%r15,%r14), %rdi
testq %rdi, %rdi
je 0x5e21
callq 0x6a92
addq $-0x10, %r14
jne 0x5e12
movq %rbx, %rdi
callq 0x3300