// File: fjamour[P]icentral/src/experiments.cc
// Function: gen_rand_edges_deletions(int, graph_t&, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>&)
void gen_rand_edges_deletions(int num_edges,
        graph_t& graph,
        vector<edge_t>& out_vec)
{
    vector<edge_t> bridges_vec;
    graph.find_bridge_edges(bridges_vec);
    //NOTE:insert each edge twice -- e(v1, v2) e(v2, v1)
    int num_bridges = bridges_vec.size();
    for(int i = 0; i < num_bridges; ++i) {
        bridges_vec.push_back(make_pair(bridges_vec[i].second, bridges_vec[i].first));
    }
    out_vec.clear();
    int num_edges_graph = graph.edge_set.size();
    set<edge_t>::const_iterator it(graph.edge_set.begin());
    for(int i = 0; i < num_edges; ++i) {
        edge_t rand_edge;
        do {
            //select an edge at random
            it = graph.edge_set.begin();
            advance(it, rand()%num_edges_graph);
            rand_edge = *it;
        } while(find(bridges_vec.begin(), bridges_vec.end(), rand_edge) != bridges_vec.end());
        out_vec.push_back(rand_edge);
    }
}

// Assembly:
subq $0xc8, %rsp
movl %edi, 0xc4(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
leaq 0x98(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x4db80
movq 0x30(%rsp), %rsi
movq 0xb8(%rsp), %rdi
callq 0x414a0
jmp 0x47aa4
leaq 0x98(%rsp), %rdi
callq 0x47680
movl %eax, 0x88(%rsp)
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
cmpl 0x88(%rsp), %eax
jge 0x47b7c
movslq 0x84(%rsp), %rsi
leaq 0x98(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x4dbc0
movq 0x18(%rsp), %rdi
addq $0x4, %rax
movq %rax, 0x20(%rsp)
movslq 0x84(%rsp), %rsi
callq 0x4dbc0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x41730
movq %rax, 0x28(%rsp)
jmp 0x47b20
movq 0x28(%rsp), %rax
movq %rax, 0x7c(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x7c(%rsp), %rsi
callq 0x4db90
jmp 0x47b3e
jmp 0x47b40
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x47ac3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x4dc40
jmp 0x47cdf
movq 0xb0(%rsp), %rdi
callq 0x42060
movq 0xb8(%rsp), %rdi
addq $0x30, %rdi
callq 0x4dbe0
movl %eax, 0x78(%rsp)
movq 0xb8(%rsp), %rdi
addq $0x30, %rdi
callq 0x420d0
movq %rax, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jge 0x47cca
leaq 0x64(%rsp), %rdi
callq 0x41760
jmp 0x47bd9
jmp 0x47bdb
movq 0xb8(%rsp), %rdi
addq $0x30, %rdi
callq 0x420d0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x70(%rsp)
callq 0x91a0
movl 0x78(%rsp), %ecx
cltd
idivl %ecx
movl %edx, %esi
leaq 0x70(%rsp), %rdi
callq 0x4dbf0
jmp 0x47c15
leaq 0x70(%rsp), %rdi
callq 0x42100
movq %rax, %rsi
leaq 0x64(%rsp), %rdi
callq 0x41e30
jmp 0x47c2e
jmp 0x47c30
leaq 0x98(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x47550
movq 0x8(%rsp), %rdi
movq %rax, 0x48(%rsp)
callq 0x473d0
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0x64(%rsp), %rdx
callq 0x4db20
movq %rax, 0x10(%rsp)
jmp 0x47c71
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x473d0
movq %rax, 0x38(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x4dae0
testb $0x1, %al
jne 0x47bdb
movq 0xb0(%rsp), %rdi
leaq 0x64(%rsp), %rsi
callq 0x42130
jmp 0x47cb8
jmp 0x47cba
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x47bbc
leaq 0x98(%rsp), %rdi
callq 0x4dc40
addq $0xc8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0x9cf0
nopl (%rax)