// File: leonn[P]neuralNet/source/neural-net.cpp
// Function: main
int main(int argc, char *argv[]){
    srand(time(NULL));
    TrainingData trainData(argv[1]);

    // e.g., { 3, 2, 1 }
    vector<unsigned> topology;

    vector<vector<double>> inputValsA, targetValuesA;
    vector<double> inputVals, targetValues, resultValues;

    int trainingPass = 0;
    int epochs=0;
    bool test=false;
    bool testFile=false;
    long double minError=atof(argv[2]);
    int maxEpochs=atoi(argv[3]);

    ofstream trainingDataOutput;
    ofstream trainingDataGlobalOutput;
    ofstream testDataOutput;
    TrainingData *testDataInput;

    trainingDataOutput.open(argv[4]);
    trainingDataGlobalOutput.open(argv[5]);

    if(argc>6){
        if(!strcmp(argv[6],"-t")){
        testDataOutput.open(argv[7]);
        test=true;
        }
        else if(!strcmp(argv[6],"-tf")){
            testDataInput=new TrainingData(argv[7]);
            testDataOutput.open(argv[8]);
            testFile=true;
        }
    }

    long double eta,momentum;
    string transferFunction;

    trainData.getTopology(topology);
    trainData.getEta(eta);
    trainData.getMomentum(momentum);
    trainData.getTransferFunction(transferFunction);

    //Load trainning data from file
    while (!trainData.isEof()) {
        trainingPass++;

        // Get new input data and feed it forward:
        if (trainData.getNextInputs(inputVals) != topology[0])
            break;
        inputValsA.push_back(inputVals);

        // Train the net what the outputs should have been:
        trainData.getTargetOutputs(targetValues);
        assert(targetValues.size() == topology.back());
        targetValuesA.push_back(targetValues);
    }

    Net net(topology,transferFunction);
    long double recentAverageError;
    long double globalError;

    do {
        globalError=0.0;

        for (int i = 0; i < trainingPass; i++){
            // Get new input data and feed it forward:
            net.feedForward(inputValsA[i]);

            // Collect the net's actual output results:
            net.getResults(resultValues);

            // Train the net what the outputs should have been:
            net.backPropagation(targetValuesA[i],eta,momentum);

            // Report how well the training is working, average over recent samples:
            recentAverageError=net.getRecentAverageError();
            globalError+=recentAverageError;
            trainingDataOutput <<recentAverageError<<endl;
        }
        globalError/=trainingPass;
        trainingDataGlobalOutput <<globalError<<endl;
        epochs++;

    } while(round(globalError, minError) > minError && epochs < maxEpochs);

    trainingDataOutput.close();
    trainingDataGlobalOutput.close();

    if (test){
         for (int i = 0; i < trainingPass; i++){
            // Get new input data and feed it forward:][]
            net.feedForward(inputValsA[i]);
            showVectorValues("Input:", inputValsA[i], testDataOutput);

            showVectorValues("Target_Output:", targetValuesA[i], testDataOutput);

            // Collect the net's actual output results:
            net.getResults(resultValues);
            showTestVectorValues("Output:", resultValues, testDataOutput);
        }
    }

    if (testFile){
        trainingPass=0;
        //clear trainning data vectors
        inputValsA.clear();
        targetValuesA.clear();
        inputVals.clear();
        targetValues.clear();
        resultValues.clear();

        //Load trainning data from file
        while (!testDataInput->isEof()) {
            trainingPass++;

            // Get new input data and feed it forward:
            if (testDataInput->getNextInputs(inputVals) != topology[0])
                break;
            inputValsA.push_back(inputVals);

            // Train the net what the outputs should have been:
            testDataInput->getTargetOutputs(targetValues);
            assert(targetValues.size() == topology.back());
            targetValuesA.push_back(targetValues);
        }

        for (int i = 0; i < trainingPass; i++){
            // Get new input data and feed it forward:][]
            net.feedForward(inputValsA[i]);
            showVectorValues("Input:", inputValsA[i],testDataOutput);

            showVectorValues("Target_Output:", targetValuesA[i],testDataOutput);

            // Collect the net's actual output results:
            net.getResults(resultValues);
            showVectorValues("Output:", resultValues,testDataOutput);
        }
    }

    testDataOutput.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xbb0, %rsp            # imm = 0xBB0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x21d0
movl %eax, %edi
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xaf8(%rbp)
leaq -0x239(%rbp), %rdi
movq %rdi, -0xaf0(%rbp)
callq 0x2370
movq -0xaf8(%rbp), %rsi
movq -0xaf0(%rbp), %rdx
leaq -0x238(%rbp), %rdi
callq 0x2290
jmp 0x5877
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x9760
jmp 0x588c
leaq -0x238(%rbp), %rdi
callq 0x2150
leaq -0x239(%rbp), %rdi
callq 0x2230
leaq -0x268(%rbp), %rdi
callq 0x6760
leaq -0x280(%rbp), %rdi
callq 0x6780
leaq -0x298(%rbp), %rdi
callq 0x6780
leaq -0x2b0(%rbp), %rdi
callq 0x67a0
leaq -0x2c8(%rbp), %rdi
callq 0x67a0
leaq -0x2e0(%rbp), %rdi
callq 0x67a0
movl $0x0, -0x2e4(%rbp)
movl $0x0, -0x2e8(%rbp)
movb $0x0, -0x2e9(%rbp)
movb $0x0, -0x2ea(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2260
movsd %xmm0, -0xae0(%rbp)
fldl -0xae0(%rbp)
fstpt -0x300(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2300
movl %eax, -0x304(%rbp)
leaq -0x508(%rbp), %rdi
callq 0x2350
jmp 0x5950
leaq -0x708(%rbp), %rdi
callq 0x2350
jmp 0x595e
leaq -0x908(%rbp), %rdi
callq 0x2350
jmp 0x596c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
leaq -0x508(%rbp), %rdi
movl $0x10, %edx
callq 0x2040
jmp 0x5987
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq -0x708(%rbp), %rdi
movl $0x10, %edx
callq 0x2040
jmp 0x59a2
cmpl $0x6, -0x8(%rbp)
jle 0x5bc8
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
leaq 0x576c(%rip), %rsi      # 0xb127
callq 0x22b0
cmpl $0x0, %eax
jne 0x5a8f
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
leaq -0x908(%rbp), %rdi
movl $0x10, %edx
callq 0x2040
jmp 0x59e4
movb $0x1, -0x2e9(%rbp)
jmp 0x5bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x5a22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x2150
leaq -0x239(%rbp), %rdi
callq 0x2230
jmp 0x6700
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x66ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x66a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x6694
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x6688
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
leaq 0x568c(%rip), %rsi      # 0xb12a
callq 0x22b0
cmpl $0x0, %eax
jne 0x5bc4
movl $0x208, %edi            # imm = 0x208
callq 0x2210
movq %rax, -0xb00(%rbp)
jmp 0x5abf
movb $0x1, -0x932(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0xb10(%rbp)
leaq -0x931(%rbp), %rdi
movq %rdi, -0xb08(%rbp)
callq 0x2370
movq -0xb10(%rbp), %rsi
movq -0xb08(%rbp), %rdx
leaq -0x930(%rbp), %rdi
callq 0x2290
jmp 0x5b04
movq -0xb00(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x9760
jmp 0x5b19
movq -0xb00(%rbp), %rax
movb $0x0, -0x932(%rbp)
movq %rax, -0x910(%rbp)
leaq -0x930(%rbp), %rdi
callq 0x2150
leaq -0x931(%rbp), %rdi
callq 0x2230
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x908(%rbp), %rdi
movl $0x10, %edx
callq 0x2040
jmp 0x5b61
movb $0x1, -0x2ea(%rbp)
jmp 0x5bc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x5b9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0x930(%rbp), %rdi
callq 0x2150
leaq -0x931(%rbp), %rdi
callq 0x2230
testb $0x1, -0x932(%rbp)
jne 0x5bb3
jmp 0x5bbf
movq -0xb00(%rbp), %rdi
callq 0x21e0
jmp 0x6688
jmp 0x5bc6
jmp 0x5bc8
leaq -0x980(%rbp), %rdi
callq 0x22a0
leaq -0x218(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x91e0
jmp 0x5be9
leaq -0x218(%rbp), %rdi
leaq -0x950(%rbp), %rsi
callq 0x9370
jmp 0x5bfe
leaq -0x218(%rbp), %rdi
leaq -0x960(%rbp), %rsi
callq 0x9610
jmp 0x5c13
leaq -0x218(%rbp), %rdi
leaq -0x980(%rbp), %rsi
callq 0x94c0
jmp 0x5c28
jmp 0x5c2a
leaq -0x218(%rbp), %rdi
callq 0x91b0
movb %al, -0xb11(%rbp)
jmp 0x5c3e
movb -0xb11(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5c4f
jmp 0x5d46
movl -0x2e4(%rbp), %eax
incl %eax
movl %eax, -0x2e4(%rbp)
leaq -0x218(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x97d0
movl %eax, -0xb18(%rbp)
jmp 0x5c78
leaq -0x268(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x67c0
movq %rax, %rcx
movl -0xb18(%rbp), %eax
cmpl (%rcx), %eax
je 0x5cb1
jmp 0x5d46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x667c
leaq -0x280(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x67e0
jmp 0x5cc6
leaq -0x218(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x9980
jmp 0x5cdb
leaq -0x2c8(%rbp), %rdi
callq 0x2ff0
movq %rax, -0xb20(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x6850
movq %rax, %rcx
movq -0xb20(%rbp), %rax
movl (%rcx), %ecx
cmpq %rcx, %rax
jne 0x5d0d
jmp 0x5d2c
leaq 0x541a(%rip), %rdi      # 0xb12e
leaq 0x543a(%rip), %rsi      # 0xb155
movl $0x52, %edx
leaq 0x5444(%rip), %rcx      # 0xb16b
callq 0x2170
leaq -0x298(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x67e0
jmp 0x5d41
jmp 0x5c2a
leaq -0x9c0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
leaq -0x980(%rbp), %rdx
callq 0x2640
jmp 0x5d62
jmp 0x5d64
fldz
fstpt -0x9e0(%rbp)
movl $0x0, -0x9e4(%rbp)
movl -0x9e4(%rbp), %eax
cmpl -0x2e4(%rbp), %eax
jge 0x5e89
movslq -0x9e4(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0x9c0(%rbp), %rdi
callq 0x2860
jmp 0x5dac
leaq -0x9c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x2cd0
jmp 0x5dc1
movslq -0x9e4(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0x9c0(%rbp), %rdi
leaq -0x950(%rbp), %rdx
leaq -0x960(%rbp), %rcx
callq 0x2a20
jmp 0x5df3
leaq -0x9c0(%rbp), %rdi
callq 0x2d80
fstpt -0xb2c(%rbp)
jmp 0x5e07
fldt -0xb2c(%rbp)
fstpt -0x9d0(%rbp)
fldt -0x9d0(%rbp)
fldt -0x9e0(%rbp)
faddp %st, %st(1)
fstpt -0x9e0(%rbp)
fldt -0x9d0(%rbp)
movq %rsp, %rax
fstpt (%rax)
leaq -0x508(%rbp), %rdi
callq 0x2250
movq %rax, -0xb38(%rbp)
jmp 0x5e47
movq -0xb38(%rbp), %rdi
movq 0xb17b(%rip), %rsi      # 0x10fd0
callq 0x2220
jmp 0x5e5c
jmp 0x5e5e
movl -0x9e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9e4(%rbp)
jmp 0x5d76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x6670
movl -0x2e4(%rbp), %eax
movl %eax, -0xae4(%rbp)
fildl -0xae4(%rbp)
fldt -0x9e0(%rbp)
fdivp %st, %st(1)
fstpt -0x9e0(%rbp)
fldt -0x9e0(%rbp)
movq %rsp, %rax
fstpt (%rax)
leaq -0x708(%rbp), %rdi
callq 0x2250
movq %rax, -0xb40(%rbp)
jmp 0x5ec9
movq -0xb40(%rbp), %rdi
movq 0xb0f9(%rip), %rsi      # 0x10fd0
callq 0x2220
jmp 0x5ede
movl -0x2e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2e8(%rbp)
fldt -0x9e0(%rbp)
fldt -0x300(%rbp)
movq %rsp, %rax
fstpt 0x10(%rax)
fstpt (%rax)
callq 0x57b0
fstpt -0xb4c(%rbp)
jmp 0x5f0e
fldt -0xb4c(%rbp)
fldt -0x300(%rbp)
xorl %eax, %eax
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
movb %al, -0xb4d(%rbp)
jbe 0x5f41
jmp 0x5f2c
movl -0x2e8(%rbp), %eax
cmpl -0x304(%rbp), %eax
setl %al
movb %al, -0xb4d(%rbp)
movb -0xb4d(%rbp), %al
testb $0x1, %al
jne 0x5d64
leaq -0x508(%rbp), %rdi
callq 0x22c0
jmp 0x5f5d
leaq -0x708(%rbp), %rdi
callq 0x22c0
jmp 0x5f6b
testb $0x1, -0x2e9(%rbp)
je 0x61f3
movl $0x0, -0x9e8(%rbp)
movl -0x9e8(%rbp), %eax
cmpl -0x2e4(%rbp), %eax
jge 0x61f1
movslq -0x9e8(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0x9c0(%rbp), %rdi
callq 0x2860
jmp 0x5fb8
leaq -0xa09(%rbp), %rdi
movq %rdi, -0xb58(%rbp)
callq 0x2370
movq -0xb58(%rbp), %rdx
leaq 0x51a9(%rip), %rsi      # 0xb182
leaq -0xa08(%rbp), %rdi
callq 0x2290
jmp 0x5fe7
movslq -0x9e8(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0xa08(%rbp), %rdi
leaq -0x908(%rbp), %rdx
callq 0x5620
jmp 0x6012
leaq -0xa08(%rbp), %rdi
callq 0x2150
leaq -0xa09(%rbp), %rdi
callq 0x2230
leaq -0xa31(%rbp), %rdi
movq %rdi, -0xb60(%rbp)
callq 0x2370
movq -0xb60(%rbp), %rdx
leaq 0x513e(%rip), %rsi      # 0xb189
leaq -0xa30(%rbp), %rdi
callq 0x2290
jmp 0x6059
movslq -0x9e8(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0xa30(%rbp), %rdi
leaq -0x908(%rbp), %rdx
callq 0x5620
jmp 0x6084
leaq -0xa30(%rbp), %rdi
callq 0x2150
leaq -0xa31(%rbp), %rdi
callq 0x2230
leaq -0x9c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x2cd0
jmp 0x60b1
leaq -0xa59(%rbp), %rdi
movq %rdi, -0xb68(%rbp)
callq 0x2370
movq -0xb68(%rbp), %rdx
leaq 0x50be(%rip), %rsi      # 0xb190
leaq -0xa58(%rbp), %rdi
callq 0x2290
jmp 0x60e0
leaq -0xa58(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
leaq -0x908(%rbp), %rdx
callq 0x56d0
jmp 0x60fc
leaq -0xa58(%rbp), %rdi
callq 0x2150
leaq -0xa59(%rbp), %rdi
callq 0x2230
movl -0x9e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9e8(%rbp)
jmp 0x5f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x615a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xa08(%rbp), %rdi
callq 0x2150
leaq -0xa09(%rbp), %rdi
callq 0x2230
jmp 0x6670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x619d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xa30(%rbp), %rdi
callq 0x2150
leaq -0xa31(%rbp), %rdi
callq 0x2230
jmp 0x6670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x61e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xa58(%rbp), %rdi
callq 0x2150
leaq -0xa59(%rbp), %rdi
callq 0x2230
jmp 0x6670
jmp 0x61f3
testb $0x1, -0x2ea(%rbp)
je 0x65c6
movl $0x0, -0x2e4(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x68b0
leaq -0x298(%rbp), %rdi
callq 0x68b0
leaq -0x2b0(%rbp), %rdi
callq 0x30d0
leaq -0x2c8(%rbp), %rdi
callq 0x30d0
leaq -0x2e0(%rbp), %rdi
callq 0x30d0
movq -0x910(%rbp), %rdi
callq 0x91b0
movb %al, -0xb69(%rbp)
jmp 0x625a
movb -0xb69(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x626b
jmp 0x634b
movl -0x2e4(%rbp), %eax
incl %eax
movl %eax, -0x2e4(%rbp)
movq -0x910(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x97d0
movl %eax, -0xb70(%rbp)
jmp 0x6294
leaq -0x268(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x67c0
movq %rax, %rcx
movl -0xb70(%rbp), %eax
cmpl (%rcx), %eax
je 0x62b6
jmp 0x634b
leaq -0x280(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x67e0
jmp 0x62cb
movq -0x910(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x9980
jmp 0x62e0
leaq -0x2c8(%rbp), %rdi
callq 0x2ff0
movq %rax, -0xb78(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x6850
movq %rax, %rcx
movq -0xb78(%rbp), %rax
movl (%rcx), %ecx
cmpq %rcx, %rax
jne 0x6312
jmp 0x6331
leaq 0x4e15(%rip), %rdi      # 0xb12e
leaq 0x4e35(%rip), %rsi      # 0xb155
movl $0x97, %edx
leaq 0x4e3f(%rip), %rcx      # 0xb16b
callq 0x2170
leaq -0x298(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x67e0
jmp 0x6346
jmp 0x6246
movl $0x0, -0xa60(%rbp)
movl -0xa60(%rbp), %eax
cmpl -0x2e4(%rbp), %eax
jge 0x65c4
movslq -0xa60(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0x9c0(%rbp), %rdi
callq 0x2860
jmp 0x638b
leaq -0xa81(%rbp), %rdi
movq %rdi, -0xb80(%rbp)
callq 0x2370
movq -0xb80(%rbp), %rdx
leaq 0x4dd6(%rip), %rsi      # 0xb182
leaq -0xa80(%rbp), %rdi
callq 0x2290
jmp 0x63ba
movslq -0xa60(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0xa80(%rbp), %rdi
leaq -0x908(%rbp), %rdx
callq 0x5620
jmp 0x63e5
leaq -0xa80(%rbp), %rdi
callq 0x2150
leaq -0xa81(%rbp), %rdi
callq 0x2230
leaq -0xaa9(%rbp), %rdi
movq %rdi, -0xb88(%rbp)
callq 0x2370
movq -0xb88(%rbp), %rdx
leaq 0x4d6b(%rip), %rsi      # 0xb189
leaq -0xaa8(%rbp), %rdi
callq 0x2290
jmp 0x642c
movslq -0xa60(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x6890
movq %rax, %rsi
leaq -0xaa8(%rbp), %rdi
leaq -0x908(%rbp), %rdx
callq 0x5620
jmp 0x6457
leaq -0xaa8(%rbp), %rdi
callq 0x2150
leaq -0xaa9(%rbp), %rdi
callq 0x2230
leaq -0x9c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x2cd0
jmp 0x6484
leaq -0xad1(%rbp), %rdi
movq %rdi, -0xb90(%rbp)
callq 0x2370
movq -0xb90(%rbp), %rdx
leaq 0x4ceb(%rip), %rsi      # 0xb190
leaq -0xad0(%rbp), %rdi
callq 0x2290
jmp 0x64b3
leaq -0xad0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
leaq -0x908(%rbp), %rdx
callq 0x5620
jmp 0x64cf
leaq -0xad0(%rbp), %rdi
callq 0x2150
leaq -0xad1(%rbp), %rdi
callq 0x2230
movl -0xa60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa60(%rbp)
jmp 0x6355
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x652d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xa80(%rbp), %rdi
callq 0x2150
leaq -0xa81(%rbp), %rdi
callq 0x2230
jmp 0x6670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x6570
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xaa8(%rbp), %rdi
callq 0x2150
leaq -0xaa9(%rbp), %rdi
callq 0x2230
jmp 0x6670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
jmp 0x65b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x248(%rbp)
movl %eax, -0x24c(%rbp)
leaq -0xad0(%rbp), %rdi
callq 0x2150
leaq -0xad1(%rbp), %rdi
callq 0x2230
jmp 0x6670
jmp 0x65c6
leaq -0x908(%rbp), %rdi
callq 0x22c0
jmp 0x65d4
leaq -0x9c0(%rbp), %rdi
callq 0x68d0
leaq -0x980(%rbp), %rdi
callq 0x2150
leaq -0x908(%rbp), %rdi
callq 0x22e0
leaq -0x708(%rbp), %rdi
callq 0x22e0
leaq -0x508(%rbp), %rdi
callq 0x22e0
leaq -0x2e0(%rbp), %rdi
callq 0x68f0
leaq -0x2c8(%rbp), %rdi
callq 0x68f0
leaq -0x2b0(%rbp), %rdi
callq 0x68f0
leaq -0x298(%rbp), %rdi
callq 0x6950
leaq -0x280(%rbp), %rdi
callq 0x6950
leaq -0x268(%rbp), %rdi
callq 0x69b0
leaq -0x218(%rbp), %rdi
callq 0x6a10
movl -0x4(%rbp), %eax
addq $0xbb0, %rsp            # imm = 0xBB0
popq %rbp
retq
leaq -0x9c0(%rbp), %rdi
callq 0x68d0
leaq -0x980(%rbp), %rdi
callq 0x2150
leaq -0x908(%rbp), %rdi
callq 0x22e0
leaq -0x708(%rbp), %rdi
callq 0x22e0
leaq -0x508(%rbp), %rdi
callq 0x22e0
leaq -0x2e0(%rbp), %rdi
callq 0x68f0
leaq -0x2c8(%rbp), %rdi
callq 0x68f0
leaq -0x2b0(%rbp), %rdi
callq 0x68f0
leaq -0x298(%rbp), %rdi
callq 0x6950
leaq -0x280(%rbp), %rdi
callq 0x6950
leaq -0x268(%rbp), %rdi
callq 0x69b0
leaq -0x218(%rbp), %rdi
callq 0x6a10
movq -0x248(%rbp), %rdi
callq 0x2360
nopl (%rax)