// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e6a
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 0x4e6a
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 0x8d7e
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 0x4dfb
movq 0x50(%rsp), %rcx
testq %rcx, %rcx
je 0x5071
leaq 0x18(%rsp), %r13
leaq 0x78(%rsp), %r15
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rsp)
movq %rcx, 0x38(%rsp)
leaq 0x10(%rcx), %rsi
movq %r13, %rdi
callq 0x6d76
movq 0x18(%rsp), %rbx
cmpq %r13, %rbx
je 0x5046
movq 0x10(%rbx), %rbp
movq $-0x2710, %rax          # imm = 0xD8F0
subq %rbp, %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 %rdx, %rsi
movq (%r9,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x4f32
movq (%rdx), %r10
movq %rdx, %rax
cmpq 0x8(%r10), %rcx
je 0x4f32
movq %r10, %r11
movq (%r10), %r10
testq %r10, %r10
je 0x4f30
movq 0x8(%r10), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rsi, %rdx
jne 0x4f32
movq %r11, %rax
cmpq %rdi, %rcx
jne 0x4f05
jmp 0x4f32
xorl %eax, %eax
testq %rax, %rax
je 0x4f3c
movq (%rax), %r14
jmp 0x4f3f
xorl %r14d, %r14d
incq %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq %rdx, %rsi
movq (%r9,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x4f94
movq (%rdx), %r9
movq %rdx, %rax
cmpq 0x8(%r9), %rcx
je 0x4f94
movq %r9, %r10
movq (%r9), %r9
testq %r9, %r9
je 0x4f92
movq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %eax
cmpq %rsi, %rdx
jne 0x4f94
movq %r10, %rax
cmpq %rdi, %rcx
jne 0x4f67
jmp 0x4f94
xorl %eax, %eax
testq %rax, %rax
je 0x4f9e
movq (%rax), %r12
jmp 0x4fa1
xorl %r12d, %r12d
testq %r14, %r14
je 0x4fed
movq 0x10(%r14), %r13
addq $0x10, %r14
cmpq %r14, %r13
je 0x4fed
movq 0x10(%r13), %rax
leaq (%rax,%rbp), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x4fe7
addq %rbp, %rax
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
callq 0x90a0
movq (%r13), %r13
jmp 0x4fae
testq %r12, %r12
leaq 0x18(%rsp), %r13
je 0x503e
movq 0x10(%r12), %r14
addq $0x10, %r12
cmpq %r12, %r14
je 0x503e
movq 0x10(%r14), %rax
leaq (%rax,%rbp), %rcx
addq $0x2710, %rcx           # imm = 0x2710
cmpq $0x4e20, %rcx           # imm = 0x4E20
ja 0x5039
addq %rbp, %rax
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movq %rsp, %rdx
callq 0x90a0
movq (%r14), %r14
jmp 0x5000
movq (%rbx), %rbx
jmp 0x4ea1
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x5060
movq (%rdi), %rbx
callq 0x21b0
movq %rbx, %rdi
cmpq %r13, %rbx
jne 0x5050
movq 0x38(%rsp), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x4e82
callq 0x2240
movq %rax, %rbx
movq 0x8f58(%rip), %rdi      # 0xdfd8
leaq 0x52e3(%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 0x8f1d(%rip), %rdi      # 0xdfd8
callq 0x21c0
movq %rax, %rbx
leaq 0x52c7(%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 0x5144
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x78(%rsp), %rdi
callq 0x6e04
leaq 0x40(%rsp), %rdi
callq 0x6e66
movl $0x1ab, %eax            # imm = 0x1AB
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x524a(%rip), %rdi      # 0xa395
leaq 0x5257(%rip), %rsi      # 0xa3a9
leaq 0x5262(%rip), %rcx      # 0xa3bb
movl $0x64, %edx
callq 0x2120
jmp 0x5170
movq %rax, %rbx
jmp 0x51a9
jmp 0x5170
jmp 0x5170
jmp 0x5170
movq %rax, %rbx
jmp 0x519c
movq %rax, %rbx
jmp 0x5182
movq %rax, %rbx
leaq 0x18(%rsp), %r13
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x519c
movq (%rdi), %r14
callq 0x21b0
movq %r14, %rdi
cmpq %r13, %r14
jne 0x518c
leaq 0xb0(%rsp), %rdi
callq 0x2080
leaq 0x78(%rsp), %rdi
callq 0x6e04
leaq 0x40(%rsp), %rdi
callq 0x6e66
movq %rbx, %rdi
callq 0x2310