// File: Manca[P]algorithms2/./assignment6.hpp
// Function: assignment6::readFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::unordered_map<int, std::vector<int, std::allocator<int>>, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, std::vector<int, std::allocator<int>>>>>&, std::unordered_map<int, std::vector<int, std::allocator<int>>, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, std::vector<int, std::allocator<int>>>>>&)
void readFile(const std::string& fileName, Graph& GOrig, Graph& GRev)
    {
        std::ifstream file(fileName, std::ios::in);
        int n;
        file >> n;

        PROFILE("Reading file: " + fileName);
        if (file.is_open())
        {
            int tail, head;
            while (file >> tail >> head)
            {
                // two edges per x,y pair
                GOrig[-tail].push_back(head);   // 1) notX => y
                if (GOrig.count(head) == 0)
                    GOrig[head] = std::vector<int>();

                GOrig[-head].push_back(tail);   // 2) notY => x
                if (GOrig.count(tail) == 0)
                    GOrig[tail] = std::vector<int>();

                // the same for reversed graph
                GRev[head].push_back(-tail);
                if (GRev.count(-tail) == 0)
                    GRev[-tail] = std::vector<int>();

                GRev[tail].push_back(-head);
                if (GRev.count(-head) == 0)
                    GRev[-head] = std::vector<int>();

            }
            file.close();
        }
        PROFILE_STOP();
    }

// Assembly:
subq $0x398, %rsp            # imm = 0x398
movq %rdi, 0x390(%rsp)
movq %rsi, 0x388(%rsp)
movq %rdx, 0x380(%rsp)
movq 0x390(%rsp), %rsi
leaq 0x178(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl $0x8, %edx
callq 0x33e0
movq 0x90(%rsp), %rdi
leaq 0x174(%rsp), %rsi
callq 0x31e0
jmp 0x98a8
callq 0x10a60
movq %rax, 0x88(%rsp)
jmp 0x98b7
movq 0x390(%rsp), %rdx
leaq 0x26f91(%rip), %rsi     # 0x30857
leaq 0x140(%rsp), %rdi
callq 0x11490
jmp 0x98d5
movq 0x88(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x10ad0
jmp 0x98ec
leaq 0x140(%rsp), %rdi
callq 0x31f0
leaq 0x178(%rsp), %rdi
callq 0x33d0
movb %al, 0x87(%rsp)
jmp 0x990f
movb 0x87(%rsp), %al
testb $0x1, %al
jne 0x991f
jmp 0x9dd7
jmp 0x9921
leaq 0x178(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
callq 0x31e0
movq %rax, 0x78(%rsp)
jmp 0x993d
movq 0x78(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x31e0
movq %rax, 0x70(%rsp)
jmp 0x9956
movq 0x70(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3310
movb %al, 0x6f(%rsp)
jmp 0x9970
movb 0x6f(%rsp), %al
testb $0x1, %al
jne 0x997d
jmp 0x9dc6
movq 0x388(%rsp), %rdi
movl 0x13c(%rsp), %eax
negl %eax
movl %eax, 0x134(%rsp)
leaq 0x134(%rsp), %rsi
callq 0x122f0
movq %rax, 0x60(%rsp)
jmp 0x99a9
movq 0x60(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x106f0
jmp 0x99bd
movq 0x388(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x12320
movq %rax, 0x58(%rsp)
jmp 0x99d9
movq 0x58(%rsp), %rax
cmpq $0x0, %rax
jne 0x9aae
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
movq $0x0, 0x120(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x10fd0
movq 0x388(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x12350
movq %rax, 0x50(%rsp)
jmp 0x9a28
movq 0x50(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x12380
leaq 0x110(%rsp), %rdi
callq 0x107c0
jmp 0x9aae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x9e02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x31f0
jmp 0x9e02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x107c0
jmp 0x9e02
movq 0x388(%rsp), %rdi
movl 0x138(%rsp), %eax
negl %eax
movl %eax, 0x10c(%rsp)
leaq 0x10c(%rsp), %rsi
callq 0x122f0
movq %rax, 0x48(%rsp)
jmp 0x9ada
movq 0x48(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
callq 0x106f0
jmp 0x9aee
movq 0x388(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
callq 0x12320
movq %rax, 0x40(%rsp)
jmp 0x9b0a
movq 0x40(%rsp), %rax
cmpq $0x0, %rax
jne 0x9ba0
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
movq $0x0, 0x100(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x10fd0
movq 0x388(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
callq 0x12350
movq %rax, 0x38(%rsp)
jmp 0x9b59
movq 0x38(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x12380
leaq 0xf0(%rsp), %rdi
callq 0x107c0
jmp 0x9ba0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x107c0
jmp 0x9e02
movq 0x380(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x12350
movq %rax, 0x30(%rsp)
jmp 0x9bbc
movq 0x30(%rsp), %rdi
movl 0x13c(%rsp), %eax
negl %eax
movl %eax, 0xec(%rsp)
leaq 0xec(%rsp), %rsi
callq 0x123c0
jmp 0x9be0
movq 0x380(%rsp), %rdi
movl 0x13c(%rsp), %eax
negl %eax
movl %eax, 0xe8(%rsp)
leaq 0xe8(%rsp), %rsi
callq 0x12320
movq %rax, 0x28(%rsp)
jmp 0x9c0c
movq 0x28(%rsp), %rax
cmpq $0x0, %rax
jne 0x9cb2
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x10fd0
movq 0x380(%rsp), %rdi
movl 0x13c(%rsp), %eax
negl %eax
movl %eax, 0xcc(%rsp)
leaq 0xcc(%rsp), %rsi
callq 0x122f0
movq %rax, 0x20(%rsp)
jmp 0x9c6b
movq 0x20(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x12380
leaq 0xd0(%rsp), %rdi
callq 0x107c0
jmp 0x9cb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x107c0
jmp 0x9e02
movq 0x380(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
callq 0x12350
movq %rax, 0x18(%rsp)
jmp 0x9cce
movq 0x18(%rsp), %rdi
movl 0x138(%rsp), %eax
negl %eax
movl %eax, 0xc8(%rsp)
leaq 0xc8(%rsp), %rsi
callq 0x123c0
jmp 0x9cf2
movq 0x380(%rsp), %rdi
movl 0x138(%rsp), %eax
negl %eax
movl %eax, 0xc4(%rsp)
leaq 0xc4(%rsp), %rsi
callq 0x12320
movq %rax, 0x10(%rsp)
jmp 0x9d1e
movq 0x10(%rsp), %rax
cmpq $0x0, %rax
jne 0x9dc1
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x10fd0
movq 0x380(%rsp), %rdi
movl 0x138(%rsp), %eax
negl %eax
movl %eax, 0x9c(%rsp)
leaq 0x9c(%rsp), %rsi
callq 0x122f0
movq %rax, 0x8(%rsp)
jmp 0x9d7d
movq 0x8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x12380
leaq 0xa0(%rsp), %rdi
callq 0x107c0
jmp 0x9dc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x107c0
jmp 0x9e02
jmp 0x9921
leaq 0x178(%rsp), %rdi
callq 0x30a0
jmp 0x9dd5
jmp 0x9dd7
callq 0x10a60
movq %rax, (%rsp)
jmp 0x9de2
movq (%rsp), %rdi
callq 0x10b90
jmp 0x9ded
leaq 0x178(%rsp), %rdi
callq 0x30f0
addq $0x398, %rsp            # imm = 0x398
retq
leaq 0x178(%rsp), %rdi
callq 0x30f0
movq 0x168(%rsp), %rdi
callq 0x3460
nopl (%rax)