// File: /workspace/github_cpp_makefile_star2_O2/bolongz[P]Systematic-Alias-Sampling/./sas.h
// Function: SystematicAliasSampling::aliastable()
void aliastable(){
            
            if( !normalize() ) std::cout << "Wrong normalization" <<std::endl;;
            Table F(bincount); //define F
            for(size_t i = 0; i < bincount ; i++){
                F[i] = pmf[i] * double(bincount);
            }
            aliasvalue.resize(bincount);
            aliasindices.resize(bincount);
            aliasprobabilities.resize(bincount);
            std::stack<double> G, S;

            /* Denote by G the set of i, if F[i] >= 1, otherwise S*/
            
            for(size_t i = 0; i < bincount ; i++) {
                if(F[i] >= 1.0 || fabs(F[i] - 1.0) < 1e-6) G.push(i);
                else S.push(i);
                
                aliasindices[i] = i;
            }
             
            /* main loop until S is empty */
            while(!G.empty() && !S.empty()){
            
               int j = S.top();
               S.pop(); // remove the top element of stack S
               int k = G.top(); //get the top element in the stack G
               aliasindices[j] = k;
               aliasprobabilities[j] = 1.0 - F[j];
               
               F[k] = (F[k] + F[j]) -1.0;
               if(F[k] < 1.0){
                    G.pop();
                    S.push(k);
               }

            }
            for(size_t i = 0; i < bincount ; i++) {
                aliasvalue[i] = values[aliasindices[i]];
            }
         //   aliasprobabilities = F;
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
callq 0x3b72
testb %al, %al
jne 0x323c
movq 0x5db0(%rip), %rdi      # 0x8fd8
leaq 0x2ed3(%rip), %rsi      # 0x6102
callq 0x2120
movq %rax, %rdi
callq 0x2080
movq 0x78(%rbx), %rsi
leaq 0x20(%rsp), %r14
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x3568
movq 0x78(%rbx), %rsi
movq %rsi, %xmm1
punpckldq 0x2e2d(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
movq (%rbx), %rax
subpd 0x2e32(%rip), %xmm1     # 0x60a0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
xorl %ecx, %ecx
movq (%r14), %rdx
cmpq %rcx, %rsi
je 0x3297
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rcx,8)
incq %rcx
jmp 0x327f
leaq 0x30(%rbx), %rdi
callq 0x3bdc
leaq 0x48(%rbx), %r14
movq 0x78(%rbx), %rsi
movq %r14, %rdi
callq 0x3bdc
leaq 0x60(%rbx), %r15
movq 0x78(%rbx), %rsi
movq %r15, %rdi
callq 0x3bdc
leaq 0x38(%rsp), %rdi
callq 0x3c0e
leaq 0x88(%rsp), %rdi
callq 0x3c0e
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
leaq 0x38(%rsp), %rbp
cmpq 0x78(%rbx), %r12
jae 0x33aa
movq 0x20(%rsp), %rax
movsd (%rax,%r12,8), %xmm1
ucomisd 0x2d0f(%rip), %xmm1     # 0x6010
movq %r12, %xmm0
jae 0x3326
addsd 0x2d28(%rip), %xmm1     # 0x6038
andpd 0x2d98(%rip), %xmm1     # 0x60b0
movsd 0x2d28(%rip), %xmm2     # 0x6048
ucomisd %xmm1, %xmm2
jbe 0x335b
punpckldq 0x2d62(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2d6a(%rip), %xmm0     # 0x60a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3f68
jmp 0x3393
punpckldq 0x2d2d(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2d35(%rip), %xmm0     # 0x60a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
callq 0x3f68
movq (%r14), %rax
movapd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax,%r12,8)
incq %r12
jmp 0x32e4
movl $0x200, %r13d           # imm = 0x200
leaq 0x88(%rsp), %r12
movq 0x68(%rsp), %rax
cmpq 0x48(%rsp), %rax
je 0x34aa
movq 0xb8(%rsp), %rax
cmpq 0x98(%rsp), %rax
je 0x34aa
cmpq 0xc0(%rsp), %rax
jne 0x33f7
movq 0xd0(%rsp), %rax
movq -0x8(%rax), %rax
addq %r13, %rax
cvttsd2si -0x8(%rax), %ebp
movq %r12, %rdi
callq 0x4198
movq 0x68(%rsp), %rax
cmpq 0x70(%rsp), %rax
jne 0x341f
movq 0x80(%rsp), %rax
movq -0x8(%rax), %rax
addq %r13, %rax
movsd -0x8(%rax), %xmm0
cvttsd2si %xmm0, %eax
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm2
movslq %ebp, %rcx
movq (%r14), %rdx
movlpd %xmm2, (%rdx,%rcx,8)
movq 0x20(%rsp), %rdx
movsd 0x2bc8(%rip), %xmm1     # 0x6010
movapd %xmm1, %xmm0
subsd (%rdx,%rcx,8), %xmm0
movq (%r15), %rsi
movsd %xmm0, (%rsi,%rcx,8)
cltq
movsd (%rdx,%rax,8), %xmm0
addsd (%rdx,%rcx,8), %xmm0
addsd 0x2bcb(%rip), %xmm0     # 0x6038
movsd %xmm0, (%rdx,%rax,8)
ucomisd %xmm0, %xmm1
jbe 0x33b8
leaq 0x38(%rsp), %rdi
movapd %xmm2, 0x10(%rsp)
callq 0x4198
movapd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3f68
jmp 0x33b8
movq 0x78(%rbx), %rax
movq 0x48(%rbx), %rcx
movq 0x18(%rbx), %rdx
movq 0x30(%rbx), %rsi
xorl %edi, %edi
movsd 0x2b7c(%rip), %xmm0     # 0x6040
cmpq %rdi, %rax
je 0x34f9
movsd (%rcx,%rdi,8), %xmm1
cvttsd2si %xmm1, %r8
movq %r8, %r9
sarq $0x3f, %r9
subsd %xmm0, %xmm1
cvttsd2si %xmm1, %r10
andq %r9, %r10
orq %r8, %r10
movsd (%rdx,%r10,8), %xmm1
movsd %xmm1, (%rsi,%rdi,8)
incq %rdi
jmp 0x34c4
leaq 0x88(%rsp), %rdi
callq 0x41e8
leaq 0x38(%rsp), %rdi
callq 0x41e8
leaq 0x20(%rsp), %rdi
callq 0x4798
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x354c
jmp 0x3533
movq %rax, %rbx
jmp 0x3556
jmp 0x353c
jmp 0x353c
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x41e8
leaq 0x38(%rsp), %rdi
callq 0x41e8
leaq 0x20(%rsp), %rdi
callq 0x4798
movq %rbx, %rdi
callq 0x21e0