// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH13_CopyControl/examples/StrFolderMain.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 $0x3a8, %rsp            # imm = 0x3A8
leaq 0x2191(%rip), %rsi      # 0x5078
leaq -0x110(%rbp), %rdi
callq 0x37d0
leaq 0x2188(%rip), %rsi      # 0x5082
leaq -0x100(%rbp), %rdi
callq 0x37d0
leaq 0x217f(%rip), %rsi      # 0x508c
leaq -0xf0(%rbp), %rdi
callq 0x37d0
leaq 0x2176(%rip), %rsi      # 0x5096
leaq -0xe0(%rbp), %rdi
callq 0x37d0
leaq 0x216d(%rip), %rsi      # 0x50a0
leaq -0xd0(%rbp), %rdi
callq 0x37d0
leaq 0x2164(%rip), %rsi      # 0x50aa
leaq -0xc0(%rbp), %rdi
callq 0x37d0
leaq -0x150(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x381a
leaq -0x200(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x381a
leaq -0x2c0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x381a
leaq -0x280(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x381a
leaq -0x240(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x381a
leaq -0x1c0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x381a
leaq -0x178(%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 -0x150(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x187e
leaq -0x2c0(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x187e
leaq -0x240(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x187e
leaq -0x150(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x187e
leaq -0x200(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x187e
leaq -0x280(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x187e
leaq -0x1c0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x187e
leaq -0x150(%rbp), %rdi
callq 0x19d8
leaq -0xb0(%rbp), %rdi
callq 0x1918
leaq -0x3c0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x15f0
leaq -0x380(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x15f0
leaq -0x340(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x15f0
leaq -0x300(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x15f0
leaq -0x150(%rbp), %rdi
callq 0x19d8
leaq -0xb0(%rbp), %rdi
callq 0x1918
leaq -0x200(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x1710
leaq -0x280(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x1710
leaq -0x1c0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x1710
leaq -0x150(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x1710
leaq -0x150(%rbp), %rdi
callq 0x19d8
leaq -0xb0(%rbp), %rdi
callq 0x1918
leaq -0x200(%rbp), %rdi
movq %rdi, %rsi
callq 0x1710
leaq -0x150(%rbp), %rdi
movq %rdi, %rsi
callq 0x1710
leaq -0x150(%rbp), %rdi
callq 0x19d8
leaq -0xb0(%rbp), %rdi
callq 0x1918
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
movq 0x5e26(%rip), %rdi      # 0x8fd0
leaq 0x1f03(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x384a
movq 0x5de7(%rip), %rdi      # 0x8fd0
leaq 0x1ec4(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x384a
movq 0x5da8(%rip), %rdi      # 0x8fd0
leaq 0x1e85(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x384a
movq 0x5d69(%rip), %rdi      # 0x8fd0
leaq 0x1e46(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x384a
movq 0x5d2a(%rip), %rdi      # 0x8fd0
leaq 0x1e07(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x384a
movq 0x5ceb(%rip), %rdi      # 0x8fd0
leaq 0x1dc8(%rip), %rsi      # 0x50b4
callq 0x10e0
movq -0x40(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x6, %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x50(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x384a
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
andq $0x0, -0x20(%rbp)
movq 0x5ca0(%rip), %rdi      # 0x8fd0
leaq 0x1d7d(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
pushq $0x30
popq %r14
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x30(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x3886
movq 0x5c59(%rip), %rdi      # 0x8fd0
leaq 0x1d36(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x30(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3886
movq 0x5c16(%rip), %rdi      # 0x8fd0
leaq 0x1cf3(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x80(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x17be
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3e4e
leaq -0x80(%rbp), %rdi
callq 0x1824
movq 0x5bbd(%rip), %rdi      # 0x8fd0
leaq 0x1c9a(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x80(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x17be
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3e4e
leaq -0x80(%rbp), %rdi
callq 0x1824
movq 0x5b64(%rip), %rdi      # 0x8fd0
leaq 0x1c41(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
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 0x3e4e
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
callq 0x1824
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 -0x1c0(%rbp), %rsi
callq 0x18b4
movq 0x5ad4(%rip), %rdi      # 0x8fd0
leaq 0x1bb1(%rip), %rsi      # 0x50b4
callq 0x10e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
subq -0x30(%rbp), %rax
cqto
idivq %r14
movq %rax, %rsi
callq 0x10b0
movq %rax, %rdi
callq 0x1080
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3886
leaq -0x80(%rbp), %rdi
callq 0x1824
leaq -0x30(%rbp), %rdi
callq 0x38c2
leaq -0x50(%rbp), %rdi
callq 0x38ee
leaq -0x300(%rbp), %rdi
callq 0x174e
leaq -0x340(%rbp), %rdi
callq 0x174e
leaq -0x380(%rbp), %rdi
callq 0x174e
leaq -0x3c0(%rbp), %rdi
callq 0x174e
leaq -0xb0(%rbp), %rdi
callq 0x1824
leaq -0x180(%rbp), %rdi
callq 0x1824
leaq -0x1c0(%rbp), %rdi
callq 0x174e
leaq -0x240(%rbp), %rdi
callq 0x174e
leaq -0x280(%rbp), %rdi
callq 0x174e
leaq -0x2c0(%rbp), %rdi
callq 0x174e
leaq -0x200(%rbp), %rdi
callq 0x174e
leaq -0x150(%rbp), %rdi
callq 0x174e
leaq -0xc0(%rbp), %rdi
callq 0x1b0a
leaq -0xd0(%rbp), %rdi
callq 0x1b0a
leaq -0xe0(%rbp), %rdi
callq 0x1b0a
leaq -0xf0(%rbp), %rdi
callq 0x1b0a
leaq -0x100(%rbp), %rdi
callq 0x1b0a
leaq -0x110(%rbp), %rdi
callq 0x1b0a
xorl %eax, %eax
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x36bd
jmp 0x36bd
jmp 0x36d5
jmp 0x36bd
jmp 0x36d5
movq %rax, %rbx
jmp 0x36fb
movq %rax, %rbx
jmp 0x3707
movq %rax, %rbx
jmp 0x3713
jmp 0x36cb
movq %rax, %rbx
jmp 0x3743
movq %rax, %rbx
jmp 0x374f
movq %rax, %rbx
jmp 0x375b
movq %rax, %rbx
jmp 0x3767
movq %rax, %rbx
jmp 0x3773
movq %rax, %rbx
jmp 0x377f
movq %rax, %rbx
jmp 0x378b
movq %rax, %rbx
jmp 0x3797
movq %rax, %rbx
jmp 0x37a3
movq %rax, %rbx
jmp 0x37af
movq %rax, %rbx
jmp 0x37bb
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x1824
jmp 0x36d8
movq %rax, %rbx
jmp 0x371f
movq %rax, %rbx
jmp 0x36ef
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x38c2
jmp 0x36e6
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x38ee
leaq -0x300(%rbp), %rdi
callq 0x174e
leaq -0x340(%rbp), %rdi
callq 0x174e
leaq -0x380(%rbp), %rdi
callq 0x174e
leaq -0x3c0(%rbp), %rdi
callq 0x174e
leaq -0xb0(%rbp), %rdi
callq 0x1824
leaq -0x180(%rbp), %rdi
callq 0x1824
leaq -0x1c0(%rbp), %rdi
callq 0x174e
leaq -0x240(%rbp), %rdi
callq 0x174e
leaq -0x280(%rbp), %rdi
callq 0x174e
leaq -0x2c0(%rbp), %rdi
callq 0x174e
leaq -0x200(%rbp), %rdi
callq 0x174e
leaq -0x150(%rbp), %rdi
callq 0x174e
leaq -0xc0(%rbp), %rdi
callq 0x1b0a
leaq -0xd0(%rbp), %rdi
callq 0x1b0a
leaq -0xe0(%rbp), %rdi
callq 0x1b0a
leaq -0xf0(%rbp), %rdi
callq 0x1b0a
leaq -0x100(%rbp), %rdi
callq 0x1b0a
leaq -0x110(%rbp), %rdi
callq 0x1b0a
movq %rbx, %rdi
callq 0x1190
nop