// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b2d3
cmpq %rax, 0x18(%rbx)
jb 0x1b2db
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 0x1b3e6
movq %rax, %r14
cmpq %r13, (%rax)
jne 0x1b3dd
movl 0x18(%r14), %eax
movl 0x8(%r12), %ecx
movl %eax, %edx
orl %ecx, %edx
je 0x1b403
leaq 0x10(%r14), %rbx
movb 0x1d(%r14), %dl
cmpb %dl, 0xd(%r12)
jne 0x1b37c
movl %ecx, %edx
cmpl %edx, %eax
jne 0x1b3dd
cmpb $0x0, 0xe(%r12)
movq %r12, %rsi
jne 0x1b361
movq (%r12), %rsi
cmpb $0x0, 0x1e(%r14)
jne 0x1b36c
movq 0x10(%r14), %rbx
movq %rbx, %rdi
callq 0xb960
testl %eax, %eax
sete %r15b
jmp 0x1b3d8
movzbl %dl, %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 0x1b3c3
cmpb $0x0, 0x1e(%r14)
jne 0x1b3b2
movq 0x10(%r14), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xb960
testl %eax, %eax
sete %r15b
testq %rbp, %rbp
je 0x1b3d8
movq 0x30(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0xb940
testb %r15b, %r15b
jne 0x1b403
movq 0x8(%r14), %rax
jmp 0x1b311
movq 0x18(%rsp), %r15
movq 0x30(%r15), %rax
cmpq 0x28(%r15), %rax
je 0x1b439
movq -0x8(%rax), %rbx
addq $-0x8, %rax
movq %rax, 0x30(%r15)
jmp 0x1b44a
cmpb $0x0, 0x4(%rsp)
je 0x1b431
leaq 0x20(%r14), %rbx
movq 0x30(%r14), %rax
testq %rax, %rax
je 0x1b424
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 0x1b493
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 0xf080
nop