// File: /workspace/github_cpp_makefile_star2_O1/sjain12[P]CliqueCounting/tests/../Escape/CliquesGraft.h
// Function: cliques_edge_sampling_2(Escape::Graph&, Escape::CGraph&, CDAG&, std::basic_ofstream<char, std::char_traits<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long long, int)
void cliques_edge_sampling_2(Graph &g, CGraph &CG, CDAG &DG, ofstream &of, string gname, string fname, unsigned long long clique_size, int num_samples)
{    
    high_resolution_clock::time_point t_elim_s = high_resolution_clock::now();
    Stack* stack = newStack();
    VertexSet *path = NULL, *nbrs = NULL;
 
    double num_cliques = 0, est = 0;

    std::random_device rd{}; // use to seed the rng 
    std::mt19937 rng{rd()}; // rng

    std::uniform_int_distribution<int> distribution(0,floor((CG.nEdges-1)/2));

	cout << "Starting sampling" << endl;
    for (int i=0; i<num_samples; i++)
    {
        EdgeIdx edge = distribution(rng);
        num_cliques += get_edge_cliques(g, CG, DG, 2*edge, clique_size - 2);
    }
    est = num_cliques * CG.nEdges/ (2 * num_samples * nCr[clique_size][2]);

	high_resolution_clock::time_point t_elim_e = high_resolution_clock::now();
    auto duration_program = std::chrono::duration_cast<std::chrono::microseconds>( t_elim_e - t_elim_s ).count();
    
    cout << "time reqd: " << duration_program << endl;
	cout << "number of cliques = " << num_cliques << endl;
    cout << "est = " << est << endl;
    
    of << clique_size << "," << est << "," << duration_program << "," << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2748, %rsp           # imm = 0x2748
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %rbp
callq 0x3060
movq %rax, 0x30(%rsp)
leaq 0x13c0(%rsp), %rbx
movq %rbx, %rdi
callq 0x5ec2
movq %rbx, %rdi
callq 0x3380
movl 0x2788(%rsp), %r13d
movq 0x2780(%rsp), %r15
movl %eax, %eax
movq %rax, 0x38(%rsp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x38(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x45d1
movq $0x270, 0x13b8(%rsp) # imm = 0x270
movq 0x8(%r12), %rax
leaq -0x1(%rax), %rcx
shrq $0x3f, %rcx
addq %rcx, %rax
decq %rax
shrq %rax
movl $0x0, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
movq 0x99a8(%rip), %rbx      # 0xdfd0
leaq 0x5a91(%rip), %rsi      # 0xa0c0
movl $0x11, %edx
movq %rbx, %rdi
callq 0x3310
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq 0x9976(%rip), %rdi      # 0xdfd0
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq %r14, 0x28(%rsp)
testl %r13d, %r13d
jle 0x46c7
leaq -0x2(%r15), %r14
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x38(%rsp), %rbx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x66e2
movslq %eax, %rcx
addq %rcx, %rcx
movq %rbp, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
movq %r14, %r8
callq 0x40a9
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
decl %r13d
jne 0x4689
jmp 0x46d1
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%r12), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x2788(%rsp), %eax
addl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq 0x2780(%rsp), %r14
imulq $0x328, %r14, %rax      # imm = 0x328
leaq 0x9bb9(%rip), %rcx      # 0xe2c0
mulsd 0x10(%rax,%rcx), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x3060
subq 0x30(%rsp), %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %r15
movq 0x989c(%rip), %rdi      # 0xdfd0
leaq 0x5997(%rip), %rsi      # 0xa0d2
movl $0xb, %edx
callq 0x3310
movq %r15, %rax
shrq $0x3f, %rax
sarq $0x7, %r15
addq %rax, %r15
movq 0x9876(%rip), %rdi      # 0xdfd0
movq %r15, %rsi
callq 0x3270
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x983d(%rip), %rdi      # 0xdfd0
leaq 0x5944(%rip), %rsi      # 0xa0de
movl $0x14, %edx
callq 0x3310
movq 0x9825(%rip), %rdi      # 0xdfd0
movsd 0x8(%rsp), %xmm0
callq 0x3440
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x97e9(%rip), %rdi      # 0xdfd0
leaq 0x5905(%rip), %rsi      # 0xa0f3
movl $0x6, %edx
callq 0x3310
movsd 0x8(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
divsd 0x20(%rsp), %xmm0
movq 0x97bf(%rip), %rdi      # 0xdfd0
movsd %xmm0, 0x8(%rsp)
callq 0x3440
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x31a0
movq %rax, %rbx
leaq 0x58ba(%rip), %rsi      # 0xa117
movl $0x1, %edx
movq %rax, %rdi
callq 0x3310
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x3440
movq %rax, %rbx
leaq 0x5895(%rip), %rsi      # 0xa117
movl $0x1, %edx
movq %rax, %rdi
callq 0x3310
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3270
movq %rax, %rbx
leaq 0x5873(%rip), %rsi      # 0xa117
movl $0x1, %edx
movq %rax, %rdi
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
leaq 0x13c0(%rsp), %rdi
callq 0x3260
addq $0x2748, %rsp           # imm = 0x2748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4917
jmp 0x48ff
jmp 0x48ff
jmp 0x48ff
movq %rax, %rbx
leaq 0x13c0(%rsp), %rdi
callq 0x3260
movq %rbx, %rdi
callq 0x34a0
movq %rax, %rdi
callq 0x601f