// File: /workspace/github_cpp_makefile_star2_O1/mapequation[P]partition-validation/./partition-validation.h
// Function: Partitions::printClusters()
void Partitions::printClusters() {
    cout << "--> Writing " << nClusters << " clusters..." << flush;

    my_ofstream ofs;
    ofs.open(outFileName.c_str());

    int i = 1;
    ofs << "# Clustered " << nTrainingPartitions << " partitions into " << clusters.size() << " clusters." << endl;
    ofs << "ClusterId PartitionId" << endl;
    for (auto &cluster: clusters) {
        for (auto &partition: cluster) {
            ofs << i << " " << partition->partitionId + 1 << endl;
        }
        i++;
    }

    ofs.close();

    string distanceOutFileName = outFileName;
    size_t periodPos = distanceOutFileName.find_last_of('.');

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

    ofs.open(distanceOutFileName.c_str());
    i = 1;

    ofs << "# Clustered " << nTrainingPartitions << " partitions into " << clusters.size() << " clusters." << endl;
    ofs << "ClusterId1 ClusterId2 Distance" << endl;

    for (auto cluster1 = begin(clusters); cluster1 != end(clusters); cluster1++) {
        auto j = i + 1;
        for (auto cluster2 = next(cluster1); cluster2 != end(clusters); cluster2++) {
            auto partition1 = *cluster1->begin();
            auto partition2 = *cluster2->begin();
            ofs << i << " " << j << " " << wpJaccardDist(partition1, partition2) << endl;
            j++;
        }
        i++;
    }

    ofs.close();
    cout << "done!" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdi, %r14
movq 0x92a1(%rip), %rbx      # 0xdfd8
leaq 0x5464(%rip), %rsi      # 0xa1a2
movl $0xc, %edx
movq %rbx, %rdi
callq 0x32a0
movl 0x4e0(%r14), %esi
movq %rbx, %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x544b(%rip), %rsi      # 0xa1af
movl $0xc, %edx
movq %rax, %rdi
callq 0x32a0
movq %rbx, %rdi
callq 0x3170
leaq 0x48(%rsp), %rbx
movl $0xf, %esi
movq %rbx, %rdi
callq 0x691c
movq 0x70(%r14), %rsi
movq %rbx, %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x5419(%rip), %rsi      # 0xa1bc
leaq 0x48(%rsp), %rdi
movl $0xc, %edx
callq 0x32a0
movl 0x4e4(%r14), %esi
leaq 0x48(%rsp), %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x53fc(%rip), %rsi      # 0xa1c9
movl $0x11, %edx
movq %rax, %rdi
callq 0x32a0
movq 0x40(%r14), %rsi
subq 0x38(%r14), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x3160
movq %rax, %rbx
leaq 0x53d5(%rip), %rsi      # 0xa1db
movl $0xa, %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
leaq 0x53a5(%rip), %rsi      # 0xa1e6
leaq 0x48(%rsp), %rbx
movl $0x15, %edx
movq %rbx, %rdi
callq 0x32a0
movq 0x48(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
leaq 0x48(%rsp), %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x38(%r14), %rax
movq %r14, 0x18(%rsp)
movq 0x40(%r14), %rcx
movq %rcx, 0x8(%rsp)
cmpq %rcx, %rax
je 0x4f2a
movl $0x1, %ebp
leaq 0x48(%rsp), %r14
leaq 0x5202(%rip), %r15      # 0xa0ac
movq (%rax), %r12
movq %rax, 0x10(%rsp)
movq 0x8(%rax), %r13
cmpq %r13, %r12
je 0x4f18
movq %r14, %rdi
movl %ebp, %esi
callq 0x33d0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32a0
movq (%r12), %rax
movl (%rax), %esi
incl %esi
movq %rbx, %rdi
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
addq $0x8, %r12
jmp 0x4eb6
incl %ebp
movq 0x10(%rsp), %rax
addq $0x18, %rax
cmpq 0x8(%rsp), %rax
jne 0x4eaa
leaq 0x48(%rsp), %rdi
callq 0x3320
movq 0x18(%rsp), %r14
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x70(%r14), %rsi
movq 0x78(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x78a0
leaq 0x28(%rsp), %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x3420
cmpq $-0x1, %rax
je 0x4f91
leaq 0x5282(%rip), %rcx      # 0xa1fc
leaq 0x28(%rsp), %rdi
movl $0xa, %r8d
movq %rax, %rsi
xorl %edx, %edx
callq 0x3280
jmp 0x4fa2
leaq 0x5264(%rip), %rsi      # 0xa1fc
leaq 0x28(%rsp), %rdi
callq 0x3410
movq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x51ff(%rip), %rsi      # 0xa1bc
leaq 0x48(%rsp), %rdi
movl $0xc, %edx
callq 0x32a0
movl 0x4e4(%r14), %esi
leaq 0x48(%rsp), %rdi
callq 0x33d0
movq %rax, %rbx
leaq 0x51e2(%rip), %rsi      # 0xa1c9
movl $0x11, %edx
movq %rax, %rdi
callq 0x32a0
movq 0x40(%r14), %rsi
subq 0x38(%r14), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x3160
movq %rax, %rbx
leaq 0x51bb(%rip), %rsi      # 0xa1db
movl $0xa, %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
leaq 0x51ac(%rip), %rsi      # 0xa207
leaq 0x48(%rsp), %rbx
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x32a0
movq 0x48(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
leaq 0x48(%rsp), %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x38(%r14), %rax
cmpq 0x40(%r14), %rax
je 0x519e
movl $0x1, 0x8(%rsp)
movq %rax, %rcx
movl 0x8(%rsp), %eax
movl %eax, %r12d
leal 0x1(%r12), %eax
movl %eax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
leaq 0x18(%rcx), %rax
movq %rax, 0x20(%rsp)
cmpq 0x40(%r14), %rax
je 0x518f
movl 0x8(%rsp), %ebp
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %r13
movq (%r15), %rax
movq (%rax), %rbx
leaq 0x48(%rsp), %rdi
movl %r12d, %esi
callq 0x33d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4f9a(%rip), %rsi      # 0xa0ac
callq 0x32a0
movq %r14, %rdi
movl %ebp, %esi
callq 0x33d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x4f79(%rip), %rsi      # 0xa0ac
callq 0x32a0
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x37fc
movq %r14, %rdi
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
incl %ebp
addq $0x18, %r15
movq 0x18(%rsp), %r14
cmpq 0x40(%r14), %r15
jne 0x50e2
movq 0x20(%rsp), %rax
cmpq 0x40(%r14), %rax
jne 0x50ae
leaq 0x48(%rsp), %rdi
callq 0x3320
movq 0x8e29(%rip), %rbx      # 0xdfd8
leaq 0x4fe6(%rip), %rsi      # 0xa19c
movl $0x5, %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 0x8df7(%rip), %rdi      # 0xdfd8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x520a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x8aef(%rip), %rax      # 0xdd00
leaq 0x140(%rsp), %rbx
movq %rax, -0xf8(%rbx)
leaq 0x8b01(%rip), %rax      # 0xdd28
movq %rax, (%rbx)
leaq 0x50(%rsp), %rdi
callq 0x31f0
movq %rbx, %rdi
callq 0x30d0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5256
jmp 0x5256
jmp 0x5256
jmp 0x525b
movq %rax, %rbx
jmp 0x527a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x527a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3250
leaq 0x48(%rsp), %rdi
callq 0x69b8
movq %rbx, %rdi
callq 0x33e0