// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %r12
movq 0x8(%rsi), %r13
cmpq %r13, %r12
je 0x3df9
movq %r13, %rax
subq %r12, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4971
movq %r12, %rdi
movq %r13, %rsi
callq 0x4a6a
movq 0x18(%r15), %rax
movq 0x20(%r15), %rcx
subq %rax, %rcx
je 0x3f45
movq (%r14), %rdx
movq 0x8(%r14), %rsi
movq %rsi, %rdi
subq %rdx, %rdi
movsd -0x8(%rsi), %xmm0
sarq $0x3, %rcx
sarq $0x3, %rdi
movq %rdi, %xmm2
punpckldq 0x224f(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x2257(%rip), %xmm2     # 0x6090
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
movq (%rbx), %r8
cmpq $0x1, %rdi
adcq $0x0, %rdi
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %r9d, %r9d
movapd 0x224d(%rip), %xmm2     # 0x60b0
movsd 0x21dd(%rip), %xmm3     # 0x6048
movsd 0x219d(%rip), %xmm4     # 0x6010
movq 0x2205(%rip), %xmm5     # 0x6080
movapd 0x220d(%rip), %xmm6     # 0x6090
movsd (%rax,%r9,8), %xmm7
movsd (%rdx), %xmm9
ucomisd %xmm7, %xmm9
jbe 0x3eaf
subsd %xmm7, %xmm9
andpd %xmm2, %xmm9
xorpd %xmm8, %xmm8
ucomisd %xmm3, %xmm9
ja 0x3f33
ucomisd %xmm0, %xmm7
movapd %xmm4, %xmm8
jae 0x3f33
movapd %xmm7, %xmm8
subsd %xmm0, %xmm8
andpd %xmm2, %xmm8
ucomisd %xmm8, %xmm3
movapd %xmm4, %xmm8
ja 0x3f33
cmpq %rdx, %rsi
je 0x3f29
xorl %r10d, %r10d
movsd (%rdx,%r10,8), %xmm8
ucomisd %xmm8, %xmm7
jae 0x3f00
movapd %xmm7, %xmm9
subsd %xmm8, %xmm9
andpd %xmm2, %xmm9
ucomisd %xmm9, %xmm3
jbe 0x3f0b
incq %r10
cmpq %r10, %rdi
jne 0x3edd
movq %rdi, %r10
movq %r10, %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 0x3f2e
xorpd %xmm8, %xmm8
divsd %xmm1, %xmm8
movsd %xmm8, (%r8,%r9,8)
incq %r9
cmpq %rcx, %r9
jne 0x3e83
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop