// File: /workspace/github_cpp_makefile_star2_O2/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_sv, dinit_equal_to>::iterator, bool> dinit_unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, hash_sv, dinit_equal_to>::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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
movq 0x8(%rdx), %rax
movq %rax, 0x8(%rdi)
callq 0xe5a1
movq %rax, %rbp
leaq 0x8(%r15), %r13
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rax
cmpq %rax, %rsi
je 0x10e69
movq %r13, 0x8(%rsp)
subq %rsi, %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movq %rax, %rcx
xorl %r14d, %r14d
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movq %rbp, 0x10(%rsp)
movq %rdx, %rbp
imulq $0x18, %rdx, %r13
movq (%rsi,%r13), %rdi
addq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x10fde
movq 0x8(%r15), %rsi
addq %rsi, %r13
cmpq %r13, %rax
je 0x10e9f
movq 0x8(%rsp), %r13
jmp 0x10ef6
pushq $0x4
popq %rsi
movq %r13, %rdi
callq 0xf52c
movq $0x3, 0x28(%r15)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rax
subq %rsi, %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movq %rax, %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rbp
jmp 0x10edd
pushq $0x18
popq %rdi
movq 0x10(%rsp), %r14
movq 0x20(%r15), %rax
cmpq 0x28(%r15), %rax
jae 0x10eb8
movq 0x8(%rsp), %r13
jmp 0x10edd
movq 0x10(%r15), %rax
subq %rsi, %rax
cqto
idivq %rdi
movabsq $0x2aaaaaaaaaaaaaa, %rcx # imm = 0x2AAAAAAAAAAAAAA
cmpq %rcx, %rax
movq 0x8(%rsp), %r13
jbe 0x10f17
orq $-0x1, 0x28(%r15)
imulq $0x18, %rbp, %rdi
addq %rsi, %rdi
movq %rdi, %rsi
movq %r12, %rdx
callq 0xf9d4
incq 0x20(%r15)
movb $0x1, %r14b
movq %r13, (%rbx)
movq %rax, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
movb %r14b, 0x18(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rax, %rax
movq %rdi, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x10f48
shlq 0x28(%r15)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rax
subq %rsi, %rax
cqto
idivq %rbp
movq %rax, %rcx
movq %r14, %rax
jmp 0x10e95
nop