// File: /workspace/github_cpp_makefile_star2_O3/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 0x8d25(%rip), %rbx      # 0xdfd8
leaq 0x4fcc(%rip), %rsi      # 0xa286
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 0x4fa8(%rip), %rsi      # 0xa29d
movl $0x9, %edx
movq %rbx, %rdi
callq 0x32a0
movq %r14, 0x18(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0x532b
movq %r14, %rdi
callq 0x3100
movq 0x8cba(%rip), %rdi      # 0xdfd8
movq %r14, %rsi
movq %rax, %rdx
callq 0x32a0
jmp 0x5342
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 0x53af
movl 0x10(%rsp), %r12d
movl $0x1, %ebp
leaq 0x4db2(%rip), %r14      # 0xa10c
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32a0
movq 0x18(%rsp), %rax
movq (%rax,%rbp,8), %r15
testq %r15, %r15
je 0x5390
movq %r15, %rdi
callq 0x3100
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x32a0
jmp 0x53a7
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 0x535a
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 0x4ec1(%rip), %rsi      # 0xa2a7
leaq 0x4fb6(%rip), %rdx      # 0xa3a3
leaq 0x50(%rsp), %rdi
callq 0x7a34
cmpl $0x1, 0x10(%rsp)
je 0x60f6
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4f8f(%rip), %rsi      # 0xa3a4
leaq 0x4f8e(%rip), %rdx      # 0xa3aa
leaq 0x80(%rsp), %rdi
callq 0x7a34
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4f6b(%rip), %rsi      # 0xa3a4
leaq 0x4f6a(%rip), %rdx      # 0xa3aa
leaq 0x28(%rsp), %rdi
callq 0x7a34
cmpl $0x2, 0x10(%rsp)
jl 0x579b
movl $0x4d2, %eax            # imm = 0x4D2
movq %rax, 0x78(%rsp)
movl $0x1, %ebp
movsd 0x4bb4(%rip), %xmm0     # 0xa020
movsd %xmm0, 0x48(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0xa0(%rsp), %r12
leaq 0x4f1a(%rip), %r13      # 0xa3a4
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 0x6ea3
movq %r12, %rdi
leaq 0x4ee8(%rip), %rsi      # 0xa3ab
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x54ef
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x5f37
movq %r12, %rdi
movq %r14, %rsi
callq 0x6ea3
movq %r12, %rdi
leaq 0x52aa(%rip), %rsi      # 0xa7b6
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5538
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56b3
movq %r12, %rdi
movq %r14, %rsi
callq 0x6ea3
movq %r12, %rdi
leaq 0x5264(%rip), %rsi      # 0xa7b9
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5581
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56c9
movq %r12, %rdi
movq %r14, %rsi
callq 0x6ea3
movq %r12, %rdi
leaq 0x521e(%rip), %rsi      # 0xa7bc
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x55ca
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56e0
movq %r12, %rdi
movq %r14, %rsi
callq 0x6ea3
movq %r12, %rdi
leaq 0x51e0(%rip), %rsi      # 0xa7c7
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5613
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x56f5
movq %r12, %rdi
movq %r14, %rsi
callq 0x6ea3
movq %r12, %rdi
leaq 0x51ae(%rip), %rsi      # 0xa7de
callq 0x30a0
movl %eax, %ebx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x565c
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
testl %ebx, %ebx
je 0x571a
movq (%r14), %rax
cmpb $0x2d, (%rax)
je 0x6072
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x30a0
testl %eax, %eax
je 0x574f
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
callq 0x30a0
testl %eax, %eax
jne 0x570b
movq (%r14), %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6e66
leaq 0x28(%rsp), %rdi
jmp 0x5767
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movq %rax, 0x78(%rsp)
jmp 0x5708
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x32d0
movsd %xmm0, 0x48(%rsp)
jmp 0x5708
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movl %eax, 0x8(%rsp)
jmp 0x5708
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r15,8), %rdi
callq 0x3360
movl %eax, 0x14(%rsp)
addl $0x2, %ebp
cmpl 0x10(%rsp), %ebp
jl 0x54a2
jmp 0x57d4
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 0x570b
movq (%r14), %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6e66
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x32c0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x5794
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
incl %ebp
jmp 0x570b
movl $0x0, 0x8(%rsp)
movsd 0x4875(%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 0x4bc9(%rip), %rsi      # 0xa3a4
leaq 0x80(%rsp), %rdi
callq 0x30a0
testl %eax, %eax
je 0x6111
leaq 0x4bad(%rip), %rsi      # 0xa3a4
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 0x6148
movq 0x87b5(%rip), %rbx      # 0xdfd8
leaq 0x4ffb(%rip), %rsi      # 0xa825
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 0x8783(%rip), %rdi      # 0xdfd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x876f(%rip), %rdi      # 0xdfd8
leaq 0x4fbc(%rip), %rsi      # 0xa82c
movl $0x10, %edx
callq 0x32a0
movq 0x8757(%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 0x871e(%rip), %rdi      # 0xdfd8
leaq 0x4f7c(%rip), %rsi      # 0xa83d
movl $0x59, %edx
callq 0x32a0
movq 0x8706(%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 0x86ca(%rip), %rdi      # 0xdfd8
leaq 0x4f82(%rip), %rsi      # 0xa897
movl $0x24, %edx
callq 0x32a0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x86a2(%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 0x59dd
movq 0x8668(%rip), %rdi      # 0xdfd8
leaq 0x4f45(%rip), %rsi      # 0xa8bc
movl $0x11, %edx
callq 0x32a0
movq 0x8650(%rip), %rdi      # 0xdfd8
movl %ebp, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4f35(%rip), %rsi      # 0xa8ce
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 0x5a92
testl %r13d, %r13d
jle 0x5da8
movq 0x85eb(%rip), %rdi      # 0xdfd8
leaq 0x4ef1(%rip), %rsi      # 0xa8e5
movl $0x28, %edx
callq 0x32a0
movq 0x85d3(%rip), %rdi      # 0xdfd8
movl 0x8(%rsp), %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4ef6(%rip), %rsi      # 0xa90e
movl $0x12, %edx
movq %rax, %rdi
callq 0x32a0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4ee7(%rip), %rsi      # 0xa921
movl $0x15, %edx
movq %rax, %rdi
callq 0x32a0
movq %rbx, %rdi
movl %r13d, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4edb(%rip), %rsi      # 0xa937
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 0x853f(%rip), %rdi      # 0xdfd8
leaq 0x4ed2(%rip), %rsi      # 0xa972
movl $0x21, %edx
callq 0x32a0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x851d(%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 0x84e7(%rip), %rdi      # 0xdfd8
leaq 0x4e9c(%rip), %rsi      # 0xa994
movl $0x20, %edx
callq 0x32a0
movq 0x84cf(%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 0x6f64
addq $0x10, %rsp
testl %ebp, %ebp
je 0x5cd4
xorl %r12d, %r12d
testl %ebp, %ebp
movl $0x0, %ebx
movl %ebp, 0x14(%rsp)
cmovgl %ebp, %ebx
leaq 0xa0(%rsp), %r13
subl $0x1, %ebx
jb 0x5eb9
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 0x4e6d(%rip), %rsi      # 0xaa43
callq 0x32a0
leal 0x1(%r12), %r15d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x33d0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4e4c(%rip), %rsi      # 0xaa49
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 0x3c58
movq %r13, %rdi
movl %r12d, %esi
callq 0x3fb4
movl $0x43, %edx
movq %r14, %rdi
leaq 0x4d97(%rip), %rsi      # 0xa9f4
callq 0x32a0
movq %r14, %rdi
movl %r15d, %esi
callq 0x33d0
movq %rax, %r12
movl $0x8, %edx
movq %rax, %rdi
leaq 0x4dcc(%rip), %rsi      # 0xaa4b
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 0x5b94
testl %r13d, %r13d
je 0x5e20
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
negl %r13d
movl $0x1, %ebx
leaq 0xa0(%rsp), %r14
movq 0x82db(%rip), %r15      # 0xdfd8
leaq 0x4d34(%rip), %r12      # 0xaa38
leal (%rbx,%r13), %eax
cmpl $0x1, %eax
je 0x5eb9
movq %r14, %rdi
xorl %esi, %esi
callq 0x3c58
movq %r14, %rdi
xorl %esi, %esi
callq 0x3fb4
movl $0x43, %edx
movq %r15, %rdi
leaq 0x4cc0(%rip), %rsi      # 0xa9f4
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 0x5d04
cmpl $0x0, 0x8(%rsp)
jle 0x5a92
movq 0x821e(%rip), %rdi      # 0xdfd8
leaq 0x4b7e(%rip), %rsi      # 0xa93f
movl $0x16, %edx
callq 0x32a0
movq 0x8206(%rip), %rdi      # 0xdfd8
movl 0x8(%rsp), %esi
callq 0x33d0
movq %rax, %rbx
leaq 0x4b71(%rip), %rsi      # 0xa956
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 0x59d5
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x3c58
cmpl $0x0, 0x8(%rsp)
jle 0x5eac
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x3fb4
movq 0x818c(%rip), %rdi      # 0xdfd8
leaq 0x4b62(%rip), %rsi      # 0xa9b5
movl $0x3e, %edx
callq 0x32a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x590(%rsp), %xmm0
cvtsi2sdl 0x594(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x815b(%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 0x4d0a
leaq 0xa0(%rsp), %rdi
callq 0x731a
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5ee2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x5f07
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5f23
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 0x8090(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq 0x8084(%rip), %rdi      # 0xdfd8
leaq 0x4453(%rip), %rsi      # 0xa3ae
movl $0xd, %edx
callq 0x32a0
movq 0x806c(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x8060(%rip), %rdi      # 0xdfd8
leaq 0x443d(%rip), %rsi      # 0xa3bc
movl $0x1b, %edx
callq 0x32a0
movq 0x8048(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x803c(%rip), %rdi      # 0xdfd8
leaq 0x4435(%rip), %rsi      # 0xa3d8
movl $0x6c, %edx
callq 0x32a0
movq 0x8024(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x8018(%rip), %rdi      # 0xdfd8
leaq 0x447e(%rip), %rsi      # 0xa445
movl $0xc8, %edx
callq 0x32a0
movq 0x8000(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7ff4(%rip), %rdi      # 0xdfd8
leaq 0x4523(%rip), %rsi      # 0xa50e
movl $0xd1, %edx
callq 0x32a0
movq 0x7fdc(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7fd0(%rip), %rdi      # 0xdfd8
leaq 0x45d1(%rip), %rsi      # 0xa5e0
movl $0x144, %edx            # imm = 0x144
callq 0x32a0
movq 0x7fb8(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7fac(%rip), %rdi      # 0xdfd8
leaq 0x46f2(%rip), %rsi      # 0xa725
movl $0x63, %edx
callq 0x32a0
movq 0x7f94(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7f88(%rip), %rdi      # 0xdfd8
leaq 0x4732(%rip), %rsi      # 0xa789
movl $0x2c, %edx
callq 0x32a0
movq 0x7f70(%rip), %rdi      # 0xdfd8
callq 0x3110
jmp 0x6107
movq 0x7f5f(%rip), %rdi      # 0xdfd8
leaq 0x4774(%rip), %rsi      # 0xa7f4
movl $0x11, %edx
callq 0x32a0
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
callq 0x6ea3
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x7f27(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq %rax, %rdi
callq 0x3110
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x60e3
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
movq 0x7eee(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x6107
movq 0x7edb(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32b0
movq 0x7ec0(%rip), %rdi      # 0xdfd8
leaq 0x46e7(%rip), %rsi      # 0xa806
movl $0xe, %edx
callq 0x32a0
movq 0x7ea8(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7e9c(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x6107
movq 0x7e89(%rip), %rdi      # 0xdfd8
leaq 0x46bf(%rip), %rsi      # 0xa815
movl $0xf, %edx
callq 0x32a0
movq 0x7e71(%rip), %rdi      # 0xdfd8
callq 0x3110
movq 0x7e65(%rip), %rdi      # 0xdfd8
leaq 0x50(%rsp), %rsi
callq 0x3210
jmp 0x6107
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x61e2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3250
jmp 0x61e2
jmp 0x61cb
jmp 0x61cb
jmp 0x61ba
jmp 0x61cb
jmp 0x61d2
jmp 0x61cb
movq %rax, %rbx
jmp 0x61fe
movq %rax, %rbx
jmp 0x6223
jmp 0x61cb
jmp 0x61cb
jmp 0x61cb
jmp 0x61cb
jmp 0x61cb
jmp 0x61cb
movq %rax, %rbx
jmp 0x61e2
jmp 0x61d2
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x731a
leaq 0x38(%rsp), %rax
movq 0x28(%rsp), %rdi
cmpq %rax, %rdi
je 0x61fe
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x90(%rsp), %rax
movq 0x80(%rsp), %rdi
cmpq %rax, %rdi
je 0x6223
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x60(%rsp), %rax
movq 0x50(%rsp), %rdi
cmpq %rax, %rdi
je 0x623f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3250
movq %rbx, %rdi
callq 0x33e0