// File: /workspace/github_cpp_makefile_star2_O3/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 0x3629
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x21d0
movl %eax, %r15d
movq 0x10(%rbx), %rdi
callq 0x21d0
movl %eax, %ebp
movq 0x18(%rbx), %rdi
callq 0x21d0
cltd
movl %ebp, 0x10(%rsp)
idivl %ebp
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
movq %rbp, 0xb0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xa0(%rsp)
movq %rbp, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
testl %r15d, %r15d
jle 0x2e49
leal -0x1(%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x32e5(%rip), %xmm1     # 0x6058
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0xc0(%rsp), %rbx
leaq 0x110(%rsp), %r14
leaq 0xa0(%rsp), %r12
leaq 0x70(%rsp), %r13
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x8(%rsp), %xmm0
addsd 0x32b1(%rip), %xmm0     # 0x6060
movsd %xmm0, 0x110(%rsp)
movq 0xc8(%rsp), %rsi
cmpq 0xd0(%rsp), %rsi
je 0x2ddc
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xc8(%rsp)
jmp 0x2de7
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5238
movsd 0x110(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x321c(%rip), %xmm0     # 0x6018
callq 0x2240
mulsd 0x3227(%rip), %xmm0     # 0x6030
movsd %xmm0, 0x70(%rsp)
movq 0xa8(%rsp), %rsi
cmpq 0xb0(%rsp), %rsi
je 0x2e33
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8(%rsp)
jmp 0x2e3e
movq %r12, %rdi
movq %r13, %rdx
callq 0x5310
incl %ebp
cmpl %ebp, %r15d
jne 0x2d9a
leaq 0x110(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x3770
leaq 0x110(%rsp), %rdi
callq 0x3824
movslq %r15d, %rsi
leaq 0xf8(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x3d22
movl 0x4(%rsp), %ebx
movq 0x188(%rsp), %rax
testq %rax, %rax
je 0x2ed2
movq 0xf8(%rsp), %rcx
movq 0x110(%rsp), %rdx
xorl %esi, %esi
testq %rsi, %rsi
je 0x2ec2
movsd -0x8(%rcx,%rsi,8), %xmm0
addsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, (%rcx,%rsi,8)
jmp 0x2eca
movsd (%rdx), %xmm0
movsd %xmm0, (%rcx)
incq %rsi
cmpq %rsi, %rax
jne 0x2eab
movl 0x10(%rsp), %eax
movslq %eax, %rcx
movq %rcx, 0x58(%rsp)
movl %eax, %r12d
xorpd %xmm0, %xmm0
testl %ebx, %ebx
jle 0x3324
movsd %xmm0, 0x60(%rsp)
xorl %ebp, %ebp
leaq 0x38(%rsp), %r14
leaq 0x75ef(%rip), %r13      # 0xa4f0
movq %r14, %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3d22
cmpl $0x0, 0x10(%rsp)
jle 0x2fc2
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x4eae
movq 0xf8(%rsp), %rax
movq 0x100(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movq %rax, %rcx
testq %rdx, %rdx
jle 0x2f9c
movsd 0x892a(%rip), %xmm1     # 0xb888
movsd 0x891a(%rip), %xmm2     # 0xb880
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
movq %rax, %rcx
movq %rdx, %rsi
shrq %rsi
movsd (%rcx,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x2f94
leaq (%rcx,%rsi,8), %rcx
addq $0x8, %rcx
notq %rsi
addq %rdx, %rsi
movq %rsi, %rdx
testq %rsi, %rsi
jg 0x2f78
subq %rax, %rcx
movq 0xc0(%rsp), %rax
movsd (%rax,%rcx), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
cmpq %r12, %rbx
jne 0x2f2f
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %rbx
subq 0x40(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x3076(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x300d
movsd %xmm1, 0x8(%rsp)
callq 0x2140
movsd 0x8(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
addsd %xmm0, %xmm1
movsd 0x60(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
incl %ebp
cmpl 0x4(%rsp), %ebp
jne 0x2f01
movl 0x4(%rsp), %ebx
testl %ebx, %ebx
jle 0x3332
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %ebp, %ebp
leaq 0x7498(%rip), %r15      # 0xa4f0
leaq 0x128(%rsp), %r13
leaq 0x140(%rsp), %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3d22
cmpl $0x0, 0x10(%rsp)
jle 0x30fa
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x4eae
mulsd 0x8(%rsp), %xmm0
addsd 0x2fbb(%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 %r13, %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x309f
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %r14
subq 0x40(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2f3e(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3145
movsd %xmm1, 0x68(%rsp)
callq 0x2140
movsd 0x68(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
incl %ebp
cmpl 0x4(%rsp), %ebp
jne 0x3072
movl 0x4(%rsp), %ebx
xorpd %xmm0, %xmm0
testl %ebx, %ebx
jle 0x361e
movsd %xmm0, 0x48(%rsp)
leaq 0x70(%rsp), %r15
leaq 0x110(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
movq %r15, %rdi
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3d22
movq %r13, %rdi
movl 0x10(%rsp), %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x40ba
movq %rbp, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %r14
subq 0x40(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2e73(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3210
movsd %xmm1, 0x8(%rsp)
callq 0x2140
movsd 0x8(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x48(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
decl %ebx
jne 0x3195
movl 0x4(%rsp), %ebx
xorpd %xmm0, %xmm0
testl %ebx, %ebx
jle 0x3342
movsd %xmm0, 0x18(%rsp)
xorl %ebx, %ebx
leaq 0x729d(%rip), %r13      # 0xa4f0
leaq 0x8636(%rip), %rbp      # 0xb890
leaq 0x28(%rsp), %r15
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0x70(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3d22
cmpl $0x0, 0x10(%rsp)
jle 0x32ad
xorl %r14d, %r14d
movq %rbp, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x5140
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x328c
movq %r15, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %r14
subq 0x40(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2d8d(%rip), %xmm1     # 0x6068
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x32f6
movsd %xmm1, 0x8(%rsp)
callq 0x2140
movsd 0x8(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
incl %ebx
cmpl 0x4(%rsp), %ebx
jne 0x325f
movl 0x4(%rsp), %ebx
jmp 0x3348
movsd %xmm0, 0x48(%rsp)
movsd %xmm0, 0x60(%rsp)
jmp 0x333c
xorpd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd %xmm0, 0x50(%rsp)
movsd %xmm0, 0x18(%rsp)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x53e8
xorpd %xmm0, %xmm0
testl %ebx, %ebx
jle 0x3458
movsd %xmm0, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x7172(%rip), %rbp      # 0xa4f0
leaq 0x70(%rsp), %rbx
leaq 0x28(%rsp), %r15
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x21f0
leaq 0xe0(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0x27(%rsp), %rdx
callq 0x3d22
cmpl $0x0, 0x10(%rsp)
jle 0x33e0
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x56b6
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq 0xe0(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %r12
jne 0x33b5
movq %r15, %rdi
xorl %esi, %esi
callq 0x21f0
movq 0x28(%rsp), %r14
movq 0x30(%rsp), %rax
subq 0x38(%rsp), %r14
subq 0x40(%rsp), %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2c5a(%rip), %xmm1     # 0x6068
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x342c
movsd %xmm1, 0x68(%rsp)
callq 0x2140
movsd 0x68(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
addsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
incl %r13d
cmpl 0x4(%rsp), %r13d
jne 0x3388
jmp 0x345e
movsd %xmm0, 0x8(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
movq 0x5b5a(%rip), %rdi      # 0x8fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x2c9b(%rip), %rsi      # 0x6128
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 0x2c70(%rip), %rsi      # 0x6128
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x48(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rbx
leaq 0x2c45(%rip), %rsi      # 0x6128
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 0x2c1a(%rip), %rsi      # 0x6128
movl $0x1, %edx
movq %rax, %rdi
callq 0x2180
movsd 0x8(%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 0x356b
callq 0x2140
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x357a
callq 0x2140
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x358c
callq 0x2140
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x359e
callq 0x2140
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x35b0
callq 0x2140
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x35c2
callq 0x2140
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x35d4
callq 0x2140
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x35e6
callq 0x2140
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x35f8
callq 0x2140
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x360a
callq 0x2140
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd %xmm0, 0x48(%rsp)
jmp 0x3342
movq 0x59a8(%rip), %rdi      # 0x8fd8
leaq 0x2ac5(%rip), %rsi      # 0x60fc
callq 0x2160
movq %rax, %rdi
callq 0x2070
movl $0x1, %edi
callq 0x2190
jmp 0x366f
jmp 0x3652
movq %rax, %rbx
jmp 0x36bd
jmp 0x365d
jmp 0x366f
jmp 0x365d
movq %rax, %rbx
jmp 0x36ca
jmp 0x3699
jmp 0x366f
jmp 0x366a
jmp 0x366f
movq %rax, %rbx
jmp 0x368d
movq %rax, %rbx
jmp 0x36ab
jmp 0x3699
jmp 0x3699
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x368d
callq 0x2140
leaq 0x70(%rsp), %rdi
callq 0x4240
jmp 0x36ab
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x36ab
callq 0x2140
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x36bd
callq 0x2140
leaq 0x110(%rsp), %rdi
callq 0x3f58
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x36dc
callq 0x2140
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x36ee
callq 0x2140
movq %rbx, %rdi
callq 0x2230