// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::BFSSubQuery(std::set<unsigned int, std::less<unsigned int>, std::allocator<unsigned int>>&, unsigned int, unsigned int, std::vector<bool, std::allocator<bool>>&)
unsigned int Graph::BFSSubQuery(set<unsigned int>& qvertice, const unsigned int v, unsigned int depth, vector<bool>& flag){
	unsigned int tmpu, tmpv;
	set<unsigned int> nextset;
	set<unsigned int>::iterator sit;

	if(qvertice.empty()){
		return INT_MAX;
	}

	for(sit=qvertice.begin(); sit!=qvertice.end(); sit++){
		tmpu=*sit;
		if(tmpu==v)
			return depth;
		flag[tmpu]=true;

		for(int i=0; i<graph[tmpu].outList.size(); i++){
			tmpv=graph[tmpu].outList[i];
			if(flag[tmpv]==false && nextset.find(tmpv)==nextset.end() ){
				nextset.insert(tmpv);
			}
		}
	}

	qvertice=nextset;
	nextset.clear();

	return BFSSubQuery(qvertice, v, depth+1, flag);
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x118(%rsp)
movq %rsi, 0x110(%rsp)
movl %edx, 0x10c(%rsp)
movl %ecx, 0x108(%rsp)
movq %r8, 0x100(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x13320
leaq 0xc0(%rsp), %rdi
callq 0x133a0
movq 0x110(%rsp), %rdi
callq 0x133c0
testb $0x1, %al
jne 0xb3e7
jmp 0xb402
movl $0x7fffffff, 0x124(%rsp) # imm = 0x7FFFFFFF
movl $0x1, 0xbc(%rsp)
jmp 0xb709
movq 0x110(%rsp), %rdi
callq 0x133e0
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x110(%rsp), %rdi
callq 0x13430
movq %rax, 0xa8(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x13410
testb $0x1, %al
jne 0xb45a
jmp 0xb6a1
leaq 0xc0(%rsp), %rdi
callq 0x13460
movl (%rax), %eax
movl %eax, 0xfc(%rsp)
movl 0xfc(%rsp), %eax
cmpl 0x10c(%rsp), %eax
jne 0xb49e
movl 0x108(%rsp), %eax
movl %eax, 0x124(%rsp)
movl $0x1, 0xbc(%rsp)
jmp 0xb709
movq 0x100(%rsp), %rdi
movl 0xfc(%rsp), %eax
movl %eax, %esi
callq 0x12f10
movq %rdx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
jmp 0xb4c0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
leaq 0x98(%rsp), %rdi
movl $0x1, %esi
callq 0x12f70
movl $0x0, 0x88(%rsp)
movq 0x48(%rsp), %rdi
movslq 0x88(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $0x48, %rdi
movl 0xfc(%rsp), %eax
movl %eax, %esi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
callq 0x4c10
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0xb686
movq 0x48(%rsp), %rdi
addq $0x48, %rdi
movl 0xfc(%rsp), %eax
movl %eax, %esi
callq 0x11d60
movq %rax, %rdi
addq $0x18, %rdi
movslq 0x88(%rsp), %rsi
callq 0x12960
movl (%rax), %eax
movl %eax, 0xf8(%rsp)
movq 0x100(%rsp), %rdi
movl 0xf8(%rsp), %eax
movl %eax, %esi
callq 0x12f10
movq %rdx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
jmp 0xb58e
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x12fc0
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x1f(%rsp)
jne 0xb60a
leaq 0xc8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x134a0
movq %rax, 0x10(%rsp)
jmp 0xb5db
movq 0x10(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x13430
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x13480
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xb614
jmp 0xb66e
leaq 0xc8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x13330
movb %dl, 0x7(%rsp)
movq %rax, 0x8(%rsp)
jmp 0xb634
movb 0x7(%rsp), %al
movq 0x8(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movb %al, 0x60(%rsp)
jmp 0xb66e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x13390
jmp 0xb725
jmp 0xb670
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0xb4f7
jmp 0xb688
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x134e0
movq %rax, 0x50(%rsp)
jmp 0xb427
movq 0x110(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x13520
jmp 0xb6b8
leaq 0xc8(%rsp), %rdi
callq 0x13550
movq 0x48(%rsp), %rdi
movq 0x110(%rsp), %rsi
movl 0x10c(%rsp), %edx
movl 0x108(%rsp), %ecx
incl %ecx
movq 0x100(%rsp), %r8
callq 0xb380
movl %eax, (%rsp)
jmp 0xb6f4
movl (%rsp), %eax
movl %eax, 0x124(%rsp)
movl $0x1, 0xbc(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x13390
movl 0x124(%rsp), %eax
addq $0x128, %rsp            # imm = 0x128
retq
movq 0x90(%rsp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)