// File: flastest[P]HeterogeneousParallelDijkstra/./graph_gen.hh
// Function: generate_graph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int)
void generate_graph(std::string file_name, int number_of_nodes, int number_of_edges)
{
	srand(time(0));
	ofstream file_stream;
	file_stream.open (file_name);

	file_stream << "# a graph with "<< number_of_nodes << " nodes and " << number_of_edges << " edges.\n";
	file_stream << "# in general, I saw it was good to have 5 times as many edges as nodes to get a fully connected graph.\n";


	for (int i = 1; i <= number_of_edges; i++)
	{
    int point_a = rand() % number_of_nodes;
    int point_b = (rand() % number_of_nodes);
    //std::cout<<"point_a is "<<point_a<<std::endl;
    if (point_b == point_a)
    {
    //    std::cout<<"point_b is "<<point_b<<std::endl;
        point_b =(point_b + 1) % number_of_nodes;
    //    std::cout<<"point_b is changed to "<<point_b<<std::endl;

    } 
		file_stream << 	to_string(point_a) << " " << to_string(point_b);
		if (i < number_of_edges) file_stream << "\n";
	}

	file_stream.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x270(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x4300
movl %eax, %edi
callq 0x4310
leaq -0x210(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x4530
movq -0x278(%rbp), %rdi
movq -0x270(%rbp), %rsi
movl $0x10, %edx
callq 0x4170
jmp 0x4a19
leaq 0x225e8(%rip), %rsi     # 0x27008
leaq -0x210(%rbp), %rdi
callq 0x4320
movq %rax, -0x280(%rbp)
jmp 0x4a35
movq -0x280(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4570
movq %rax, -0x288(%rbp)
jmp 0x4a4d
movq -0x288(%rbp), %rdi
leaq 0x225bd(%rip), %rsi     # 0x27018
callq 0x4320
movq %rax, -0x290(%rbp)
jmp 0x4a69
movq -0x290(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x4570
movq %rax, -0x298(%rbp)
jmp 0x4a81
movq -0x298(%rbp), %rdi
leaq 0x22595(%rip), %rsi     # 0x27024
callq 0x4320
jmp 0x4a96
leaq 0x22590(%rip), %rsi     # 0x2702d
leaq -0x210(%rbp), %rdi
callq 0x4320
jmp 0x4aab
movl $0x1, -0x220(%rbp)
movl -0x220(%rbp), %eax
cmpl -0x10(%rbp), %eax
jg 0x4c21
callq 0x40c0
cltd
idivl -0xc(%rbp)
movl %edx, -0x224(%rbp)
callq 0x40c0
cltd
idivl -0xc(%rbp)
movl %edx, -0x228(%rbp)
movl -0x228(%rbp), %eax
cmpl -0x224(%rbp), %eax
jne 0x4b1c
movl -0x228(%rbp), %eax
addl $0x1, %eax
cltd
idivl -0xc(%rbp)
movl %edx, -0x228(%rbp)
jmp 0x4b1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4c44
movl -0x224(%rbp), %esi
leaq -0x248(%rbp), %rdi
callq 0xc220
jmp 0x4b30
leaq -0x210(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x42e0
movq %rax, -0x2a0(%rbp)
jmp 0x4b4c
movq -0x2a0(%rbp), %rdi
leaq 0x226e2(%rip), %rsi     # 0x2723c
callq 0x4320
movq %rax, -0x2a8(%rbp)
jmp 0x4b68
movl -0x228(%rbp), %esi
leaq -0x268(%rbp), %rdi
callq 0xc220
jmp 0x4b7c
movq -0x2a8(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x42e0
jmp 0x4b91
leaq -0x268(%rbp), %rdi
callq 0x41d0
leaq -0x248(%rbp), %rdi
callq 0x41d0
movl -0x220(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x4c0b
leaq 0x224d8(%rip), %rsi     # 0x27093
leaq -0x210(%rbp), %rdi
callq 0x4320
jmp 0x4bc9
jmp 0x4c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x4bfd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x41d0
leaq -0x248(%rbp), %rdi
callq 0x41d0
jmp 0x4c44
jmp 0x4c0d
movl -0x220(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x220(%rbp)
jmp 0x4ab5
leaq -0x210(%rbp), %rdi
callq 0x4460
jmp 0x4c2f
leaq -0x210(%rbp), %rdi
callq 0x44a0
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
leaq -0x210(%rbp), %rdi
callq 0x44a0
movq -0x218(%rbp), %rdi
callq 0x4580
nopl (%rax)