// File: mapequation[P]partition-validation/partition-validation.cc
// Function: main
int main(int argc, char *argv[]) {

    cout << "Version: Feb 23, 2022." << endl;
    cout << "Command: ";
    cout << argv[0];
    for (int i = 1; i < argc; i++)
        cout << " " << argv[i];
    cout << endl;

    // Parse command input
    const string CALL_SYNTAX = "Call: ./partition-validation [-h] [-s <seed>] [-t <distance threshold>] "
                               "[--validate <validation size>] [--k-fold-crossvalidate k] "
                               "[--validation-sampling <training size> <validation size> <validation samples>] "
                               "input_partitions.txt output_clustering_txt\n";
    if (argc == 1) {
        cout << CALL_SYNTAX;
        exit(-1);
    }

    int seed = 1234;

    string inFileName = "noname";
    string outFileName = "noname";

    int argNr = 1;
    double distThreshold = 0.2;
    int nValidationPartitions = 0;
    int nTrainingPartitions = 0;
    int crossValidateK = 0;
    int validationSamples = 0;

    while (argNr < argc) {
        if (to_string(argv[argNr]) == "-h") {
            cout << CALL_SYNTAX;
            cout << "-h: This help" << endl;
            cout << "seed: Any positive integer." << endl;
            cout << "distance threshold: "
                    "The max distance from center partition to other partitions in the cluster. Default: 0.2."
                 << endl;
            cout << "--validate <validation size>: "
                    "The number of partitions at the end of the input that will be used for validation. "
                    "The first partitions will be used to find clusters. Default is 0 validation partitions." << endl;
            cout << "--k-fold-crossvalidate k: "
                    "Perform k-fold cross-validation of all partitions. The training partitions will be used to "
                    "find clusters and the other ones for validation. Default is 0 folds for no cross-validation."
                 << endl;
            cout << "--validation-sampling <training size> <validation size> <validation samples>: "
                    "A random set of validation size partitions will be held out from training size partitions "
                    "in each of validation samples resamplings. Reports the average fraction of validation partitions "
                    "that belong to clusters. Default is no validation sampling." << endl;
            cout << "input_partitions.txt: "
                    "Each column corresponds to a partition and each row corresponds to a node id." << endl;
            cout << "output_clustering.txt: clusterID partitionID" << endl;
            exit(-1);
        } else if (to_string(argv[argNr]) == "-s") {
            argNr++;
            seed = atoi(argv[argNr]);
            argNr++;
        } else if (to_string(argv[argNr]) == "-t") {
            argNr++;
            distThreshold = atof(argv[argNr]);
            argNr++;
        } else if (to_string(argv[argNr]) == "--validate") {
            argNr++;
            nValidationPartitions = atoi(argv[argNr]);
            argNr++;
        } else if (to_string(argv[argNr]) == "--k-fold-crossvalidate") {
            argNr++;
            crossValidateK = atoi(argv[argNr]);
            argNr++;
        } else if (to_string(argv[argNr]) == "--validation-sampling") {
            argNr++;
            nTrainingPartitions = atoi(argv[argNr]);
            argNr++;
            nValidationPartitions = atoi(argv[argNr]);
            argNr++;
            validationSamples = atoi(argv[argNr]);
            argNr++;
        } else {
            if (argv[argNr][0] == '-') {
                cout << "Unknown command: " << to_string(argv[argNr]) << endl;
                cout << CALL_SYNTAX;
                exit(-1);
            }

            if (inFileName == "noname") {
                inFileName = string(argv[argNr]);
                argNr++;
            } else if (outFileName == "noname") {
                outFileName = string(argv[argNr]);
                argNr++;
            }
        }
    }

    if (inFileName == "noname") {
        cout << "Missing infile" << endl;
        cout << CALL_SYNTAX;
        exit(-1);
    }
    if (outFileName == "noname") {
        cout << "Missing outfile" << endl;
        cout << CALL_SYNTAX;
        exit(-1);
    }

    cout << "Setup:" << endl;
    cout << "--> Using seed: " << seed << endl;
    cout << "--> Will cluster partitions such that no partition is farther away from its center than: " << distThreshold
         << endl;
    cout << "--> Will read partitions from file: " << inFileName << endl;

    if (crossValidateK > 0) {
        cout << "--> Will perform " << crossValidateK << "-fold cross-valiation." << endl;
        nValidationPartitions = 0;
        validationSamples = 0;
    } else if (validationSamples > 0) {
        cout << "--> Will perform validation sampling of " << nValidationPartitions << " partitions given "
             << nTrainingPartitions << " training partitions " << validationSamples << " times." << endl;
        crossValidateK = 0;
    } else if (nValidationPartitions > 0) {
        cout << "--> Will use the last " << nValidationPartitions << " partitions for validation." << endl;
        crossValidateK = 0;
        validationSamples = 0;
    }

    cout << "--> Will write clusters to file: " << outFileName << endl;
    cout << "--> Will use number of threads: " << omp_get_max_threads() << endl;

    Partitions partitions(inFileName, outFileName, distThreshold, nTrainingPartitions, nValidationPartitions,
                          crossValidateK, validationSamples, seed);

    if (crossValidateK == 0) {
        if (validationSamples == 0) {
            partitions.clusterPartitions(0);
            if (nValidationPartitions > 0) {
                partitions.validatePartitions(0);
                cout << "--> Fraction of validation partitions that fits in a cluster: "
                     << 1.0 * partitions.nTotValidated / partitions.nTotTested << endl;
            }
            partitions.printClusters();
        } else {
            for (int sample = 0; sample < validationSamples; sample++) {
                partitions.clusterPartitions(0);
                partitions.validatePartitions(0);
                cout << "--> Fraction of validation partitions that fits in a cluster after " << sample + 1
                     << " samples: " << 1.0 * partitions.nTotValidated / partitions.nTotTested << endl;
            }
        }
    } else {
        for (int fold = 0; fold < crossValidateK; fold++) {
            cout << endl << "Fold " << fold + 1 << "/" << crossValidateK << endl;
            partitions.clusterPartitions(fold);
            partitions.validatePartitions(fold);
            cout << "--> Fraction of validation partitions that fits in a cluster after " << fold + 1 << " folds: "
                 << 1.0 * partitions.nTotValidated / partitions.nTotTested << endl;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x900, %rsp            # imm = 0x900
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x1f0c0(%rip), %rdi     # 0x24fd0
leaq 0x122f3(%rip), %rsi     # 0x1820a
callq 0x32c0
movq %rax, %rdi
movq 0x1f09a(%rip), %rsi     # 0x24fc0
callq 0x3310
movq 0x1f09e(%rip), %rdi     # 0x24fd0
leaq 0x122e8(%rip), %rsi     # 0x18221
callq 0x32c0
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x1f084(%rip), %rdi     # 0x24fd0
callq 0x32c0
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x5f92
movq 0x1f069(%rip), %rdi     # 0x24fd0
leaq 0x12122(%rip), %rsi     # 0x18090
callq 0x32c0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x32c0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5f58
movq 0x1f037(%rip), %rdi     # 0x24fd0
movq 0x1f020(%rip), %rsi     # 0x24fc0
callq 0x3310
leaq -0x39(%rbp), %rdi
movq %rdi, -0x6f0(%rbp)
callq 0x34b0
movq -0x6f0(%rbp), %rdx
leaq 0x12268(%rip), %rsi     # 0x1822b
leaq -0x38(%rbp), %rdi
callq 0x99a0
jmp 0x5fce
leaq -0x39(%rbp), %rdi
callq 0x3330
cmpl $0x1, -0x8(%rbp)
jne 0x6024
movq 0x1efec(%rip), %rdi     # 0x24fd0
leaq -0x38(%rbp), %rsi
callq 0x3280
jmp 0x5fef
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x3330
jmp 0x71d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x71cd
movl $0x4d2, -0x50(%rbp)     # imm = 0x4D2
leaq -0x71(%rbp), %rdi
movq %rdi, -0x6f8(%rbp)
callq 0x34b0
movq -0x6f8(%rbp), %rdx
leaq 0x122df(%rip), %rsi     # 0x18328
leaq -0x70(%rbp), %rdi
callq 0x99a0
jmp 0x6054
leaq -0x71(%rbp), %rdi
callq 0x3330
leaq -0x99(%rbp), %rdi
movq %rdi, -0x700(%rbp)
callq 0x34b0
movq -0x700(%rbp), %rdx
leaq 0x122aa(%rip), %rsi     # 0x18328
leaq -0x98(%rbp), %rdi
callq 0x99a0
jmp 0x608c
leaq -0x99(%rbp), %rdi
callq 0x3330
movl $0x1, -0xa0(%rbp)
movsd 0x11f6e(%rip), %xmm0    # 0x18018
movsd %xmm0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
movl $0x0, -0xb4(%rbp)
movl $0x0, -0xb8(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x6955
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x9a80
jmp 0x6106
leaq 0x12222(%rip), %rsi     # 0x1832f
leaq -0xd8(%rbp), %rdi
callq 0x9a50
movb %al, -0x701(%rbp)
jmp 0x6121
leaq -0xd8(%rbp), %rdi
callq 0x31a0
movb -0x701(%rbp), %al
testb $0x1, %al
jne 0x613c
jmp 0x6345
movq 0x1ee8d(%rip), %rdi     # 0x24fd0
leaq -0x38(%rbp), %rsi
callq 0x3280
jmp 0x614e
movq 0x1ee7b(%rip), %rdi     # 0x24fd0
leaq 0x121d6(%rip), %rsi     # 0x18332
callq 0x32c0
movq %rax, -0x710(%rbp)
jmp 0x616a
movq -0x710(%rbp), %rdi
movq 0x1ee48(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x617f
movq 0x1ee4a(%rip), %rdi     # 0x24fd0
leaq 0x121b3(%rip), %rsi     # 0x18340
callq 0x32c0
movq %rax, -0x718(%rbp)
jmp 0x619b
movq -0x718(%rbp), %rdi
movq 0x1ee17(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x61b0
movq 0x1ee19(%rip), %rdi     # 0x24fd0
leaq 0x1219e(%rip), %rsi     # 0x1835c
callq 0x32c0
movq %rax, -0x720(%rbp)
jmp 0x61cc
movq -0x720(%rbp), %rdi
movq 0x1ede6(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x61e1
movq 0x1ede8(%rip), %rdi     # 0x24fd0
leaq 0x121da(%rip), %rsi     # 0x183c9
callq 0x32c0
movq %rax, -0x728(%rbp)
jmp 0x61fd
movq -0x728(%rbp), %rdi
movq 0x1edb5(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6212
movq 0x1edb7(%rip), %rdi     # 0x24fd0
leaq 0x12272(%rip), %rsi     # 0x18492
callq 0x32c0
movq %rax, -0x730(%rbp)
jmp 0x622e
movq -0x730(%rbp), %rdi
movq 0x1ed84(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6243
movq 0x1ed86(%rip), %rdi     # 0x24fd0
leaq 0x12313(%rip), %rsi     # 0x18564
callq 0x32c0
movq %rax, -0x738(%rbp)
jmp 0x625f
movq -0x738(%rbp), %rdi
movq 0x1ed53(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6274
movq 0x1ed55(%rip), %rdi     # 0x24fd0
leaq 0x12427(%rip), %rsi     # 0x186a9
callq 0x32c0
movq %rax, -0x740(%rbp)
jmp 0x6290
movq -0x740(%rbp), %rdi
movq 0x1ed22(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x62a5
movq 0x1ed24(%rip), %rdi     # 0x24fd0
leaq 0x1245a(%rip), %rsi     # 0x1870d
callq 0x32c0
movq %rax, -0x748(%rbp)
jmp 0x62c1
movq -0x748(%rbp), %rdi
movq 0x1ecf1(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x62d6
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x3330
jmp 0x71cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x3330
jmp 0x71c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x71b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x9a80
jmp 0x6362
leaq 0x123d1(%rip), %rsi     # 0x1873a
leaq -0xf8(%rbp), %rdi
callq 0x9a50
movb %al, -0x749(%rbp)
jmp 0x637d
leaq -0xf8(%rbp), %rdi
callq 0x31a0
movb -0x749(%rbp), %al
testb $0x1, %al
jne 0x6395
jmp 0x63ec
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0x50(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x694e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0x118(%rbp), %rdi
callq 0x9a80
jmp 0x6409
leaq 0x1232d(%rip), %rsi     # 0x1873d
leaq -0x118(%rbp), %rdi
callq 0x9a50
movb %al, -0x74a(%rbp)
jmp 0x6424
leaq -0x118(%rbp), %rdi
callq 0x31a0
movb -0x74a(%rbp), %al
testb $0x1, %al
jne 0x643c
jmp 0x6498
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x33a0
movsd %xmm0, -0xa8(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x694c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0x138(%rbp), %rdi
callq 0x9a80
jmp 0x64b5
leaq 0x12284(%rip), %rsi     # 0x18740
leaq -0x138(%rbp), %rdi
callq 0x9a50
movb %al, -0x74b(%rbp)
jmp 0x64d0
leaq -0x138(%rbp), %rdi
callq 0x31a0
movb -0x74b(%rbp), %al
testb $0x1, %al
jne 0x64e8
jmp 0x6542
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0xac(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x694a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0x158(%rbp), %rdi
callq 0x9a80
jmp 0x655f
leaq 0x121e5(%rip), %rsi     # 0x1874b
leaq -0x158(%rbp), %rdi
callq 0x9a50
movb %al, -0x74c(%rbp)
jmp 0x657a
leaq -0x158(%rbp), %rdi
callq 0x31a0
movb -0x74c(%rbp), %al
testb $0x1, %al
jne 0x6592
jmp 0x65ec
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0xb4(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x6948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0x178(%rbp), %rdi
callq 0x9a80
jmp 0x6609
leaq 0x12152(%rip), %rsi     # 0x18762
leaq -0x178(%rbp), %rdi
callq 0x9a50
movb %al, -0x74d(%rbp)
jmp 0x6624
leaq -0x178(%rbp), %rdi
callq 0x31a0
movb -0x74d(%rbp), %al
testb $0x1, %al
jne 0x663f
jmp 0x66eb
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0xb0(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0xac(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, -0xb8(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x6946
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x67b5
movq 0x1e8c3(%rip), %rdi     # 0x24fd0
leaq 0x12064(%rip), %rsi     # 0x18778
callq 0x32c0
movq %rax, -0x758(%rbp)
jmp 0x6722
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq -0x198(%rbp), %rdi
callq 0x9a80
jmp 0x673f
movq -0x758(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x3280
movq %rax, -0x760(%rbp)
jmp 0x675b
movq -0x760(%rbp), %rdi
movq 0x1e857(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6770
leaq -0x198(%rbp), %rdi
callq 0x31a0
movq 0x1e84d(%rip), %rdi     # 0x24fd0
leaq -0x38(%rbp), %rsi
callq 0x3280
jmp 0x678e
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x31a0
jmp 0x71b8
leaq 0x11b6c(%rip), %rsi     # 0x18328
leaq -0x70(%rbp), %rdi
callq 0x9a50
movb %al, -0x761(%rbp)
jmp 0x67cd
movb -0x761(%rbp), %al
testb $0x1, %al
jne 0x67dc
jmp 0x687a
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x778(%rbp)
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x770(%rbp)
callq 0x34b0
movq -0x778(%rbp), %rsi
movq -0x770(%rbp), %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x99a0
jmp 0x6821
leaq -0x70(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x3380
leaq -0x1b8(%rbp), %rdi
callq 0x31a0
leaq -0x1b9(%rbp), %rdi
callq 0x3330
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x6944
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1b9(%rbp), %rdi
callq 0x3330
jmp 0x71b8
leaq 0x11aa7(%rip), %rsi     # 0x18328
leaq -0x98(%rbp), %rdi
callq 0x9a50
movb %al, -0x779(%rbp)
jmp 0x6895
movb -0x779(%rbp), %al
testb $0x1, %al
jne 0x68a4
jmp 0x6942
movq -0x10(%rbp), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x790(%rbp)
leaq -0x1e1(%rbp), %rdi
movq %rdi, -0x788(%rbp)
callq 0x34b0
movq -0x790(%rbp), %rsi
movq -0x788(%rbp), %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x99a0
jmp 0x68e9
leaq -0x98(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3380
leaq -0x1e0(%rbp), %rdi
callq 0x31a0
leaq -0x1e1(%rbp), %rdi
callq 0x3330
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x6942
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1e1(%rbp), %rdi
callq 0x3330
jmp 0x71b8
jmp 0x6944
jmp 0x6946
jmp 0x6948
jmp 0x694a
jmp 0x694c
jmp 0x694e
jmp 0x6950
jmp 0x60da
leaq 0x119cc(%rip), %rsi     # 0x18328
leaq -0x70(%rbp), %rdi
callq 0x9a50
movb %al, -0x791(%rbp)
jmp 0x696d
movb -0x791(%rbp), %al
testb $0x1, %al
jne 0x6979
jmp 0x69c6
movq 0x1e650(%rip), %rdi     # 0x24fd0
leaq 0x11e03(%rip), %rsi     # 0x1878a
callq 0x32c0
movq %rax, -0x7a0(%rbp)
jmp 0x6995
movq -0x7a0(%rbp), %rdi
movq 0x1e61d(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x69aa
movq 0x1e61f(%rip), %rdi     # 0x24fd0
leaq -0x38(%rbp), %rsi
callq 0x3280
jmp 0x69bc
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3370
leaq 0x1195b(%rip), %rsi     # 0x18328
leaq -0x98(%rbp), %rdi
callq 0x9a50
movb %al, -0x7a1(%rbp)
jmp 0x69e1
movb -0x7a1(%rbp), %al
testb $0x1, %al
jne 0x69ed
jmp 0x6a3a
movq 0x1e5dc(%rip), %rdi     # 0x24fd0
leaq 0x11d9e(%rip), %rsi     # 0x18799
callq 0x32c0
movq %rax, -0x7b0(%rbp)
jmp 0x6a09
movq -0x7b0(%rbp), %rdi
movq 0x1e5a9(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6a1e
movq 0x1e5ab(%rip), %rdi     # 0x24fd0
leaq -0x38(%rbp), %rsi
callq 0x3280
jmp 0x6a30
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3370
movq 0x1e58f(%rip), %rdi     # 0x24fd0
leaq 0x11d61(%rip), %rsi     # 0x187a9
callq 0x32c0
movq %rax, -0x7b8(%rbp)
jmp 0x6a56
movq -0x7b8(%rbp), %rdi
movq 0x1e55c(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6a6b
movq 0x1e55e(%rip), %rdi     # 0x24fd0
leaq 0x11d37(%rip), %rsi     # 0x187b0
callq 0x32c0
movq %rax, -0x7c0(%rbp)
jmp 0x6a87
movq -0x7c0(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x3490
movq %rax, -0x7c8(%rbp)
jmp 0x6a9f
movq -0x7c8(%rbp), %rdi
movq 0x1e513(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6ab4
movq 0x1e515(%rip), %rdi     # 0x24fd0
leaq 0x11cff(%rip), %rsi     # 0x187c1
callq 0x32c0
movq %rax, -0x7d0(%rbp)
jmp 0x6ad0
movq -0x7d0(%rbp), %rdi
movsd -0xa8(%rbp), %xmm0
callq 0x34f0
movq %rax, -0x7d8(%rbp)
jmp 0x6aed
movq -0x7d8(%rbp), %rdi
movq 0x1e4c5(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6b02
movq 0x1e4c7(%rip), %rdi     # 0x24fd0
leaq 0x11d0b(%rip), %rsi     # 0x1881b
callq 0x32c0
movq %rax, -0x7e0(%rbp)
jmp 0x6b1e
movq -0x7e0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3280
movq %rax, -0x7e8(%rbp)
jmp 0x6b37
movq -0x7e8(%rbp), %rdi
movq 0x1e47b(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6b4c
cmpl $0x0, -0xb4(%rbp)
jle 0x6bda
movq 0x1e470(%rip), %rdi     # 0x24fd0
leaq 0x11cd9(%rip), %rsi     # 0x18840
callq 0x32c0
movq %rax, -0x7f0(%rbp)
jmp 0x6b75
movq -0x7f0(%rbp), %rdi
movl -0xb4(%rbp), %esi
callq 0x3490
movq %rax, -0x7f8(%rbp)
jmp 0x6b90
movq -0x7f8(%rbp), %rdi
leaq 0x11cb4(%rip), %rsi     # 0x18852
callq 0x32c0
movq %rax, -0x800(%rbp)
jmp 0x6bac
movq -0x800(%rbp), %rdi
movq 0x1e406(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6bc1
movl $0x0, -0xac(%rbp)
movl $0x0, -0xb8(%rbp)
jmp 0x6d55
cmpl $0x0, -0xb8(%rbp)
jle 0x6ccc
movq 0x1e3e2(%rip), %rdi     # 0x24fd0
leaq 0x11c74(%rip), %rsi     # 0x18869
callq 0x32c0
movq %rax, -0x808(%rbp)
jmp 0x6c03
movq -0x808(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x3490
movq %rax, -0x810(%rbp)
jmp 0x6c1e
movq -0x810(%rbp), %rdi
leaq 0x11c66(%rip), %rsi     # 0x18892
callq 0x32c0
movq %rax, -0x818(%rbp)
jmp 0x6c3a
movq -0x818(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x3490
movq %rax, -0x820(%rbp)
jmp 0x6c55
movq -0x820(%rbp), %rdi
leaq 0x11c42(%rip), %rsi     # 0x188a5
callq 0x32c0
movq %rax, -0x828(%rbp)
jmp 0x6c71
movq -0x828(%rbp), %rdi
movl -0xb8(%rbp), %esi
callq 0x3490
movq %rax, -0x830(%rbp)
jmp 0x6c8c
movq -0x830(%rbp), %rdi
leaq 0x11c21(%rip), %rsi     # 0x188bb
callq 0x32c0
movq %rax, -0x838(%rbp)
jmp 0x6ca8
movq -0x838(%rbp), %rdi
movq 0x1e30a(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6cbd
movl $0x0, -0xb4(%rbp)
jmp 0x6d53
cmpl $0x0, -0xac(%rbp)
jle 0x6d51
movq 0x1e2f4(%rip), %rdi     # 0x24fd0
leaq 0x11be0(%rip), %rsi     # 0x188c3
callq 0x32c0
movq %rax, -0x840(%rbp)
jmp 0x6cf1
movq -0x840(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x3490
movq %rax, -0x848(%rbp)
jmp 0x6d0c
movq -0x848(%rbp), %rdi
leaq 0x11bc0(%rip), %rsi     # 0x188da
callq 0x32c0
movq %rax, -0x850(%rbp)
jmp 0x6d28
movq -0x850(%rbp), %rdi
movq 0x1e28a(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6d3d
movl $0x0, -0xb4(%rbp)
movl $0x0, -0xb8(%rbp)
jmp 0x6d53
jmp 0x6d55
movq 0x1e274(%rip), %rdi     # 0x24fd0
leaq 0x11b93(%rip), %rsi     # 0x188f6
callq 0x32c0
movq %rax, -0x858(%rbp)
jmp 0x6d71
movq -0x858(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3280
movq %rax, -0x860(%rbp)
jmp 0x6d8d
movq -0x860(%rbp), %rdi
movq 0x1e225(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6da2
movq 0x1e227(%rip), %rdi     # 0x24fd0
leaq 0x11b68(%rip), %rsi     # 0x18918
callq 0x32c0
movq %rax, -0x868(%rbp)
jmp 0x6dbe
movq -0x868(%rbp), %rdi
movl $0x1, %esi
callq 0x3490
movq %rax, -0x870(%rbp)
jmp 0x6dd8
movq -0x870(%rbp), %rdi
movq 0x1e1da(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6ded
movsd -0xa8(%rbp), %xmm0
movl -0xb0(%rbp), %ecx
movl -0xac(%rbp), %r8d
movl -0xb4(%rbp), %r9d
movl -0xb8(%rbp), %edx
movl -0x50(%rbp), %esi
movq %rsp, %rax
movl %esi, 0x8(%rax)
movl %edx, (%rax)
leaq -0x6e0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x9b20
jmp 0x6e33
cmpl $0x0, -0xb4(%rbp)
jne 0x6ff2
cmpl $0x0, -0xb8(%rbp)
jne 0x6f06
leaq -0x6e0(%rbp), %rdi
xorl %esi, %esi
callq 0x4020
jmp 0x6e5d
cmpl $0x0, -0xac(%rbp)
jle 0x6ef3
leaq -0x6e0(%rbp), %rdi
xorl %esi, %esi
callq 0x4630
jmp 0x6e7a
movq 0x1e14f(%rip), %rdi     # 0x24fd0
leaq 0x11ab1(%rip), %rsi     # 0x18939
callq 0x32c0
movq %rax, -0x878(%rbp)
jmp 0x6e96
movq -0x878(%rbp), %rdi
cvtsi2sdl -0x1f0(%rbp), %xmm0
cvtsi2sdl -0x1ec(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x34f0
movq %rax, -0x880(%rbp)
jmp 0x6ebf
movq -0x880(%rbp), %rdi
movq 0x1e0f3(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6ed4
jmp 0x6ef3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6e0(%rbp), %rdi
callq 0xa030
jmp 0x71b8
leaq -0x6e0(%rbp), %rdi
callq 0x5740
jmp 0x6f01
jmp 0x6fed
movl $0x0, -0x6e4(%rbp)
movl -0x6e4(%rbp), %eax
cmpl -0xb8(%rbp), %eax
jge 0x6feb
leaq -0x6e0(%rbp), %rdi
xorl %esi, %esi
callq 0x4020
jmp 0x6f32
leaq -0x6e0(%rbp), %rdi
xorl %esi, %esi
callq 0x4630
jmp 0x6f42
movq 0x1e087(%rip), %rdi     # 0x24fd0
leaq 0x11a28(%rip), %rsi     # 0x18978
callq 0x32c0
movq %rax, -0x888(%rbp)
jmp 0x6f5e
movq -0x888(%rbp), %rdi
movl -0x6e4(%rbp), %esi
incl %esi
callq 0x3490
movq %rax, -0x890(%rbp)
jmp 0x6f7b
movq -0x890(%rbp), %rdi
leaq 0x11a33(%rip), %rsi     # 0x189bc
callq 0x32c0
movq %rax, -0x898(%rbp)
jmp 0x6f97
movq -0x898(%rbp), %rdi
cvtsi2sdl -0x1f0(%rbp), %xmm0
cvtsi2sdl -0x1ec(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x34f0
movq %rax, -0x8a0(%rbp)
jmp 0x6fc0
movq -0x8a0(%rbp), %rdi
movq 0x1dff2(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x6fd5
jmp 0x6fd7
movl -0x6e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6e4(%rbp)
jmp 0x6f10
jmp 0x6fed
jmp 0x7182
movl $0x0, -0x6e8(%rbp)
movl -0x6e8(%rbp), %eax
cmpl -0xb4(%rbp), %eax
jge 0x7180
movq 0x1dfbb(%rip), %rdi     # 0x24fd0
movq 0x1dfa4(%rip), %rsi     # 0x24fc0
callq 0x3310
movq %rax, -0x8a8(%rbp)
jmp 0x702a
movq -0x8a8(%rbp), %rdi
leaq 0x1198f(%rip), %rsi     # 0x189c7
callq 0x32c0
movq %rax, -0x8b0(%rbp)
jmp 0x7046
movq -0x8b0(%rbp), %rdi
movl -0x6e8(%rbp), %esi
incl %esi
callq 0x3490
movq %rax, -0x8b8(%rbp)
jmp 0x7063
movq -0x8b8(%rbp), %rdi
leaq 0x1195c(%rip), %rsi     # 0x189cd
callq 0x32c0
movq %rax, -0x8c0(%rbp)
jmp 0x707f
movq -0x8c0(%rbp), %rdi
movl -0xb4(%rbp), %esi
callq 0x3490
movq %rax, -0x8c8(%rbp)
jmp 0x709a
movq -0x8c8(%rbp), %rdi
movq 0x1df18(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x70af
movl -0x6e8(%rbp), %esi
leaq -0x6e0(%rbp), %rdi
callq 0x4020
jmp 0x70c3
movl -0x6e8(%rbp), %esi
leaq -0x6e0(%rbp), %rdi
callq 0x4630
jmp 0x70d7
movq 0x1def2(%rip), %rdi     # 0x24fd0
leaq 0x11893(%rip), %rsi     # 0x18978
callq 0x32c0
movq %rax, -0x8d0(%rbp)
jmp 0x70f3
movq -0x8d0(%rbp), %rdi
movl -0x6e8(%rbp), %esi
incl %esi
callq 0x3490
movq %rax, -0x8d8(%rbp)
jmp 0x7110
movq -0x8d8(%rbp), %rdi
leaq 0x118b1(%rip), %rsi     # 0x189cf
callq 0x32c0
movq %rax, -0x8e0(%rbp)
jmp 0x712c
movq -0x8e0(%rbp), %rdi
cvtsi2sdl -0x1f0(%rbp), %xmm0
cvtsi2sdl -0x1ec(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x34f0
movq %rax, -0x8e8(%rbp)
jmp 0x7155
movq -0x8e8(%rbp), %rdi
movq 0x1de5d(%rip), %rsi     # 0x24fc0
callq 0x3310
jmp 0x716a
jmp 0x716c
movl -0x6e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6e8(%rbp)
jmp 0x6ffc
jmp 0x7182
leaq -0x6e0(%rbp), %rdi
callq 0xa030
leaq -0x98(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x31a0
leaq -0x38(%rbp), %rdi
callq 0x31a0
movl -0x4(%rbp), %eax
addq $0x900, %rsp            # imm = 0x900
popq %rbp
retq
leaq -0x98(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x31a0
leaq -0x38(%rbp), %rdi
callq 0x31a0
movq -0x48(%rbp), %rdi
callq 0x34a0
nop