// File: /workspace/github_cpp_makefile_star2_O1/mapequation[P]partition-validation/./partition-validation.h
// Function: Partitions::Partitions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, double, int, int, int, int, int)
Partitions(const string &inFileName,
               const string &outFileName,
               double distThreshold,
               int nTrainingPartitions,
               int nValidationPartitions,
               int crossValidateK,
               int validationSamples,
               int seed)
            : crossValidateK(crossValidateK),
              outFileName(outFileName),
              distThreshold(distThreshold),
              nTrainingPartitions(nTrainingPartitions),
              nValidationPartitions(nValidationPartitions),
              validationSamples(validationSamples) {

        nThreads = max(1, omp_get_max_threads());

        for (int i = 0; i < nThreads; i++) {
            mtRands.emplace_back(seed + 1);
        }

        ifs.open(inFileName.c_str());

        if (!ifs) {
            cout << "Failed to open \"" << inFileName << "\" exiting..." << endl;
            exit(-1);
        }

        readPartitionsFile();

        if (crossValidateK > 0) {
            // Randomize ordered partitions
            shuffle(begin(partitions), end(partitions), mtRands[0]);
        }

        if (validationSamples > 0) {
            validationSampleOutFileName = outFileName;
            auto periodPos = validationSampleOutFileName.find_last_of('.');

            if (periodPos == string::npos) {
                validationSampleOutFileName += "_validation";
            } else {
                validationSampleOutFileName.insert(periodPos, "_validation");
            }

            validationOfs.open(validationSampleOutFileName.c_str());
            validationOfs << "# number_of_validated_out_of_" << nValidationPartitions
                          << " number_of_partition_clusters" << endl;
        }

        ifs.close();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0x4(%rsp)
movl %ecx, %r14d
movsd %xmm0, 0x8(%rsp)
movq %rdx, %r13
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
leaq 0x30(%rdi), %rax
movq %rax, (%rdi)
movq $0x1, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movl $0x3f800000, 0x20(%rdi) # imm = 0x3F800000
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movl %r9d, 0x10(%rsp)
movl %r9d, 0x68(%rdi)
movl $0x1, 0x6c(%rdi)
leaq 0x70(%rdi), %r12
leaq 0x80(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rax, 0x70(%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x78a0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x90(%rbx)
leaq 0x98(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movq $0x0, 0xa8(%rbx)
leaq 0xb0(%rbx), %rbp
movq %rbp, %rdi
movq %r12, 0x40(%rsp)
callq 0x3290
movq %rbp, 0x8(%rsp)
leaq 0x2b8(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x2c8(%rbx), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x2b8(%rbx)
movq $0x0, 0x2c0(%rbx)
movb $0x0, 0x2c8(%rbx)
leaq 0x2d8(%rbx), %rdi
movl $0xf, %esi
movq %rdi, 0x30(%rsp)
callq 0x691c
movl 0x88(%rsp), %r12d
movl 0x80(%rsp), %ecx
xorl %ebp, %ebp
movq %rbp, 0x4d8(%rbx)
movl $0x0, 0x4e0(%rbx)
movl %r14d, 0x4e4(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x4e8(%rbx)
movl %ecx, 0x4ec(%rbx)
movq %rbp, 0x4f0(%rbx)
movl $0x1, 0x6c(%rbx)
incl %r12d
leaq 0x14(%rsp), %r14
movl %r12d, 0x14(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x75a6
incl %ebp
cmpl 0x6c(%rbx), %ebp
jl 0x6f63
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
movq 0x38(%rsp), %r14
movq 0x30(%rsp), %rbp
callq 0x3150
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r12,%rax)
jne 0x70b8
movq %rbx, %rdi
callq 0x442e
cmpl $0x0, 0x10(%rsp)
jle 0x6fd5
movq 0x50(%rbx), %rdi
movq 0x58(%rbx), %rsi
movq 0x98(%rbx), %rdx
callq 0x6684
cmpl $0x0, 0x80(%rsp)
jle 0x70a1
movq %r14, %rdi
movq %r13, %rsi
callq 0x3130
movq %r14, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x3420
cmpq $-0x1, %rax
je 0x7024
leaq 0x309f(%rip), %rcx      # 0xa0ae
movl $0xb, %r8d
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3280
jmp 0x7033
leaq 0x3083(%rip), %rsi      # 0xa0ae
movq %r14, %rdi
callq 0x3410
movq (%r14), %rsi
movq %rbp, %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x39f9(%rip), %rsi      # 0xaa43
movl $0x1d, %edx
movq %rbp, %rdi
callq 0x32a0
movq %rbp, %rdi
movl 0x4(%rsp), %esi
callq 0x33d0
movq %rax, %r14
leaq 0x39f4(%rip), %rsi      # 0xaa61
movl $0x1d, %edx
movq %rax, %rdi
callq 0x32a0
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 %r12, %rdi
callq 0x3070
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6f19(%rip), %rdi      # 0xdfd8
leaq 0x395f(%rip), %rsi      # 0xaa25
movl $0x10, %edx
callq 0x32a0
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x6ef5(%rip), %rdi      # 0xdfd8
callq 0x32a0
movq %rax, %r14
leaq 0x3944(%rip), %rsi      # 0xaa36
movl $0xc, %edx
movq %rax, %rdi
callq 0x32a0
movq %r14, %rdi
callq 0x3110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32b0
movq %rax, %r14
jmp 0x7131
movq %rax, %r14
jmp 0x715a
movq %rax, %r14
jmp 0x7190
jmp 0x7124
jmp 0x7124
movq %rax, %r14
movq 0x30(%rsp), %rdi
callq 0x69b8
movq 0x38(%rsp), %rax
movq (%rax), %rdi
cmpq 0x18(%rsp), %rdi
je 0x7150
movq 0x18(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3250
movq 0x8(%rsp), %rdi
callq 0x3080
movq (%r15), %rdi
testq %rdi, %rdi
je 0x7171
movq 0xa8(%rbx), %rsi
subq %rdi, %rsi
callq 0x3250
movq 0x40(%rsp), %rax
movq (%rax), %rdi
cmpq 0x20(%rsp), %rdi
je 0x7190
movq 0x20(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3250
leaq 0x50(%rbx), %rdi
leaq 0x38(%rbx), %r15
callq 0x6a9c
movq %r15, %rdi
callq 0x7610
movq %rbx, %rdi
callq 0x7830
movq %r14, %rdi
callq 0x33e0
nop