// File: /workspace/github_cpp_makefile_star2_O3/MingYueRuYa[P]cprimeprimecode/memory_manager.cpp
// Function: demo06::test_overload_operator_new_and_array_new()
void test_overload_operator_new_and_array_new()
{
	cout << "\ntest_overload_operator_new_and_array_new().......\n";

	cout << "sizeof(Foo)= " << sizeof(Foo) << endl;
	{
		Foo *p = new Foo(7);
		delete p;


		Foo *pArray = new Foo[5];	//无法给array elements 以initializer
		delete []pArray;
	}

	{
		cout << "testing global expression ::new and ::new[] \n";
		//这回绕过overload new(), delete(), new[](), delete[]();
		//当然ctor，dtor都会被正常调用
		Foo *p = ::new Foo(7);
		::delete p;

		Foo *pArray = ::new Foo[5];
		::delete [] pArray;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x4ec5(%rip), %rbx      # 0x7fd0
leaq 0x2089(%rip), %rsi      # 0x519b
movl $0x33, %edx
movq %rbx, %rdi
callq 0x21a0
leaq 0x20a9(%rip), %rsi      # 0x51cf
movl $0xd, %edx
movq %rbx, %rdi
callq 0x21a0
movl $0x30, %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
movl $0x30, %edi
callq 0x2e6a
movq %rax, %r14
movq %rax, %rdi
movl $0x7, %esi
callq 0x3bd6
movq %r14, %rdi
callq 0x3c96
movl $0x30, %esi
movq %r14, %rdi
callq 0x2f00
movl $0xf8, %edi
callq 0x2fb2
movq %rax, %r14
movq $0x5, (%rax)
leaq 0x8(%rax), %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x3d3c
addq $-0x30, %r15
addq $0x30, %rbx
cmpq $-0xf0, %r15
jne 0x31b4
movq (%r14), %rcx
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
addq $0x8, %rbx
testq %rcx, %rcx
je 0x31fe
leaq (%rax,%rax,2), %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c96
addq $-0x30, %r15
jne 0x31ef
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3048
movq 0x4dc0(%rip), %rdi      # 0x7fd0
leaq 0x1fc6(%rip), %rsi      # 0x51dd
movl $0x2d, %edx
callq 0x21a0
movl $0x30, %edi
callq 0x2180
movq %rax, %r14
movq %rax, %rdi
movl $0x7, %esi
callq 0x3bd6
movq %r14, %rdi
callq 0x3c96
movl $0x30, %esi
movq %r14, %rdi
callq 0x2190
movl $0xf8, %edi
callq 0x2030
movq %rax, %r14
movq $0x5, (%rax)
leaq 0x8(%rax), %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x3d3c
addq $-0x30, %r15
addq $0x30, %rbx
cmpq $-0xf0, %r15
jne 0x326b
movq (%r14), %rcx
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
addq $0x8, %rbx
testq %rcx, %rcx
je 0x32b5
leaq (%rax,%rax,2), %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c96
addq $-0x30, %r15
jne 0x32a6
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2270
movq %rax, %rbx
movl $0x30, %esi
movq %r14, %rdi
callq 0x2190
jmp 0x334a
movq %rax, %rbx
movl $0x30, %esi
movq %r14, %rdi
callq 0x2f00
jmp 0x334a
movq %rax, %rbx
testq %r15, %r15
je 0x330d
negq %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c96
addq $-0x30, %r15
jne 0x32fe
movl $0xf8, %esi
movq %r14, %rdi
callq 0x2270
jmp 0x334a
movq %rax, %rbx
testq %r15, %r15
je 0x333d
negq %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c96
addq $-0x30, %r15
jne 0x332e
movl $0xf8, %esi
movq %r14, %rdi
callq 0x3048
movq %rbx, %rdi
callq 0x2250