// File: /workspace/github_cpp_makefile_star2_O3/bolongz[P]Systematic-Alias-Sampling/./sas.h
// Function: SystematicAliasSampling::empirical_distribution(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
void empirical_distribution(Table &samples, Values &edf){
            std::sort(samples.begin(), samples.end()); 
            size_t count = 0;
            double last = samples[samples.size() - 1];
            for(size_t i = 0; i < values.size(); i++){
                count = 0;
                if(values[i] < samples[0] && fabs(samples[0] - values[i]) > 1e-6){
                    edf[i] = 0.0;
                    continue;
                }else if(values[i] >= last || fabs(values[i] - last)  < 1e-6){
                
                    edf[i] = 1.0;
                    continue;
                }else{
                    for(size_t j = 0 ; j < samples.size(); j++){
                        if( values[i] >= samples[j] || fabs(values[i] - samples[j]) < 1e-6 ){
                            count++;
                        }else{
                            break;
                        }

                    }
                    edf[i] = double(count) / samples.size();
                }
            }
        
        }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rdi, %r15
movq (%rsi), %rbx
movq 0x8(%rsi), %r13
cmpq %r13, %rbx
je 0x3e06
movq %rsi, %r12
movq %r13, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x499e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4a97
movq (%r12), %rbx
movq 0x8(%r12), %rax
jmp 0x3e09
movq %rbx, %rax
movq 0x18(%r15), %rcx
movq 0x20(%r15), %rdx
subq %rcx, %rdx
je 0x3f4e
movq %rax, %rsi
subq %rbx, %rsi
movsd -0x8(%rax), %xmm0
sarq $0x3, %rdx
sarq $0x3, %rsi
movq %rsi, %xmm2
punpckldq 0x2246(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x224e(%rip), %xmm2     # 0x6090
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
movq (%r14), %rdi
cmpq $0x1, %rsi
adcq $0x0, %rsi
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %r8d, %r8d
movapd 0x2244(%rip), %xmm2     # 0x60b0
movsd 0x21d4(%rip), %xmm3     # 0x6048
movsd 0x2194(%rip), %xmm4     # 0x6010
movq 0x21fc(%rip), %xmm5     # 0x6080
movapd 0x2204(%rip), %xmm6     # 0x6090
movsd (%rcx,%r8,8), %xmm7
movsd (%rbx), %xmm9
ucomisd %xmm7, %xmm9
jbe 0x3eb8
subsd %xmm7, %xmm9
andpd %xmm2, %xmm9
xorpd %xmm8, %xmm8
ucomisd %xmm3, %xmm9
ja 0x3f3c
ucomisd %xmm0, %xmm7
movapd %xmm4, %xmm8
jae 0x3f3c
movapd %xmm7, %xmm8
subsd %xmm0, %xmm8
andpd %xmm2, %xmm8
ucomisd %xmm8, %xmm3
movapd %xmm4, %xmm8
ja 0x3f3c
cmpq %rbx, %rax
je 0x3f32
xorl %r9d, %r9d
movsd (%rbx,%r9,8), %xmm8
ucomisd %xmm8, %xmm7
jae 0x3f09
movapd %xmm7, %xmm9
subsd %xmm8, %xmm9
andpd %xmm2, %xmm9
ucomisd %xmm9, %xmm3
jbe 0x3f14
incq %r9
cmpq %r9, %rsi
jne 0x3ee6
movq %rsi, %r9
movq %r9, %xmm7
punpckldq %xmm5, %xmm7    # xmm7 = xmm7[0],xmm5[0],xmm7[1],xmm5[1]
subpd %xmm6, %xmm7
movapd %xmm7, %xmm8
unpckhpd %xmm7, %xmm8            # xmm8 = xmm8[1],xmm7[1]
addsd %xmm7, %xmm8
jmp 0x3f37
xorpd %xmm8, %xmm8
divsd %xmm1, %xmm8
movsd %xmm8, (%rdi,%r8,8)
incq %r8
cmpq %rdx, %r8
jne 0x3e8c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq