// File: /workspace/github_cpp_makefile_star2_O1/hanhwi[P]SimPoint/analysiscode/Simpoint.cpp
// Function: Simpoint::getLargestClusters(double, Dataset const&)
vector<bool> Simpoint::getLargestClusters(double coveragePct, const Dataset &finalCenters) {
    Utilities::check(coveragePct >= 0 && coveragePct <= 1,
            "getLargestClusters(): coveragePct is out of bounds");

    // sort the clusters by size
    // the pair represents percentage (double) and cluster (int)
    vector<pair<double, int> > sortedClusters(finalCenters.numRows());
    for (unsigned int i = 0; i < sortedClusters.size(); i++) {
        sortedClusters[i] = make_pair(finalCenters.getWeight(i), i);
    }
    sort(sortedClusters.begin(), sortedClusters.end());
    reverse(sortedClusters.begin(), sortedClusters.end());

    // now that they're sorted, select the largest that fulfill the
    // desired percentage and mark them as largestClusters
    double percentExecution = 0.0;
    vector<bool> largestClusters(sortedClusters.size(), false); // order of orig. clusters
    Logger::log(1) << "    Largest non-empty clusters with total weight >= "
        << coveragePct << " (listed largest to smallest): ";
    for (unsigned int i = 0; (i < sortedClusters.size()) &&
            (percentExecution < coveragePct) &&
            (sortedClusters[i].first > 0.0); i++) {
        percentExecution += sortedClusters[i].first;
        largestClusters[sortedClusters[i].second] = true;
        Logger::log(1) << sortedClusters[i].second << " ";
    }
    Logger::log(1) << endl;

    return largestClusters;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movsd %xmm0, 0x30(%rsp)
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10642(%rip), %rsi     # 0x1cb6e
leaq 0x1066d(%rip), %rdx     # 0x1cba0
leaq 0x10(%rsp), %rdi
callq 0x6086
xorpd %xmm0, %xmm0
movsd 0x30(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0xc813
movsd 0xfd2f(%rip), %xmm0     # 0x1c288
ucomisd %xmm1, %xmm0
jb 0xc813
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xc57a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x8(%r14), %rax
subq (%r14), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0xf5ee
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r15
movq %r15, %rax
subq %r12, %rax
sarq $0x4, %rax
cmpq %r12, %r15
je 0xc5d8
movq 0x18(%r14), %rcx
leaq 0x8(%r12), %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, -0x8(%rdx)
movl %esi, (%rdx)
incq %rsi
movl %esi, %edi
addq $0x10, %rdx
cmpq %rdi, %rax
ja 0xc5be
cmpq %r15, %r12
je 0xc600
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x107ec
movq %r12, %rdi
movq %r15, %rsi
callq 0x1089f
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
setne %dl
leaq -0x10(%rsi), %rcx
cmpq %rax, %rcx
seta %dil
andb %dl, %dil
cmpb $0x1, %dil
jne 0xc652
movq %rax, %rdx
movsd (%rdx), %xmm0
movsd (%rcx), %xmm1
movsd %xmm1, (%rdx)
movsd %xmm0, (%rcx)
movl 0x8(%rdx), %edi
movl 0x8(%rcx), %r8d
movl %r8d, 0x8(%rdx)
movl %edi, 0x8(%rcx)
addq $0x10, %rdx
addq $-0x10, %rcx
cmpq %rcx, %rdx
jb 0xc627
subq %rax, %rsi
sarq $0x4, %rsi
leaq 0xe(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xf(%rsp), %rcx
movq %rbx, %rdi
callq 0xf66e
leaq 0x1acbb(%rip), %r15     # 0x27330
xorl %eax, %eax
cmpl $0x0, (%r15)
setle %al
movq 0x8(%r15,%rax,8), %r14
leaq 0x10517(%rip), %rsi     # 0x1cba1
movl $0x34, %edx
movq %r14, %rdi
callq 0x4330
movq %r14, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x4510
leaq 0x1052a(%rip), %rsi     # 0x1cbd6
movl $0x1f, %edx
movq %rax, %rdi
callq 0x4330
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0xc7b5
xorpd %xmm1, %xmm1
movsd 0x30(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xc7b5
movl $0x1, %ebp
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
xorl %ecx, %ecx
leaq 0x3f(%r12), %r13
leaq 0x12b0a(%rip), %r14     # 0x1f204
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm0
ucomisd 0xfc35(%rip), %xmm0     # 0x1c340
jbe 0xc7b5
movsd %xmm0, 0x38(%rsp)
movsd %xmm1, 0x40(%rsp)
addq %rcx, %rax
movslq 0x8(%rax), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq (%rbx), %rax
movq %rcx, %rdx
andq %r13, %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
orq %rdx, -0x8(%rax,%rsi,8)
xorl %eax, %eax
cmpl $0x0, (%r15)
setle %al
movq 0x8(%r15,%rax,8), %rdi
movl %ecx, %esi
callq 0x4560
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x4330
movl %ebp, %ecx
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
cmpq %rcx, %rdx
movsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm0
jbe 0xc7b5
addsd %xmm0, %xmm1
incl %ebp
movsd 0x30(%rsp), %xmm0
ucomisd %xmm1, %xmm0
ja 0xc6fa
xorl %eax, %eax
cmpl $0x0, (%r15)
setle %al
movq 0x8(%r15,%rax,8), %r14
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41d0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc801
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ab16(%rip), %rax     # 0x27330
movl (%rax), %ecx
shrl $0x1f, %ecx
movq 0x8(%rax,%rcx,8), %rbx
leaq 0xf94d(%rip), %rsi      # 0x1c178
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4330
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x4330
movq %rax, %rdi
callq 0x4160
movl $0x1, %edi
callq 0x4370
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xc8a5
movq 0x20(%rsp), %rsi
incq %rsi
jmp 0xc8a0
jmp 0xc87c
jmp 0xc877
movq %rax, %r14
jmp 0xc8a5
movq %rax, %r14
jmp 0xc88e
jmp 0xc883
movq %rax, %r14
movq %rbx, %rdi
callq 0x10dde
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc8a5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq %r14, %rdi
callq 0x4580
movq %rax, %rdi
callq 0x5feb
nop