// File: /workspace/github_cpp_makefile_star2_O1/hanhwi[P]SimPoint/analysiscode/Simpoint.cpp
// Function: Simpoint::applyWeights()
void Simpoint::applyWeights() {
    if (options.fixedLength == "on") {
        Logger::log() << "  Applying fixed-length vector weights (uniform weights)\n";
        double weight = 1.0 / (double)wholeDataset->numRows();
        for (unsigned int i = 0; i < wholeDataset->numRows(); i++) {
            wholeDataset->setWeight(i, weight);
        }
    } else if (options.loadVectorWeightsName != "") {
        Logger::log() << "  Applying vector weights from file " << options.loadVectorWeightsName << endl;
        Utilities::check(isRegularFile(options.loadVectorWeightsName),
                "applyWeights() not regular file " + options.loadVectorWeightsName);
        ifstream input(options.loadVectorWeightsName.c_str());
        Utilities::check(input.is_open(), "Simpoint::applyWeights(): could not open file " +
                                options.loadVectorWeightsName);
        vector<double> weights(wholeDataset->numRows());
        double totalWeight = 0.0;
        for (unsigned int i = 0; i < wholeDataset->numRows(); i++) {
            input >> weights[i];
            totalWeight += weights[i];
        }

        for (unsigned int i = 0; i < wholeDataset->numRows(); i++) {
            wholeDataset->setWeight(i, weights[i] / totalWeight);
        }

        input.close();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
addq $0x100, %rdi            # imm = 0x100
leaq 0x10d53(%rip), %rsi     # 0x1c859
callq 0x40e0
testl %eax, %eax
je 0xbd47
leaq 0x320(%rbx), %r14
leaq 0x10719(%rip), %rsi     # 0x1c23a
movq %r14, %rdi
callq 0x40e0
testl %eax, %eax
je 0xbe39
leaq 0x1b7f8(%rip), %r12     # 0x27330
movl (%r12), %eax
shrl $0x1f, %eax
movq 0x8(%r12,%rax,8), %r15
leaq 0x10e99(%rip), %rsi     # 0x1c9e4
movl $0x24, %edx
movq %r15, %rdi
callq 0x4330
movq 0x320(%rbx), %rsi
movq 0x328(%rbx), %rdx
movq %r15, %rdi
callq 0x4330
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41d0
movq 0x320(%rbx), %rdi
leaq 0x30(%rsp), %r15
movq %r15, %rsi
callq 0x4280
movl %eax, %ebp
movl $0xf000, %r13d          # imm = 0xF000
andl 0x18(%r15), %r13d
leaq 0x10e4a(%rip), %rsi     # 0x1ca09
leaq 0x30(%rsp), %rdi
movq %r14, %rdx
callq 0x5ed9
testl %ebp, %ebp
jne 0xbe4b
cmpl $0x8000, %r13d          # imm = 0x8000
jne 0xbe4b
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbbfc
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42d0
movq (%r14), %rsi
leaq 0x30(%rsp), %rdi
movl $0x8, %edx
callq 0x45a0
leaq 0xa8(%rsp), %rdi
callq 0x40b0
movl %eax, %ebp
leaq 0x10e06(%rip), %rsi     # 0x1ca2a
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x5ed9
testb %bpl, %bpl
je 0xbe87
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc55
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42d0
movq (%rbx), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %esi # imm = 0xAAAAAAAB
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6aee
movq (%rbx), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
xorpd %xmm1, %xmm1
testl %ecx, %ecx
je 0xbcf0
xorl %r15d, %r15d
leaq 0x30(%rsp), %r14
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
xorl %r13d, %r13d
movsd %xmm1, 0x28(%rsp)
movq 0x8(%rsp), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x41b0
movq 0x8(%rsp), %rax
movsd 0x28(%rsp), %xmm1
addsd (%rax,%r15), %xmm1
incq %r13
movq (%rbx), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
imulq %r12, %rcx
movl %ecx, %edx
addq $0x8, %r15
cmpq %rdx, %r13
jb 0xbca9
testl %ecx, %ecx
je 0xbd17
movq 0x8(%rsp), %rdx
movq 0x18(%rax), %rax
movl %ecx, %ecx
xorl %esi, %esi
movsd (%rdx,%rsi,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0xbd01
leaq 0x30(%rsp), %rdi
callq 0x40a0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xbd38
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
leaq 0x30(%rsp), %rdi
callq 0x40c0
jmp 0xbe39
leaq 0x1b5e2(%rip), %rax     # 0x27330
movl (%rax), %ecx
shrl $0x1f, %ecx
movq 0x8(%rax,%rcx,8), %rdi
leaq 0x10c4b(%rip), %rsi     # 0x1c9aa
movl $0x39, %edx
callq 0x4330
movq (%rbx), %rax
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
testl %ecx, %ecx
je 0xbe39
movl %ecx, %edx
cvtsi2sd %rdx, %xmm1
movsd 0x104ec(%rip), %xmm0    # 0x1c288
divsd %xmm1, %xmm0
movq 0x18(%rax), %rax
movl %ecx, %edx
leaq 0x1(%rdx), %rcx
andq $-0x2, %rcx
decq %rdx
movq %rdx, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqa 0x1040d(%rip), %xmm2    # 0x1c1d0
xorl %edx, %edx
movdqa 0x10413(%rip), %xmm3    # 0x1c1e0
pxor %xmm3, %xmm1
pcmpeqd %xmm4, %xmm4
movdqa 0x10413(%rip), %xmm5    # 0x1c1f0
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm1, %xmm7
pcmpeqd %xmm1, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0xbe17
movsd %xmm0, (%rax,%rdx,8)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0xbe2c
movsd %xmm0, 0x8(%rax,%rdx,8)
addq $0x2, %rdx
paddq %xmm5, %xmm2
cmpq %rdx, %rcx
jne 0xbddd
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%r12), %eax
shrl $0x1f, %eax
movq 0x8(%r12,%rax,8), %rbx
leaq 0x1031a(%rip), %rsi     # 0x1c178
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4330
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x4330
movq %rax, %rdi
callq 0x4160
jmp 0xbec1
movl (%r12), %eax
shrl $0x1f, %eax
movq 0x8(%r12,%rax,8), %rbx
leaq 0x102de(%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 0xbf29
movq 0x18(%rsp), %rsi
incq %rsi
jmp 0xbf24
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbf33
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xbf33
jmp 0xbf0f
jmp 0xbf0a
movq %rax, %rbx
jmp 0xbf29
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xbf29
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
leaq 0x30(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x4580
nop