// File: HQarroum[P]thread-pool/examples/one-producer-many-consumers/./../../includes/concurrent_queue.hpp
// Function: moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::ImplicitProducer::get_block_index_index_for_index(unsigned long, moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::ImplicitProducer::BlockIndexHeader*&) const
inline size_t get_block_index_index_for_index(index_t index, BlockIndexHeader*& localBlockIndex) const
		{
#ifdef MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX
			debug::DebugLock lock(mutex);
#endif
			index &= ~static_cast<index_t>(BLOCK_SIZE - 1);
			localBlockIndex = blockIndex.load(std::memory_order_acquire);
			auto tail = localBlockIndex->tail.load(std::memory_order_acquire);
			auto tailBase = localBlockIndex->index[tail]->key.load(std::memory_order_relaxed);
			assert(tailBase != INVALID_BLOCK_BASE);
			// Note: Must use division instead of shift because the index may wrap around, causing a negative
			// offset, whose negativity we want to preserve
			auto offset = static_cast<size_t>(static_cast<typename std::make_signed<index_t>::type>(index - tailBase) / BLOCK_SIZE);
			size_t idx = (tail + offset) & (localBlockIndex->capacity - 1);
			assert(localBlockIndex->index[idx]->key.load(std::memory_order_relaxed) == index && localBlockIndex->index[idx]->value.load(std::memory_order_relaxed) != nullptr);
			return idx;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x50(%rbp)
movq %rsi, -0x58(%rbp)
movq %rdx, -0x60(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rax
andq $-0x20, %rax
movq %rax, -0x58(%rbp)
addq $0x60, %rdi
movl $0x2, %esi
callq 0xb160
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
movl $0x2, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0xc(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x58d0
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x84(%rbp)
decl %eax
subl $0x2, %eax
jb 0xad6f
jmp 0xad52
movl -0x84(%rbp), %eax
subl $0x5, %eax
je 0xad7f
jmp 0xad5f
movq -0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xad8d
movq -0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xad8d
movq -0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl -0x24(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x58d0
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x94(%rbp)
decl %eax
subl $0x2, %eax
jb 0xadfd
jmp 0xade0
movl -0x94(%rbp), %eax
subl $0x5, %eax
je 0xae0d
jmp 0xaded
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xae1b
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xae1b
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x1, -0x70(%rbp)
je 0xae2c
jmp 0xae4b
leaq 0xda76(%rip), %rdi      # 0x188a9
leaq 0xd56c(%rip), %rsi      # 0x183a6
movl $0xb7c, %edx            # imm = 0xB7C
leaq 0xda82(%rip), %rcx      # 0x188c8
callq 0x3180
movq -0x58(%rbp), %rax
movq -0x70(%rbp), %rcx
subq %rcx, %rax
shrq $0x5, %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rax
movq -0x78(%rbp), %rcx
addq %rcx, %rax
movq -0x60(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
decq %rcx
andq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x3c(%rbp), %edi
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x58d0
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0xa4(%rbp)
decl %eax
subl $0x2, %eax
jb 0xaee5
jmp 0xaec8
movl -0xa4(%rbp), %eax
subl $0x5, %eax
je 0xaef5
jmp 0xaed5
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xaf03
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xaf03
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0x58(%rbp), %rcx
movb %al, -0xb1(%rbp)
jne 0xaf40
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x8, %rdi
xorl %esi, %esi
callq 0x6210
cmpq $0x0, %rax
setne %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0xaf4c
jmp 0xaf4e
jmp 0xaf6d
leaq 0xda55(%rip), %rdi      # 0x189aa
leaq 0xd44a(%rip), %rsi      # 0x183a6
movl $0xb81, %edx            # imm = 0xB81
leaq 0xd960(%rip), %rcx      # 0x188c8
callq 0x3180
movq -0x80(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)