// File: UTSASRG[P]Guarder/./bibopheap.hh
// Function: BibopHeap::BibopObjCache::initialize(unsigned long, unsigned long, unsigned long*, BibopHeap::BibopFreeCache*, unsigned int)
void initialize(uintptr_t ustartaddr, uintptr_t uendaddr, uintptr_t * objectCache,
							BibopFreeCache * freeCache, unsigned shiftBits) {
					unsigned i;

          // Initialize each of the cache region object
          // counters to indicate an uninitialized object cache
          for(i = 0; i < NUM_CACHE_REGIONS; i++) {
              _regionCounters[i] = UNINITIALIZED_CACHE_REGION;
          }

					// Force the over-provisioning to choose a fresh set of objects
					_nextUp = BibopHeap::_overProvObjBufSize;

					_shiftBits = shiftBits;
					_classSize = (size_t)(1U << _shiftBits);

					// Check whether the current bag size can support the current
					// entropy setting (e.g., if any bag has fewer objects than
					// needed to fill its object cache or over-provisioning buffer,
					// then we cannot support the current entropy setting).
					unsigned numObjectsInBag = _bibopBagSize / _classSize;
					bool overProvFail = (numObjectsInBag < BibopHeap::_overProvObjBufSize);
					bool entropyFail = (numObjectsInBag < BibopHeap::_cacheSize);
					if(overProvFail) {
							PRERR("cannot support the given over-provisioning factor:");
							PRERR("           class size = %zu", _classSize);
							PRERR("   num objects in bag = %u", numObjectsInBag);
							PRERR("   over prov buf size = %u", BibopHeap::_overProvObjBufSize);
					}
					if(entropyFail) {
							PRERR("cannot support the given allocator entropy:");
							PRERR("           class size = %zu", _classSize);
							PRERR("   num objects in bag = %u", numObjectsInBag);
							PRERR("       obj cache size = %u", BibopHeap::_cacheSize);
					}
					if(overProvFail || entropyFail) { exit(EXIT_FAILURE); }

					_freeCache = freeCache;
					_numUsedObjects = 0;
					_heapTop = ustartaddr;		// next available object
					_bagEnd = uendaddr;				// last available object
					_objects = (void **)objectCache;
					_nextObjs = objectCache + BibopHeap::_cacheSize;
			}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x8, -0x30(%rbp)
jae 0x8da2
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl $0xffffffff, 0x34(%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8d82
movq -0x40(%rbp), %rax
movq 0x81eb(%rip), %rcx      # 0x10f98
movl (%rcx), %ecx
movl %ecx, 0x28(%rax)
movl -0x2c(%rbp), %ecx
movl %ecx, 0x30(%rax)
movl 0x30(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movq -0x40(%rbp), %rcx
movl %eax, %eax
movq %rax, 0x10(%rcx)
movq 0x81d5(%rip), %rax      # 0x10fa8
movq (%rax), %rax
xorl %edx, %edx
divq 0x10(%rcx)
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq 0x81af(%rip), %rcx      # 0x10f98
cmpl (%rcx), %eax
setb %al
andb $0x1, %al
movb %al, -0x35(%rbp)
movl -0x34(%rbp), %eax
movq 0x8173(%rip), %rcx      # 0x10f70
cmpl (%rcx), %eax
setb %al
andb $0x1, %al
movb %al, -0x36(%rbp)
testb $0x1, -0x35(%rbp)
je 0x8f9f
callq 0x52d0
movq %rax, -0x80(%rbp)
callq 0x5400
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3c11(%rip), %rdx      # 0xca43
leaq 0x3729(%rip), %r8       # 0xc562
movl $0x176, %r9d            # imm = 0x176
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x78(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x78(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0x70(%rbp)
callq 0x5400
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3c04(%rip), %rdx      # 0xca9a
leaq 0x36c5(%rip), %r8       # 0xc562
movl $0x177, %r9d            # imm = 0x177
movq %rax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x68(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x68(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0x60(%rbp)
callq 0x5400
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl -0x34(%rbp), %eax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3be1(%rip), %rdx      # 0xcada
leaq 0x3662(%rip), %r8       # 0xc562
movl $0x178, %r9d            # imm = 0x178
movl %eax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x58(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x58(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0x50(%rbp)
callq 0x5400
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movq 0x8045(%rip), %rax      # 0x10f98
movl (%rax), %eax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3bb8(%rip), %rdx      # 0xcb19
leaq 0x35fa(%rip), %r8       # 0xc562
movl $0x179, %r9d            # imm = 0x179
movl %eax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x48(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x48(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
testb $0x1, -0x36(%rbp)
je 0x9167
callq 0x52d0
movq %rax, -0xc0(%rbp)
callq 0x5400
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3b88(%rip), %rdx      # 0xcb58
leaq 0x358b(%rip), %r8       # 0xc562
movl $0x17c, %r9d            # imm = 0x17C
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0xb8(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0xb8(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0xb0(%rbp)
callq 0x5400
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3a5a(%rip), %rdx      # 0xca9a
leaq 0x351b(%rip), %r8       # 0xc562
movl $0x17d, %r9d            # imm = 0x17D
movq %rax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0xa8(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0xa0(%rbp)
callq 0x5400
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl -0x34(%rbp), %eax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3a2b(%rip), %rdx      # 0xcada
leaq 0x34ac(%rip), %r8       # 0xc562
movl $0x17e, %r9d            # imm = 0x17E
movl %eax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x98(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x98(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
callq 0x52d0
movq %rax, -0x90(%rbp)
callq 0x5400
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movq 0x7e5b(%rip), %rax      # 0x10f70
movl (%rax), %eax
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3a85(%rip), %rdx      # 0xcba8
leaq 0x3438(%rip), %r8       # 0xc562
movl $0x17f, %r9d            # imm = 0x17F
movl %eax, (%rsp)
movb $0x0, %al
callq 0x57e0
callq 0x52d0
movq %rax, -0x88(%rbp)
callq 0x52d0
movq %rax, %rdi
callq 0x51e0
movq -0x88(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
callq 0x5160
testb $0x1, -0x35(%rbp)
jne 0x9173
testb $0x1, -0x36(%rbp)
je 0x917d
movl $0x1, %edi
callq 0x55b0
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, 0x2c(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rcx
movq 0x7dbd(%rip), %rdx      # 0x10f70
movl (%rdx), %edx
shlq $0x3, %rdx
addq %rdx, %rcx
movq %rcx, 0x60(%rax)
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)