// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/examples/SP.cc
// Function: main
int main()
{
	double* p = new double;
	// an object that can act like a delete expression
	DebugDelete d("plain pointer");
	d(p); // calls DebugDelete::operator()(double*), which deletes p

	int* ip = new int;
	// calls operator()(int*) on a temporary DebugDelete object
	DebugDelete("plain pointer")(ip);

	// destroying the the object to which upi points
	// instantiates DebugDelete::operator()<int>(int *)
	unique_ptr<int, DebugDelete> upi(new int, DebugDelete());

	// destroying the the object to which ups points
	// instantiates DebugDelete::operator()<string>(string*)
	unique_ptr<string, DebugDelete> ups(new string, DebugDelete());

	// illustrate other types using DebugDelete as their deleter
	shared_ptr<int> sp1(new int(42), DebugDelete("shared_ptr"));

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl $0x8, %edi
callq 0x10b0
movq %rax, %rbx
leaq -0xa0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd55(%rip), %rsi       # 0x2004
leaq 0xd5b(%rip), %rdx       # 0x2011
leaq -0xb0(%rbp), %rdi
callq 0x1a9a
movq 0x2d27(%rip), %r15      # 0x3ff0
leaq -0xf0(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0xe0(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
addq %rsi, %rdx
callq 0x1982
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x1310
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x10c0
leaq -0xf8(%rbp), %rdi
movq %rbx, %rsi
callq 0x1754
movl $0x4, %edi
callq 0x10b0
movq %rax, %rbx
leaq -0x70(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xcc9(%rip), %rsi       # 0x2004
leaq 0xccf(%rip), %rdx       # 0x2011
leaq -0x80(%rbp), %rdi
callq 0x1a9a
leaq -0xa8(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
callq 0x1982
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x17cc
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x139b
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x13b0
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x10c0
movl $0x4, %edi
callq 0x10b0
movq %rax, %rbx
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xc45(%rip), %rsi       # 0x2012
leaq 0xc48(%rip), %rdx       # 0x201c
leaq -0x50(%rbp), %rdi
callq 0x1a9a
leaq -0x78(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0x68(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
callq 0x1982
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0xb0(%rbp)
movq %r13, -0xa8(%rbp)
cmpq %r14, %rax
je 0x142c
movq %rax, -0xa8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x1435
movups (%r14), %xmm0
movups %xmm0, (%r13)
movq -0x70(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq %r14, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movb $0x0, -0x68(%rbp)
movq %rbx, -0x88(%rbp)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x146c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10c0
movl $0x20, %edi
callq 0x10b0
movq %rax, %rbx
addq $0x10, %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq -0xc0(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0xb74(%rip), %rsi       # 0x2012
leaq 0xb77(%rip), %rdx       # 0x201c
leaq -0xd0(%rbp), %rdi
callq 0x1a9a
leaq -0x48(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
addq %rsi, %rdx
callq 0x1982
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq %r14, -0x78(%rbp)
cmpq %r12, %rax
je 0x14fb
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x1504
movups (%r12), %xmm0
movups %xmm0, (%r14)
movq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
movq %r12, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %rbx, -0x58(%rbp)
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x153b
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x10c0
movl $0x4, %edi
callq 0x10b0
leaq -0x40(%rbp), %r12
movq %rax, %rbx
movl $0x2a, (%rax)
leaq -0x50(%rbp), %rdi
movq %r12, (%rdi)
leaq 0xabd(%rip), %rsi       # 0x201d
leaq 0xac0(%rip), %rdx       # 0x2027
callq 0x1a9a
leaq -0x118(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0x108(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
callq 0x1982
leaq -0xd0(%rbp), %rdi
leaq -0x120(%rbp), %rdx
movq %rbx, %rsi
callq 0x1844
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x15c3
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x15d8
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10c0
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x15e9
callq 0x1a2e
leaq -0x80(%rbp), %rdi
callq 0x18e2
leaq -0xb0(%rbp), %rdi
callq 0x1932
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x1620
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x10c0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x1657
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x1657
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x1677
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x1677
jmp 0x1674
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x18e2
jmp 0x16a7
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x16a7
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x16a7
jmp 0x16a4
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x1932
jmp 0x170c
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x170c
movq -0x40(%rbp), %rsi
jmp 0x16fb
jmp 0x1709
jmp 0x1709
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x16ee
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x16ee
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x170c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x10c0
jmp 0x170c
jmp 0x1709
jmp 0x1709
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x172e
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1120
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x172e
movq -0xa0(%rbp), %rsi
jmp 0x1726
movq %rax, %rbx
jmp 0x172e
nop