// File: /workspace/github_cpp_makefile_star2_O3/datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::RandomDAGGenerator(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::RandomDAGGenerator(int n, int m, const string& filename){
	int i=0;
	int u, v;

	vsize = n;
	vl = VertexList(n, Vertex());
	graph = GRA(n, In_OutList());

	set< pair<int, int> > tmpset;

	for(int i=0; i<m; i++){
		u=Rand64()%vsize;
		v=Rand64()%vsize;

		if(u==v){
			i--;
			continue;
		}
		if(u>v)
			swap(u, v);

		if(tmpset.find(make_pair(u, v))==tmpset.end()){
			addEdge(u,v);
			tmpset.insert(make_pair(u, v));
		}
		else{
			i--;
			continue;
		}
	}

	int count=0;
	for(int u=0; u<vsize; u++){
		sort(graph[u].outList.begin(), graph[u].outList.end());
		count+=graph[u].outList.size();
		for(int j=0; j+1<graph[u].outList.size(); j++){
			if(graph[u].outList[j]==graph[u].outList[j+1]){
				cout << "redundant edges" << endl;
				quit();
			}
		}
	}

	cout << "Number of edges: " << count << endl;

	ofstream output(filename.c_str());
	writeGraph(output);
	output.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rcx, 0x10(%rsp)
movl %edx, %ebp
movq %rdi, %rbx
movl %esi, 0xc(%rdi)
movslq %esi, %r15
leaq 0x20(%rsp), %rdx
movw $0x0, (%rdx)
movl $0x0, 0xc(%rdx)
xorl %r12d, %r12d
movq %r12, 0x4(%rdx)
leaq 0x70(%rsp), %r14
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0xc08e
movq 0x30(%rbx), %rdi
movaps (%r14), %xmm0
movups %xmm0, 0x30(%rbx)
movq 0x10(%r14), %rax
movq %rax, 0x40(%rbx)
movq %r12, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
testq %rdi, %rdi
je 0x67ce
callq 0x3260
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x67ce
callq 0x3260
leaq 0x70(%rsp), %rdx
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movq %r15, %rsi
callq 0xbd88
movq 0x58(%rbx), %rax
leaq 0x50(%rsp), %r14
movaps (%r14), %xmm0
movq 0x10(%r14), %rcx
movq %rcx, 0x58(%rbx)
movups 0x48(%rbx), %xmm1
movups %xmm0, 0x48(%rbx)
leaq 0x20(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
callq 0xbcd8
movq %r14, %rdi
callq 0xbcd8
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x684a
callq 0x3260
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x6859
callq 0x3260
leaq 0x28(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
testl %ebp, %ebp
jle 0x692c
xorl %r15d, %r15d
callq 0x30a0
movslq %eax, %r14
callq 0x30a0
cltq
shlq $0x1f, %rax
orq %r14, %rax
movslq 0xc(%rbx), %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, %r12
callq 0x30a0
movslq %eax, %r14
callq 0x30a0
cltq
shlq $0x1f, %rax
orq %r14, %rax
movslq 0xc(%rbx), %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, %r14
cmpl %r14d, %r12d
je 0x6923
movl %r14d, %r13d
cmovgl %r12d, %r13d
cmovll %r12d, %r14d
movq %r13, %rax
shlq $0x20, %rax
leaq (%r14,%rax), %r12
movq %r12, 0x70(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xde4e
leaq 0x28(%rsp), %rcx
cmpq %rcx, %rax
jne 0x6923
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x5762
movq %r12, 0x70(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xdeac
incl %r15d
cmpl %ebp, %r15d
jl 0x6881
cmpl $0x0, 0xc(%rbx)
movl $0x0, %r14d
jle 0x6a3d
movq 0x48(%rbx), %rax
xorl %r15d, %r15d
movq 0xf68e(%rip), %r12      # 0x15fd8
xorl %r14d, %r14d
movq %r14, 0x18(%rsp)
leaq (%r15,%r15,2), %r13
shlq $0x4, %r13
movq 0x18(%rax,%r13), %rbp
movq 0x20(%rax,%r13), %r14
cmpq %r14, %rbp
je 0x69a6
movq %r14, %rax
subq %rbp, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r14, %rsi
callq 0xd6a1
movq %rbp, %rdi
movq %r14, %rsi
callq 0xd784
movq 0x48(%rbx), %rax
movq 0x18(%rax,%r13), %rcx
movq 0x20(%rax,%r13), %rbp
jmp 0x69a9
movq %rbp, %rcx
subq %rcx, %rbp
cmpq $0x5, %rbp
jb 0x6a21
movl $0x1, %r14d
movl -0x4(%rcx,%r14,4), %edx
cmpl (%rcx,%r14,4), %edx
jne 0x6a08
movl $0xf, %edx
movq %r12, %rdi
leaq 0x9ab4(%rip), %rsi      # 0x10486
callq 0x32e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
callq 0x4948
movq 0x48(%rbx), %rax
incq %r14
movq 0x18(%rax,%r13), %rcx
movq 0x20(%rax,%r13), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
ja 0x69b8
shrq $0x2, %rbp
movq 0x18(%rsp), %r14
addl %ebp, %r14d
incq %r15
movslq 0xc(%rbx), %rcx
cmpq %rcx, %r15
jl 0x694d
movq 0xf594(%rip), %rdi      # 0x15fd8
leaq 0x9a4b(%rip), %rsi      # 0x10496
movl $0x11, %edx
callq 0x32e0
movq 0xf57c(%rip), %rdi      # 0x15fd8
movl %r14d, %esi
callq 0x3440
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x70(%rsp), %rdi
movl $0x10, %edx
callq 0x32c0
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x5e2a
leaq 0x70(%rsp), %rdi
callq 0x3350
movq 0xf505(%rip), %rax      # 0x15fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x78(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x70(%rsp,%rcx)
callq 0x3220
leaq 0x168(%rsp), %rdi
callq 0x30e0
leaq 0x20(%rsp), %rdi
callq 0xcb58
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6b34
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xbe1c
jmp 0x6b41
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3380
jmp 0x6b37
jmp 0x6b34
jmp 0x6b34
jmp 0x6b34
jmp 0x6b34
jmp 0x6b34
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xcb58
movq %rbx, %rdi
callq 0x3460
nop