// File: /workspace/github_cpp_makefile_star2_O3/HQarroum[P]thread-pool/examples/many-producers-many-consumers/./../../includes/concurrent_queue.hpp
// Function: bool moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::ImplicitProducer::enqueue_bulk<(moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::AllocationMode)0, std::function<void ()> const*>(std::function<void ()> const*, unsigned long)
bool enqueue_bulk(It itemFirst, size_t count)
		{
			// First, we need to make sure we have enough room to enqueue all of the elements;
			// this means pre-allocating blocks and putting them in the block index (but only if
			// all the allocations succeeded).
			
			// Note that the tailBlock we start off with may not be owned by us any more;
			// this happens if it was filled up exactly to the top (setting tailIndex to
			// the first index of the next block which is not yet allocated), then dequeued
			// completely (putting it on the free list) before we enqueue again.
			
			index_t startTailIndex = this->tailIndex.load(std::memory_order_relaxed);
			auto startBlock = this->tailBlock;
			Block* firstAllocatedBlock = nullptr;
			auto endBlock = this->tailBlock;
			
			// Figure out how many blocks we'll need to allocate, and do so
			size_t blockBaseDiff = ((startTailIndex + count - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1)) - ((startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1));
			index_t currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
			if (blockBaseDiff > 0) {
#ifdef MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX
				debug::DebugLock lock(mutex);
#endif
				do {
					blockBaseDiff -= static_cast<index_t>(BLOCK_SIZE);
					currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
					
					// Find out where we'll be inserting this block in the block index
					BlockIndexEntry* idxEntry = nullptr;  // initialization here unnecessary but compiler can't always tell
					Block* newBlock;
					bool indexInserted = false;
					auto head = this->headIndex.load(std::memory_order_relaxed);
					assert(!details::circular_less_than<index_t>(currentTailIndex, head));
					bool full = !details::circular_less_than<index_t>(head, currentTailIndex + BLOCK_SIZE) || (MAX_SUBQUEUE_SIZE != details::const_numeric_max<size_t>::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head));

					if (full || !(indexInserted = insert_block_index_entry<allocMode>(idxEntry, currentTailIndex)) || (newBlock = this->parent->ConcurrentQueue::template requisition_block<allocMode>()) == nullptr) {
						// Index allocation or block allocation failed; revert any other allocations
						// and index insertions done so far for this operation
						if (indexInserted) {
							rewind_block_index_tail();
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
						}
						currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
						for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) {
							currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
							idxEntry = get_block_index_entry_for_index(currentTailIndex);
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
							rewind_block_index_tail();
						}
						this->parent->add_blocks_to_free_list(firstAllocatedBlock);
						this->tailBlock = startBlock;
						
						return false;
					}
					
#ifdef MCDBGQ_TRACKMEM
					newBlock->owner = this;
#endif
					newBlock->ConcurrentQueue::Block::template reset_empty<implicit_context>();
					newBlock->next = nullptr;
					
					// Insert the new block into the index
					idxEntry->value.store(newBlock, std::memory_order_relaxed);
					
					// Store the chain of blocks so that we can undo if later allocations fail,
					// and so that we can find the blocks when we do the actual enqueueing
					if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr) {
						assert(this->tailBlock != nullptr);
						this->tailBlock->next = newBlock;
					}
					this->tailBlock = newBlock;
					endBlock = newBlock;
					firstAllocatedBlock = firstAllocatedBlock == nullptr ? newBlock : firstAllocatedBlock;
				} while (blockBaseDiff > 0);
			}
			
			// Enqueue, one block at a time
			index_t newTailIndex = startTailIndex + static_cast<index_t>(count);
			currentTailIndex = startTailIndex;
			this->tailBlock = startBlock;
			assert((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr || count == 0);
			if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) == 0 && firstAllocatedBlock != nullptr) {
				this->tailBlock = firstAllocatedBlock;
			}
			while (true) {
				index_t stopIndex = (currentTailIndex & ~static_cast<index_t>(BLOCK_SIZE - 1)) + static_cast<index_t>(BLOCK_SIZE);
				if (details::circular_less_than<index_t>(newTailIndex, stopIndex)) {
					stopIndex = newTailIndex;
				}
				MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
					while (currentTailIndex != stopIndex) {
						new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++);
					}
				}
				else {
					MOODYCAMEL_TRY {
						while (currentTailIndex != stopIndex) {
							new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
							++currentTailIndex;
							++itemFirst;
						}
					}
					MOODYCAMEL_CATCH (...) {
						auto constructedStopIndex = currentTailIndex;
						auto lastBlockEnqueued = this->tailBlock;
						
						if (!details::is_trivially_destructible<T>::value) {
							auto block = startBlock;
							if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) == 0) {
								block = firstAllocatedBlock;
							}
							currentTailIndex = startTailIndex;
							while (true) {
								stopIndex = (currentTailIndex & ~static_cast<index_t>(BLOCK_SIZE - 1)) + static_cast<index_t>(BLOCK_SIZE);
								if (details::circular_less_than<index_t>(constructedStopIndex, stopIndex)) {
									stopIndex = constructedStopIndex;
								}
								while (currentTailIndex != stopIndex) {
									(*block)[currentTailIndex++]->~T();
								}
								if (block == lastBlockEnqueued) {
									break;
								}
								block = block->next;
							}
						}
						
						currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
						for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) {
							currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
							auto idxEntry = get_block_index_entry_for_index(currentTailIndex);
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
							rewind_block_index_tail();
						}
						this->parent->add_blocks_to_free_list(firstAllocatedBlock);
						this->tailBlock = startBlock;
						MOODYCAMEL_RETHROW;
					}
				}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r8
movq %rsi, %r15
movq %rdi, %rbx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x20(%rdi), %r12
movq 0x40(%rdi), %rax
leaq (%r12,%rdx), %r9
decq %r9
andq $-0x20, %r9
leaq -0x1(%r12), %rcx
andq $-0x20, %rcx
cmpq %rcx, %r9
movq %rax, 0x18(%rsp)
movq %rcx, 0x28(%rsp)
je 0x71ac
movq %r8, 0x10(%rsp)
movl %r12d, %eax
andl $0x1f, %eax
movq %rax, (%rsp)
movq %rsi, %r14
subq %rcx, %r14
addq $-0x41, %r14
leaq 0x20(%rcx), %r13
negq %r9
xorl %edx, %edx
leaq -0x1(%rsi), %rax
movq %rax, 0x20(%rsp)
movq %r9, 0x30(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x28(%rbx), %rax
movq %r13, %rcx
subq %rax, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
cmpq %rdx, %rcx
ja 0x732d
addq %r14, %rax
cmpq 0x20(%rsp), %rax
jae 0x7228
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x7228
movq 0x8(%rax), %rdx
incq %rdx
movq (%rax), %rcx
movq 0x18(%rax), %rsi
decq %rcx
andq %rdx, %rcx
movq (%rsi,%rcx,8), %rbp
movq (%rbp), %rdx
cmpq $0x1, %rdx
je 0x7110
movq 0x8(%rbp), %rdx
testq %rdx, %rdx
je 0x7110
movq %rbx, %rdi
callq 0x52a6
testb %al, %al
je 0x7228
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rdx
incq %rdx
movq (%rax), %rcx
movq 0x18(%rax), %rsi
decq %rcx
andq %rdx, %rcx
movq (%rsi,%rcx,8), %rbp
movq (%rbp), %rdx
cmpq $0x1, %rdx
jne 0x736b
movq %r13, (%rbp)
movq %rcx, 0x8(%rax)
movq 0x50(%rbx), %rdi
callq 0x55f6
testq %rax, %rax
je 0x7208
movq %rax, %rdi
movq $0x0, 0x408(%rax)
movq $0x0, 0x400(%rax)
movq %rax, 0x8(%rbp)
cmpq $0x0, (%rsp)
movq 0x8(%rsp), %rdx
movq 0x30(%rsp), %r9
jne 0x715d
testq %rdx, %rdx
je 0x7171
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x734c
movq %rdi, 0x400(%rax)
movq %rdi, 0x40(%rbx)
testq %rdx, %rdx
cmoveq %rdi, %rdx
addq $-0x20, %r14
leaq (%r9,%r13), %rax
addq $0x20, %rax
addq $0x20, %r13
cmpq $0x20, %rax
jne 0x706e
movq 0x18(%rsp), %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x10(%rsp), %r8
jmp 0x71bb
movl %r12d, %ecx
andl $0x1f, %ecx
movq %rcx, (%rsp)
xorl %edx, %edx
movq %rax, %rdi
movq %rax, 0x40(%rbx)
testq %r8, %r8
je 0x71d4
cmpq $0x0, (%rsp)
jne 0x71d4
testq %rdx, %rdx
je 0x738a
addq %r12, %r8
cmpq $0x0, (%rsp)
movq %rdx, 0x8(%rsp)
movq %r8, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
jne 0x7325
movq %rdx, %rcx
movq %r12, %rbp
movq %r12, %r14
testq %rdx, %rdx
jne 0x73a9
jmp 0x73b3
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rcx
decq %rcx
movq (%rax), %rdx
decq %rdx
andq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq $0x0, 0x8(%rbp)
movq 0x8(%rsp), %r9
testq %r9, %r9
je 0x7315
movq 0x28(%rsp), %r10
addq $0x20, %r10
movq %r9, %rax
movq 0x60(%rbx), %rdx
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rcx
movq (%rcx,%rsi,8), %rdi
movq (%rdi), %rdi
cmpq $0x1, %rdi
je 0x7608
movq %r10, %r8
subq %rdi, %r8
shrq $0x5, %r8
addq %rsi, %r8
movq (%rdx), %rdx
decq %rdx
andq %r8, %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rdx
cmpq %rdx, %r10
jne 0x75e9
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x75e9
movq $0x0, 0x8(%rcx)
movq 0x60(%rbx), %rcx
movq 0x8(%rcx), %rdx
decq %rdx
movq (%rcx), %rsi
decq %rsi
andq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movq 0x400(%rax), %rax
addq $0x20, %r10
testq %rax, %rax
jne 0x7242
movq 0x50(%rbx), %rcx
movq %r9, %rdx
movq 0x400(%r9), %r9
movl $0x80000000, %eax       # imm = 0x80000000
lock
xaddl %eax, 0x430(%rdx)
testl %eax, %eax
jne 0x7310
movq 0x28(%rcx), %rax
movq %rax, 0x438(%rdx)
movl $0x1, 0x430(%rdx)
lock
cmpxchgq %rdx, 0x28(%rcx)
je 0x7310
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
lock
xaddl %esi, 0x430(%rdx)
cmpl $0x1, %esi
je 0x72e5
testq %r9, %r9
jne 0x72c6
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rbx)
xorl %eax, %eax
jmp 0x7433
movq %r12, %r14
jmp 0x73b3
leaq 0x134f(%rip), %rdi      # 0x8683
leaq 0xdfc(%rip), %rsi       # 0x8137
leaq 0x1cc0(%rip), %rcx      # 0x9002
movl $0xa53, %edx            # imm = 0xA53
callq 0x3160
leaq 0x1dd4(%rip), %rdi      # 0x9127
leaq 0xddd(%rip), %rsi       # 0x8137
leaq 0x1ca1(%rip), %rcx      # 0x9002
movl $0xa76, %edx            # imm = 0xA76
callq 0x3160
leaq 0x1460(%rip), %rdi      # 0x87d2
leaq 0xdbe(%rip), %rsi       # 0x8137
leaq 0x1496(%rip), %rcx      # 0x8816
movl $0xb60, %edx            # imm = 0xB60
callq 0x3160
leaq 0x1db1(%rip), %rdi      # 0x9142
leaq 0xd9f(%rip), %rsi       # 0x8137
leaq 0x1c63(%rip), %rcx      # 0x9002
movl $0xa83, %edx            # imm = 0xA83
callq 0x3160
movq %rcx, 0x40(%rbx)
movq %rcx, %rax
movq %rbp, %r14
movq %r14, %rbp
andq $-0x20, %rbp
addq $0x20, %rbp
movq %r8, %rcx
subq %rbp, %rcx
cmpq %rsi, %rcx
cmovaq %r8, %rbp
cmpq %rbp, %r14
jne 0x73d5
movq %r14, %rbp
jmp 0x741a
movl $0x20, %r13d
subq %r14, %r13
movl %r14d, %edi
andl $0x1f, %edi
shll $0x5, %edi
addq 0x40(%rbx), %rdi
movq %r15, %rsi
callq 0x7642
incq %r14
addq $0x20, %r15
decq %r13
cmpq %r14, %rbp
jne 0x73de
movq 0x40(%rbx), %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x10(%rsp), %r8
movq 0x20(%rsp), %rdi
cmpq %rdi, %rax
je 0x7428
movq 0x400(%rax), %rcx
jmp 0x73a9
cmpq %r8, %rbp
jne 0x7442
movq %r8, 0x20(%rbx)
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d66(%rip), %rdi      # 0x91af
leaq 0xce7(%rip), %rsi       # 0x8137
leaq 0x1bab(%rip), %rcx      # 0x9002
movl $0xac0, %edx            # imm = 0xAC0
callq 0x3160
movq %rax, %rdi
callq 0x30e0
cmpq $0x0, (%rsp)
movq 0x40(%rbx), %rdx
movq 0x18(%rsp), %r15
cmoveq 0x8(%rsp), %r15
negq %r13
movq %rdx, 0x10(%rsp)
movq %r12, %rbp
andq $-0x20, %rbp
movq %r13, %rax
subq %rbp, %rax
addq $0x20, %rbp
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
cmpq %rcx, %rax
cmovaq %r14, %rbp
cmpq %rbp, %r12
je 0x74dc
movl %r12d, %edi
andl $0x1f, %edi
shll $0x5, %edi
movq 0x10(%r15,%rdi), %rax
testq %rax, %rax
je 0x74cc
addq %r15, %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
incq %r12
cmpq %r12, %rbp
jne 0x74ac
movq %rbp, %r12
movq 0x10(%rsp), %rdx
cmpq %rdx, %r15
je 0x74ea
movq 0x400(%r15), %r15
jmp 0x7485
movq 0x8(%rsp), %rax
testq %rax, %rax
jne 0x7502
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rbx)
callq 0x32f0
movq 0x28(%rsp), %r10
addq $0x20, %r10
movq %rax, %r9
movq 0x60(%rbx), %rdx
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rcx
movq (%rcx,%rsi,8), %rdi
movq (%rdi), %rdi
cmpq $0x1, %rdi
je 0x7608
movq %r10, %r8
subq %rdi, %r8
shrq $0x5, %r8
addq %rsi, %r8
movq (%rdx), %rdx
decq %rdx
andq %r8, %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rdx
cmpq %rdx, %r10
jne 0x75e9
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x75e9
movq $0x0, 0x8(%rcx)
movq 0x60(%rbx), %rcx
movq 0x8(%rcx), %rdx
decq %rdx
movq (%rcx), %rsi
decq %rsi
andq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movq 0x400(%rax), %rax
addq $0x20, %r10
testq %rax, %rax
jne 0x750e
movq 0x50(%rbx), %rcx
movq %r9, %rdi
movq %rdi, %rdx
movq 0x400(%rdi), %rdi
movl $0x80000000, %eax       # imm = 0x80000000
lock
xaddl %eax, 0x430(%rdx)
testl %eax, %eax
jne 0x75df
movq 0x28(%rcx), %rax
movq %rax, 0x438(%rdx)
movl $0x1, 0x430(%rdx)
lock
cmpxchgq %rdx, 0x28(%rcx)
je 0x75df
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
lock
xaddl %esi, 0x430(%rdx)
cmpl $0x1, %esi
je 0x75b4
testq %rdi, %rdi
jne 0x7595
jmp 0x74f4
leaq 0xff8(%rip), %rdi       # 0x85e8
leaq 0xb40(%rip), %rsi       # 0x8137
leaq 0xf08(%rip), %rcx       # 0x8506
movl $0xb81, %edx            # imm = 0xB81
callq 0x3160
leaq 0xed8(%rip), %rdi       # 0x84e7
leaq 0xb21(%rip), %rsi       # 0x8137
leaq 0xee9(%rip), %rcx       # 0x8506
movl $0xb7c, %edx            # imm = 0xB7C
callq 0x3160
movq %rax, %rbx
callq 0x3330
movq %rbx, %rdi
callq 0x3380
jmp 0x7639
movq %rax, %rdi
callq 0x3c65
nop