// File: /workspace/github_cpp_makefile_star2_O1/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 0x4ebf(%rip), %rbx      # 0x7fd0
leaq 0x2083(%rip), %rsi      # 0x519b
movl $0x33, %edx
movq %rbx, %rdi
callq 0x21a0
leaq 0x20a3(%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 0x2e70
movq %rax, %r14
movq %rax, %rdi
movl $0x7, %esi
callq 0x3bdc
movq %r14, %rdi
callq 0x3c9c
movl $0x30, %esi
movq %r14, %rdi
callq 0x2f06
movl $0xf8, %edi
callq 0x2fb8
movq %rax, %r14
movq $0x5, (%rax)
leaq 0x8(%rax), %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x3d42
addq $-0x30, %r15
addq $0x30, %rbx
cmpq $-0xf0, %r15
jne 0x31ba
movq (%r14), %rcx
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
addq $0x8, %rbx
testq %rcx, %rcx
je 0x3204
leaq (%rax,%rax,2), %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c9c
addq $-0x30, %r15
jne 0x31f5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x304e
movq 0x4dba(%rip), %rdi      # 0x7fd0
leaq 0x1fc0(%rip), %rsi      # 0x51dd
movl $0x2d, %edx
callq 0x21a0
movl $0x30, %edi
callq 0x2180
movq %rax, %r14
movq %rax, %rdi
movl $0x7, %esi
callq 0x3bdc
movq %r14, %rdi
callq 0x3c9c
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 0x3d42
addq $-0x30, %r15
addq $0x30, %rbx
cmpq $-0xf0, %r15
jne 0x3271
movq (%r14), %rcx
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rbx
addq $0x8, %rbx
testq %rcx, %rcx
je 0x32bb
leaq (%rax,%rax,2), %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c9c
addq $-0x30, %r15
jne 0x32ac
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 0x3350
movq %rax, %rbx
movl $0x30, %esi
movq %r14, %rdi
callq 0x2f06
jmp 0x3350
movq %rax, %rbx
testq %r15, %r15
je 0x3313
negq %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c9c
addq $-0x30, %r15
jne 0x3304
movl $0xf8, %esi
movq %r14, %rdi
callq 0x2270
jmp 0x3350
movq %rax, %rbx
testq %r15, %r15
je 0x3343
negq %r15
movq %r14, %r12
addq $-0x28, %r12
leaq (%r12,%r15), %rdi
callq 0x3c9c
addq $-0x30, %r15
jne 0x3334
movl $0xf8, %esi
movq %r14, %rdi
callq 0x304e
movq %rbx, %rdi
callq 0x2250