// File: /workspace/github_cpp_makefile_star2_O1/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, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x8(%rdx), %r14
testq %r14, %r14
movq %rdx, 0x20(%rsp)
je 0x15a0e
movq (%rdx), %rbp
xorl %ebx, %ebx
movq %r14, %r15
xorl %r12d, %r12d
movq %r12, %r13
movq $0x0, 0x28(%rsp)
leaq (%rbx,%rbp), %rsi
cmpq $0x8, %r15
movl $0x8, %edx
cmovbq %r15, %rdx
leaq 0x28(%rsp), %rdi
callq 0x4310
shlq $0x5, %r13
subq %r12, %r13
addq 0x28(%rsp), %r13
addq $0x8, %rbx
addq $-0x8, %r15
movq %r13, %r12
cmpq %r14, %rbx
jb 0x159cc
jmp 0x15a11
xorl %r13d, %r13d
movq 0x10(%rsp), %r14
leaq 0x8(%r14), %rdi
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rsi
cmpq %rsi, %rcx
movq %rdi, 0x18(%rsp)
je 0x15abe
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
movq %r14, %rax
leaq (%rcx,%rbx,8), %r14
movq (%r14), %r12
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq %r14, %r12
je 0x15a8f
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x15c7c
testb %al, %al
jne 0x15a8f
movq (%r12), %r12
cmpq %r14, %r12
jne 0x15a77
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
leaq (%rax,%rbx,8), %r15
cmpq %r15, %r12
je 0x15afc
movq 0x8(%rsp), %rbx
movq %rcx, (%rbx)
movq %r12, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
movb $0x0, 0x18(%rbx)
movq 0x10(%rsp), %r14
jmp 0x15b6f
movl $0x4, %esi
callq 0x143ec
movq $0x3, 0x28(%r14)
movq 0x10(%r14), %rax
subq 0x8(%r14), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rbp
movq 0x8(%rsp), %rbx
jmp 0x15b74
movq 0x10(%rsp), %r14
movq 0x20(%r14), %rcx
cmpq 0x28(%r14), %rcx
movq 0x8(%rsp), %rbx
jb 0x15b6f
movq 0x10(%r14), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rsi
movabsq $0x2aaaaaaaaaaaaaa, %rax # imm = 0x2AAAAAAAAAAAAAA
cmpq %rax, %rsi
jbe 0x15b42
movq $-0x1, 0x28(%r14)
jmp 0x15b6f
addq %rsi, %rsi
movq %r14, %rdi
movq %rcx, %rbp
callq 0x15bd0
shlq 0x28(%r14)
movq 0x10(%r14), %rcx
subq 0x8(%r14), %rcx
sarq $0x3, %rcx
imulq %rbp, %rcx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rbp
cmpq %r15, %r12
jne 0x15bbe
movq 0x8(%r14), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,8), %r15
movq %r15, %rdi
movq 0x20(%rsp), %rsi
callq 0x1484a
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x4070
incq 0x10(%r15)
incq 0x20(%r14)
movq 0x18(%rsp), %rax
movq %rax, (%rbx)
movq %r12, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
movb $0x1, 0x18(%rbx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq