// File: /workspace/github_cpp_makefile_star2_O1/MingYueRuYa[P]cprimeprimecode/memory_manager.cpp
// Function: demo05::test_per_class_allocator_2()
void test_per_class_allocator_2()
{
	cout << "\ntest_per_class_allocator_2\n";

	cout << sizeof(AirPlane) << endl;	//8

	size_t const N = 100;
	AirPlane *p[N];

	for (size_t i=0; i<N; ++i) {
		p[i] = new AirPlane();
	}

	//随机测试object是否正常
	p[1]->set(100, 'A');
	p[5]->set(10000, 'B');
	p[9]->set(1000000, 'C');

	cout << p[1] << ' ' << p[1]->getType() << ' ' << p[1]->getMiles() << endl;
	cout << p[5] << ' ' << p[5]->getType() << ' ' << p[5]->getMiles() << endl;
	cout << p[9] << ' ' << p[9]->getType() << ' ' << p[9]->getMiles() << endl;
	//result:
		//	0x85dc010 A 100
		//	0x85dc030 B 10000
		//	0x85dc050 C 1000000

	//输出前10个pointers，用以比较其间隔
	for (size_t i=0; i<10; ++i) {
		cout << p[i] << endl;
	}
	//result:	间隔为8，中间没有cookie
		//	0x85dc008
		//	0x85dc010
		//	0x85dc018
		//	0x85dc020
		//	0x85dc028
		//	0x85dc030
		//	0x85dc038
		//	0x85dc040
		//	0x85dc048
		//	0x85dc050

	for (size_t i=0; i<N; ++i) {
		delete p[i];
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq 0x5429(%rip), %rbx      # 0x7fd0
leaq 0x254d(%rip), %rsi      # 0x50fb
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x21a0
movl $0x10, %esi
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
xorl %ebx, %ebx
movl $0x10, %edi
callq 0x2b10
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, -0x350(%rbp,%rbx,8)
incq %rbx
cmpq $0x64, %rbx
jne 0x2bf4
movq -0x348(%rbp), %r12
movq $0x64, (%r12)
movb $0x41, 0x8(%r12)
movq -0x328(%rbp), %r15
movq $0x2710, (%r15)         # imm = 0x2710
movb $0x42, 0x8(%r15)
movq -0x308(%rbp), %r14
movq $0xf4240, (%r14)        # imm = 0xF4240
movb $0x43, 0x8(%r14)
movq 0x5379(%rip), %rbx      # 0x7fd0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2100
movb $0x20, %cl
leaq -0x29(%rbp), %r13
movb %cl, (%r13)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21a0
movb 0x8(%r12), %cl
movb %cl, (%r13)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21a0
movb $0x20, %cl
movb %cl, (%r13)
leaq -0x29(%rbp), %rsi
movl $0x1, %edx
movq %rax, %rdi
callq 0x21a0
movq (%r12), %rsi
movq %rax, %rdi
callq 0x20c0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2100
movb $0x20, %r13b
leaq -0x29(%rbp), %rcx
movb %r13b, (%rcx)
leaq -0x29(%rbp), %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21a0
movb 0x8(%r15), %cl
movb %cl, (%r12)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21a0
movb %r13b, (%r12)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21a0
movq (%r15), %rsi
movq %rax, %rdi
callq 0x20c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2100
movb %r13b, (%r12)
leaq -0x29(%rbp), %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21a0
movb 0x8(%r14), %cl
movb %cl, (%r15)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21a0
movb %r13b, (%r15)
leaq -0x29(%rbp), %rsi
movl $0x1, %edx
movq %rax, %rdi
callq 0x21a0
movq (%r14), %rsi
movq %rax, %rdi
callq 0x20c0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
xorl %r15d, %r15d
movq -0x350(%rbp,%r15,8), %rsi
movq %rbx, %rdi
callq 0x2100
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
incq %r15
cmpq $0xa, %r15
jne 0x2df2
xorl %eax, %eax
movq -0x350(%rbp,%rax,8), %rcx
testq %rcx, %rcx
je 0x2e55
movq 0x5325(%rip), %rdx      # 0x8170
movq %rdx, (%rcx)
movq %rcx, 0x531b(%rip)      # 0x8170
incq %rax
cmpq $0x64, %rax
jne 0x2e37
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq