// File: UTSASRG[P]Guarder/./bibopheap.hh
// Function: BibopHeap::BibopObjCache::repopulate()
void repopulate() {
					// Perform an O(n) repopulation of this object cache using
					// freed objects located in the freeCache
					// If there are not enough objects in freeCache to fully perform
					// the repopulation, we should shift to using new objects from the
					// top of the heap (pointed to by _heapTop)

					PRDBG("*** beginning repopulation ***");

					ObjectSource * objSource;
					if(_freeCache->getNumObjects() > 0) {
							PRDBG("\tusing free cache as object source");
							objSource = _freeCache;
					} else {
							PRDBG("\tusing heap top as object source");
							objSource = this;
					}

					unsigned position = 0;
					#pragma message "allocation buffer refill level set to 75%"
					// Fills the cache back up to 75% available (25% used)
					unsigned refill_level = BIBOP_CACHE_SIZE >> 2;
					while(_numUsedObjects > refill_level) {
							if(_objects[position] == NULL) {
									//if((_objects[position] = objSource->getNext()) == NULL) {
									void * popObject = objSource->getNext();
									PRDBG("\t\tfree object %p -> _objects[%d] (cache entry %p, obj src = %p)",
											popObject, position, &_objects[position], objSource);
									// Write the next object from the free cache into this position.
									// If the free cache returned NULL then it is out of objects.
									if((_objects[position] = popObject) == NULL) {
											PRDBG("\t*** switching back to heap top as object source");
											objSource = this;
											// We do not increment position in this case because we want
											// the loop to attempt to fill this position again, but using
											// the heap as the object source instead of the free cache.
									} else {
											// Our object source returned a valid object -- decrement the
											// number of used objects, and increment the array position
											// to proceed with the next item
											//unsigned currentRegion = position & NUM_CACHE_REGIONS_MASK;
											unsigned currentRegion = position >> CACHE_REGION_SIZE_SHIFT_BITS;
											PRDBG("_regionCounters[%d]++ (index = %d)", currentRegion, position);
											_regionCounters[currentRegion]++;
											_numUsedObjects--;
											position++;
									}
							} else {
									// If the object at this position is alive,
									// simply move to the next object...
									position++;
							}
					}
			}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xb8, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x52d0
movq %rax, -0x48(%rbp)
callq 0x5400
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2f8f(%rip), %rdx      # 0xce28
leaq 0x26c2(%rip), %r8       # 0xc562
movl $0x223, %r9d            # imm = 0x223
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x40(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x40(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5940
cmpq $0x0, %rax
jbe 0x9f51
callq 0x52d0
movq %rax, -0x58(%rbp)
callq 0x5400
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2f5f(%rip), %rdx      # 0xce67
leaq 0x2653(%rip), %r8       # 0xc562
movl $0x227, %r9d            # imm = 0x227
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x50(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x50(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x9fb5
callq 0x52d0
movq %rax, -0x68(%rbp)
callq 0x5400
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2f38(%rip), %rdx      # 0xceaa
leaq 0x25e9(%rip), %r8       # 0xc562
movl $0x22a, %r9d            # imm = 0x22A
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x60(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x60(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq 0x6f55(%rip), %rax      # 0x10f18
movl 0x8(%rax), %eax
shrl $0x2, %eax
movl %eax, -0x20(%rbp)
movq -0x38(%rbp), %rax
movl 0x2c(%rax), %eax
cmpl -0x20(%rbp), %eax
jbe 0xa1ed
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movl -0x1c(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0xa1df
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
movq %rax, -0x28(%rbp)
callq 0x52d0
movq %rax, -0x78(%rbp)
callq 0x5400
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rbx
movl -0x1c(%rbp), %r11d
movq 0x58(%rax), %r10
movl -0x1c(%rbp), %eax
shlq $0x3, %rax
addq %rax, %r10
movq -0x18(%rbp), %rax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2ead(%rip), %rdx      # 0xceeb
leaq 0x251d(%rip), %r8       # 0xc562
movl $0x237, %r9d            # imm = 0x237
movq %rbx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x70(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x70(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x58(%rcx), %rcx
movl -0x1c(%rbp), %edx
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
jne 0xa114
callq 0x52d0
movq %rax, -0x88(%rbp)
callq 0x5400
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2e7f(%rip), %rdx      # 0xcf4b
leaq 0x248f(%rip), %r8       # 0xc562
movl $0x23b, %r9d            # imm = 0x23B
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x80(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x80(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0xa1dd
movl -0x1c(%rbp), %eax
movq 0x6dfa(%rip), %rcx      # 0x10f18
movl 0x8(%rcx), %ecx
shrl $0x3, %ecx
movl %ecx, %ecx
bsrq %rcx, %rcx
xorq $0x3f, %rcx
movslq %ecx, %rdx
movl $0x40, %ecx
subq %rdx, %rcx
subq $0x1, %rcx
shrl %cl, %eax
movl %eax, -0x2c(%rbp)
callq 0x52d0
movq %rax, -0x98(%rbp)
callq 0x5400
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl -0x2c(%rbp), %r10d
movl -0x1c(%rbp), %eax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x2e2c(%rip), %rdx      # 0xcf9c
leaq 0x23eb(%rip), %r8       # 0xc562
movl $0x246, %r9d            # imm = 0x246
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x90(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x90(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl 0x34(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x34(%rax,%rcx,4)
movl 0x2c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2c(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1e8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9fcc
addq $0xb8, %rsp
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)