// File: /workspace/github_cpp_makefile_star2_O1/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 0x43d4
testb %al, %al
jne 0x387f
movq 0x5794(%rip), %r14      # 0x8fd8
leaq 0x28e1(%rip), %rsi      # 0x612c
movl $0x13, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
movq 0x78(%rbx), %rsi
leaq 0xc0(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x3d24
movq 0x78(%rbx), %rsi
testq %rsi, %rsi
je 0x38e2
movq %rsi, %xmm1
punpckldq 0x27d5(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
movq (%rbx), %rax
subpd 0x27da(%rip), %xmm1     # 0x6090
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0xc0(%rsp), %rcx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rsi
jne 0x38cc
leaq 0x30(%rbx), %rdi
callq 0x4452
leaq 0x48(%rbx), %r14
movq 0x78(%rbx), %rsi
movq %r14, %rdi
callq 0x4452
leaq 0x60(%rbx), %r15
movq 0x78(%rbx), %rsi
movq %r15, %rdi
callq 0x4452
xorpd %xmm0, %xmm0
leaq 0x70(%rsp), %rdi
movapd %xmm0, 0x40(%rdi)
movapd %xmm0, 0x30(%rdi)
movapd %xmm0, 0x20(%rdi)
movapd %xmm0, 0x10(%rdi)
movapd %xmm0, (%rdi)
xorl %esi, %esi
callq 0x45ca
leaq 0x20(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rdi)
movapd %xmm0, 0x30(%rdi)
movapd %xmm0, 0x20(%rdi)
movapd %xmm0, 0x10(%rdi)
movapd %xmm0, (%rdi)
xorl %esi, %esi
callq 0x45ca
cmpq $0x0, 0x78(%rbx)
je 0x3aa1
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
leaq 0x70(%rsp), %rbp
movq 0xc0(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
ucomisd 0x2687(%rip), %xmm0     # 0x6010
movq %r12, %xmm1
movdqa %xmm1, 0x10(%rsp)
jae 0x39b4
addsd 0x26a2(%rip), %xmm0     # 0x6040
andpd 0x270a(%rip), %xmm0     # 0x60b0
movsd 0x269a(%rip), %xmm1     # 0x6048
ucomisd %xmm0, %xmm1
jbe 0x3a13
movapd 0x10(%rsp), %xmm1
unpcklps 0x26bf(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x26c7(%rip), %xmm1     # 0x6090
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xa0(%rsp), %rax
movq 0xb0(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3a06
movsd %xmm0, (%rax)
addq $0x8, %rax
movq %rax, 0xa0(%rsp)
jmp 0x3a69
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4732
jmp 0x3a69
movapd 0x10(%rsp), %xmm1
unpcklps 0x2660(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2668(%rip), %xmm1     # 0x6090
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq 0x60(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3a5c
movsd %xmm0, (%rax)
addq $0x8, %rax
movq %rax, 0x50(%rsp)
jmp 0x3a69
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x4732
movapd 0x10(%rsp), %xmm1
unpcklps 0x260a(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2612(%rip), %xmm1     # 0x6090
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x48(%rbx), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
cmpq 0x78(%rbx), %r12
jb 0x3973
movq 0xa0(%rsp), %rax
cmpq 0x80(%rsp), %rax
je 0x3c58
movl $0x200, %ebp            # imm = 0x200
leaq 0x8(%rsp), %r13
movq 0x50(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x3c58
movq 0x58(%rsp), %rdi
movq %rax, %rcx
cmpq %rdi, %rax
jne 0x3aea
movq 0x68(%rsp), %rcx
movq -0x8(%rcx), %rcx
addq %rbp, %rcx
cvttsd2si -0x8(%rcx), %r12d
cmpq %rdi, %rax
je 0x3afb
addq $-0x8, %rax
jmp 0x3b29
callq 0x2140
movq 0x68(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x68(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x58(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x60(%rsp)
addq $0x1f8, %rax            # imm = 0x1F8
movq %rax, 0x50(%rsp)
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rdi
movq %rax, %rcx
cmpq %rdi, %rax
jne 0x3b55
movq 0xb8(%rsp), %rcx
movq -0x8(%rcx), %rcx
addq %rbp, %rcx
movsd -0x8(%rcx), %xmm0
cvttsd2si %xmm0, %ecx
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm2
movslq %r12d, %rdx
movq (%r14), %rsi
movlps %xmm2, (%rsi,%rdx,8)
movq 0xc0(%rsp), %rsi
movsd 0x2490(%rip), %xmm1     # 0x6010
movapd %xmm1, %xmm0
subsd (%rsi,%rdx,8), %xmm0
movq (%r15), %r8
movsd %xmm0, (%r8,%rdx,8)
movslq %ecx, %rcx
movsd (%rsi,%rcx,8), %xmm0
addsd (%rsi,%rdx,8), %xmm0
addsd 0x2499(%rip), %xmm0     # 0x6040
movsd %xmm0, (%rsi,%rcx,8)
ucomisd %xmm0, %xmm1
jbe 0x3c42
cmpq %rdi, %rax
je 0x3bc1
addq $-0x8, %rax
jmp 0x3c05
movaps %xmm2, 0x10(%rsp)
callq 0x2140
movaps 0x10(%rsp), %xmm2
movq 0xb8(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0xb8(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0xb0(%rsp)
addq $0x1f8, %rax            # imm = 0x1F8
movq %rax, 0xa0(%rsp)
movsd %xmm2, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq 0x60(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3c35
movsd %xmm2, (%rax)
addq $0x8, %rax
movq %rax, 0x50(%rsp)
jmp 0x3c42
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x4732
movq 0xa0(%rsp), %rax
cmpq 0x80(%rsp), %rax
jne 0x3ac1
movq 0x78(%rbx), %rax
testq %rax, %rax
je 0x3caa
movq 0x48(%rbx), %rcx
movq 0x18(%rbx), %rdx
movq 0x30(%rbx), %rsi
xorl %edi, %edi
movsd 0x23d9(%rip), %xmm0     # 0x6050
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
cmpq %rdi, %rax
jne 0x3c77
leaq 0x20(%rsp), %rdi
callq 0x492e
leaq 0x70(%rsp), %rdi
callq 0x492e
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x3cd0
callq 0x2140
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3cff
jmp 0x3ced
jmp 0x3cf2
jmp 0x3cf2
movq %rax, %rbx
jmp 0x3d09
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x492e
leaq 0x70(%rsp), %rdi
callq 0x492e
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x3d1b
callq 0x2140
movq %rbx, %rdi
callq 0x2230
nop