// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH13_CopyControl/examples/FolderMain.cc
// Function: main
int main()
{
	string s1("contents1");
	string s2("contents2");
	string s3("contents3");
	string s4("contents4");
	string s5("contents5");
	string s6("contents6");

	// all new messages, no copies yet
	Message m1(s1);
	Message m2(s2);
	Message m3(s3);
	Message m4(s4);
	Message m5(s5);
	Message m6(s6);

	Folder f1;
	Folder f2;

	m1.save(f1); m3.save(f1); m5.save(f1);
	m1.save(f2);
	m2.save(f2); m4.save(f2); m6.save(f2);

	m1.debug_print();
	f2.debug_print();

	// create some copies
	Message c1(m1);
	Message c2(m2), c4(m4), c6(m6);

	m1.debug_print();
	f2.debug_print();

	// now some assignments
	m2 = m3;
	m4 = m5;
	m6 = m3;
	m1 = m5;

	m1.debug_print();
	f2.debug_print();

	// finally, self-assignment
	m2 = m2;
	m1 = m1;

	m1.debug_print();
	f2.debug_print();

	vector<Message> vm;
	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m1);

	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m2);

	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m3);

	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m4);

	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m5);

	cout << "capacity: " << vm.capacity() << endl;
	vm.push_back(m6);

	vector<Folder> vf;
	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(f1);

	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(f2);

	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(Folder(f1));

	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(Folder(f2));

	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(Folder());

	Folder f3;
	f3.save(m6);
	cout << "capacity: " << vf.capacity() << endl;
	vf.push_back(f3);


	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x4a8, %rsp            # imm = 0x4A8
leaq 0x1243(%rip), %rsi      # 0x50d6
leaq -0x1f0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq 0x1233(%rip), %rsi      # 0x50e0
leaq -0x1d0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq 0x1223(%rip), %rsi      # 0x50ea
leaq -0x1b0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq 0x1213(%rip), %rsi      # 0x50f4
leaq -0x190(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq 0x1203(%rip), %rsi      # 0x50fe
leaq -0x170(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq 0x11f3(%rip), %rsi      # 0x5108
leaq -0x150(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x2060
leaq -0x100(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x47c0
leaq -0x290(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x47c0
leaq -0x380(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x47c0
leaq -0x330(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x47c0
leaq -0x2e0(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x47c0
leaq -0x240(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x47c0
leaq -0x128(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0xa8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x100(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2902
leaq -0x380(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2902
leaq -0x2e0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2902
leaq -0x100(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2902
leaq -0x290(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2902
leaq -0x330(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2902
leaq -0x240(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2902
leaq -0x100(%rbp), %rdi
callq 0x2a5c
leaq -0xb0(%rbp), %rdi
callq 0x299c
leaq -0x4c0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x2640
leaq -0x470(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x2640
leaq -0x420(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x2640
leaq -0x3d0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2640
leaq -0x100(%rbp), %rdi
callq 0x2a5c
leaq -0xb0(%rbp), %rdi
callq 0x299c
leaq -0x290(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x277a
leaq -0x330(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x277a
leaq -0x240(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x277a
leaq -0x100(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x277a
leaq -0x100(%rbp), %rdi
callq 0x2a5c
leaq -0xb0(%rbp), %rdi
callq 0x299c
leaq -0x290(%rbp), %rdi
movq %rdi, %rsi
callq 0x277a
leaq -0x100(%rbp), %rdi
movq %rdi, %rsi
callq 0x277a
leaq -0x100(%rbp), %rdi
callq 0x2a5c
leaq -0xb0(%rbp), %rdi
callq 0x299c
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
movq 0x3e50(%rip), %rdi      # 0x7fd0
leaq 0xf8b(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
pushq $0x50
popq %rbx
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x47f0
movq 0x3e0a(%rip), %rdi      # 0x7fd0
leaq 0xf45(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x47f0
movq 0x3dc7(%rip), %rdi      # 0x7fd0
leaq 0xf02(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x47f0
movq 0x3d84(%rip), %rdi      # 0x7fd0
leaq 0xebf(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x47f0
movq 0x3d41(%rip), %rdi      # 0x7fd0
leaq 0xe7c(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x47f0
movq 0x3cfe(%rip), %rdi      # 0x7fd0
leaq 0xe39(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cqto
idivq %rbx
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x50(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x47f0
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
andq $0x0, -0x20(%rbp)
movq 0x3caf(%rip), %rdi      # 0x7fd0
leaq 0xdea(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
pushq $0x30
popq %r14
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x482c
movq 0x3c68(%rip), %rdi      # 0x7fd0
leaq 0xda3(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x482c
movq 0x3c25(%rip), %rdi      # 0x7fd0
leaq 0xd60(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x80(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2828
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4e14
leaq -0x80(%rbp), %rdi
callq 0x28a8
movq 0x3bcc(%rip), %rdi      # 0x7fd0
leaq 0xd07(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x80(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2828
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4e14
leaq -0x80(%rbp), %rdi
callq 0x28a8
movq 0x3b73(%rip), %rdi      # 0x7fd0
leaq 0xcae(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x78(%rbp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r15)
andq $0x0, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
andq $0x0, 0x20(%r15)
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4e14
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
callq 0x28a8
andl $0x0, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
movq %r15, 0x18(%rbx)
movq %r15, 0x20(%rbx)
andq $0x0, 0x28(%rbx)
leaq -0x80(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x2938
movq 0x3ae3(%rip), %rdi      # 0x7fd0
leaq 0xc1e(%rip), %rsi       # 0x5112
callq 0x2120
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x20d0
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x482c
leaq -0x80(%rbp), %rdi
callq 0x28a8
leaq -0x30(%rbp), %rdi
callq 0x4868
leaq -0x50(%rbp), %rdi
callq 0x4894
leaq -0x3d0(%rbp), %rdi
callq 0x27b8
leaq -0x420(%rbp), %rdi
callq 0x27b8
leaq -0x470(%rbp), %rdi
callq 0x27b8
leaq -0x4c0(%rbp), %rdi
callq 0x27b8
leaq -0xb0(%rbp), %rdi
callq 0x28a8
leaq -0x130(%rbp), %rdi
callq 0x28a8
leaq -0x240(%rbp), %rdi
callq 0x27b8
leaq -0x2e0(%rbp), %rdi
callq 0x27b8
leaq -0x330(%rbp), %rdi
callq 0x27b8
leaq -0x380(%rbp), %rdi
callq 0x27b8
leaq -0x290(%rbp), %rdi
callq 0x27b8
leaq -0x100(%rbp), %rdi
callq 0x27b8
leaq -0x150(%rbp), %rdi
callq 0x2080
leaq -0x170(%rbp), %rdi
callq 0x2080
leaq -0x190(%rbp), %rdi
callq 0x2080
leaq -0x1b0(%rbp), %rdi
callq 0x2080
leaq -0x1d0(%rbp), %rdi
callq 0x2080
leaq -0x1f0(%rbp), %rdi
callq 0x2080
xorl %eax, %eax
addq $0x4a8, %rsp            # imm = 0x4A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x46ae
jmp 0x46ae
jmp 0x46c6
jmp 0x46ae
jmp 0x46c6
movq %rax, %rbx
jmp 0x46ec
movq %rax, %rbx
jmp 0x46f8
movq %rax, %rbx
jmp 0x4704
jmp 0x46bc
movq %rax, %rbx
jmp 0x4734
movq %rax, %rbx
jmp 0x4740
movq %rax, %rbx
jmp 0x474c
movq %rax, %rbx
jmp 0x4758
movq %rax, %rbx
jmp 0x4764
movq %rax, %rbx
jmp 0x4770
movq %rax, %rbx
jmp 0x477c
movq %rax, %rbx
jmp 0x4788
movq %rax, %rbx
jmp 0x4794
movq %rax, %rbx
jmp 0x47a0
movq %rax, %rbx
jmp 0x47ac
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x28a8
jmp 0x46c9
movq %rax, %rbx
jmp 0x4710
movq %rax, %rbx
jmp 0x46e0
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x4868
jmp 0x46d7
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4894
leaq -0x3d0(%rbp), %rdi
callq 0x27b8
leaq -0x420(%rbp), %rdi
callq 0x27b8
leaq -0x470(%rbp), %rdi
callq 0x27b8
leaq -0x4c0(%rbp), %rdi
callq 0x27b8
leaq -0xb0(%rbp), %rdi
callq 0x28a8
leaq -0x130(%rbp), %rdi
callq 0x28a8
leaq -0x240(%rbp), %rdi
callq 0x27b8
leaq -0x2e0(%rbp), %rdi
callq 0x27b8
leaq -0x330(%rbp), %rdi
callq 0x27b8
leaq -0x380(%rbp), %rdi
callq 0x27b8
leaq -0x290(%rbp), %rdi
callq 0x27b8
leaq -0x100(%rbp), %rdi
callq 0x27b8
leaq -0x150(%rbp), %rdi
callq 0x2080
leaq -0x170(%rbp), %rdi
callq 0x2080
leaq -0x190(%rbp), %rdi
callq 0x2080
leaq -0x1b0(%rbp), %rdi
callq 0x2080
leaq -0x1d0(%rbp), %rdi
callq 0x2080
leaq -0x1f0(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x21e0