// File: t0mm4rx[P]piscine_cpp/day04/ex02/main.cpp
// Function: main
int main(void)
{
	ISpaceMarine* bob = new TacticalMarine;
	ISpaceMarine* jim = new AssaultTerminator;
	Squad *vlc = new Squad;
	Squad copy;
	vlc->push(bob);
	copy = *vlc;
	vlc->push(jim);
	std::cout << "--- First squad ---" << std::endl;
	for (int i = 0; i < vlc->getCount(); ++i)
	{
		ISpaceMarine* cur = vlc->getUnit(i);
		cur->battleCry();
		cur->rangedAttack();
		cur->meleeAttack();
	}
	std::cout << "--- Second squad ---" << std::endl;
	for (int i = 0; i < copy.getCount(); ++i)
	{
		ISpaceMarine* cur = copy.getUnit(i);
		cur->battleCry();
		cur->rangedAttack();
		cur->meleeAttack();
	}
	delete vlc;
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
movl $0x8, %edi
callq 0x1080
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
callq 0x1a70
jmp 0x1d4d
movq -0x70(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x8, %edi
callq 0x1080
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
callq 0x12e0
jmp 0x1d70
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x18, %edi
callq 0x1080
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
callq 0x15e0
jmp 0x1d93
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x15e0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x1db7
movq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x16b0
jmp 0x1dc6
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x1dd9
movq 0x31f8(%rip), %rdi      # 0x4fd8
leaq 0x1354(%rip), %rsi      # 0x313b
callq 0x1070
movq %rax, -0x88(%rbp)
jmp 0x1df5
movq -0x88(%rbp), %rdi
movq 0x31c5(%rip), %rsi      # 0x4fc8
callq 0x10a0
jmp 0x1e0a
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x8c(%rbp)
jmp 0x1e2f
movl -0x90(%rbp), %eax
movl -0x8c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1f1b
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %esi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, -0x98(%rbp)
jmp 0x1e5c
movq -0x98(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x1e76
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x1e85
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
jmp 0x1e94
jmp 0x1e96
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1e11
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x8, %esi
callq 0x1090
jmp 0x2014
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x8, %esi
callq 0x1090
jmp 0x2014
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x18, %esi
callq 0x1090
jmp 0x2014
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x17c0
jmp 0x2014
movq 0x30b6(%rip), %rdi      # 0x4fd8
leaq 0x1226(%rip), %rsi      # 0x314f
callq 0x1070
movq %rax, -0xa0(%rbp)
jmp 0x1f37
movq -0xa0(%rbp), %rdi
movq 0x3083(%rip), %rsi      # 0x4fc8
callq 0x10a0
jmp 0x1f4c
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0xa8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1890
movl %eax, -0xa4(%rbp)
jmp 0x1f6d
movl -0xa8(%rbp), %eax
movl -0xa4(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1fda
movl -0x5c(%rbp), %esi
leaq -0x48(%rbp), %rdi
callq 0x18b0
movq %rax, -0xb0(%rbp)
jmp 0x1f92
movq -0xb0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x1fac
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x1fbb
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
jmp 0x1fca
jmp 0x1fcc
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x1f53
movq -0x30(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x1ff8
movq -0xb8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movl $0x0, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x17c0
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x10d0