// File: /workspace/github_cpp_makefile_star2_O1/bowenfan96[P]icl-mcs-enigma/enigma.cpp
// Function: Enigma::is_one_to_one(std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>> const&)
bool Enigma::is_one_to_one(const std::vector<int>& map_from, const std::vector<int>& map_to) 
{
    // check if both arrays contain only unique elements
    int sz = map_to.size();
    
    std::unordered_set<int> set1;
    for(int i=0; i < sz; i++) {
        if(!set1.insert(map_from[i]).second) {
            return false;
        }
    }
    std::unordered_set<int> set2;
    for(int i=0; i < sz; i++) {
        if(!set2.insert(map_to[i]).second) {
            return false;
        }
    }
    
    // check if an index maps to itself
    for(int i=0; i < sz; i++) {
        if(map_from.at(i) == map_to.at(i)) {
            return false;
        }
    }
    
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
movq 0x8(%rsi), %rcx
movq %rsi, -0x38(%rbp)
subq (%rsi), %rcx
shrq $0x2, %rcx
leaq -0x80(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq %rcx, -0x30(%rbp)
testl %ecx, %ecx
jle 0x2c9b
movq -0x30(%rbp), %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
leaq -0xb0(%rbp), %r15
leaq -0x78(%rbp), %r12
movq (%r14), %rsi
addq %rbx, %rsi
movq %r15, -0x78(%rbp)
movq %r15, %rdi
movq %r12, %rdx
callq 0x4d3a
testb $0x1, %dl
je 0x2d86
addq $0x4, %rbx
decq %r13
jne 0x2c74
leaq -0x48(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
cmpl $0x0, -0x30(%rbp)
jle 0x2d03
movq -0x30(%rbp), %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
leaq -0x78(%rbp), %r15
leaq -0x40(%rbp), %r12
movq -0x38(%rbp), %rax
movq (%rax), %rsi
addq %rbx, %rsi
movq %r15, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rdx
callq 0x4d3a
testb $0x1, %dl
je 0x2d8b
addq $0x4, %rbx
decq %r13
jne 0x2cd8
movq -0x30(%rbp), %rbx
testl %ebx, %ebx
setle %r15b
jle 0x2d8e
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movq -0x38(%rbp), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rcx
subq %rsi, %rcx
sarq $0x2, %rcx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq %rcx, %rdi
negq %rdi
movq %rdx, %r8
negq %r8
movq %rbx, %r9
negq %r9
movl $0x1, %r10d
leaq (%r8,%r10), %r11
cmpq $0x1, %r11
je 0x2dbf
leaq (%rdi,%r10), %r11
cmpq $0x1, %r11
je 0x2dbc
movl -0x4(%rax,%r10,4), %r11d
cmpl -0x4(%rsi,%r10,4), %r11d
je 0x2d8e
cmpq %rbx, %r10
setae %r15b
leaq (%r9,%r10), %r11
incq %r11
incq %r10
cmpq $0x1, %r11
jne 0x2d4d
jmp 0x2d8e
xorl %r15d, %r15d
jmp 0x2d97
xorl %r15d, %r15d
leaq -0x78(%rbp), %rdi
callq 0x48f4
leaq -0xb0(%rbp), %rdi
callq 0x48f4
andb $0x1, %r15b
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, %rdx
leaq 0x36b4(%rip), %rdi      # 0x647a
movq %rdx, %rsi
xorl %eax, %eax
callq 0x2240
jmp 0x2dd2
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x48f4
jmp 0x2de3
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x48f4
movq %rbx, %rdi
callq 0x22b0
nop