// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x598, %rsp            # imm = 0x598
movq %rsi, %r14
movl %edi, 0x10(%rsp)
movq 0x8d2d(%rip), %rbx      # 0xdfd8
leaq 0x4f74(%rip), %rsi      # 0xa226
movl $0x16, %edx
movq %rbx, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x4f50(%rip), %rsi      # 0xa23d
movl $0x9, %edx
movq %rbx, %rdi
callq 0x32a0
movq %r14, 0x18(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0x5323
movq %r14, %rdi
callq 0x3100
movq 0x8cc2(%rip), %rdi      # 0xdfd8
movq %r14, %rsi
movq %rax, %rdx
callq 0x32a0
jmp 0x533a
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x33c0
cmpl $0x2, 0x10(%rsp)
jl 0x53a7
movl 0x10(%rsp), %r12d
movl $0x1, %ebp
leaq 0x4d5a(%rip), %r14      # 0xa0ac
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32a0
movq 0x18(%rsp), %rax
movq (%rax,%rbp,8), %r15
testq %r15, %r15
je 0x5388
movq %r15, %rdi
callq 0x3100
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x32a0
jmp 0x539f
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x33c0
incq %rbp
cmpq %rbp, %r12
jne 0x5352
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4e69(%rip), %rsi      # 0xa247
leaq 0x4f5e(%rip), %rdx      # 0xa343
leaq 0x50(%rsp), %rdi
callq 0x7930
cmpl $0x1, 0x10(%rsp)
je 0x60ee
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4f37(%rip), %rsi      # 0xa344
leaq 0x4f36(%rip), %rdx      # 0xa34a
leaq 0x80(%rsp), %rdi
callq 0x7930
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4f13(%rip), %rsi      # 0xa344
leaq 0x4f12(%rip), %rdx      # 0xa34a
leaq 0x28(%rsp), %rdi
callq 0x7930
cmpl $0x2, 0x10(%rsp)
jl 0x5793
movl $0x4d2, %eax            # imm = 0x4D2
movq %rax, 0x78(%rsp)
movl $0x1, %ebp
movsd 0x4bbc(%rip), %xmm0     # 0xa020
movsd %xmm0, 0x48(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0xa0(%rsp), %r12
leaq 0x4ec2(%rip), %r13      # 0xa344
movl $0x0, 0x14(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x8(%rsp)
movslq %ebp, %r15
movq 0x18(%rsp), %rax
leaq (%rax,%r15,8), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x4e90(%rip), %rsi      # 0xa34b
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x54e7
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x5f2f
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x5252(%rip), %rsi      # 0xa756
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5530
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56ab
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x520c(%rip), %rsi      # 0xa759
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5579
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56c1
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x51c6(%rip), %rsi      # 0xa75c
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x55c2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56d8
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x5188(%rip), %rsi      # 0xa767
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x560b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56ed
movq %r12, %rdi
movq %r14, %rsi
callq 0x6d3f
movq %r12, %rdi
leaq 0x5156(%rip), %rsi      # 0xa77e
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5654
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x5712
movq (%r14), %rax
cmpb $0x2d, (%rax)
je 0x606a
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x30a0
testl %eax, %eax
je 0x5747
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x30a0
testl %eax, %eax
jne 0x5703
movq (%r14), %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6d02
leaq 0x28(%rsp), %rdi
jmp 0x575f
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movq %rax, 0x78(%rsp)
jmp 0x5700
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x32d0
movsd %xmm0, 0x48(%rsp)
jmp 0x5700
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movl %eax, 0x8(%rsp)
jmp 0x5700
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movl %eax, 0x14(%rsp)
addl $0x2, %ebp
cmpl 0x10(%rsp), %ebp
jl 0x549a
jmp 0x57cc
movq 0x18(%rsp), %rbx
movq 0x8(%rbx,%r15,8), %rdi
callq 0x3360
movl %eax, 0x24(%rsp)
movq 0x10(%rbx,%r15,8), %rdi
callq 0x3360
movl %eax, 0x8(%rsp)
movq 0x18(%rbx,%r15,8), %rdi
callq 0x3360
movq %rax, 0x70(%rsp)
addl $0x4, %ebp
jmp 0x5703
movq (%r14), %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6d02
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x32c0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x578c
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
incl %ebp
jmp 0x5703
movl $0x0, 0x8(%rsp)
movsd 0x487d(%rip), %xmm0     # 0xa020
movsd %xmm0, 0x48(%rsp)
movl $0x4d2, %eax            # imm = 0x4D2
movq %rax, 0x78(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x0, 0x14(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x4b71(%rip), %rsi      # 0xa344
leaq 0x80(%rsp), %rdi
callq 0x30a0
testl %eax, %eax
je 0x6109
leaq 0x4b55(%rip), %rsi      # 0xa344
leaq 0x28(%rsp), %rdi
callq 0x30a0
testl %eax, %eax
movl 0x14(%rsp), %ebp
movq 0x78(%rsp), %r15
movl 0x24(%rsp), %r12d
movq 0x70(%rsp), %r13
je 0x6140
movq 0x87bd(%rip), %rbx      # 0xdfd8
leaq 0x4fa3(%rip), %rsi      # 0xa7c5
movl $0x6, %edx
movq %rbx, %rdi
callq 0x32a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x878b(%rip), %rdi      # 0xdfd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x8777(%rip), %rdi      # 0xdfd8
leaq 0x4f64(%rip), %rsi      # 0xa7cc
movl $0x10, %edx
callq 0x32a0
movq 0x875f(%rip), %rdi      # 0xdfd8
movl %r15d, %esi
callq 0x33d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x8726(%rip), %rdi      # 0xdfd8
leaq 0x4f24(%rip), %rsi      # 0xa7dd
movl $0x59, %edx
callq 0x32a0
movq 0x870e(%rip), %rdi      # 0xdfd8
movsd 0x48(%rsp), %xmm0
callq 0x3380
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x86d2(%rip), %rdi      # 0xdfd8
leaq 0x4f2a(%rip), %rsi      # 0xa837
movl $0x24, %edx
callq 0x32a0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x86aa(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
testl %ebp, %ebp
jle 0x59d5
movq 0x8670(%rip), %rdi      # 0xdfd8
leaq 0x4eed(%rip), %rsi      # 0xa85c
movl $0x11, %edx
callq 0x32a0
movq 0x8658(%rip), %rdi      # 0xdfd8
movl %ebp, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4edd(%rip), %rsi      # 0xa86e
movl $0x16, %edx
movq %rax, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movl $0x0, 0x8(%rsp)
xorl %r13d, %r13d
jmp 0x5a8a
testl %r13d, %r13d
jle 0x5da0
movq 0x85f3(%rip), %rdi      # 0xdfd8
leaq 0x4e99(%rip), %rsi      # 0xa885
movl $0x28, %edx
callq 0x32a0
movq 0x85db(%rip), %rdi      # 0xdfd8
movl 0x8(%rsp), %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4e9e(%rip), %rsi      # 0xa8ae
movl $0x12, %edx
movq %rax, %rdi
callq 0x32a0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4e8f(%rip), %rsi      # 0xa8c1
movl $0x15, %edx
movq %rax, %rdi
callq 0x32a0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4e83(%rip), %rsi      # 0xa8d7
movl $0x7, %edx
movq %rax, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
xorl %ebp, %ebp
movq 0x8547(%rip), %rdi      # 0xdfd8
leaq 0x4e7a(%rip), %rsi      # 0xa912
movl $0x21, %edx
callq 0x32a0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x8525(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x84ef(%rip), %rdi      # 0xdfd8
leaq 0x4e44(%rip), %rsi      # 0xa934
movl $0x20, %edx
callq 0x32a0
movq 0x84d7(%rip), %r14      # 0xdfd8
movq %r14, %rdi
movl $0x1, %esi
callq 0x33d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movsd 0x48(%rsp), %xmm0
movl %r12d, %ecx
movl 0x8(%rsp), %r8d
movl %ebp, %r9d
pushq %r15
pushq %r13
callq 0x6e00
addq $0x10, %rsp
testl %ebp, %ebp
je 0x5ccc
xorl %r12d, %r12d
testl %ebp, %ebp
movl $0x0, %ebx
movl %ebp, 0x14(%rsp)
cmovgl %ebp, %ebx
leaq 0xa0(%rsp), %r13
subl $0x1, %ebx
jb 0x5eb1
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %rax, %rbp
movl $0x5, %edx
movq %rax, %rdi
leaq 0x4e15(%rip), %rsi      # 0xa9e3
callq 0x32a0
leal 0x1(%r12), %r15d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x33d0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4df4(%rip), %rsi      # 0xa9e9
callq 0x32a0
movq %rbp, %rdi
movl 0x14(%rsp), %esi
callq 0x33d0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %r13, %rdi
movl %r12d, %esi
callq 0x3c24
movq %r13, %rdi
movl %r12d, %esi
callq 0x3f80
movl $0x43, %edx
movq %r14, %rdi
leaq 0x4d3f(%rip), %rsi      # 0xa994
callq 0x32a0
movq %r14, %rdi
movl %r15d, %esi
callq 0x33d0
movq %rax, %r12
movl $0x8, %edx
movq %rax, %rdi
leaq 0x4d74(%rip), %rsi      # 0xa9eb
callq 0x32a0
cvtsi2sdl 0x590(%rsp), %xmm0
cvtsi2sdl 0x594(%rsp), %xmm1
divsd %xmm1, %xmm0
movq %r12, %rdi
callq 0x3380
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movl %r15d, %r12d
jmp 0x5b8c
testl %r13d, %r13d
je 0x5e18
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
negl %r13d
movl $0x1, %ebx
leaq 0xa0(%rsp), %r14
movq 0x82e3(%rip), %r15      # 0xdfd8
leaq 0x4cdc(%rip), %r12      # 0xa9d8
leal (%rbx,%r13), %eax
cmpl $0x1, %eax
je 0x5eb1
movq %r14, %rdi
xorl %esi, %esi
callq 0x3c24
movq %r14, %rdi
xorl %esi, %esi
callq 0x3f80
movl $0x43, %edx
movq %r15, %rdi
leaq 0x4c68(%rip), %rsi      # 0xa994
callq 0x32a0
movq %r15, %rdi
movl %ebx, %esi
callq 0x33d0
movq %rax, %rbp
movl $0xa, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x32a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x590(%rsp), %xmm0
cvtsi2sdl 0x594(%rsp), %xmm1
divsd %xmm1, %xmm0
movq %rbp, %rdi
callq 0x3380
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3030
incl %ebx
movq %rax, %rdi
callq 0x3170
jmp 0x5cfc
cmpl $0x0, 0x8(%rsp)
jle 0x5a8a
movq 0x8226(%rip), %rdi      # 0xdfd8
leaq 0x4b26(%rip), %rsi      # 0xa8df
movl $0x16, %edx
callq 0x32a0
movq 0x820e(%rip), %rdi      # 0xdfd8
movl 0x8(%rsp), %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4b19(%rip), %rsi      # 0xa8f6
movl $0x1b, %edx
movq %rax, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
xorl %ebp, %ebp
jmp 0x59cd
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x3c24
cmpl $0x0, 0x8(%rsp)
jle 0x5ea4
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x3f80
movq 0x8194(%rip), %rdi      # 0xdfd8
leaq 0x4b0a(%rip), %rsi      # 0xa955
movl $0x3e, %edx
callq 0x32a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x590(%rsp), %xmm0
cvtsi2sdl 0x594(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x8163(%rip), %rdi      # 0xdfd8
callq 0x3380
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0xa0(%rsp), %rdi
callq 0x4d1c
leaq 0xa0(%rsp), %rdi
callq 0x71b6
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5eda
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x5eff
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5f1b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3250
xorl %eax, %eax
addq $0x598, %rsp            # imm = 0x598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0x8098(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq 0x808c(%rip), %rdi      # 0xdfd8
leaq 0x43fb(%rip), %rsi      # 0xa34e
movl $0xd, %edx
callq 0x32a0
movq 0x8074(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x8068(%rip), %rdi      # 0xdfd8
leaq 0x43e5(%rip), %rsi      # 0xa35c
movl $0x1b, %edx
callq 0x32a0
movq 0x8050(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x8044(%rip), %rdi      # 0xdfd8
leaq 0x43dd(%rip), %rsi      # 0xa378
movl $0x6c, %edx
callq 0x32a0
movq 0x802c(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x8020(%rip), %rdi      # 0xdfd8
leaq 0x4426(%rip), %rsi      # 0xa3e5
movl $0xc8, %edx
callq 0x32a0
movq 0x8008(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7ffc(%rip), %rdi      # 0xdfd8
leaq 0x44cb(%rip), %rsi      # 0xa4ae
movl $0xd1, %edx
callq 0x32a0
movq 0x7fe4(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7fd8(%rip), %rdi      # 0xdfd8
leaq 0x4579(%rip), %rsi      # 0xa580
movl $0x144, %edx            # imm = 0x144
callq 0x32a0
movq 0x7fc0(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7fb4(%rip), %rdi      # 0xdfd8
leaq 0x469a(%rip), %rsi      # 0xa6c5
movl $0x63, %edx
callq 0x32a0
movq 0x7f9c(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7f90(%rip), %rdi      # 0xdfd8
leaq 0x46da(%rip), %rsi      # 0xa729
movl $0x2c, %edx
callq 0x32a0
movq 0x7f78(%rip), %rdi      # 0xdfd8
callq 0x3110
jmp 0x60ff
movq 0x7f67(%rip), %rdi      # 0xdfd8
leaq 0x471c(%rip), %rsi      # 0xa794
movl $0x11, %edx
callq 0x32a0
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
callq 0x6d3f
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x7f2f(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq %rax, %rdi
callq 0x3110
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x60db
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x7ef6(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x60ff
movq 0x7ee3(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32b0
movq 0x7ec8(%rip), %rdi      # 0xdfd8
leaq 0x468f(%rip), %rsi      # 0xa7a6
movl $0xe, %edx
callq 0x32a0
movq 0x7eb0(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7ea4(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x60ff
movq 0x7e91(%rip), %rdi      # 0xdfd8
leaq 0x4667(%rip), %rsi      # 0xa7b5
movl $0xf, %edx
callq 0x32a0
movq 0x7e79(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7e6d(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x60ff
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x61da
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
jmp 0x61da
jmp 0x61c3
jmp 0x61c3
jmp 0x61b2
jmp 0x61c3
jmp 0x61ca
jmp 0x61c3
movq %rax, %rbx
jmp 0x61f6
movq %rax, %rbx
jmp 0x621b
jmp 0x61c3
jmp 0x61c3
jmp 0x61c3
jmp 0x61c3
jmp 0x61c3
jmp 0x61c3
movq %rax, %rbx
jmp 0x61da
jmp 0x61ca
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x71b6
leaq 0x38(%rsp), %rax
movq 0x28(%rsp), %rdi
cmpq %rax, %rdi
je 0x61f6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x90(%rsp), %rax
movq 0x80(%rsp), %rdi
cmpq %rax, %rdi
je 0x621b
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x60(%rsp), %rax
movq 0x50(%rsp), %rdi
cmpq %rax, %rdi
je 0x6237
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3250
movq %rbx, %rdi
callq 0x33e0