// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH03_StringsVectorsAndArrays/examples/vec_decls.cc
// Function: main
int main()
{
	// list initialization, articles has 3 elements
	vector<string> articles = {"a", "an", "the"};

	vector<string> svec; // default initialization; svec has no elements
	vector<int> ivec;             // ivec holds objects of type int
	vector<Sales_item> Sales_vec; // holds Sales_items
	
	vector<vector<string>> file;  // vector whose elements are vectors
	vector<vector<int>> vecOfvec; // each element is itself a vector
	
	// all five vectors have size 0
	cout << svec.size() << " " << ivec.size() << " "
	     << Sales_vec.size() << " "
	     << file.size() << " " << vecOfvec.size() << endl;
	
	vector<int> ivec2(10);     // ten elements, each initialized to 0
	vector<int> ivec3(10, -1); // ten int elements, each initialized to -1
	vector<string> svec2(10);  // ten elements, each an empty string
	vector<string> svec3(10, "hi!"); // ten strings; each element is "hi!"
	cout << ivec2.size() << " " << ivec3.size() << " "
	     << svec2.size() << " " << svec3.size() << endl;
	
	// 10 is not a string, so cannot be list initialization
	vector<string> v1(10); // construct v1 with ten value-initialized elements
	vector<string> v2{10}; // ten elements value-initialized elements
	vector<string> v3(10, "hi");  // ten elements with value "hi"
	// again list initialization is not viable, so ordinary construction
	vector<string> v4{10, "hi"};  // ten elements with values "hi"
	
	// all four vectors have size ten
	cout << v1.size() << " " << v2.size() 
	     << " " << v3.size() << " " << v4.size() << endl;
	
	vector<string> vs1{"hi"}; // list initialization: vs1 has 1 element 
	vector<string> vs2{10};   // ten default-initialized elements
	vector<string> vs3{10, "hi"}; // has ten elements with value "hi"
	cout << vs1.size() << " " << vs2.size() << " " << vs3.size() << endl;
	
	vector<int> v5(10, 1);  // ten elements with value 1
	vector<int> v6{10, 1};  // two elements with values 10 and 1
	cout << v5.size() << " " << v6.size() << endl;
	
	// intention is clearer
	vector<int> alt_v3 = {10};    // one element with value 10
	vector<int> alt_v4 = {10, 1}; // two elements with values 10 and 1
	cout << alt_v3.size() << " " << alt_v4.size() << endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
leaq 0x1b2e(%rip), %rsi      # 0x4006
leaq -0x80(%rbp), %r14
leaq -0x210(%rbp), %rdx
movq %r14, %rdi
callq 0x2050
leaq -0x60(%rbp), %r15
leaq 0x1b12(%rip), %rsi      # 0x4008
leaq -0xf0(%rbp), %rdx
movq %r15, %rdi
callq 0x2050
leaq -0x40(%rbp), %r15
leaq 0x1afb(%rip), %rsi      # 0x400b
leaq -0xd0(%rbp), %rdx
movq %r15, %rdi
callq 0x2050
leaq -0x288(%rbp), %rdi
leaq -0x80(%rbp), %rsi
pushq $0x3
popq %rdx
leaq -0xb0(%rbp), %rcx
callq 0x2e56
pushq $0x40
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0x80, %rdi
callq 0x2070
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x253c
xorps %xmm0, %xmm0
movaps %xmm0, -0x210(%rbp)
andq $0x0, -0x200(%rbp)
movaps %xmm0, -0xf0(%rbp)
andq $0x0, -0xe0(%rbp)
movaps %xmm0, -0xd0(%rbp)
andq $0x0, -0xc0(%rbp)
movaps %xmm0, -0xb0(%rbp)
andq $0x0, -0xa0(%rbp)
movaps %xmm0, -0x170(%rbp)
andq $0x0, -0x160(%rbp)
movq 0x3a30(%rip), %rdi      # 0x5fd8
xorl %esi, %esi
callq 0x20b0
leaq 0x1a4e(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0xe8(%rbp), %rsi
subq -0xf0(%rbp), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x1a25(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
movq -0xc8(%rbp), %rax
subq -0xd0(%rbp), %rax
pushq $0x30
popq %rcx
cqto
idivq %rcx
movq %rax, %rsi
callq 0x20b0
leaq 0x19f5(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
movq -0xa8(%rbp), %rax
subq -0xb0(%rbp), %rax
pushq $0x18
popq %rbx
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20b0
leaq 0x19c5(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq %rax, %rdi
movq -0x168(%rbp), %rax
subq -0x170(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq -0x270(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
callq 0x2e90
leaq -0x80(%rbp), %rdx
orl $-0x1, (%rdx)
leaq -0x258(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x1e8(%rbp), %rcx
callq 0x2ee2
leaq -0x1e8(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
callq 0x2f42
leaq 0x1958(%rip), %rsi      # 0x400f
leaq -0x80(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
callq 0x2050
leaq -0x240(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
leaq -0x1b8(%rbp), %rcx
callq 0x2f94
leaq -0x80(%rbp), %rdi
callq 0x2070
movq -0x268(%rbp), %rsi
subq -0x270(%rbp), %rsi
sarq $0x2, %rsi
movq 0x38d5(%rip), %rdi      # 0x5fd8
callq 0x20b0
leaq 0x18f5(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x250(%rbp), %rsi
subq -0x258(%rbp), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x18cc(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x1e0(%rbp), %rsi
subq -0x1e8(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x18a3(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x238(%rbp), %rsi
subq -0x240(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq -0x1d0(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
callq 0x2f42
leaq -0x1b8(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
callq 0x2f42
leaq 0x185b(%rip), %rsi      # 0x4013
leaq -0x80(%rbp), %rdi
leaq -0x1a0(%rbp), %rdx
callq 0x2050
leaq -0x228(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
leaq -0x150(%rbp), %rcx
callq 0x2f94
leaq -0x80(%rbp), %rdi
callq 0x2070
leaq 0x1821(%rip), %rsi      # 0x4013
leaq -0x80(%rbp), %rdi
leaq -0x150(%rbp), %rdx
callq 0x2050
leaq -0x1a0(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
leaq -0x138(%rbp), %rcx
callq 0x2f94
leaq -0x80(%rbp), %rdi
callq 0x2070
movq -0x1c8(%rbp), %rsi
subq -0x1d0(%rbp), %rsi
sarq $0x5, %rsi
movq 0x379a(%rip), %rdi      # 0x5fd8
callq 0x20b0
leaq 0x17ba(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x1b0(%rbp), %rsi
subq -0x1b8(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x1791(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x220(%rbp), %rsi
subq -0x228(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x1768(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x198(%rbp), %rsi
subq -0x1a0(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq 0x1746(%rip), %rsi      # 0x4013
leaq -0x80(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0x2050
leaq -0x150(%rbp), %rdi
leaq -0x80(%rbp), %rsi
pushq $0x1
popq %rdx
leaq -0x188(%rbp), %rcx
callq 0x2e56
leaq -0x80(%rbp), %rdi
callq 0x2070
leaq -0x138(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
callq 0x2f42
leaq 0x16f9(%rip), %rsi      # 0x4013
leaq -0x80(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0x2050
leaq -0x188(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x80(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x2f94
leaq -0x80(%rbp), %rdi
callq 0x2070
movq -0x148(%rbp), %rsi
subq -0x150(%rbp), %rsi
sarq $0x5, %rsi
movq 0x3672(%rip), %rdi      # 0x5fd8
callq 0x20b0
leaq 0x1692(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x130(%rbp), %rsi
subq -0x138(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
leaq 0x1669(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x180(%rbp), %rsi
subq -0x188(%rbp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq -0x120(%rbp), %rdx
movl $0x1, (%rdx)
leaq -0x80(%rbp), %rdi
pushq $0xa
popq %rsi
leaq -0x98(%rbp), %rcx
callq 0x2ee2
movabsq $0x10000000a, %rbx      # imm = 0x10000000A
leaq -0x98(%rbp), %rsi
movq %rbx, (%rsi)
leaq -0x120(%rbp), %rdi
pushq $0x2
popq %rdx
leaq -0x108(%rbp), %rcx
callq 0x2ff4
movq -0x78(%rbp), %rsi
subq -0x80(%rbp), %rsi
sarq $0x2, %rsi
movq 0x35b6(%rip), %rdi      # 0x5fd8
callq 0x20b0
leaq 0x15d6(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x118(%rbp), %rsi
subq -0x120(%rbp), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq -0x108(%rbp), %rsi
movl $0xa, (%rsi)
leaq -0x98(%rbp), %rdi
pushq $0x1
popq %rdx
leaq -0x1f0(%rbp), %rcx
callq 0x2ff4
leaq -0x1f0(%rbp), %rsi
movq %rbx, (%rsi)
leaq -0x108(%rbp), %rdi
pushq $0x2
popq %rdx
leaq -0x19(%rbp), %rcx
callq 0x2ff4
movq -0x90(%rbp), %rsi
subq -0x98(%rbp), %rsi
sarq $0x2, %rsi
movq 0x3527(%rip), %rdi      # 0x5fd8
callq 0x20b0
leaq 0x1547(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x20f0
movq -0x100(%rbp), %rsi
subq -0x108(%rbp), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
callq 0x2080
leaq -0x108(%rbp), %rdi
callq 0x327c
leaq -0x98(%rbp), %rdi
callq 0x327c
leaq -0x120(%rbp), %rdi
callq 0x327c
leaq -0x80(%rbp), %rdi
callq 0x327c
leaq -0x188(%rbp), %rdi
callq 0x302a
leaq -0x138(%rbp), %rdi
callq 0x302a
leaq -0x150(%rbp), %rdi
callq 0x302a
leaq -0x1a0(%rbp), %rdi
callq 0x302a
leaq -0x228(%rbp), %rdi
callq 0x302a
leaq -0x1b8(%rbp), %rdi
callq 0x302a
leaq -0x1d0(%rbp), %rdi
callq 0x302a
leaq -0x240(%rbp), %rdi
callq 0x302a
leaq -0x1e8(%rbp), %rdi
callq 0x302a
leaq -0x258(%rbp), %rdi
callq 0x327c
leaq -0x270(%rbp), %rdi
callq 0x327c
leaq -0x170(%rbp), %rdi
callq 0x3056
leaq -0xb0(%rbp), %rdi
callq 0x3082
leaq -0xd0(%rbp), %rdi
callq 0x30ae
leaq -0xf0(%rbp), %rdi
callq 0x327c
leaq -0x210(%rbp), %rdi
callq 0x302a
leaq -0x288(%rbp), %rdi
callq 0x302a
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2d03
jmp 0x2d11
movq %rax, %rbx
jmp 0x2d20
jmp 0x2d2b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2070
jmp 0x2d3a
movq %rax, %rbx
jmp 0x2d3a
movq %rax, %rbx
jmp 0x2d46
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2070
jmp 0x2d57
jmp 0x2d54
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2070
jmp 0x2d63
movq %rax, %rbx
jmp 0x2d63
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2070
jmp 0x2d6f
movq %rax, %rbx
jmp 0x2d6f
movq %rax, %rbx
jmp 0x2d7b
jmp 0x2d89
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2070
jmp 0x2d98
movq %rax, %rbx
jmp 0x2d98
movq %rax, %rbx
jmp 0x2da4
movq %rax, %rbx
jmp 0x2db0
jmp 0x2e0c
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x80, %rdi
callq 0x2070
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x2cb5
jmp 0x2e04
jmp 0x2cd3
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2070
cmpq %r14, %r15
jne 0x2cd6
jmp 0x2e04
movq %rax, %rbx
jmp 0x2e04
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x327c
leaq -0x98(%rbp), %rdi
callq 0x327c
jmp 0x2d14
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x327c
leaq -0x80(%rbp), %rdi
callq 0x327c
jmp 0x2d2e
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x302a
leaq -0x138(%rbp), %rdi
callq 0x302a
leaq -0x150(%rbp), %rdi
callq 0x302a
jmp 0x2d57
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x302a
leaq -0x228(%rbp), %rdi
callq 0x302a
leaq -0x1b8(%rbp), %rdi
callq 0x302a
leaq -0x1d0(%rbp), %rdi
callq 0x302a
jmp 0x2d8c
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x302a
leaq -0x1e8(%rbp), %rdi
callq 0x302a
leaq -0x258(%rbp), %rdi
callq 0x327c
leaq -0x270(%rbp), %rdi
callq 0x327c
leaq -0x170(%rbp), %rdi
callq 0x3056
leaq -0xb0(%rbp), %rdi
callq 0x3082
leaq -0xd0(%rbp), %rdi
callq 0x30ae
leaq -0xf0(%rbp), %rdi
callq 0x327c
leaq -0x210(%rbp), %rdi
callq 0x302a
leaq -0x288(%rbp), %rdi
callq 0x302a
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rbx
jmp 0x2dbc
nop