// File: davmac314[P]dinit/src/includes/dinit-util.h
// Function: std::pair<dinit_unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, hash_env_name, env_equal_name>::iterator, bool> dinit_unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, hash_env_name, env_equal_name>::do_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&&)
std::pair<iterator,bool> do_insert(V &&value)
    {
        size_t hashval = hash_f(value);
        size_t bucket_num;

        if (buckets.empty()) {
            buckets.resize(4); // good enough starting point
            current_limit = 3;
            bucket_num = hashval % buckets.size();
        }
        else {
            // First, check if the value is already present
            bucket_num = hashval % buckets.size();
            auto list_it = std::find_if(buckets[bucket_num].begin(), buckets[bucket_num].end(),
                    [&](const key_type &k) { return key_equal_f(k,std::forward<V>(value)); });
            if (list_it != buckets[bucket_num].end()) {
                return { { &buckets, list_it, bucket_num }, false };
            }

            // Not present. Check if we need to expand.
            if (current_size >= current_limit) {
                if (buckets.size() <= (buckets.max_size() / 2)) {
                    rehash(buckets.size() * 2);
                    current_limit *= 2;
                    bucket_num = hashval % buckets.size();
                }
                else {
                    // in the unlikely event that we have hit the max_size, let's just become overloaded
                    current_limit = -1;
                }
            }
        }

        auto list_it = buckets[bucket_num].insert(buckets[bucket_num].end(), std::forward<V>(value));
        ++current_size;
        return { { &buckets, list_it, bucket_num }, true };
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd0(%rbp)
movq %rdi, -0xc8(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
movq -0x10(%rbp), %rsi
callq 0x22600
movq -0xc0(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x8, %rdi
callq 0x1dbc0
testb $0x1, %al
jne 0x222ff
jmp 0x2234f
movq -0xc0(%rbp), %rdi
addq $0x8, %rdi
movl $0x4, %esi
callq 0x22650
movq -0xc0(%rbp), %rdi
movq $0x3, 0x28(%rdi)
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
addq $0x8, %rdi
callq 0x19af0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, -0x20(%rbp)
jmp 0x2251e
movq -0xc0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xe0(%rbp)
addq $0x8, %rdi
callq 0x19af0
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movq -0xe0(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, -0x20(%rbp)
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
callq 0x1dc50
movq %rax, %rdi
callq 0x14830
movq -0xc0(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
callq 0x1dc50
movq %rax, %rdi
callq 0x14860
movq %rax, %rcx
movq -0xc0(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x226e0
movq -0xc0(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
callq 0x1dc50
movq %rax, %rdi
callq 0x14860
movq %rax, -0x50(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x14890
testb $0x1, %al
jne 0x2241f
jmp 0x22460
movq -0xc0(%rbp), %rsi
addq $0x8, %rsi
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rcx
movq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x1f610
movq -0xd0(%rbp), %rdi
movb $0x0, -0x71(%rbp)
leaq -0x68(%rbp), %rsi
leaq -0x71(%rbp), %rdx
callq 0x22750
jmp 0x225e4
movq -0xc0(%rbp), %rcx
movq 0x20(%rcx), %rax
cmpq 0x28(%rcx), %rax
jb 0x2251c
movq -0xc0(%rbp), %rdi
addq $0x8, %rdi
callq 0x19af0
movq -0xc0(%rbp), %rdi
movq %rax, -0xe8(%rbp)
addq $0x8, %rdi
callq 0x22790
movq %rax, %rcx
movq -0xe8(%rbp), %rax
shrq %rcx
cmpq %rcx, %rax
ja 0x2250b
movq -0xc0(%rbp), %rdi
addq $0x8, %rdi
callq 0x19af0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
shlq %rsi
callq 0x227c0
movq -0xc0(%rbp), %rdi
movq 0x28(%rdi), %rax
shlq %rax
movq %rax, 0x28(%rdi)
movq -0x18(%rbp), %rax
movq %rax, -0xf0(%rbp)
addq $0x8, %rdi
callq 0x19af0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, -0x20(%rbp)
jmp 0x2251a
movq -0xc0(%rbp), %rax
movq $-0x1, 0x28(%rax)
jmp 0x2251c
jmp 0x2251e
movq -0xc0(%rbp), %rdi
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
callq 0x1dc50
movq -0xc0(%rbp), %rdi
movq %rax, -0xf8(%rbp)
addq $0x8, %rdi
movq -0x20(%rbp), %rsi
callq 0x1dc50
movq %rax, %rdi
callq 0x14860
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x22190
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x88(%rbp), %rsi
callq 0x228e0
movq -0xc0(%rbp), %rsi
movq %rax, -0x80(%rbp)
movq 0x20(%rsi), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsi)
addq $0x8, %rsi
movq -0x80(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x20(%rbp), %rcx
movq -0xb0(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x1f610
movq -0xd0(%rbp), %rdi
movb $0x1, -0xb1(%rbp)
leaq -0xa8(%rbp), %rsi
leaq -0xb1(%rbp), %rdx
callq 0x22750
movq -0xc8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop