// File: /workspace/github_cpp_makefile_star2_O1/hanhwi[P]SimPoint/analysiscode/Simpoint.cpp
// Function: Simpoint::saveSimpointWeights(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<bool, std::allocator<bool>> const&, Dataset const&)
void Simpoint::saveSimpointWeights(const string &filename, 
        const vector<bool> &largestClusters, const Dataset &centers) {
    ofstream output(filename.c_str());
    Utilities::check(output.is_open(), "Simpoint::saveSimpointWeights(): could not open file " +
                            filename);
    double sumWeights = 0.0;
    for (unsigned int r = 0; r < centers.numRows(); r++) {
        if (largestClusters[r]) {
            sumWeights += centers.getWeight(r);
        }
    }

    for (unsigned int r = 0; r < centers.numRows(); r++) {
        if (largestClusters[r]) {
            output << (centers.getWeight(r) / sumWeights) << " " << r << endl;
        }
    }
    output.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rsi
leaq 0x28(%rsp), %rdi
movl $0x10, %edx
callq 0x4310
leaq 0x98(%rsp), %rdi
callq 0x40b0
movl %eax, %ebp
leaq 0x1004e(%rip), %rsi     # 0x1cc26
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x5ed9
testb %bpl, %bpl
je 0xcd73
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcc09
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
testl %edx, %edx
je 0xcc64
movq (%r14), %rax
movq 0x18(%rbx), %rcx
movl %edx, %edx
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %esi, %esi
movq %rsi, %rdi
shrq $0x6, %rdi
movq (%rax,%rdi,8), %rdi
btq %rsi, %rdi
jae 0xcc5a
movsd (%rsp), %xmm0
addsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rsp)
incq %rsi
cmpq %rsi, %rdx
jne 0xcc3a
jmp 0xcc6d
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
testl %eax, %eax
je 0xcd25
xorl %r15d, %r15d
leaq 0x28(%rsp), %r12
leaq 0x1256f(%rip), %r13     # 0x1f204
movq (%r14), %rax
movq %r15, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %r15, %rax
jae 0xcd08
movq 0x18(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
divsd (%rsp), %xmm0
movq %r12, %rdi
callq 0x4510
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x4330
movq %rbp, %rdi
movq %r15, %rsi
callq 0x41c0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41d0
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incq %r15
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
cmpq %rax, %r15
jb 0xcc95
leaq 0x28(%rsp), %rdi
callq 0x4440
movq 0x1a292(%rip), %rax     # 0x26fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x4240
leaq 0x120(%rsp), %rdi
callq 0x4120
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a5b6(%rip), %rax     # 0x27330
movl (%rax), %ecx
shrl $0x1f, %ecx
movq 0x8(%rax,%rcx,8), %rbx
leaq 0xf3ed(%rip), %rsi      # 0x1c178
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4330
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x4330
movq %rax, %rdi
callq 0x4160
movl $0x1, %edi
callq 0x4370
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcde3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xcde3
jmp 0xcde0
jmp 0xcde0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4480
movq %rbx, %rdi
callq 0x4580
nop