// File: /workspace/github_cpp_makefile_star2_O1/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 0x20b0
movq %rax, %rbx
leaq -0xa0(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd55(%rip), %rsi       # 0x3004
leaq 0xd5b(%rip), %rdx       # 0x3011
leaq -0xb0(%rbp), %rdi
callq 0x2ab6
movq 0x2d27(%rip), %r15      # 0x4ff0
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 0x29a2
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2310
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x20c0
leaq -0xf8(%rbp), %rdi
movq %rbx, %rsi
callq 0x2754
movl $0x4, %edi
callq 0x20b0
movq %rax, %rbx
leaq -0x70(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xcc9(%rip), %rsi       # 0x3004
leaq 0xccf(%rip), %rdx       # 0x3011
leaq -0x80(%rbp), %rdi
callq 0x2ab6
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 0x29a2
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x27dc
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x239b
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x20c0
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x23b0
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x20c0
movl $0x4, %edi
callq 0x20b0
movq %rax, %rbx
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xc45(%rip), %rsi       # 0x3012
leaq 0xc48(%rip), %rdx       # 0x301c
leaq -0x50(%rbp), %rdi
callq 0x2ab6
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 0x29a2
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0xb0(%rbp)
movq %r13, -0xa8(%rbp)
cmpq %r14, %rax
je 0x242c
movq %rax, -0xa8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x2435
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 0x246c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x20c0
movl $0x20, %edi
callq 0x20b0
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       # 0x3012
leaq 0xb77(%rip), %rdx       # 0x301c
leaq -0xd0(%rbp), %rdi
callq 0x2ab6
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 0x29a2
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq %r14, -0x78(%rbp)
cmpq %r12, %rax
je 0x24fb
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x2504
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 0x253b
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x20c0
movl $0x4, %edi
callq 0x20b0
leaq -0x40(%rbp), %r12
movq %rax, %rbx
movl $0x2a, (%rax)
leaq -0x50(%rbp), %rdi
movq %r12, (%rdi)
leaq 0xabd(%rip), %rsi       # 0x301d
leaq 0xac0(%rip), %rdx       # 0x3027
callq 0x2ab6
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 0x29a2
leaq -0xd0(%rbp), %rdi
leaq -0x120(%rbp), %rdx
movq %rbx, %rsi
callq 0x2864
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x25c3
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x20c0
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x25d8
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x20c0
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x25e9
callq 0x2a4a
leaq -0x80(%rbp), %rdi
callq 0x2902
leaq -0xb0(%rbp), %rdi
callq 0x2952
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x2620
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x20c0
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 0x2657
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x20c0
jmp 0x2657
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2677
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x20c0
jmp 0x2677
jmp 0x2674
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2902
jmp 0x26a7
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x26a7
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x20c0
jmp 0x26a7
jmp 0x26a4
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x2952
jmp 0x270c
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x270c
movq -0x40(%rbp), %rsi
jmp 0x26fb
jmp 0x2709
jmp 0x2709
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x26ee
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x20c0
jmp 0x26ee
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x270c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x20c0
jmp 0x270c
jmp 0x2709
jmp 0x2709
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x272e
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x20c0
movq %rbx, %rdi
callq 0x2120
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x272e
movq -0xa0(%rbp), %rsi
jmp 0x2726
movq %rax, %rbx
jmp 0x272e
nop