// File: BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: NotValidToValid(ROAGroup, ROAGroup, std::unordered_map<int, PrefixRange*, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, PrefixRange*>>>*)
void NotValidToValid(ROAGroup newPrefixes, ROAGroup oldPrefixes, unordered_map<int, PrefixRange*>* notValidToValidPrefixes){ 
  set<int>* ASes = newPrefixes.getASes();

  for( set<int>::iterator i = ASes->begin(); i != ASes->end(); ++i) {
    int as = *i;

    PrefixRange* rPrimeValid = newPrefixes.getByAS(as); 

    PrefixRange empty = PrefixRange();

    PrefixRange* oldValid = &empty; 

    // If oldPrefixes has the as we are working on then set it
    if ( oldPrefixes.hasAS(as) ) oldValid = oldPrefixes.getByAS(as); 

    rPrimeValid->denseIntersectWith( oldValid->complement() , true);

    if ( ! rPrimeValid->empty() ) notValidToValidPrefixes->insert( make_pair(as, new PrefixRange( *rPrimeValid ) ) );
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0xc0(%rbp)
movq %rsi, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0x5bf0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5c10
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5c70
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5c40
testb $0x1, %al
jne 0x3d2e
jmp 0x3f37
leaq -0x28(%rbp), %rdi
callq 0x5ca0
movq -0xc0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %esi
callq 0x5cc0
movq %rax, -0x40(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x5fd0
movq -0xd0(%rbp), %rax
movq -0xb8(%rbp), %rdi
movq %rax, -0x60(%rbp)
movl -0x34(%rbp), %esi
callq 0x6030
movb %al, -0xc1(%rbp)
jmp 0x3d81
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x3d8d
jmp 0x3dc3
movq -0xb8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x5cc0
movq %rax, -0xd8(%rbp)
jmp 0x3da5
movq -0xd8(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x3dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3f2c
movq -0x40(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x60(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x6080
jmp 0x3de0
movq -0xe0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x1, %edx
callq 0x5ed0
jmp 0x3dfa
leaq -0x88(%rbp), %rdi
callq 0x61e0
movq -0x40(%rbp), %rdi
callq 0x62a0
movb %al, -0xe1(%rbp)
jmp 0x3e17
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x3f15
jmp 0x3e27
movq -0x18(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl $0x18, %edi
callq 0x3270
movq %rax, -0xf0(%rbp)
jmp 0x3e45
movq -0xf0(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x6380
jmp 0x3e57
movq -0xf0(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x34(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6350
movq %rdx, -0x108(%rbp)
movl %eax, -0xfc(%rbp)
jmp 0x3e84
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl -0xfc(%rbp), %ecx
movl %ecx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x6310
movb %dl, -0x111(%rbp)
movq %rax, -0x110(%rbp)
jmp 0x3ec0
movb -0x111(%rbp), %al
movq -0x110(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movb %al, -0xa8(%rbp)
jmp 0x3f15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x61e0
jmp 0x3f2c
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x18, %esi
callq 0x3280
jmp 0x3f2c
leaq -0x58(%rbp), %rdi
callq 0x61e0
leaq -0x28(%rbp), %rdi
callq 0x5d20
jmp 0x3d0b
leaq -0x58(%rbp), %rdi
callq 0x61e0
jmp 0x3f40
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3400
nopl (%rax)