// File: /workspace/github_cpp_makefile_star2_O1/UTSASRG[P]Guarder/./bibopheap.hh
// Function: BibopHeap::BibopFreeCache::add(void*)
inline bool add(void * addr) {
							// Check if this buffer has reached full capacity...
							if(_numFreeObjects == _capacity) {
									#ifdef USE_GLOBAL_FREE_CACHE
									// Attempt to donate up to half of the
									// local buffer's items to the global buffer
									if(_myGlobalFreeCache) {
											int i;

											_myGlobalFreeCache->acquireLock();
											for(i = 0; i < (_capacity >> 1); i++) {
													if(!_myGlobalFreeCache->add(getNext())) {
															break;
													}
											}
											_myGlobalFreeCache->releaseLock();
											PRDBG("donated %d objects to global cache", i);
											// If i==0, the global free cache is also at full capacity
											if(i == 0) {
													FATAL("global and local free cache out of capacity");
											}
									} else {
											// If we are a global buffer and we're full,
											// simply return false back to the caller
											return false;
									}
									#else
									// If the global free cache is not in use and the local
									// buffer is full, print an error and return false
									PRERR("local free cache out of capacity: dropping object %p", addr);
									return false;
									#endif
							}

							*(void **)_head = addr;
							_head += POINTER_SIZE;
							if(_head == _endaddr) {
									// do wrap-around on _head
									_head = _startaddr;
							}

							_numFreeObjects++;

							/*
							// DEBUG: internal consistency check
							long count = (_endaddr - _startaddr) / sizeof(void *);
							if(_head > _tail) {
									count = (_head - _tail) / sizeof(void *);
							} else if(_head < _tail) {
									count = ((_endaddr - _tail) + (_head - _startaddr)) / sizeof(void *);
							}
							PRDBG("freeCache->add(%p): this=%p, _numFreeObjects=%lu, count=%ld, _capacity=%lu, _start=0x%lx, _end=0x%lx",
											addr, this, _numFreeObjects, count, _capacity, _startaddr, _endaddr);
							if(_numFreeObjects != count) {
									FATAL("freeCache->add(%p): this=%p, _numFreeObjects=%lu, count=%ld, _capacity=%lu, _start=0x%lx, _end=0x%lx",
													addr, this,  _numFreeObjects, count, _capacity, _startaddr, _endaddr);
							}
							*/

							if(_head == _tail) {
									PRDBG("free cache is now full");
									if(_numFreeObjects != _capacity) {
											PRERR("_numFreeObjects = %lu, _capacity = %lu", _numFreeObjects, _capacity);
									}
									assert(_numFreeObjects == _capacity);
							}

							return true;
					}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq 0x28(%rdi), %r12
movq 0x38(%rdi), %r13
cmpq %r12, %r13
je 0x7d79
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq %r14, (%rax)
addq $0x8, %rax
movq %rax, 0x18(%rdi)
cmpq 0x10(%rdi), %rax
jne 0x7c77
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rbx)
leaq 0x1(%r13), %rax
movq %rax, 0x38(%rbx)
movq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
jne 0x7ddb
callq 0x41e0
movq %rax, %r15
callq 0x4250
movq %rax, %r14
leaq 0x27fe(%rip), %rdx      # 0xa4a2
leaq 0x18cf(%rip), %r8       # 0x957a
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %rax, %rcx
movl $0x122, %r9d            # imm = 0x122
xorl %eax, %eax
callq 0x4490
callq 0x41e0
movq %rax, %r15
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0x40f0
movq 0x38(%rbx), %rax
cmpq 0x28(%rbx), %rax
je 0x7d4c
callq 0x41e0
leaq 0x27db(%rip), %rdx      # 0xa4d9
leaq 0x1875(%rip), %r8       # 0x957a
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdi
movq %r14, %rcx
movl $0x124, %r9d            # imm = 0x124
xorl %eax, %eax
pushq 0x28(%rbx)
pushq 0x38(%rbx)
callq 0x4490
addq $0x10, %rsp
callq 0x41e0
movq %rax, %r14
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x40f0
movq 0x38(%rbx), %rax
cmpq 0x28(%rbx), %rax
je 0x7ddb
leaq 0x27c3(%rip), %rdi      # 0xa524
leaq 0x1812(%rip), %rsi      # 0x957a
leaq 0x27d2(%rip), %rcx      # 0xa541
movl $0x126, %edx            # imm = 0x126
callq 0x4200
callq 0x41e0
movq %rax, %rbx
callq 0x4250
subq $0x8, %rsp
leaq 0x26b8(%rip), %rdx      # 0xa449
leaq 0x17e2(%rip), %r8       # 0x957a
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movq %rax, %rcx
movl $0x103, %r9d            # imm = 0x103
xorl %eax, %eax
pushq %r14
callq 0x4490
addq $0x10, %rsp
callq 0x41e0
movq %rax, %rbx
callq 0x41e0
movq %rax, %rdi
callq 0x4120
movl $0x2, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x40f0
cmpq %r12, %r13
setne %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop