// File: datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::HugeNodeListUnion(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>> const&)
void Graph::HugeNodeListUnion(vector<int>& v1, const vector<int>& v2){
	int v1size=v1.size(), v2size=v2.size();

	if(v1size==0){
		v1=v2;
		return;
	}

	if(vl[v1[v1size-1]].outdegree > vl[v2[0]].outdegree){
		if(v1size==HUGENODENUM)
			return ;
		else{
			if(v2.begin()+HUGENODENUM-v1size < v2.end())
				v1.insert(v1.end(), v2.begin(), v2.begin()+HUGENODENUM-v1size);
			else
				v1.insert(v1.end(), v2.begin(), v2.end());
			return ;
		}
	}

/*
	if(v1size==1){
		int i=0;
		for(; i<v2size; i++){
			if(vl[v2[i]].outdegree <= vl[v1[0]].outdegree){
				break;
			}
		}
		if(i<HUGENODENUM)
			v1.insert(v1.begin(), v2.begin(), v2.begin()+i);
		else{
			v1=v2;
			return ;
		}
		while(i<v2size && vl[v2[i]].outdegree==vl[v1[0]].outdegree){
			i++;
		}
		if(i<v2size)
			if(v2size==HUGENODENUM)
				v1.insert(v1.end(), v2.begin()+i, v2.begin()+HUGENODENUM-1);
			else
				v1.insert(v1.end(), v2.begin()+i, v2.end());
		return ;
	}
*/

	int k=0;
	int i=0, j=0;
	static vector<int> v(HUGENODENUM);
	v.clear();

	while(k<HUGENODENUM && i<v1size && j<v2size){
		if(vl[v1[i]].outdegree==vl[v2[j]].outdegree){
			if(v1[i]==v2[j]){
				v.push_back(v1[i]);
				i++;
				j++;
				k++;
			}else if(v1[i]<v2[j]){
				v.push_back(v1[i]);
				i++;
				k++;
			}else{
				v.push_back(v2[j]);
				j++;
				k++;
			}
		}else if(vl[v1[i]].outdegree>vl[v2[j]].outdegree){
			v.push_back(v1[i]);
			k++;
			i++;
		}else{
			v.push_back(v2[j]);
			k++;
			j++;
		}
	}

	if(k==HUGENODENUM){
		v1=v;
		return;
	}else{
		if(k==HUGENODENUM+1){
			cout << "bug..." << endl;
			v.pop_back();
			v1=v;
			return ;
		}else if(k>HUGENODENUM+1){
			cout << "bug..." << endl;
			return ;
		}
	}

	if(i!=v1size){
		if(v1.end() < v1.begin()+i+HUGENODENUM-v.size())
			v.insert(v.end(), v1.begin()+i, v1.end());
		else
			v.insert(v.end(), v1.begin()+i, v1.begin()+i+HUGENODENUM-v.size());
	}
	if(j!=v2size){
		if(v2.end() < v2.begin()+j+HUGENODENUM-v.size())
			v.insert(v.end(), v2.begin()+j, v2.end());
		else
			v.insert(v.end(), v2.begin()+j, v2.begin()+j+HUGENODENUM-v.size());
	}

	v1=v;
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x270(%rsp)
movq %rsi, 0x268(%rsp)
movq %rdx, 0x260(%rsp)
movq 0x270(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x268(%rsp), %rdi
callq 0x4c10
movl %eax, 0x25c(%rsp)
movq 0x260(%rsp), %rdi
callq 0x4c10
movl %eax, 0x258(%rsp)
cmpl $0x0, 0x25c(%rsp)
jne 0xeed8
movq 0x260(%rsp), %rsi
movq 0x268(%rsp), %rdi
callq 0x11fb0
jmp 0xfb05
movq 0x70(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x58(%rsp)
movq 0x268(%rsp), %rdi
movl 0x25c(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x12960
movq 0x58(%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movq 0x70(%rsp), %rax
movl 0xc(%rcx), %ecx
movl %ecx, 0x6c(%rsp)
addq $0x30, %rax
movq %rax, 0x60(%rsp)
movq 0x260(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x13300
movq 0x60(%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movl 0x6c(%rsp), %eax
cmpl 0xc(%rcx), %eax
jle 0xf14d
movq 0x70(%rsp), %rcx
movl 0x25c(%rsp), %eax
cmpl 0x4(%rcx), %eax
jne 0xef69
jmp 0xfb05
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x240(%rsp)
movslq 0x4(%rax), %rsi
leaq 0x240(%rsp), %rdi
callq 0x139d0
movq %rax, 0x248(%rsp)
movslq 0x25c(%rsp), %rsi
leaq 0x248(%rsp), %rdi
callq 0x13a10
movq %rax, 0x250(%rsp)
movq 0x260(%rsp), %rdi
callq 0x13a60
movq %rax, 0x238(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x13960
testb $0x1, %al
jne 0xefef
jmp 0xf0bd
movq 0x268(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x268(%rsp), %rdi
callq 0x122e0
movq %rax, 0x228(%rsp)
leaq 0x230(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x13b50
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0x220(%rsp)
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x208(%rsp)
movslq 0x4(%rax), %rsi
leaq 0x208(%rsp), %rdi
callq 0x139d0
movq %rax, 0x210(%rsp)
movslq 0x25c(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x13a10
movq 0x50(%rsp), %rdi
movq %rax, 0x218(%rsp)
movq 0x230(%rsp), %rsi
movq 0x220(%rsp), %rdx
movq 0x218(%rsp), %rcx
callq 0x13a90
movq %rax, 0x200(%rsp)
jmp 0xf148
movq 0x268(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x268(%rsp), %rdi
callq 0x122e0
movq %rax, 0x1f0(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x13b50
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0x1e8(%rsp)
movq 0x260(%rsp), %rdi
callq 0x13a60
movq 0x48(%rsp), %rdi
movq %rax, 0x1e0(%rsp)
movq 0x1f8(%rsp), %rsi
movq 0x1e8(%rsp), %rdx
movq 0x1e0(%rsp), %rcx
callq 0x13a90
movq %rax, 0x1d8(%rsp)
jmp 0xfb05
movl $0x0, 0x1d4(%rsp)
movl $0x0, 0x1d0(%rsp)
movl $0x0, 0x1cc(%rsp)
cmpb $0x0, 0x26283(%rip)     # 0x353f8
jne 0xf1f3
leaq 0x2627a(%rip), %rdi     # 0x353f8
callq 0x3500
cmpl $0x0, %eax
je 0xf1f3
movq 0x70(%rsp), %rax
movslq 0x4(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x1cb(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x12990
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x26227(%rip), %rdi     # 0x353e0
callq 0x129a0
jmp 0xf1c0
leaq 0x1cb(%rsp), %rdi
callq 0x12a20
leaq 0x23cc(%rip), %rdi      # 0x115a0
leaq 0x26205(%rip), %rsi     # 0x353e0
leaq 0x260ee(%rip), %rdx     # 0x352d0
callq 0x3260
leaq 0x2620a(%rip), %rdi     # 0x353f8
callq 0x31e0
leaq 0x261e6(%rip), %rdi     # 0x353e0
callq 0x11be0
movq 0x70(%rsp), %rdx
movl 0x1d4(%rsp), %ecx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, 0x37(%rsp)
jge 0xf241
movl 0x1d0(%rsp), %ecx
xorl %eax, %eax
cmpl 0x25c(%rsp), %ecx
movb %al, 0x37(%rsp)
jge 0xf241
movl 0x1cc(%rsp), %eax
cmpl 0x258(%rsp), %eax
setl %al
movb %al, 0x37(%rsp)
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0xf24e
jmp 0xf56e
movq 0x70(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x20(%rsp)
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movq 0x20(%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movq 0x70(%rsp), %rax
movl 0xc(%rcx), %ecx
movl %ecx, 0x30(%rsp)
addq $0x30, %rax
movq %rax, 0x28(%rsp)
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq 0x28(%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movl 0x30(%rsp), %eax
cmpl 0xc(%rcx), %eax
jne 0xf465
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq %rax, %rcx
movl 0x1c(%rsp), %eax
cmpl (%rcx), %eax
jne 0xf395
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movq %rax, %rsi
leaq 0x260ba(%rip), %rdi     # 0x353e0
callq 0x12660
movl 0x1d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d0(%rsp)
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
jmp 0xf460
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x1cb(%rsp), %rdi
callq 0x12a20
leaq 0x2606d(%rip), %rdi     # 0x353f8
callq 0x31d0
jmp 0xfb0d
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movl (%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq %rax, %rcx
movl 0x18(%rsp), %eax
cmpl (%rcx), %eax
jge 0xf418
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movq %rax, %rsi
leaq 0x25ff1(%rip), %rdi     # 0x353e0
callq 0x12660
movl 0x1d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d0(%rsp)
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
jmp 0xf45e
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq %rax, %rsi
leaq 0x25fa9(%rip), %rdi     # 0x353e0
callq 0x12660
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
jmp 0xf460
jmp 0xf569
movq 0x70(%rsp), %rax
addq $0x30, %rax
movq %rax, (%rsp)
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movq (%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movq 0x70(%rsp), %rax
movl 0xc(%rcx), %ecx
movl %ecx, 0x14(%rsp)
addq $0x30, %rax
movq %rax, 0x8(%rsp)
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq 0x8(%rsp), %rdi
movslq (%rax), %rsi
callq 0x11d40
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl 0xc(%rcx), %eax
jle 0xf521
movq 0x268(%rsp), %rdi
movslq 0x1d0(%rsp), %rsi
callq 0x12960
movq %rax, %rsi
leaq 0x25ee8(%rip), %rdi     # 0x353e0
callq 0x12660
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
movl 0x1d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d0(%rsp)
jmp 0xf567
movq 0x260(%rsp), %rdi
movslq 0x1cc(%rsp), %rsi
callq 0x13300
movq %rax, %rsi
leaq 0x25ea0(%rip), %rdi     # 0x353e0
callq 0x12660
movl 0x1d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d4(%rsp)
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
jmp 0xf569
jmp 0xf1ff
movq 0x70(%rsp), %rcx
movl 0x1d4(%rsp), %eax
cmpl 0x4(%rcx), %eax
jne 0xf598
movq 0x268(%rsp), %rdi
leaq 0x25e52(%rip), %rsi     # 0x353e0
callq 0x11fb0
jmp 0xfb05
movq 0x70(%rsp), %rcx
movl 0x1d4(%rsp), %eax
movl 0x4(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0xf5f5
movq 0x25a23(%rip), %rdi     # 0x34fd8
leaq 0x18fc5(%rip), %rsi     # 0x28581
callq 0x32c0
movq %rax, %rdi
movq 0x259fd(%rip), %rsi     # 0x34fc8
callq 0x3300
leaq 0x25e09(%rip), %rdi     # 0x353e0
callq 0x14320
movq 0x268(%rsp), %rdi
leaq 0x25df5(%rip), %rsi     # 0x353e0
callq 0x11fb0
jmp 0xfb05
movq 0x70(%rsp), %rcx
movl 0x1d4(%rsp), %eax
movl 0x4(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0xf632
movq 0x259c6(%rip), %rdi     # 0x34fd8
leaq 0x18f68(%rip), %rsi     # 0x28581
callq 0x32c0
movq %rax, %rdi
movq 0x259a0(%rip), %rsi     # 0x34fc8
callq 0x3300
jmp 0xfb05
jmp 0xf634
jmp 0xf636
movl 0x1d0(%rsp), %eax
cmpl 0x25c(%rsp), %eax
je 0xf895
movq 0x268(%rsp), %rdi
callq 0x122e0
movq %rax, 0x1b0(%rsp)
movq 0x268(%rsp), %rdi
callq 0x12270
movq %rax, 0x190(%rsp)
movslq 0x1d0(%rsp), %rsi
leaq 0x190(%rsp), %rdi
callq 0x13bd0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x198(%rsp)
movslq 0x4(%rax), %rsi
leaq 0x198(%rsp), %rdi
callq 0x13bd0
movq %rax, 0x1a0(%rsp)
leaq 0x25d27(%rip), %rdi     # 0x353e0
callq 0x4c10
movq %rax, %rsi
leaq 0x1a0(%rsp), %rdi
callq 0x13c10
movq %rax, 0x1a8(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x13b90
testb $0x1, %al
jne 0xf6f4
jmp 0xf795
leaq 0x25ce5(%rip), %rdi     # 0x353e0
callq 0x122e0
movq %rax, 0x180(%rsp)
leaq 0x188(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x13b50
movq 0x268(%rsp), %rdi
callq 0x12270
movq %rax, 0x170(%rsp)
movslq 0x1d0(%rsp), %rsi
leaq 0x170(%rsp), %rdi
callq 0x13bd0
movq %rax, 0x178(%rsp)
movq 0x268(%rsp), %rdi
callq 0x122e0
movq %rax, 0x168(%rsp)
movq 0x188(%rsp), %rsi
movq 0x178(%rsp), %rdx
movq 0x168(%rsp), %rcx
leaq 0x25c5d(%rip), %rdi     # 0x353e0
callq 0x13c60
movq %rax, 0x160(%rsp)
jmp 0xf893
leaq 0x25c44(%rip), %rdi     # 0x353e0
callq 0x122e0
movq %rax, 0x150(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x13b50
movq 0x268(%rsp), %rdi
callq 0x12270
movq %rax, 0x140(%rsp)
movslq 0x1d0(%rsp), %rsi
leaq 0x140(%rsp), %rdi
callq 0x13bd0
movq %rax, 0x148(%rsp)
movq 0x268(%rsp), %rdi
callq 0x12270
movq %rax, 0x120(%rsp)
movslq 0x1d0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x13bd0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x128(%rsp)
movslq 0x4(%rax), %rsi
leaq 0x128(%rsp), %rdi
callq 0x13bd0
movq %rax, 0x130(%rsp)
leaq 0x25b96(%rip), %rdi     # 0x353e0
callq 0x4c10
movq %rax, %rsi
leaq 0x130(%rsp), %rdi
callq 0x13c10
movq %rax, 0x138(%rsp)
movq 0x158(%rsp), %rsi
movq 0x148(%rsp), %rdx
movq 0x138(%rsp), %rcx
leaq 0x25b5a(%rip), %rdi     # 0x353e0
callq 0x13c60
movq %rax, 0x118(%rsp)
jmp 0xf895
movl 0x1cc(%rsp), %eax
cmpl 0x258(%rsp), %eax
je 0xfaf1
movq 0x260(%rsp), %rdi
callq 0x13a60
movq %rax, 0x110(%rsp)
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0xf0(%rsp)
movslq 0x1cc(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x139d0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0xf8(%rsp)
movslq 0x4(%rax), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x139d0
movq %rax, 0x100(%rsp)
leaq 0x25ac8(%rip), %rdi     # 0x353e0
callq 0x4c10
movq %rax, %rsi
leaq 0x100(%rsp), %rdi
callq 0x13a10
movq %rax, 0x108(%rsp)
leaq 0x110(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x13960
testb $0x1, %al
jne 0xf953
jmp 0xf9f4
leaq 0x25a86(%rip), %rdi     # 0x353e0
callq 0x122e0
movq %rax, 0xe0(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x13b50
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0xd0(%rsp)
movslq 0x1cc(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x139d0
movq %rax, 0xd8(%rsp)
movq 0x260(%rsp), %rdi
callq 0x13a60
movq %rax, 0xc8(%rsp)
movq 0xe8(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq 0xc8(%rsp), %rcx
leaq 0x259fe(%rip), %rdi     # 0x353e0
callq 0x13a90
movq %rax, 0xc0(%rsp)
jmp 0xfaef
leaq 0x259e5(%rip), %rdi     # 0x353e0
callq 0x122e0
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x13b50
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0xa0(%rsp)
movslq 0x1cc(%rsp), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x139d0
movq %rax, 0xa8(%rsp)
movq 0x260(%rsp), %rdi
callq 0x139a0
movq %rax, 0x80(%rsp)
movslq 0x1cc(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x139d0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x88(%rsp)
movslq 0x4(%rax), %rsi
leaq 0x88(%rsp), %rdi
callq 0x139d0
movq %rax, 0x90(%rsp)
leaq 0x25937(%rip), %rdi     # 0x353e0
callq 0x4c10
movq %rax, %rsi
leaq 0x90(%rsp), %rdi
callq 0x13a10
movq %rax, 0x98(%rsp)
movq 0xb8(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x98(%rsp), %rcx
leaq 0x258fb(%rip), %rdi     # 0x353e0
callq 0x13a90
movq %rax, 0x78(%rsp)
jmp 0xfaf1
movq 0x268(%rsp), %rdi
leaq 0x258e0(%rip), %rsi     # 0x353e0
callq 0x11fb0
addq $0x278, %rsp            # imm = 0x278
retq
movq 0x1c0(%rsp), %rdi
callq 0x34e0
nopw (%rax,%rax)