// File: iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/examples/debug.cc
// Function: main
int main()
{
	vector<int> v = {1,2,3,4,5,6,7,8,9};
	string s("hi");
	cout << debug_rep(v) << endl;
	cout << debug_rep(s) << endl;
	cout << debug_rep("hi") << endl;
	cout << debug_rep(&v[0]) << endl;
	cout << debug_rep(&s) << endl;
	const string *sp = &s;
	cout << debug_rep(sp) << endl;

	char carr[] = "bye";            // calls pointer version if no overloads
	cout << debug_rep(carr) << endl;
	vector<string> authors = {"Proust", "Shakespeare", "Barth"};
	vector<const char*> authors2 = {"Proust", "Shakespeare", "Barth"};
	cout << debug_rep(authors) << endl;
	cout << debug_rep(authors2) << endl;
	cout << debug_rep(s) << endl;
	s += "more stuff";
	cout << debug_rep(s) << endl;
	s += "\\escape\"and quotes";
	cout << debug_rep(s) << endl;

	cout << debug_rep("hi world!") << endl; // calls debug_rep(T*)

	s = "hi";
	const char *cp = "bye";
	char arr[] = "world";

	cout << debug_rep(s) << endl;  // calls specialization debug_rep(const string&
	cout << debug_rep(cp) << endl; // calls specialization debug_rep(const char*
	cout << debug_rep(arr) << endl;// calls specialization debug_rep(char*
	cout << debug_rep(&s) << endl; // calls template debug_rep(T*)

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4e0, %rsp            # imm = 0x4E0
movl $0x0, -0x4(%rbp)
movups 0x4b0f(%rip), %xmm0     # 0x70d8
movaps %xmm0, -0x50(%rbp)
movups 0x4af4(%rip), %xmm0     # 0x70c8
movaps %xmm0, -0x60(%rbp)
movl $0x9, -0x40(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x9, -0x28(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x33a0
movq -0x3d0(%rbp), %rcx
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x20(%rbp), %rdi
callq 0x33c0
jmp 0x2619
leaq -0x61(%rbp), %rdi
callq 0x3440
leaq -0x99(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x2250
movq -0x3d8(%rbp), %rdx
leaq 0x49d2(%rip), %rsi      # 0x7015
leaq -0x98(%rbp), %rdi
callq 0x21c0
jmp 0x2651
leaq -0x99(%rbp), %rdi
callq 0x2190
leaq -0xc0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3460
jmp 0x266f
movq 0x8962(%rip), %rdi      # 0xafd8
leaq -0xc0(%rbp), %rsi
callq 0x2110
movq %rax, -0x3e0(%rbp)
jmp 0x268b
movq -0x3e0(%rbp), %rdi
movq 0x892f(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x26a0
leaq -0xc0(%rbp), %rdi
callq 0x20c0
leaq -0xe0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23b0
jmp 0x26c1
movq 0x8910(%rip), %rdi      # 0xafd8
leaq -0xe0(%rbp), %rsi
callq 0x2110
movq %rax, -0x3e8(%rbp)
jmp 0x26dd
movq -0x3e8(%rbp), %rdi
movq 0x88dd(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x26f2
leaq -0xe0(%rbp), %rdi
callq 0x20c0
leaq 0x4910(%rip), %rsi      # 0x7015
leaq -0x100(%rbp), %rdi
callq 0x2500
jmp 0x2713
movq 0x88be(%rip), %rdi      # 0xafd8
leaq -0x100(%rbp), %rsi
callq 0x2110
movq %rax, -0x3f0(%rbp)
jmp 0x272f
movq -0x3f0(%rbp), %rdi
movq 0x888b(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2744
leaq -0x100(%rbp), %rdi
callq 0x20c0
xorl %eax, %eax
movl %eax, %esi
leaq -0x20(%rbp), %rdi
callq 0x3720
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x35a0
jmp 0x276e
movq 0x8863(%rip), %rdi      # 0xafd8
leaq -0x120(%rbp), %rsi
callq 0x2110
movq %rax, -0x3f8(%rbp)
jmp 0x278a
movq -0x3f8(%rbp), %rdi
movq 0x8830(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x279f
leaq -0x120(%rbp), %rdi
callq 0x20c0
leaq -0x140(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3740
jmp 0x27c0
movq 0x8811(%rip), %rdi      # 0xafd8
leaq -0x140(%rbp), %rsi
callq 0x2110
movq %rax, -0x400(%rbp)
jmp 0x27dc
movq -0x400(%rbp), %rdi
movq 0x87de(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x27f1
leaq -0x140(%rbp), %rdi
callq 0x20c0
leaq -0x98(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x38c0
jmp 0x2820
movq 0x87b1(%rip), %rdi      # 0xafd8
leaq -0x168(%rbp), %rsi
callq 0x2110
movq %rax, -0x408(%rbp)
jmp 0x283c
movq -0x408(%rbp), %rdi
movq 0x877e(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2851
leaq -0x168(%rbp), %rdi
callq 0x20c0
movl $0x657962, -0x16c(%rbp) # imm = 0x657962
leaq -0x190(%rbp), %rdi
leaq -0x16c(%rbp), %rsi
callq 0x2450
jmp 0x287c
movq 0x8755(%rip), %rdi      # 0xafd8
leaq -0x190(%rbp), %rsi
callq 0x2110
movq %rax, -0x410(%rbp)
jmp 0x2898
movq -0x410(%rbp), %rdi
movq 0x8722(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x28ad
leaq -0x190(%rbp), %rdi
callq 0x20c0
movb $0x1, -0x224(%rbp)
leaq -0x218(%rbp), %rax
movq %rax, -0x420(%rbp)
movq %rax, -0x220(%rbp)
leaq -0x221(%rbp), %rdi
movq %rdi, -0x418(%rbp)
callq 0x2250
movq -0x420(%rbp), %rdi
movq -0x418(%rbp), %rdx
leaq 0x471f(%rip), %rsi      # 0x701c
callq 0x21c0
jmp 0x2904
leaq -0x1f8(%rbp), %rax
movq %rax, -0x430(%rbp)
movq %rax, -0x220(%rbp)
leaq -0x222(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x2250
movq -0x430(%rbp), %rdi
movq -0x428(%rbp), %rdx
leaq 0x46e2(%rip), %rsi      # 0x7023
callq 0x21c0
jmp 0x2948
leaq -0x1d8(%rbp), %rax
movq %rax, -0x440(%rbp)
movq %rax, -0x220(%rbp)
leaq -0x223(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x2250
movq -0x440(%rbp), %rdi
movq -0x438(%rbp), %rdx
leaq 0x46aa(%rip), %rsi      # 0x702f
callq 0x21c0
jmp 0x298c
movb $0x0, -0x224(%rbp)
leaq -0x218(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq $0x3, -0x1b0(%rbp)
leaq -0x225(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x3a40
movq -0x448(%rbp), %rcx
movq -0x1b8(%rbp), %rsi
movq -0x1b0(%rbp), %rdx
leaq -0x1a8(%rbp), %rdi
callq 0x3a60
jmp 0x29e2
leaq -0x225(%rbp), %rdi
callq 0x3ae0
leaq -0x218(%rbp), %rax
movq %rax, -0x458(%rbp)
addq $0x60, %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x460(%rbp)
callq 0x20c0
movq -0x458(%rbp), %rcx
movq -0x460(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x450(%rbp)
jne 0x2a07
leaq -0x223(%rbp), %rdi
callq 0x2190
leaq -0x222(%rbp), %rdi
callq 0x2190
leaq -0x221(%rbp), %rdi
callq 0x2190
movq 0x8345(%rip), %rax      # 0xada8
movq %rax, -0x260(%rbp)
movups 0x8327(%rip), %xmm0     # 0xad98
movaps %xmm0, -0x270(%rbp)
leaq -0x270(%rbp), %rax
movq %rax, -0x250(%rbp)
movq $0x3, -0x248(%rbp)
leaq -0x271(%rbp), %rdi
movq %rdi, -0x468(%rbp)
callq 0x3b00
movq -0x468(%rbp), %rcx
movq -0x250(%rbp), %rsi
movq -0x248(%rbp), %rdx
leaq -0x240(%rbp), %rdi
callq 0x3b20
jmp 0x2ac7
leaq -0x271(%rbp), %rdi
callq 0x3ba0
leaq -0x298(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x3bc0
jmp 0x2ae8
movq 0x84e9(%rip), %rdi      # 0xafd8
leaq -0x298(%rbp), %rsi
callq 0x2110
movq %rax, -0x470(%rbp)
jmp 0x2b04
movq -0x470(%rbp), %rdi
movq 0x84b6(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2b19
leaq -0x298(%rbp), %rdi
callq 0x20c0
leaq -0x2b8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x3d00
jmp 0x2b3a
movq 0x8497(%rip), %rdi      # 0xafd8
leaq -0x2b8(%rbp), %rsi
callq 0x2110
movq %rax, -0x478(%rbp)
jmp 0x2b56
movq -0x478(%rbp), %rdi
movq 0x8464(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2b6b
leaq -0x2b8(%rbp), %rdi
callq 0x20c0
leaq -0x2d8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23b0
jmp 0x2b8c
movq 0x8445(%rip), %rdi      # 0xafd8
leaq -0x2d8(%rbp), %rsi
callq 0x2110
movq %rax, -0x480(%rbp)
jmp 0x2ba8
movq -0x480(%rbp), %rdi
movq 0x8412(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2bbd
leaq -0x2d8(%rbp), %rdi
callq 0x20c0
leaq 0x4465(%rip), %rsi      # 0x7035
leaq -0x98(%rbp), %rdi
callq 0x2120
jmp 0x2bde
leaq -0x2f8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23b0
jmp 0x2bf3
movq 0x83de(%rip), %rdi      # 0xafd8
leaq -0x2f8(%rbp), %rsi
callq 0x2110
movq %rax, -0x488(%rbp)
jmp 0x2c0f
movq -0x488(%rbp), %rdi
movq 0x83ab(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2c24
leaq -0x2f8(%rbp), %rdi
callq 0x20c0
leaq 0x4409(%rip), %rsi      # 0x7040
leaq -0x98(%rbp), %rdi
callq 0x2120
jmp 0x2c45
leaq -0x318(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23b0
jmp 0x2c5a
movq 0x8377(%rip), %rdi      # 0xafd8
leaq -0x318(%rbp), %rsi
callq 0x2110
movq %rax, -0x490(%rbp)
jmp 0x2c76
movq -0x490(%rbp), %rdi
movq 0x8344(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2c8b
leaq -0x318(%rbp), %rdi
callq 0x20c0
leaq 0x43b5(%rip), %rsi      # 0x7053
leaq -0x338(%rbp), %rdi
callq 0x2500
jmp 0x2cac
movq 0x8325(%rip), %rdi      # 0xafd8
leaq -0x338(%rbp), %rsi
callq 0x2110
movq %rax, -0x498(%rbp)
jmp 0x2cc8
movq -0x498(%rbp), %rdi
movq 0x82f2(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2cdd
leaq -0x338(%rbp), %rdi
callq 0x20c0
leaq 0x4325(%rip), %rsi      # 0x7015
leaq -0x98(%rbp), %rdi
callq 0x21b0
jmp 0x2cfe
leaq 0x4313(%rip), %rax      # 0x7018
movq %rax, -0x340(%rbp)
movw $0x64, -0x344(%rbp)
movl $0x6c726f77, -0x348(%rbp) # imm = 0x6C726F77
leaq -0x368(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x23b0
jmp 0x2d34
movq 0x829d(%rip), %rdi      # 0xafd8
leaq -0x368(%rbp), %rsi
callq 0x2110
movq %rax, -0x4a0(%rbp)
jmp 0x2d50
movq -0x4a0(%rbp), %rdi
movq 0x826a(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2d65
leaq -0x368(%rbp), %rdi
callq 0x20c0
movq -0x340(%rbp), %rsi
leaq -0x388(%rbp), %rdi
callq 0x2500
jmp 0x2d86
movq 0x824b(%rip), %rdi      # 0xafd8
leaq -0x388(%rbp), %rsi
callq 0x2110
movq %rax, -0x4a8(%rbp)
jmp 0x2da2
movq -0x4a8(%rbp), %rdi
movq 0x8218(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2db7
leaq -0x388(%rbp), %rdi
callq 0x20c0
leaq -0x3a8(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x2450
jmp 0x2dd8
movq 0x81f9(%rip), %rdi      # 0xafd8
leaq -0x3a8(%rbp), %rsi
callq 0x2110
movq %rax, -0x4b0(%rbp)
jmp 0x2df4
movq -0x4b0(%rbp), %rdi
movq 0x81c6(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2e09
leaq -0x3a8(%rbp), %rdi
callq 0x20c0
leaq -0x3c8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3740
jmp 0x2e2a
movq 0x81a7(%rip), %rdi      # 0xafd8
leaq -0x3c8(%rbp), %rsi
callq 0x2110
movq %rax, -0x4b8(%rbp)
jmp 0x2e46
movq -0x4b8(%rbp), %rdi
movq 0x8174(%rip), %rsi      # 0xafc8
callq 0x2170
jmp 0x2e5b
leaq -0x3c8(%rbp), %rdi
callq 0x20c0
movl $0x0, -0x4(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x3e40
leaq -0x1a8(%rbp), %rdi
callq 0x3ea0
leaq -0x98(%rbp), %rdi
callq 0x20c0
leaq -0x20(%rbp), %rdi
callq 0x3f00
movl -0x4(%rbp), %eax
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x3440
jmp 0x3238
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x2190
jmp 0x322f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x20c0
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3063
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3057
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x304b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x225(%rbp), %rdi
callq 0x3ae0
leaq -0x218(%rbp), %rax
movq %rax, -0x4c8(%rbp)
addq $0x60, %rax
movq %rax, -0x4c0(%rbp)
movq -0x4c0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x20c0
movq -0x4c8(%rbp), %rcx
movq -0x4d0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4c0(%rbp)
jne 0x3018
jmp 0x304b
leaq -0x223(%rbp), %rdi
callq 0x2190
leaq -0x222(%rbp), %rdi
callq 0x2190
leaq -0x221(%rbp), %rdi
callq 0x2190
testb $0x1, -0x224(%rbp)
jne 0x307a
jmp 0x30c7
movq -0x220(%rbp), %rax
leaq -0x218(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x4d8(%rbp)
je 0x30c5
movq -0x4d8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x20c0
movq -0x4e0(%rbp), %rax
leaq -0x218(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x4d8(%rbp)
jne 0x3094
jmp 0x30c7
jmp 0x3223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x271(%rbp), %rdi
callq 0x3ba0
jmp 0x3217
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x20c0
jmp 0x320b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x20c0
leaq -0x240(%rbp), %rdi
callq 0x3e40
leaq -0x1a8(%rbp), %rdi
callq 0x3ea0
leaq -0x98(%rbp), %rdi
callq 0x20c0
leaq -0x20(%rbp), %rdi
callq 0x3f00
movq -0x70(%rbp), %rdi
callq 0x2240
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)