// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, 0x30(%rsp)
movq 0x8(%rdx), %r14
testq %r14, %r14
movq %rdx, 0x10(%rsp)
je 0x15b84
movq (%rdx), %rbx
xorl %ebp, %ebp
movq %r14, %r15
xorl %r12d, %r12d
movq %r12, %r13
movq $0x0, 0x20(%rsp)
leaq (%rbx,%rbp), %rsi
cmpq $0x8, %r15
movl $0x8, %edx
cmovbq %r15, %rdx
leaq 0x20(%rsp), %rdi
callq 0x4310
shlq $0x5, %r13
subq %r12, %r13
addq 0x20(%rsp), %r13
addq $0x8, %rbp
addq $-0x8, %r15
movq %r13, %r12
cmpq %r14, %rbp
jb 0x15b42
jmp 0x15b87
xorl %r13d, %r13d
movq 0x18(%rsp), %r15
leaq 0x8(%r15), %r14
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rsi
cmpq %rsi, %rcx
je 0x15c0d
movq %r14, 0x8(%rsp)
subq %rcx, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r13, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %rbp
leaq (%rdx,%rdx,2), %rbx
leaq (%rcx,%rbx,8), %r14
movq (%r14), %r12
movq %r15, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq %r14, %r12
je 0x15c4c
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x15dba
testb %al, %al
jne 0x15bfe
movq (%r12), %r12
cmpq %r14, %r12
jne 0x15be6
movq 0x8(%rsp), %r14
movq (%r14), %rcx
movq 0x18(%rsp), %r15
jmp 0x15c51
movl $0x4, %esi
movq %r14, %rdi
callq 0x14574
movq $0x3, 0x28(%r15)
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rax
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r13, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %rbp
jmp 0x15c98
movq 0x8(%rsp), %r14
leaq (%rcx,%rbx,8), %rax
cmpq %rax, %r12
je 0x15c5e
xorl %ecx, %ecx
jmp 0x15ccf
movq 0x20(%r15), %rax
cmpq 0x28(%r15), %rax
jb 0x15c98
movq 0x10(%r15), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rbx, %rsi
movabsq $0x2aaaaaaaaaaaaaa, %rax # imm = 0x2AAAAAAAAAAAAAA
cmpq %rax, %rsi
jbe 0x15cf1
movq $-0x1, 0x28(%r15)
movq %r15, %rbx
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%rcx,%rax,8), %r15
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x149be
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x4070
incq 0x10(%r15)
incq 0x20(%rbx)
movb $0x1, %cl
movq 0x30(%rsp), %rax
movq %r14, (%rax)
movq %r12, 0x8(%rax)
movq %rbp, 0x10(%rax)
movb %cl, 0x18(%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rsi, %rsi
movq %r15, %rdi
callq 0x15d18
shlq 0x28(%r15)
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
imulq %rbx, %rsi
jmp 0x15c3f