// File: canzarlab[P]Trajan/src/match.cpp
// Function: verify(tree const&, tree const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&)
bool verify(const tree& t1, const tree& t2, vector<pair<int, int>>& matching)
{
    // ancestry relationship tables
    array2d D1(t1.n, t1.n, 0), D2(t2.n, t2.n, 0);
    make_trans(t1, t1.r, D1);
    make_trans(t2, t2.r, D2);

    // check for pairwise conflicts
    for (int i = 0; i < matching.size(); ++i)
    {
        for (int j = i + 1; j < matching.size(); ++j)
        {
            if (!valid(matching[i], matching[j], D1, D2))
            {
                auto [a, b] = matching[i];
                auto [x, y] = matching[j];
                dbg(t1.rm[a]);
                dbg(t2.rm[b]);
                dbg(t1.rm[x]);
                dbg(t2.rm[y]);
                return false;
            }
        }
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x5e08(%rax), %edx
leaq -0x40(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, -0xc0(%rbp)
movl %edx, %esi
callq 0x7b70
movl -0xc0(%rbp), %ecx
movq -0x18(%rbp), %rax
movl 0x5e08(%rax), %edx
leaq -0x60(%rbp), %rdi
movl %edx, %esi
callq 0x7b70
jmp 0x69f1
movq -0x10(%rbp), %rdi
movl 0x5e10(%rdi), %esi
leaq -0x40(%rbp), %rdx
callq 0x67a0
jmp 0x6a06
movq -0x18(%rbp), %rdi
movl 0x5e10(%rdi), %esi
leaq -0x60(%rbp), %rdx
callq 0x67a0
jmp 0x6a1b
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8730
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x6da1
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movslq -0x74(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8730
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jae 0x6d91
movq -0x20(%rbp), %rdi
movslq -0x70(%rbp), %rsi
callq 0x8750
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0x8750
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x6840
movb %al, -0xd1(%rbp)
jmp 0x6ac4
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x6d81
jmp 0x6ad4
movq -0x20(%rbp), %rdi
movslq -0x70(%rbp), %rsi
callq 0x8750
movq (%rax), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x8770
movq -0xf0(%rbp), %rdi
movq %rax, -0x98(%rbp)
callq 0x8790
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0x8750
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x8770
movq -0xe8(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0x8790
movq %rax, -0xb8(%rbp)
movq 0x2748d(%rip), %rdi     # 0x2dff0
leaq 0x174da(%rip), %rsi     # 0x1e044
callq 0x42c0
movq %rax, -0xe0(%rbp)
jmp 0x6b78
movq -0xe0(%rbp), %rdi
leaq 0x174c7(%rip), %rsi     # 0x1e04d
callq 0x42c0
movq %rax, -0xf8(%rbp)
jmp 0x6b94
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movq -0x98(%rbp), %rax
movslq (%rax), %rsi
callq 0x87b0
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x42a0
movq %rax, -0x100(%rbp)
jmp 0x6bc3
movq -0x100(%rbp), %rdi
movq 0x273df(%rip), %rsi     # 0x2dfb0
callq 0x4310
jmp 0x6bd8
movq 0x27411(%rip), %rdi     # 0x2dff0
leaq 0x1746b(%rip), %rsi     # 0x1e051
callq 0x42c0
movq %rax, -0x108(%rbp)
jmp 0x6bf4
movq -0x108(%rbp), %rdi
leaq 0x1744b(%rip), %rsi     # 0x1e04d
callq 0x42c0
movq %rax, -0x110(%rbp)
jmp 0x6c10
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0xa0(%rbp), %rax
movslq (%rax), %rsi
callq 0x87b0
movq -0x110(%rbp), %rdi
movq %rax, %rsi
callq 0x42a0
movq %rax, -0x118(%rbp)
jmp 0x6c3f
movq -0x118(%rbp), %rdi
movq 0x27363(%rip), %rsi     # 0x2dfb0
callq 0x4310
jmp 0x6c54
movq 0x27395(%rip), %rdi     # 0x2dff0
leaq 0x173f8(%rip), %rsi     # 0x1e05a
callq 0x42c0
movq %rax, -0x120(%rbp)
jmp 0x6c70
movq -0x120(%rbp), %rdi
leaq 0x173cf(%rip), %rsi     # 0x1e04d
callq 0x42c0
movq %rax, -0x128(%rbp)
jmp 0x6c8c
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movq -0xb0(%rbp), %rax
movslq (%rax), %rsi
callq 0x87b0
movq -0x128(%rbp), %rdi
movq %rax, %rsi
callq 0x42a0
movq %rax, -0x130(%rbp)
jmp 0x6cbb
movq -0x130(%rbp), %rdi
movq 0x272e7(%rip), %rsi     # 0x2dfb0
callq 0x4310
jmp 0x6cd0
movq 0x27319(%rip), %rdi     # 0x2dff0
leaq 0x17385(%rip), %rsi     # 0x1e063
callq 0x42c0
movq %rax, -0x138(%rbp)
jmp 0x6cec
movq -0x138(%rbp), %rdi
leaq 0x17353(%rip), %rsi     # 0x1e04d
callq 0x42c0
movq %rax, -0x140(%rbp)
jmp 0x6d08
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
movq -0xb8(%rbp), %rax
movslq (%rax), %rsi
callq 0x87b0
movq -0x140(%rbp), %rdi
movq %rax, %rsi
callq 0x42a0
movq %rax, -0x148(%rbp)
jmp 0x6d37
movq -0x148(%rbp), %rdi
movq 0x2726b(%rip), %rsi     # 0x2dfb0
callq 0x4310
jmp 0x6d4c
movb $0x0, -0x1(%rbp)
movl $0x1, -0xbc(%rbp)
jmp 0x6daf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x6dcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7b50
jmp 0x6dcf
jmp 0x6d83
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x6a52
jmp 0x6d93
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x6a22
movb $0x1, -0x1(%rbp)
movl $0x1, -0xbc(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7b50
leaq -0x40(%rbp), %rdi
callq 0x7b50
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x7b50
movq -0x68(%rbp), %rdi
callq 0x44e0
nopw %cs:(%rax,%rax)