// File: /workspace/github_cpp_makefile_star2_O3/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 0x70(%rsp), %rax
movq %rax, -0x30(%rax)
movl $0x1, %ecx
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 0xa8(%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
movl $0x8, %edx
callq 0x22b0
callq 0x2240
movq %rax, 0x30(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x4df3
leaq 0xb0(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x40(%rsp), %r13
movq %rsp, %rbp
movq %r14, %rdi
movq %r15, %rsi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4df3
movabsq $0x346dc5d63886594b, %rax # imm = 0x346DC5D63886594B
imulq 0x10(%rsp)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xc, %rdx
addq %rax, %rdx
movq %rdx, (%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8cf2
movq %rax, %rbx
movq (%rax), %r12
movl $0x18, %edi
callq 0x21e0
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2040
incq 0x10(%rbx)
jmp 0x4d84
movq 0x50(%rsp), %rbx
testq %rbx, %rbx
je 0x4fe9
leaq 0x18(%rsp), %r13
leaq 0x78(%rsp), %r15
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x6d22
movq %rbx, 0x38(%rsp)
movq 0x18(%rsp), %rbp
cmpq %r13, %rbp
je 0x4fbf
movq 0x10(%rbp), %rbx
movq $-0x2710, %rax          # imm = 0xD8F0
subq %rbx, %rax
movabsq $0x346dc5d63886594b, %rcx # imm = 0x346DC5D63886594B
imulq %rcx
movq %rdx, %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xc, %rcx
addq %rax, %rcx
movq 0x40(%rsp), %r9
movq 0x48(%rsp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%r9,%rdx,8), %rax
movl $0x0, %r14d
testq %rax, %rax
je 0x4ebb
movq %rdx, %rsi
movq (%rax), %r10
movq %r10, %r14
cmpq 0x8(%r10), %rcx
je 0x4ebb
movq (%r10), %r10
testq %r10, %r10
je 0x4eb8
movq 0x8(%r10), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %r14d
cmpq %rsi, %rdx
jne 0x4ebb
movq %r10, %r14
cmpq %rdi, %rcx
jne 0x4e8f
jmp 0x4ebb
xorl %r14d, %r14d
incq %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%r9,%rdx,8), %rax
movl $0x0, %r12d
testq %rax, %rax
je 0x4f10
movq %rdx, %rsi
movq (%rax), %r9
movq %r9, %r12
cmpq 0x8(%r9), %rcx
je 0x4f10
movq (%r9), %r9
testq %r9, %r9
je 0x4f0d
movq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %r12d
cmpq %rsi, %rdx
jne 0x4f10
movq %r9, %r12
cmpq %rdi, %rcx
jne 0x4ee4
jmp 0x4f10
xorl %r12d, %r12d
testq %r14, %r14
je 0x4f5c
movq 0x10(%r14), %r13
addq $0x10, %r14
cmpq %r14, %r13
je 0x4f5c
movq 0x10(%r13), %rax
leaq (%rax,%rbx), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x4f56
addq %rbx, %rax
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
callq 0x8fda
movq (%r13), %r13
jmp 0x4f1d
testq %r12, %r12
leaq 0x18(%rsp), %r13
je 0x4fad
movq 0x10(%r12), %r14
addq $0x10, %r12
cmpq %r12, %r14
je 0x4fad
movq 0x10(%r14), %rax
leaq (%rax,%rbx), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x4fa8
addq %rbx, %rax
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
callq 0x8fda
movq (%r14), %r14
jmp 0x4f6f
movq (%rbp), %rbp
cmpq %r13, %rbp
jne 0x4e33
movq 0x18(%rsp), %rbp
cmpq %r13, %rbp
je 0x4fd8
movq (%rbp), %rbx
movq %rbp, %rdi
callq 0x21b0
movq %rbx, %rbp
cmpq %r13, %rbx
jne 0x4fc4
movq 0x38(%rsp), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x4e0b
callq 0x2240
movq %rax, %rbx
movq 0x8fe0(%rip), %rdi      # 0xdfd8
leaq 0x536b(%rip), %rsi      # 0xa36a
movl $0x26, %edx
callq 0x2200
subq 0x30(%rsp), %rbx
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
movq %rbx, %rax
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq 0x8fa5(%rip), %rdi      # 0xdfd8
callq 0x21c0
movq %rax, %rbx
leaq 0x534f(%rip), %rsi      # 0xa391
movl $0x3, %edx
movq %rax, %rdi
callq 0x2200
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
cmpq $0x1ab, 0x90(%rsp) # imm = 0x1AB
jne 0x50bc
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x78(%rsp), %rdi
callq 0x6db0
leaq 0x40(%rsp), %rdi
callq 0x6e12
movl $0x1ab, %eax            # imm = 0x1AB
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52d2(%rip), %rdi      # 0xa395
leaq 0x52df(%rip), %rsi      # 0xa3a9
leaq 0x52ea(%rip), %rcx      # 0xa3bb
movl $0x64, %edx
callq 0x2120
jmp 0x50e8
movq %rax, %rbx
jmp 0x5121
jmp 0x50e8
jmp 0x50e8
jmp 0x50e8
movq %rax, %rbx
jmp 0x5114
movq %rax, %rbx
jmp 0x50fa
movq %rax, %rbx
leaq 0x18(%rsp), %r13
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x5114
movq (%rdi), %r14
callq 0x21b0
movq %r14, %rdi
cmpq %r13, %r14
jne 0x5104
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x78(%rsp), %rdi
callq 0x6db0
leaq 0x40(%rsp), %rdi
callq 0x6e12
movq %rbx, %rdi
callq 0x2310