// File: /workspace/github_cpp_makefile_star2_O1/bolongz[P]Systematic-Alias-Sampling/test.cpp
// Function: main
int main(int argc, char *argv[]){

    
    int samplecount = 0;
    int bincount = 0;

    if(argc != 4){
        std::cout << "Usage: ./test bincount samplecount runtimes" << std::endl;
        exit(1);
    } 
    bincount = atoi(argv[1]); //bincount
    samplecount = atoi(argv[2]); //sampple count
    int times  = atoi(argv[3]) / samplecount; 
    
    
    struct timeval tvs, tvm; 
    std::vector<double> pmf;
    std::vector<double> values;
    
    double h = (8.0) / (bincount - 1); //[take value in [-4, 4]
    
    for(int i = 0; i < bincount; i++){
        double t = -4 + i * h;
        values.push_back(t);
        pmf.push_back(_normal_distribution(0.0, 1.0, t));
    }
    
    //  initial sas class 
    SystematicAliasSampling _sample(pmf, values);
    
    
    _sample.aliastable(); //generate table
    //std::vector<double> av = _sample.aliasvalue;;
    //std::sort(av.begin(), av.end());

    //for(int i = 0 ; i < av.size(); i++){
        //std::cout << av[i] << std::endl;
   //     std::cout << _normal_distribution(0.0, 1.0, av[i]) << std::endl;
    //} 
    std::vector<double> cdf(bincount);
    _sample.cummulative_distribution(cdf);
    
    double span0 =0.0;
    for(int j = 0; j < times ; j++){
        gettimeofday(&tvs, NULL);
        // binary search 
        std::vector<double> b_samples(samplecount);
        for(int i = 0; i < samplecount; i++){
            double x  = __random(gen);
            b_samples[i] = values[std::upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin()];
            //std::cout << std::upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin() << std::endl;
        
        }
        gettimeofday(&tvm, NULL);
        span0 += tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    }
    //std::cout << "Binary Serach cost: " << span0 /times <<std::endl;
    
    // alias sampling method 
    std::uniform_real_distribution<double> ___random(0.0, bincount);
    
    double span =0.0;
    for(int j = 0; j < times; j++){
        gettimeofday(&tvs, NULL);
        std::vector<double> alias_samples(samplecount);
        for(int i = 0; i < samplecount; i++){
            double x  = ___random(gen);
            alias_samples[i]  = _sample.aliassample(int(x), x - int(x));
        }
        gettimeofday(&tvm, NULL);
        span += tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    }
    //std::cout << "Alias method cost: " << span/times <<std::endl;
   

    // sas sampling 
    double span1 = 0.0;
    for(int j = 0; j < times; j++){
        gettimeofday(&tvs, NULL);
        std::vector<double> samples(samplecount); // store the results
        _sample.systematicaliassampling(samplecount, samples);
        gettimeofday(&tvm, NULL);
    
        span1 += tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    }
    //std::cout << "SAS cost: " << span1 /times <<std::endl;
    
    //sas golden sampling 
    /*gettimeofday(&tvs, NULL);
    std::vector<double> samples2(samplecount);
    _sample.goldratioaliassampling(samplecount, samples2);
    
    gettimeofday(&tvm, NULL);
    double span4 = tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    std::cout << "SAS-golden cost: " << span4 <<std::endl;
    */
    // normal_distribution in c++11 
    double span2 = 0.0;
    for(int j = 0; j < times; j++){
        gettimeofday(&tvs, NULL);
        std::vector<double> samples3(samplecount);
        __normal_distribution(samplecount, samples3);
        gettimeofday(&tvm, NULL);
        span2 += tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    }
    //std::cout << "normal_distribution cost: " << span2/times <<std::endl;
    
    //discrete_distribution sampling in c++11 
    

    std::discrete_distribution<> _discrete_distribution(pmf.begin(), pmf.end());
    double span3 = 0.0;
    for(int j = 0; j < times; j++){
        gettimeofday(&tvs, NULL);
        std::vector<double> samples4(samplecount);;
        for(int i = 0 ; i < samplecount; i++){
            samples4[i] = _discrete_distribution(gen);
        }
        gettimeofday(&tvm, NULL);
        span3 += tvm.tv_sec-tvs.tv_sec + (tvm.tv_usec-tvs.tv_usec)/1000000.0;
    }
    //std::cout << "discrete_distribution cost: " << span3/times <<std::endl;
   
    std::cout << span0 /times <<" " << span/times << " " << span1/times << " " << span2/times <<" " << span3/times << std::endl;

   // std::vector<double> edf(bincount);
   
    //_sample.empirical_distribution(b_samples, edf);
    
   // for(int i = 0; i < bincount ; i++){
    //    std::cout << edf[i]<< std::endl;
        
   // }
   /* for(int j = 0 ; j < 1000; j ++){
        for(int i = 20; i < 2 * bincount; i++){
           // std::cout << "+++++++++++++"; 
           // double cvm = cramer_von_mises_alias(bincount, i);
            double cvm = cramer_von_mises_sas(bincount, i);
            //double cvm = cramer_von_mises_iid(bincount, i);
            std::cout << cvm <<" ";
        }
        std::cout << std::endl;
    }
    */
    return 0; 

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
cmpl $0x4, %edi
jne 0x3625
movq %rsi, %r14
movq 0x8(%rsi), %rdi
callq 0x21d0
movl %eax, %r15d
movq 0x10(%r14), %rdi
callq 0x21d0
movl %eax, %ebx
movq 0x18(%r14), %rdi
callq 0x21d0
cltd
movl %ebx, 0x10(%rsp)
idivl %ebx
movl %eax, 0xc(%rsp)
xorl %ebx, %ebx
movq %rbx, 0xb0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq %rbx, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
testl %r15d, %r15d
jle 0x2e59
leal -0x1(%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x32d5(%rip), %xmm1     # 0x6058
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
leaq 0xc0(%rsp), %rbp
leaq 0x110(%rsp), %r12
leaq 0xa0(%rsp), %r13
leaq 0x70(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
mulsd 0x18(%rsp), %xmm0
addsd 0x32a1(%rip), %xmm0     # 0x6060
movsd %xmm0, 0x110(%rsp)
movq 0xc8(%rsp), %rsi
cmpq 0xd0(%rsp), %rsi
je 0x2dec
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xc8(%rsp)
jmp 0x2df7
movq %rbp, %rdi
movq %r12, %rdx
callq 0x520a
movsd 0x110(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x320c(%rip), %xmm0     # 0x6018
callq 0x2240
mulsd 0x3217(%rip), %xmm0     # 0x6030
movsd %xmm0, 0x70(%rsp)
movq 0xa8(%rsp), %rsi
cmpq 0xb0(%rsp), %rsi
je 0x2e43
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8(%rsp)
jmp 0x2e4e
movq %r13, %rdi
movq %r14, %rdx
callq 0x52e2
incl %ebx
cmpl %ebx, %r15d
jne 0x2daa
leaq 0x110(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x376c
leaq 0x110(%rsp), %rdi
callq 0x3820
movslq %r15d, %rsi
leaq 0xf8(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x3d24
movq 0x188(%rsp), %rax
testq %rax, %rax
je 0x2ede
movq 0xf8(%rsp), %rcx
movq 0x110(%rsp), %rdx
xorl %esi, %esi
testq %rsi, %rsi
je 0x2ece
movsd -0x8(%rcx,%rsi,8), %xmm0
addsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, (%rcx,%rsi,8)
jmp 0x2ed6
movsd (%rdx), %xmm0
movsd %xmm0, (%rcx)
incq %rsi
cmpq %rsi, %rax
jne 0x2eb7
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movl 0x10(%rsp), %eax
movslq %eax, %rcx
movq %rcx, 0x58(%rsp)
movl %eax, %ebp
cmpl $0x0, 0xc(%rsp)
jle 0x3046
xorl %r12d, %r12d
leaq 0x40(%rsp), %r14
leaq 0x75d0(%rip), %r13      # 0xa4e0
movsd %xmm0, 0x68(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3d24
cmpl $0x0, 0x10(%rsp)
jle 0x2fd7
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x4ea6
movq 0xf8(%rsp), %rax
movq 0x100(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq %rax, %rdx
testq %rcx, %rcx
jle 0x2fb1
movsd 0x88fd(%rip), %xmm1     # 0xb870
movsd 0x88ed(%rip), %xmm2     # 0xb868
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movq %rax, %rdx
movq %rcx, %rsi
shrq %rsi
movsd (%rdx,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x2fa9
leaq (%rdx,%rsi,8), %rdx
addq $0x8, %rdx
notq %rsi
addq %rcx, %rsi
movq %rsi, %rcx
testq %rsi, %rsi
jg 0x2f8d
subq %rax, %rdx
movq 0xc0(%rsp), %rax
movsd (%rax,%rdx), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
cmpq %rbp, %rbx
jne 0x2f44
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %rbx
subq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x3061(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3022
movsd %xmm1, 0x18(%rsp)
callq 0x2140
movsd 0x18(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
addsd %xmm0, %xmm1
movsd 0x68(%rsp), %xmm0
addsd %xmm1, %xmm0
incl %r12d
cmpl 0xc(%rsp), %r12d
jne 0x2f10
movsd %xmm0, 0x68(%rsp)
cmpl $0x0, 0xc(%rsp)
jle 0x3186
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %r13d, %r13d
leaq 0x7471(%rip), %r15      # 0xa4e0
leaq 0x128(%rsp), %r12
leaq 0x140(%rsp), %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3d24
cmpl $0x0, 0x10(%rsp)
jle 0x3111
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x4ea6
mulsd 0x18(%rsp), %xmm0
addsd 0x2fa4(%rip), %xmm0     # 0x6070
cvttsd2si %xmm0, %eax
cvttpd2dq %xmm0, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
cltq
movq 0x170(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm1
ucomisd %xmm0, %xmm1
movq %rbx, %rcx
cmovbq %r12, %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbp
jne 0x30b6
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %r14
subq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2f27(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x315c
movsd %xmm1, 0x50(%rsp)
callq 0x2140
movsd 0x50(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x60(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
incl %r13d
cmpl 0xc(%rsp), %r13d
jne 0x3089
xorpd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd %xmm0, 0x18(%rsp)
cmpl $0x0, 0xc(%rsp)
jle 0x325c
movsd %xmm0, 0x18(%rsp)
leaq 0x70(%rsp), %r12
leaq 0x110(%rsp), %r15
leaq 0x30(%rsp), %r13
movl 0xc(%rsp), %ebx
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq %r12, %rdi
movq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3d24
movq %r15, %rdi
movl 0x10(%rsp), %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x40b2
movq %r13, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %r14
subq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2e4b(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3238
movsd %xmm1, 0x20(%rsp)
callq 0x2140
movsd 0x20(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
decl %ebx
jne 0x31bd
cmpl $0x0, 0xc(%rsp)
jle 0x3345
xorpd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
xorl %ebx, %ebx
leaq 0x7266(%rip), %r15      # 0xa4e0
leaq 0x85f7(%rip), %r12      # 0xb878
leaq 0x30(%rsp), %r13
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3d24
cmpl $0x0, 0x10(%rsp)
jle 0x32d4
xorl %r14d, %r14d
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5112
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbp
jne 0x32b3
movq %r13, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %r14
subq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2d66(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x331d
movsd %xmm1, 0x20(%rsp)
callq 0x2140
movsd 0x20(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
incl %ebx
cmpl 0xc(%rsp), %ebx
jne 0x3286
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x53ba
cmpl $0x0, 0xc(%rsp)
jle 0x345b
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x7163(%rip), %r15      # 0xa4e0
leaq 0x70(%rsp), %r12
leaq 0x30(%rsp), %r13
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0xd8(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0x2f(%rsp), %rdx
callq 0x3d24
cmpl $0x0, 0x10(%rsp)
jle 0x33df
xorl %r14d, %r14d
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5692
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq 0xd8(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbp
jne 0x33b4
movq %r13, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %rax
subq 0x40(%rsp), %r14
subq 0x48(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2c5b(%rip), %xmm1     # 0x6068
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x3431
movsd %xmm1, 0xf0(%rsp)
callq 0x2140
movsd 0xf0(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
incl %ebx
cmpl 0xc(%rsp), %ebx
jne 0x3387
jmp 0x3465
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0xc(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
movq 0x5b53(%rip), %rdi      # 0x8fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x2c64(%rip), %rsi      # 0x60f8
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x60(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x2c39(%rip), %rsi      # 0x60f8
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x18(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x2c0e(%rip), %rsi      # 0x60f8
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x50(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x2be3(%rip), %rsi      # 0x60f8
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x20(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3572
callq 0x2140
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3581
callq 0x2140
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3593
callq 0x2140
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x35a5
callq 0x2140
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x35b7
callq 0x2140
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x35c9
callq 0x2140
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x35db
callq 0x2140
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x35ed
callq 0x2140
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x35ff
callq 0x2140
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x3611
callq 0x2140
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x59ac(%rip), %rdi      # 0x8fd8
leaq 0x2a99(%rip), %rsi      # 0x60cc
callq 0x2160
movq %rax, %rdi
callq 0x2070
movl $0x1, %edi
callq 0x2190
jmp 0x366b
jmp 0x364e
movq %rax, %rbx
jmp 0x36b9
jmp 0x3657
jmp 0x3657
movq %rax, %rbx
jmp 0x36c6
jmp 0x365e
movq %rax, %rbx
jmp 0x3685
jmp 0x366b
jmp 0x366b
jmp 0x3695
jmp 0x366b
movq %rax, %rbx
jmp 0x36a7
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x3685
callq 0x2140
leaq 0x70(%rsp), %rdi
callq 0x422c
jmp 0x36a7
jmp 0x3695
jmp 0x3695
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x36a7
callq 0x2140
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x36b9
callq 0x2140
leaq 0x110(%rsp), %rdi
callq 0x3f50
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x36d8
callq 0x2140
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x36ea
callq 0x2140
movq %rbx, %rdi
callq 0x2230