// File: /workspace/github_cpp_makefile_star2_O2/Manca[P]algorithms1/./assignment6.hpp
// Function: assignment6::computeTargetSums(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int computeTargetSums(const string& fileName)
    {
        // some defs and inits
        typedef std::unordered_map<long long, std::list<long long>> hashTable;
        typedef std::unordered_set<long long> seenSums;
        
        hashTable _hash;
        seenSums  _sums;
        
        ifstream file(fileName, ios::in);
        
        std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
        if (file.is_open())
        {
            long long num;
            while ( file >> num)
            {
                _hash[num / 20000].push_front(num);
            }
        }
        
        // for every x in our hash table, find y that satisfies t = x + y
        for (auto pair : _hash)
        {
            for (auto num : pair.second)
            {
                auto searchMin = _hash.find((-10000 - num)/20000);
                auto searchMax = _hash.find((-10000 - num)/20000 + 1);
                if (searchMin != _hash.end())
                {
                    for (auto num2 : searchMin->second)
                        if (num + num2 >= -10000 && num + num2 <= 10000)
                            _sums.insert(num+num2);
                }
                
                if (searchMax != _hash.end())
                {
                    for (auto num2 : searchMax->second)
                        if (num + num2 >= -10000 && num + num2 <= 10000)
                            _sums.insert(num+num2);
                }
            }
        }
        
        std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
        std::cout << "Done. Time took to find all the sums: "
        << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << " ms" << endl;
        
        assert(_sums.size() == 427);
        
        return _sums.size();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, %rsi
leaq 0xa8(%rsp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rcx
movq %rcx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x70(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0xb0(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x2290
callq 0x2230
movq %rax, 0x10(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x4444
leaq 0xb0(%rsp), %rbx
leaq 0x20(%rsp), %r14
movl $0x4e20, %r13d          # imm = 0x4E20
leaq 0x78(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2240
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4444
movq 0x20(%rsp), %rax
cqto
idivq %r13
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7e16
movq %rax, %rdi
movq %r14, %rsi
callq 0x5292
jmp 0x4404
leaq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
leaq 0x8(%rsp), %r13
testq %rax, %rax
je 0x4576
movq %rax, 0x18(%rsp)
leaq 0x8(%rax), %rsi
leaq 0x20(%rsp), %rdi
callq 0x529e
leaq 0x28(%rsp), %r14
movq (%r14), %r14
leaq 0x28(%rsp), %rax
cmpq %rax, %r14
je 0x455f
movq 0x10(%r14), %r15
movq $-0x2710, %rax          # imm = 0xD8F0
subq %r15, %rax
cqto
movl $0x4e20, %ecx           # imm = 0x4E20
idivq %rcx
movq %rax, %rbx
movq %rax, 0x8(%rsp)
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81a4
movq %rax, %rbp
incq %rbx
movq %rbx, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x81a4
movq %rax, %rbx
testq %rbp, %rbp
je 0x4512
addq $0x10, %rbp
movq %rbp, %r12
movq (%r12), %r12
cmpq %rbp, %r12
je 0x4512
movq 0x10(%r12), %rax
leaq (%rax,%r15), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x44d9
addq %r15, %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x81c2
jmp 0x44d9
testq %rbx, %rbx
je 0x4473
addq $0x10, %rbx
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x4473
movq 0x10(%r12), %rax
leaq (%rax,%r15), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x4522
addq %r15, %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x81c2
jmp 0x4522
leaq 0x28(%rsp), %rdi
callq 0x5a64
movq 0x18(%rsp), %rax
movq (%rax), %rax
jmp 0x4452
callq 0x2230
movq %rax, %rbx
movq 0x9a53(%rip), %rdi      # 0xdfd8
leaq 0x4d7e(%rip), %rsi      # 0x930a
callq 0x21d0
movq %rax, %rdi
subq 0x10(%rsp), %rbx
movl $0xf4240, %ecx          # imm = 0xF4240
movq %rbx, %rax
cqto
idivq %rcx
movq %rax, %rsi
callq 0x21c0
leaq 0x4d7c(%rip), %rsi      # 0x9331
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x2100
cmpq $0x1ab, 0x58(%rsp)      # imm = 0x1AB
jne 0x4608
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x40(%rsp), %rdi
callq 0x5a88
leaq 0x78(%rsp), %rdi
callq 0x5b0e
movl $0x1ab, %eax            # imm = 0x1AB
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4d26(%rip), %rdi      # 0x9335
leaq 0x4d33(%rip), %rsi      # 0x9349
leaq 0x4d3e(%rip), %rcx      # 0x935b
pushq $0x64
popq %rdx
callq 0x2150
jmp 0x4632
movq %rax, %rbx
jmp 0x4657
jmp 0x4632
jmp 0x4632
jmp 0x4632
movq %rax, %rbx
jmp 0x464a
jmp 0x463d
jmp 0x463d
jmp 0x463d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5a64
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x40(%rsp), %rdi
callq 0x5a88
leaq 0x78(%rsp), %rdi
callq 0x5b0e
movq %rbx, %rdi
callq 0x22f0