// File: /workspace/github_cpp_makefile_star2_O2/f18m[P]boost-intrusive-pool/include/boost_intrusive_pool.hpp
// Function: memorypool::boost_intrusive_pool<DummyClass>::impl::allocate_safe_get_recycled_item()
Item* allocate_safe_get_recycled_item()
        {
#if BOOST_INTRUSIVE_POOL_DEBUG_THREAD_ACCESS
            if (m_allowed_thread == 0)
                m_allowed_thread = pthread_self();
            else
                assert(m_allowed_thread == pthread_self());
#endif

            if (m_free_count == 0) {
                assert(m_first_free_item == nullptr);
                size_t enlarge_step = get_effective_enlarge_step();
                if (enlarge_step == 0 || !enlarge(enlarge_step)) {
                    m_memory_exhausted = true;
                    return nullptr; // allocation by enlarge() failed or this is a fixed-size memory pool!
                }
            }

            // get first item from free list
            assert(m_first_free_item != nullptr);
            Item* recycled_item = dynamic_cast<Item*>(m_first_free_item); // downcast (base class -> derived class)
            assert(recycled_item != nullptr); // we always allocate all items of the same type,
                                              // so the dynamic cast cannot fail
            assert(
                recycled_item->_refcounted_item_get_pool().get() == this); // this was set during arena initialization
                                                                           // and must be valid at all times

            // update stats
            m_free_count--;
            m_inuse_count++;

            // update the pointer to the next free item available
            m_first_free_item = m_first_free_item->_refcounted_item_get_next();
            if (m_first_free_item == nullptr && m_enlarge_step > 0) {
                size_t enlarge_step = get_effective_enlarge_step();
                if (enlarge_step == 0) { // enlarge_step can be zero if we reach the max_size
                    m_memory_exhausted = true;
                } else {
                    // this is a memory pool which can be still enlarged:
                    // exit the function leaving the m_first_free_item as a valid pointer to a free item!
                    // this is just to simplify debugging and make more effective the check() function implementation!

                    assert(m_free_count == 0);
                    if (!enlarge(enlarge_step)) {
                        m_memory_exhausted = true;
                        // We tried to fetch memory from the O.S. but we failed. However we succeeded in getting the
                        // last available item. So fallback and provide that last item to the caller.
                    }
                }
            }

            // unlink the item to return
            recycled_item->_refcounted_item_set_next(nullptr);
            return recycled_item;
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x80(%rdi), %r14
callq 0x20e0
testq %r14, %r14
je 0x407d
cmpq %rax, %r14
je 0x4084
leaq 0x1c5d(%rip), %rdi      # 0x5cc2
leaq 0x1637(%rip), %rsi      # 0x56a3
leaq 0x1e70(%rip), %rcx      # 0x5ee3
movl $0x253, %edx            # imm = 0x253
callq 0x2090
movq %rax, 0x80(%rbx)
cmpq $0x0, 0x60(%rbx)
je 0x4133
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x4171
leaq 0x5a9d(%rip), %rsi      # 0x9b40
leaq 0x5aa6(%rip), %rdx      # 0x9b50
xorl %ecx, %ecx
callq 0x2100
testq %rax, %rax
je 0x4190
movq %rax, %r14
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
testq %rax, %rax
je 0x40cd
incl 0x8(%rax)
cmpq %rbx, %rax
jne 0x41af
leaq -0x18(%rbp), %rdi
callq 0x32a2
decq 0x60(%rbx)
incq 0x68(%rbx)
movq 0x30(%rbx), %rax
movq 0x50(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x50(%rbx)
testq %rcx, %rcx
jne 0x412c
testq %rax, %rax
je 0x412c
movq %rbx, %rdi
callq 0x420c
testq %rax, %rax
je 0x4128
cmpq $0x0, 0x60(%rbx)
jne 0x41ed
movq %rbx, %rdi
movq %rax, %rsi
callq 0x391a
testb %al, %al
jne 0x412c
movb $0x1, 0x58(%rbx)
andq $0x0, 0x10(%r14)
jmp 0x4165
cmpq $0x0, 0x50(%rbx)
jne 0x41ce
movq %rbx, %rdi
callq 0x420c
testq %rax, %rax
je 0x415e
movq %rbx, %rdi
movq %rax, %rsi
callq 0x391a
testb %al, %al
jne 0x408f
movb $0x1, 0x58(%rbx)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1df8(%rip), %rdi      # 0x5f70
leaq 0x1524(%rip), %rsi      # 0x56a3
leaq 0x1d5d(%rip), %rcx      # 0x5ee3
movl $0x260, %edx            # imm = 0x260
callq 0x2090
leaq 0x1df6(%rip), %rdi      # 0x5f8d
leaq 0x1505(%rip), %rsi      # 0x56a3
leaq 0x1d3e(%rip), %rcx      # 0x5ee3
movl $0x262, %edx            # imm = 0x262
callq 0x2090
leaq 0x1df0(%rip), %rdi      # 0x5fa6
leaq 0x14e6(%rip), %rsi      # 0x56a3
leaq 0x1d1f(%rip), %rcx      # 0x5ee3
movl $0x265, %edx            # imm = 0x265
callq 0x2090
leaq 0x1d7e(%rip), %rdi      # 0x5f53
leaq 0x14c7(%rip), %rsi      # 0x56a3
leaq 0x1d00(%rip), %rcx      # 0x5ee3
movl $0x257, %edx            # imm = 0x257
callq 0x2090
leaq 0x1deb(%rip), %rdi      # 0x5fdf
leaq 0x14a8(%rip), %rsi      # 0x56a3
leaq 0x1ce1(%rip), %rcx      # 0x5ee3
movl $0x277, %edx            # imm = 0x277
callq 0x2090