// File: /workspace/github_cpp_makefile_star2_O1/datourat[P]IP-label-for-graph-reachability/Graph.cpp
// Function: Graph::VectorUnion(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>> const&)
void Graph::VectorUnion(vector<int>& v1, const vector<int>& v2){
        unsigned int v1size=v1.size(), v2size=v2.size();

        if(v1[v1size-1] < v2[0]){
                if(v1size==KEYNUM)
                        return ;
                else{
                        if(v2.begin()+KEYNUM-v1size < v2.end())
                                v1.insert(v1.end(), v2.begin(), v2.begin()+KEYNUM-v1size);
                        else
                                v1.insert(v1.end(), v2.begin(), v2.end());
                        return ;
                }
        }

        if(v1size==1){
                int i=0;
                for(; i<v2size; i++){
                        if(v2[i] >= v1[0]){
                                break;
                        }
                }
                if(i<KEYNUM)
                        v1.insert(v1.begin(), v2.begin(), v2.begin()+i);
                else{
                        v1=v2;
                        return ;
                }
                while(i<v2size && v2[i]==v1[0]){
                        i++;
                }
                if(v2size==KEYNUM&&i<v2size)
                        v1.insert(v1.end(), v2.begin()+i, v2.begin()+KEYNUM-1);
                else
                        v1.insert(v1.end(), v2.begin()+i, v2.end());
                return ;
        }


        int k=0;
        unsigned int i=0, j=0;
        static vector<int> v(KEYNUM);
        v.clear();

        while(k<KEYNUM && i<v1size && j<v2size){
                if(v1[i]==v2[j]){
                        v.push_back(v1[i]);
                        k++;
                        i++;
                        j++;
                }else if(v1[i]<v2[j]){
                        v.push_back(v1[i]);
                        k++;
                        i++;
                }else{
                        v.push_back(v2[j]);
                        k++;
                        j++;
                }
        }

        if(k>=KEYNUM){
                v1=v;
                return;
        }

        if(i!=v1size){
                if(v1.end() < v1.begin()+i+KEYNUM-v.size())
                        v.insert(v.end(), v1.begin()+i, v1.end());
                else
                        v.insert(v.end(), v1.begin()+i, v1.begin()+i+KEYNUM-v.size());
//              for(; k<KEYNUM && i<v1size; i++, k++){
//                      v.push_back(v1[i]);
//              }
        }
        if(j!=v2size){
                if(v2.end() < v2.begin()+j+KEYNUM-v.size())
                        v.insert(v.end(), v2.begin()+j, v2.end());
                else
                        v.insert(v.end(), v2.begin()+j, v2.begin()+j+KEYNUM-v.size());
//              for(; k<KEYNUM && j<v2size; j++, k++){
//                      v.push_back(v2[j]);
//              }
        }

        v1=v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r10
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq (%rsi), %rsi
movq 0x8(%r10), %rax
subq %rsi, %rax
movq %rax, %rbp
sarq $0x2, %rbp
movq (%rdx), %rdx
movq 0x8(%r14), %r15
leal (%r12,%rbp), %ecx
movl (%rsi,%rcx,4), %ecx
cmpl (%rdx), %ecx
jge 0x91ae
movslq (%rdi), %rcx
cmpl %ebp, %ecx
je 0x9484
leaq (%rdx,%rcx,4), %rcx
movl %ebp, %edi
shlq $0x2, %rdi
subq %rdi, %rcx
addq %rax, %rsi
movq %r10, %rdi
cmpq %r15, %rcx
jb 0x94cd
movq %r15, %rcx
jmp 0x94cd
subq %rdx, %r15
shrq $0x2, %r15
cmpl $0x1, %ebp
movq %rdi, (%rsp)
jne 0x91e9
testl %r15d, %r15d
je 0x932e
movl (%rsi), %eax
movl %r15d, %ecx
xorl %r13d, %r13d
cmpl %eax, (%rdx,%r13,4)
jge 0x9331
incq %r13
cmpq %r13, %rcx
jne 0x91cf
movl %r15d, %r13d
jmp 0x9331
movb 0xd0d1(%rip), %al       # 0x162c0
testb %al, %al
movq %r10, 0x8(%rsp)
je 0x94e0
movq 0xd0a5(%rip), %rax      # 0x162a8
cmpq %rax, 0xd0a6(%rip)      # 0x162b0
je 0x9213
movq %rax, 0xd09d(%rip)      # 0x162b0
movl (%rdi), %eax
xorl %r13d, %r13d
testl %eax, %eax
setg %cl
jle 0x93db
testl %ebp, %ebp
je 0x93db
movl $0x0, %r12d
testl %r15d, %r15d
je 0x93de
xorl %r12d, %r12d
movl $0x1, %ebx
xorl %r13d, %r13d
movl %r12d, %eax
movq (%r10), %rcx
leaq (%rcx,%rax,4), %rdx
movl (%rdx), %eax
movl %r13d, %ecx
movq (%r14), %r11
movl (%r11,%rcx,4), %r8d
cmpl %r8d, %eax
jne 0x927f
movq 0xd049(%rip), %rsi      # 0x162b0
cmpq 0xd04a(%rip), %rsi      # 0x162b8
je 0x92b8
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd033(%rip)      # 0x162b0
jmp 0x92cd
movq 0xd02a(%rip), %rsi      # 0x162b0
movq 0xd02b(%rip), %r9       # 0x162b8
jge 0x92a3
cmpq %r9, %rsi
je 0x92d5
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xd00f(%rip)      # 0x162b0
jmp 0x92ea
cmpq %r9, %rsi
je 0x9313
movl %r8d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xcffa(%rip)      # 0x162b0
jmp 0x92d0
leaq 0xcfe9(%rip), %rdi      # 0x162a8
callq 0xdde8
movq (%rsp), %rdi
movq 0x8(%rsp), %r10
incl %r12d
incl %r13d
jmp 0x92ed
leaq 0xcfcc(%rip), %rdi      # 0x162a8
callq 0xdde8
movq (%rsp), %rdi
movq 0x8(%rsp), %r10
incl %r12d
movl (%rdi), %eax
cmpl %eax, %ebx
setl %cl
jge 0x93de
cmpl %ebp, %r12d
jae 0x93de
incl %ebx
cmpl %r15d, %r13d
jb 0x9245
jmp 0x93de
leaq (%r11,%rcx,4), %rdx
leaq 0xcf8a(%rip), %rdi      # 0x162a8
callq 0xdde8
movq (%rsp), %rdi
movq 0x8(%rsp), %r10
jmp 0x92d0
xorl %r13d, %r13d
cmpl (%rdi), %r13d
jge 0x935c
movl %r13d, %ebx
leaq (%rdx,%rbx,4), %rcx
movq %r10, %rdi
movq %r10, %rbp
callq 0xef18
cmpl %r15d, %r13d
setae %cl
jb 0x9375
movq %rbp, %rdi
movq (%rsp), %r10
jmp 0x94a2
movq %r10, %rdi
movq %r14, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc2b6
movq (%rbp), %rax
movq (%r14), %rdx
movl (%rax), %eax
cmpl %eax, (%rdx,%rbx,4)
movq %rbp, %rdi
movq (%rsp), %r10
jne 0x94a2
movl %r15d, %ecx
leaq (%rdx,%rbx,4), %rsi
addq $0x4, %rsi
movl $0x1, %edx
subl %r15d, %edx
addq %rbx, %rdx
incq %r12
xorl %r9d, %r9d
cmpl %r9d, %edx
je 0x9493
decq %r9
decq %r12
leaq 0x4(%rsi), %r8
cmpl %eax, (%rsi)
movq %r8, %rsi
je 0x93aa
movq %rbx, %rax
subq %r9, %rax
cmpq %rcx, %rax
setae %cl
subl %r12d, %ebx
movl %ebx, %r13d
jmp 0x94a2
xorl %r12d, %r12d
testb %cl, %cl
je 0x9475
cmpl %ebp, %r12d
je 0x942f
movq 0x8(%r10), %r8
movl %r12d, %edx
shlq $0x2, %rdx
addq (%r10), %rdx
cltq
leaq (%rdx,%rax,4), %rax
leaq 0xcea2(%rip), %rdi      # 0x162a8
movq 0xcea3(%rip), %rsi      # 0x162b0
movq 0xce94(%rip), %rcx      # 0x162a8
subq %rsi, %rcx
addq %rax, %rcx
cmpq %rcx, %r8
cmovbq %r8, %rcx
callq 0xf104
movq (%rsp), %rdi
movq 0x8(%rsp), %r10
cmpl %r15d, %r13d
je 0x9475
movq 0x8(%r14), %rax
movl %r13d, %edx
shlq $0x2, %rdx
addq (%r14), %rdx
movslq (%rdi), %rcx
leaq (%rdx,%rcx,4), %r8
leaq 0xce58(%rip), %rdi      # 0x162a8
movq 0xce59(%rip), %rsi      # 0x162b0
movq 0xce4a(%rip), %rcx      # 0x162a8
subq %rsi, %rcx
addq %r8, %rcx
cmpq %rcx, %rax
cmovbq %rax, %rcx
callq 0xef18
movq 0x8(%rsp), %r10
leaq 0xce2c(%rip), %rsi      # 0x162a8
movq %r10, %rdi
callq 0xc2b6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq %r9, %rbx
incq %rbx
cmpq %rcx, %rbx
setae %cl
movl %r15d, %r13d
movq 0x8(%rdi), %rsi
movq (%r14), %rax
movl %r13d, %edx
leaq (%rax,%rdx,4), %rdx
testb %cl, %cl
jne 0x94c9
movl (%r10), %ecx
cmpl %r15d, %ecx
jne 0x94c9
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rcx
addq $-0x4, %rcx
jmp 0x94cd
movq 0x8(%r14), %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xef18
leaq 0xcdd9(%rip), %rdi      # 0x162c0
callq 0x3480
movq (%rsp), %rdi
movq 0x8(%rsp), %r10
testl %eax, %eax
je 0x91fc
movslq (%rdi), %rsi
leaq 0xcda1(%rip), %rdi      # 0x162a8
leaq 0x17(%rsp), %rdx
callq 0xc488
leaq 0x2a8e(%rip), %rdi      # 0xbfa6
leaq 0xcd89(%rip), %rsi      # 0x162a8
leaq 0xcd52(%rip), %rdx      # 0x16278
callq 0x3240
leaq 0xcd8e(%rip), %rdi      # 0x162c0
callq 0x31a0
movq 0x8(%rsp), %r10
movq (%rsp), %rdi
jmp 0x91fc
movq %rax, %rbx
leaq 0xcd71(%rip), %rdi      # 0x162c0
callq 0x3190
movq %rbx, %rdi
callq 0x3460