// File: MingYueRuYa[P]cprimeprimecode/memory_manager.cpp
// Function: custom_allocator::test_custom_allocator()
void test_custom_allocator()
{
	cout << "Foo size:" << sizeof(Foo) << endl;

	Foo  *fooarray[100];
	for (int i=0; i<13; ++i) {
		fooarray[i] = new Foo();
	}

	cout << "Goo size:" << sizeof(Foo) << endl;
	Goo  *gooarray[100];
	for (int i=0; i<13; ++i) {
		gooarray[i] = new Goo();
	}

	cout << "Hoo size:" << sizeof(Foo) << endl;
	Hoo  *hooarray[100];
	for (int i=0; i<13; ++i) {
		hooarray[i] = new Hoo();
	}

//result:
	//	Foo size:4
	//	address:0x1b17008
	//	address:0x1b1700c
	//	address:0x1b17010
	//	address:0x1b17014
	//	address:0x1b17018
	//	address:0x1b17020
	//	address:0x1b17024
	//	address:0x1b17028
	//	address:0x1b1702c
	//	address:0x1b17030
	//	address:0x1b17038
	//	address:0x1b1703c
	//	address:0x1b17040
	//	Goo size:4
	//	address:0x1b17050
	//	address:0x1b17054
	//	address:0x1b17058
	//	address:0x1b1705c
	//	address:0x1b17060
	//	address:0x1b17068
	//	address:0x1b1706c
	//	address:0x1b17070
	//	address:0x1b17074
	//	address:0x1b17078
	//	address:0x1b17080
	//	address:0x1b17084
	//	address:0x1b17088
	//	Hoo size:4
	//	address:0x1b17098
	//	address:0x1b1709c
	//	address:0x1b170a0
	//	address:0x1b170a4
	//	address:0x1b170a8
	//	address:0x1b170b0
	//	address:0x1b170b4
	//	address:0x1b170b8
	//	address:0x1b170bc
	//	address:0x1b170c0
	//	address:0x1b170c8
	//	address:0x1b170cc
	//	address:0x1b170d0
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x9b0, %rsp            # imm = 0x9B0
movq 0x50d6(%rip), %rdi      # 0x8fd8
leaq 0x2399(%rip), %rsi      # 0x62a2
callq 0x2190
movq %rax, %rdi
movl $0x4, %esi
callq 0x2050
movq %rax, %rdi
movq 0x5093(%rip), %rsi      # 0x8fb8
callq 0x21c0
movl $0x0, -0x324(%rbp)
cmpl $0xd, -0x324(%rbp)
jge 0x3faa
movl $0x4, %edi
callq 0x4c40
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x9a0(%rbp)
callq 0x4c70
jmp 0x3f5b
movq -0x9a0(%rbp), %rcx
movslq -0x324(%rbp), %rax
movq %rcx, -0x320(%rbp,%rax,8)
movl -0x324(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x324(%rbp)
jmp 0x3f34
movq -0x9a0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x330(%rbp)
movl %eax, -0x334(%rbp)
movl $0x4, %esi
callq 0x4cc0
jmp 0x4109
movq 0x5027(%rip), %rdi      # 0x8fd8
leaq 0x22f4(%rip), %rsi      # 0x62ac
callq 0x2190
movq %rax, %rdi
movl $0x4, %esi
callq 0x2050
movq %rax, %rdi
movq 0x4fe4(%rip), %rsi      # 0x8fb8
callq 0x21c0
movl $0x0, -0x664(%rbp)
cmpl $0xd, -0x664(%rbp)
jge 0x4059
movl $0x4, %edi
callq 0x4d00
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x9a8(%rbp)
callq 0x4d30
jmp 0x400a
movq -0x9a8(%rbp), %rcx
movslq -0x664(%rbp), %rax
movq %rcx, -0x660(%rbp,%rax,8)
movl -0x664(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x664(%rbp)
jmp 0x3fe3
movq -0x9a8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x330(%rbp)
movl %eax, -0x334(%rbp)
movl $0x4, %esi
callq 0x4d80
jmp 0x4109
movq 0x4f78(%rip), %rdi      # 0x8fd8
leaq 0x224f(%rip), %rsi      # 0x62b6
callq 0x2190
movq %rax, %rdi
movl $0x4, %esi
callq 0x2050
movq %rax, %rdi
movq 0x4f35(%rip), %rsi      # 0x8fb8
callq 0x21c0
movl $0x0, -0x994(%rbp)
cmpl $0xd, -0x994(%rbp)
jge 0x4100
movl $0x4, %edi
callq 0x4db0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x9b0(%rbp)
callq 0x4de0
jmp 0x40b9
movq -0x9b0(%rbp), %rcx
movslq -0x994(%rbp), %rax
movq %rcx, -0x990(%rbp,%rax,8)
movl -0x994(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x994(%rbp)
jmp 0x4092
movq -0x9b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x330(%rbp)
movl %eax, -0x334(%rbp)
callq 0x4e30
jmp 0x4109
addq $0x9b0, %rsp            # imm = 0x9B0
popq %rbp
retq
movq -0x330(%rbp), %rdi
callq 0x2300
nopw %cs:(%rax,%rax)