// File: t0mm4rx[P]piscine_cpp/day04/ex03/main.cpp
// Function: main
int main()
{
	IMateriaSource* src = new MateriaSource();
	src->learnMateria(new Ice());
	src->learnMateria(new Cure());
	ICharacter* moi = new Character("moi");
	AMateria* tmp;
	tmp = src->createMateria("ice");
	moi->equip(tmp);
	tmp = src->createMateria("cure");
	moi->equip(tmp);
	tmp = src->createMateria("ice");
	moi->equip(tmp);
	ICharacter* bob = new Character("bob");
	std::cout << "0 XP=" << tmp->getXP() << std::endl;
	moi->use(0, *bob);
	moi->use(1, *bob);
	std::cout << "3rd XP=" << tmp->getXP() << std::endl;
	moi->use(2, *bob);
	std::cout << "3rd XP=" << tmp->getXP() << std::endl;
	moi->use(3, *bob);
	moi->use(-1, *bob);
	std::cout << "Unequip 3rd" << std::endl;
	moi->unequip(2);
	moi->use(2, *bob);
	std::cout << "3rd XP=" << tmp->getXP() << std::endl;
	std::cout << "Requip 3rd" << std::endl;
	moi->equip(tmp);
	moi->use(2, *bob);
	std::cout << "3rd XP=" << tmp->getXP() << std::endl;
	delete bob;
	delete moi;
	delete src;
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movl $0x0, -0x4(%rbp)
movl $0x30, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x108(%rbp)
callq 0x3470
jmp 0x39e0
movq -0x108(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x30, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x110(%rbp)
callq 0x31c0
jmp 0x3a14
movq -0x110(%rbp), %rsi
movq -0x118(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
movl $0x30, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x120(%rbp)
callq 0x2bc0
jmp 0x3a54
movq -0x120(%rbp), %rsi
movq -0x128(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl $0x50, %edi
callq 0x2130
movq %rax, -0x138(%rbp)
movb $0x1, -0x4a(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x2220
movq -0x130(%rbp), %rdx
leaq 0x1617(%rip), %rsi      # 0x50b5
leaq -0x48(%rbp), %rdi
callq 0x2e70
jmp 0x3aa9
movq -0x138(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2680
jmp 0x3abb
movb $0x0, -0x4a(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x20a0
leaq -0x49(%rbp), %rdi
callq 0x2170
movq -0x138(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x2220
movq -0x140(%rbp), %rdx
leaq 0x156f(%rip), %rsi      # 0x5074
leaq -0x78(%rbp), %rdi
callq 0x2e70
jmp 0x3b10
movq -0x148(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
leaq -0x78(%rbp), %rsi
callq *%rax
movq %rax, -0x150(%rbp)
jmp 0x3b2d
movq -0x150(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x20a0
leaq -0x79(%rbp), %rdi
callq 0x2170
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq -0x10(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x2220
movq -0x158(%rbp), %rdx
leaq 0x149f(%rip), %rsi      # 0x5026
leaq -0xa0(%rbp), %rdi
callq 0x2e70
jmp 0x3b95
movq -0x160(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
leaq -0xa0(%rbp), %rsi
callq *%rax
movq %rax, -0x168(%rbp)
jmp 0x3bb5
movq -0x168(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x20a0
leaq -0xa1(%rbp), %rdi
callq 0x2170
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x2220
movq -0x170(%rbp), %rdx
leaq 0x145f(%rip), %rsi      # 0x5074
leaq -0xc8(%rbp), %rdi
callq 0x2e70
jmp 0x3c23
movq -0x178(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
leaq -0xc8(%rbp), %rsi
callq *%rax
movq %rax, -0x180(%rbp)
jmp 0x3c43
movq -0x180(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x20a0
leaq -0xc9(%rbp), %rdi
callq 0x2170
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x50, %edi
callq 0x2130
movq %rax, -0x190(%rbp)
movb $0x1, -0xfa(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x2220
movq -0x188(%rbp), %rdx
leaq 0x1409(%rip), %rsi      # 0x50b9
leaq -0xf8(%rbp), %rdi
callq 0x2e70
jmp 0x3cbe
movq -0x190(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x2680
jmp 0x3cd3
movb $0x0, -0xfa(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x20a0
leaq -0xf9(%rbp), %rdi
callq 0x2170
movq -0x190(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq 0x42d1(%rip), %rdi      # 0x7fd8
leaq 0x13af(%rip), %rsi      # 0x50bd
callq 0x2120
movq %rax, -0x1c0(%rbp)
movq -0x58(%rbp), %rdi
callq 0x25e0
movq -0x1c0(%rbp), %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
movq 0x428d(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
xorl %esi, %esi
callq *0x28(%rax)
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0x1, %esi
callq *0x28(%rax)
movq 0x4268(%rip), %rdi      # 0x7fd8
leaq 0x134c(%rip), %rsi      # 0x50c3
callq 0x2120
movq %rax, -0x1b8(%rbp)
movq -0x58(%rbp), %rdi
callq 0x25e0
movq -0x1b8(%rbp), %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
movq 0x4224(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0x2, %esi
callq *0x28(%rax)
movq 0x4212(%rip), %rdi      # 0x7fd8
leaq 0x12f6(%rip), %rsi      # 0x50c3
callq 0x2120
movq %rax, -0x1b0(%rbp)
movq -0x58(%rbp), %rdi
callq 0x25e0
movq -0x1b0(%rbp), %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
movq 0x41ce(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0x3, %esi
callq *0x28(%rax)
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq *0x28(%rax)
movq 0x41a6(%rip), %rdi      # 0x7fd8
leaq 0x1292(%rip), %rsi      # 0x50cb
callq 0x2120
movq %rax, %rdi
movq 0x4180(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x20(%rax)
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0x2, %esi
callq *0x28(%rax)
movq 0x415f(%rip), %rdi      # 0x7fd8
leaq 0x1243(%rip), %rsi      # 0x50c3
callq 0x2120
movq %rax, -0x1a8(%rbp)
movq -0x58(%rbp), %rdi
callq 0x25e0
movq -0x1a8(%rbp), %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
movq 0x411b(%rip), %rsi      # 0x7fc8
callq 0x2150
movq 0x411f(%rip), %rdi      # 0x7fd8
leaq 0x1217(%rip), %rsi      # 0x50d7
callq 0x2120
movq %rax, %rdi
movq 0x40f9(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq (%rdi), %rax
movl $0x2, %esi
callq *0x28(%rax)
movq 0x40d9(%rip), %rdi      # 0x7fd8
leaq 0x11bd(%rip), %rsi      # 0x50c3
callq 0x2120
movq %rax, -0x1a0(%rbp)
movq -0x58(%rbp), %rdi
callq 0x25e0
movq -0x1a0(%rbp), %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
movq 0x4095(%rip), %rsi      # 0x7fc8
callq 0x2150
movq -0xd8(%rbp), %rax
movq %rax, -0x198(%rbp)
cmpq $0x0, %rax
je 0x3f59
movq -0x198(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x1c8(%rbp)
cmpq $0x0, %rax
je 0x3f77
movq -0x1c8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x1d0(%rbp)
cmpq $0x0, %rax
je 0x3f95
movq -0x1d0(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
xorl %eax, %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq -0x108(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x30, %esi
callq 0x2140
jmp 0x413c
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x30, %esi
callq 0x2140
jmp 0x413c
movq -0x120(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x30, %esi
callq 0x2140
jmp 0x413c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4029
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x20a0
leaq -0x49(%rbp), %rdi
callq 0x2170
testb $0x1, -0x4a(%rbp)
jne 0x403a
jmp 0x404b
movq -0x138(%rbp), %rdi
movl $0x50, %esi
callq 0x2140
jmp 0x413c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4073
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x20a0
leaq -0x79(%rbp), %rdi
callq 0x2170
jmp 0x413c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x40a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x20a0
leaq -0xa1(%rbp), %rdi
callq 0x2170
jmp 0x413c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x40de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x20a0
leaq -0xc9(%rbp), %rdi
callq 0x2170
jmp 0x413c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4112
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x20a0
leaq -0xf9(%rbp), %rdi
callq 0x2170
testb $0x1, -0xfa(%rbp)
jne 0x4129
jmp 0x413a
movq -0x190(%rbp), %rdi
movl $0x50, %esi
callq 0x2140
jmp 0x413c
movq -0x18(%rbp), %rdi
callq 0x2210