// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH16_TemplatesAndGenericProgramming/examples/Array.cc
// Function: main
int main()
{
    Blob<int> ia;                // empty Blob<int>
	Blob<int> ia2 = {0,1,2,3,4}; // Blob<int> with five elements
	vector<int> v1(10, 0); // ten elements initialized to 0
    Blob<int> ia3(v1.begin(), v1.end());  // copy elements from v1
    cout << ia << "\n" << ia2 << "\n" << ia3 << endl;

    // these definitions instantiate two distinct Blob types
    Blob<string> names; // Blob that holds strings
    Blob<double> prices;// different element type

	// instantiates Blob<string> class and its
	//  initializer_list<const char*> constructor
	Blob<string> articles = {"a", "an", "the"}; // three elements

	// instantiates Blob<int> and the initializer_list<int> constructor
	Blob<int> squares = {0,1,2,3,4,5,6,7,8,9};

	// instantiates Blob<int>::size() const
    cout << squares << endl;
	for (size_t i = 0; i != squares.size(); ++i)
		squares[i] = i*i; // instantiates Blob<int>::operator[](size_t)
    cout << squares << endl;

	// instantiates the Blob<int> constructor that has
	// two vector<long>::iterator parameters
	vector<long> vl = {0,1,2,3,4,5,6,7,8,9};
	Blob<int> a1(vl.begin(), vl.end());   // copy from a vector

	// instantiates the Blob<int> class
	// and the Blob<int> constructor that has two int* parameters
	int arr[] = {0,1,2,3,4,5,6,7,8,9};
	Blob<int> a2(begin(arr), end(arr));   // copy from an array

	list<int> li(10, 0); // 10 elements all zeros
	Blob<int> zeros(li.begin(), li.end());  // copy from a list

    cout << a1 << "\n" << zeros << endl;

	a1.swap(zeros);
    cout << a1 << "\n" << zeros << endl;

	list<const char*> w = {"now", "is", "the", "time"};

	// instantiates the Blob<string> class and the Blob<string>
	// constructor that has two (list<const char*>::iterator parameters
	Blob<string> a3(w.begin(), w.end());  // copy from a list

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
leaq -0x98(%rbp), %rdi
callq 0x2e44
movups 0x2cf1(%rip), %xmm0     # 0x5010
leaq -0x240(%rbp), %rsi
movaps %xmm0, (%rsi)
movl $0x4, 0x10(%rsi)
leaq -0x88(%rbp), %rdi
pushq $0x5
popq %rdx
callq 0x2a0a
leaq -0x240(%rbp), %rdx
andl $0x0, (%rdx)
leaq -0x108(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0xc0(%rbp), %rcx
callq 0x2a2c
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x2a8c
leaq -0x1d8(%rbp), %rbx
leaq -0x98(%rbp), %rsi
movq %rbx, %rdi
callq 0x2d00
movq 0x6c35(%rip), %rdi      # 0x8fc8
movq %rbx, %rsi
callq 0x2ab3
leaq 0x2d06(%rip), %rsi      # 0x50a8
movq %rax, %rdi
callq 0x20f0
movq %rax, %rbx
leaq -0x1c8(%rbp), %r14
leaq -0x88(%rbp), %rsi
movq %r14, %rdi
callq 0x2d00
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ab3
leaq 0x2cd3(%rip), %rsi      # 0x50a8
movq %rax, %rdi
callq 0x20f0
movq %rax, %rbx
leaq -0x1b8(%rbp), %r14
leaq -0x78(%rbp), %rsi
movq %r14, %rdi
callq 0x2d00
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ab3
movq %rax, %rdi
callq 0x2090
leaq -0x1b0(%rbp), %rdi
callq 0x2d4c
leaq -0x1c0(%rbp), %rdi
callq 0x2d4c
leaq -0x1d0(%rbp), %rdi
callq 0x2d4c
leaq -0x1a8(%rbp), %rdi
callq 0x351f
leaq -0x198(%rbp), %rdi
callq 0x373d
leaq 0x2c61(%rip), %rsi      # 0x50aa
leaq -0x240(%rbp), %r14
leaq -0xc0(%rbp), %rdx
movq %r14, %rdi
callq 0x2060
leaq -0x220(%rbp), %r15
leaq 0x2c3f(%rip), %rsi      # 0x50ac
leaq -0x68(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0x200(%rbp), %r15
leaq 0x2c28(%rip), %rsi      # 0x50af
leaq -0xf0(%rbp), %rdx
movq %r15, %rdi
callq 0x2060
leaq -0x188(%rbp), %rdi
leaq -0x240(%rbp), %rsi
pushq $0x3
popq %rdx
callq 0x2b2e
pushq $0x40
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0x240, %rdi           # imm = 0xFDC0
callq 0x2080
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x24af
movaps 0x2bc0(%rip), %xmm0     # 0x5090
leaq -0x240(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movaps 0x2b9e(%rip), %xmm0     # 0x5080
movaps %xmm0, (%rsi)
movabsq $0x900000008, %r15      # imm = 0x900000008
movq %r15, 0x20(%rsi)
leaq -0x40(%rbp), %rdi
pushq $0xa
popq %rdx
callq 0x2a0a
leaq -0x178(%rbp), %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x2d00
movq 0x6aaf(%rip), %rdi      # 0x8fc8
movq %rbx, %rsi
callq 0x2ab3
movq %rax, %rdi
callq 0x2090
leaq -0x170(%rbp), %rdi
callq 0x2d4c
xorl %ebx, %ebx
leaq -0x40(%rbp), %r14
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rcx, %rbx
je 0x2566
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2b50
movl %ebx, %ecx
imull %ebx, %ecx
movl %ecx, (%rax)
incq %rbx
jmp 0x253b
leaq -0x168(%rbp), %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x2d00
movq 0x6a48(%rip), %rdi      # 0x8fc8
movq %rbx, %rsi
callq 0x2ab3
movq %rax, %rdi
callq 0x2090
leaq -0x160(%rbp), %rdi
callq 0x2d4c
leaq 0x2a85(%rip), %rsi      # 0x5028
pushq $0xa
popq %rdx
leaq -0x240(%rbp), %rax
movq %rdx, %rcx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x68(%rbp), %rdi
leaq -0xc0(%rbp), %rcx
movq %rax, %rsi
callq 0x2bbe
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2bf4
leaq -0x218(%rbp), %rdx
movaps 0x2aa8(%rip), %xmm0     # 0x5090
movaps %xmm0, -0x18(%rdx)
movaps 0x2a8d(%rip), %xmm0     # 0x5080
movaps %xmm0, -0x28(%rdx)
movq %r15, -0x8(%rdx)
leaq -0x158(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2c1c
leaq -0xc0(%rbp), %rdx
andl $0x0, (%rdx)
leaq -0xf0(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0xd8(%rbp), %rcx
callq 0x2c44
leaq -0xf0(%rbp), %rdx
movq (%rdx), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2c78
leaq -0x148(%rbp), %rbx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2d00
movq 0x696d(%rip), %rdi      # 0x8fc8
movq %rbx, %rsi
callq 0x2ab3
leaq 0x2a3e(%rip), %rsi      # 0x50a8
movq %rax, %rdi
callq 0x20f0
movq %rax, %rbx
leaq -0x138(%rbp), %r14
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0x2d00
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ab3
movq %rax, %rdi
callq 0x2090
leaq -0x130(%rbp), %rdi
callq 0x2d4c
leaq -0x140(%rbp), %rdi
callq 0x2d4c
leaq -0x50(%rbp), %rsi
movups (%rsi), %xmm0
movups -0x30(%rbp), %xmm1
movups %xmm1, (%rsi)
movups %xmm0, -0x30(%rbp)
leaq -0x128(%rbp), %rbx
movq %rbx, %rdi
callq 0x2d00
movq 0x68ed(%rip), %rdi      # 0x8fc8
movq %rbx, %rsi
callq 0x2ab3
leaq 0x29be(%rip), %rsi      # 0x50a8
movq %rax, %rdi
callq 0x20f0
movq %rax, %rbx
leaq -0x118(%rbp), %r14
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0x2d00
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ab3
movq %rax, %rdi
callq 0x2090
leaq -0x110(%rbp), %rdi
callq 0x2d4c
leaq -0x120(%rbp), %rdi
callq 0x2d4c
movups 0x652e(%rip), %xmm0     # 0x8c68
leaq -0xc0(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x650c(%rip), %xmm0     # 0x8c58
movaps %xmm0, (%rsi)
leaq -0xd8(%rbp), %rdi
pushq $0x4
popq %rdx
leaq -0x19(%rbp), %rcx
callq 0x2ca0
leaq -0xd8(%rbp), %rdx
movq (%rdx), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x2cd8
leaq -0x48(%rbp), %rbx
leaq -0x28(%rbp), %r14
leaq -0xb8(%rbp), %rdi
callq 0x2d4c
leaq -0xd8(%rbp), %rdi
callq 0x2ddc
movq %r14, %rdi
callq 0x2d4c
leaq -0xf0(%rbp), %rdi
callq 0x2e10
leaq -0x150(%rbp), %rdi
callq 0x2d4c
movq %rbx, %rdi
callq 0x2d4c
leaq -0x68(%rbp), %rdi
callq 0x3bd6
leaq -0x38(%rbp), %rdi
callq 0x2d4c
leaq -0x180(%rbp), %rdi
callq 0x2d4c
leaq -0x190(%rbp), %rdi
callq 0x2d4c
leaq -0x1a0(%rbp), %rdi
callq 0x2d4c
leaq -0x70(%rbp), %rdi
callq 0x2d4c
leaq -0x108(%rbp), %rdi
callq 0x3194
leaq -0x80(%rbp), %rdi
callq 0x2d4c
leaq -0x90(%rbp), %rdi
callq 0x2d4c
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x2ddc
jmp 0x2927
movq %rax, %rbx
jmp 0x2927
movq %rax, %rbx
jmp 0x2930
movq %rax, %rbx
jmp 0x293c
movq %rax, %rbx
jmp 0x2948
movq %rax, %rbx
jmp 0x2951
jmp 0x29a7
movq %rax, %rbx
jmp 0x29b3
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x240, %rdi           # imm = 0xFDC0
callq 0x2080
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x2880
jmp 0x29bf
jmp 0x28a1
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2080
cmpq %r14, %r15
jne 0x28a4
jmp 0x29bf
movq %rax, %rbx
jmp 0x29bf
movq %rax, %rbx
jmp 0x29cb
movq %rax, %rbx
jmp 0x29d7
movq %rax, %rbx
jmp 0x29e0
movq %rax, %rbx
jmp 0x29ec
movq %rax, %rbx
jmp 0x29f5
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x2d4c
jmp 0x28fe
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
jmp 0x2922
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x2d4c
jmp 0x291b
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x2d4c
leaq -0x28(%rbp), %rdi
callq 0x2d4c
leaq -0xf0(%rbp), %rdi
callq 0x2e10
leaq -0x150(%rbp), %rdi
callq 0x2d4c
leaq -0x48(%rbp), %rdi
callq 0x2d4c
leaq -0x68(%rbp), %rdi
callq 0x3bd6
jmp 0x29aa
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
jmp 0x2972
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x2d4c
jmp 0x29aa
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x2d4c
jmp 0x298d
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x2d4c
jmp 0x299e
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0x29d2
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x2d4c
leaq -0x180(%rbp), %rdi
callq 0x2d4c
leaq -0x190(%rbp), %rdi
callq 0x2d4c
leaq -0x1a0(%rbp), %rdi
callq 0x2d4c
leaq -0x70(%rbp), %rdi
callq 0x2d4c
leaq -0x108(%rbp), %rdi
callq 0x3194
leaq -0x80(%rbp), %rdi
callq 0x2d4c
leaq -0x90(%rbp), %rdi
callq 0x2d4c
movq %rbx, %rdi
callq 0x21b0
nop