// File: /workspace/github_cpp_makefile_star2_O3/night-shift[P]Srl/include/Srl/Hash.hpp
// Function: std::pair<bool, std::function<void* ()>*> Srl::Lib::HTable<Srl::String, std::function<void* ()>, Srl::Lib::HashSrl<Srl::String, void>>::insert_hash<Srl::String const&, std::function<void* ()>&>(unsigned long, bool, Srl::String const&, std::function<void* ()>&)
std::pair<bool, V*> HTable<K, V, H>::insert_hash(uint64_t hash, bool update_on_dup,
                                                     KV&& key, Args&&... args)
    {
        if(this->limit < 1 || this->elements >= this->limit) {
            this->redistribute();
        }

        auto bucket  = get_bucket(hash);
        Entry* entry = table[bucket];
        Entry* prev  = nullptr;

        while(entry) {

            if(entry->hash == hash && entry->key == key) {

                if(update_on_dup) {

                    this->destroy_item(entry->val);
                    new (&entry->val) V(std::forward<Args>(args)...);
                }

                return { true, &entry->val };
            }

            prev  = entry;
            entry = entry->next;
        }

        Entry* mem = nullptr;

        if(this->mem_cache.size() > 0) {
            mem = this->mem_cache.back();
            this->mem_cache.pop_back();

        } else {
            mem = this->heap.template get_mem<Entry>(1);
        }

        auto* new_entry = new (mem) Entry (
            hash, std::forward<KV>(key), std::forward<Args>(args)...
        );

        if(prev) {
            prev->next = new_entry;
        } else {
            table[bucket] = new_entry;
        }

        this->elements++;

        return { false, &(new_entry->val) };
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r12
movl %edx, 0x4(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x1aeed
cmpq %rax, 0x18(%rbx)
jb 0x1aef5
movq %rbx, %rdi
callq 0xb670
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
movq %r13, %rax
shrq $0x20, %rax
xorl %r14d, %r14d
testq %rdx, %rdx
cmovneq %r14, %rax
movq %rbx, 0x18(%rsp)
movq 0x20(%rbx), %rsi
xorq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, 0x10(%rsp)
movq (%rsi,%rdx,8), %rax
testq %rax, %rax
je 0x1afff
movq %rax, %r14
cmpq %r13, (%rax)
jne 0x1aff6
movl 0x18(%r14), %edx
movl 0x8(%r12), %eax
movl %edx, %ecx
orl %eax, %ecx
je 0x1b01c
leaq 0x10(%r14), %rbx
movb 0x1d(%r14), %cl
cmpb %cl, 0xd(%r12)
jne 0x1af95
cmpl %eax, %edx
jne 0x1aff6
cmpb $0x0, 0xe(%r12)
movq %r12, %rsi
jne 0x1af79
movq (%r12), %rsi
cmpb $0x0, 0x1e(%r14)
jne 0x1af84
movq 0x10(%r14), %rbx
movq %rbx, %rdi
callq 0xb960
testl %eax, %eax
jne 0x1aff6
jmp 0x1b01c
movzbl %cl, %esi
xorl %r15d, %r15d
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xbea0
movq 0x20(%rsp), %rbp
movq 0x28(%rsp), %rdx
subq %rbp, %rdx
movl 0x18(%r14), %eax
cmpq %rax, %rdx
jne 0x1afdc
cmpb $0x0, 0x1e(%r14)
jne 0x1afcb
movq 0x10(%r14), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xb960
testl %eax, %eax
sete %r15b
testq %rbp, %rbp
je 0x1aff1
movq 0x30(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0xb940
testb %r15b, %r15b
jne 0x1b01c
movq 0x8(%r14), %rax
jmp 0x1af2b
movq 0x18(%rsp), %r15
movq 0x30(%r15), %rax
cmpq 0x28(%r15), %rax
je 0x1b052
movq -0x8(%rax), %rbx
addq $-0x8, %rax
movq %rax, 0x30(%r15)
jmp 0x1b063
cmpb $0x0, 0x4(%rsp)
je 0x1b04a
leaq 0x20(%r14), %rbx
movq 0x30(%r14), %rax
testq %rax, %rax
je 0x1b03d
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xbf60
addq $0x20, %r14
movb $0x1, %al
jmp 0x1b0ac
leaq 0x48(%r15), %rdi
movl $0x1, %esi
callq 0xbf00
movq %rax, %rbx
movq %r13, (%rbx)
movq $0x0, 0x8(%rbx)
movups (%r12), %xmm0
movups %xmm0, 0x10(%rbx)
leaq 0x20(%rbx), %r12
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0xbf60
movq 0x10(%rsp), %rcx
shlq $0x3, %rcx
addq 0x20(%r15), %rcx
leaq 0x8(%r14), %rax
testq %r14, %r14
cmoveq %rcx, %rax
movq %rbx, (%rax)
incq 0x18(%r15)
xorl %eax, %eax
movq %r12, %r14
movq %r14, %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0xf059