// File: t0mm4rx[P]piscine_cpp/day03/ex01/FragTrap.cpp
// Function: FragTrap::vaulthunter_dot_exe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void		FragTrap::vaulthunter_dot_exe(std::string const &target)
{
	int			choice;
	std::string	tool;

	if (this->energyPoints < 25)
	{
		std::cout << this->name << " tried to use vaulthunter_dot_exe but doesn't have enough energy !" << std::endl;
		return ;
	}
	this->energyPoints -= 25;
	this->energyPoints = (this->energyPoints < 0 ? 0 : this->energyPoints);
	choice = rand() % 5;
	switch (choice) {
		case 0:
			tool = "a shovel";
			break;
		case 1:
			tool = "a keyboard";
			break;
		case 2:
			tool = "a glass of beer";
			break;
		case 3:
			tool = "an avocado";
			break;
		case 4:
			tool = "a cup of coffee";
			break;
	}
	std::cout << this->name << " attacked " << target << " with " << tool << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x21b0
movq -0x50(%rbp), %rax
cmpl $0x19, 0x8(%rax)
jge 0x29c6
movq -0x50(%rbp), %rsi
addq $0x18, %rsi
movq 0x366b(%rip), %rdi      # 0x5fd8
callq 0x20f0
movq %rax, -0x58(%rbp)
jmp 0x2978
movq -0x58(%rbp), %rdi
leaq 0x173b(%rip), %rsi      # 0x40be
callq 0x2120
movq %rax, -0x60(%rbp)
jmp 0x298e
movq -0x60(%rbp), %rdi
movq 0x362f(%rip), %rsi      # 0x5fc8
callq 0x2130
jmp 0x29a0
movl $0x1, -0x48(%rbp)
jmp 0x2b36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2090
jmp 0x2b48
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
subl $0x19, %ecx
movl %ecx, 0x8(%rax)
cmpl $0x0, 0x8(%rax)
jge 0x29e0
xorl %eax, %eax
movl %eax, -0x64(%rbp)
jmp 0x29ea
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x50(%rbp), %rax
movl -0x64(%rbp), %ecx
movl %ecx, 0x8(%rax)
callq 0x2050
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x21, %rdx
addl %ecx, %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x70(%rbp)
subq $0x4, %rax
ja 0x2a9f
movq -0x70(%rbp), %rax
leaq 0x15d2(%rip), %rcx      # 0x4004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x16bf(%rip), %rsi      # 0x4101
leaq -0x38(%rbp), %rdi
callq 0x21a0
jmp 0x2a4d
jmp 0x2a9f
leaq 0x16b4(%rip), %rsi      # 0x410a
leaq -0x38(%rbp), %rdi
callq 0x21a0
jmp 0x2a61
jmp 0x2a9f
leaq 0x16ab(%rip), %rsi      # 0x4115
leaq -0x38(%rbp), %rdi
callq 0x21a0
jmp 0x2a75
jmp 0x2a9f
leaq 0x16a7(%rip), %rsi      # 0x4125
leaq -0x38(%rbp), %rdi
callq 0x21a0
jmp 0x2a89
jmp 0x2a9f
leaq 0x169e(%rip), %rsi      # 0x4130
leaq -0x38(%rbp), %rdi
callq 0x21a0
jmp 0x2a9d
jmp 0x2a9f
movq -0x50(%rbp), %rsi
addq $0x18, %rsi
movq 0x352a(%rip), %rdi      # 0x5fd8
callq 0x20f0
movq %rax, -0x78(%rbp)
jmp 0x2ab9
movq -0x78(%rbp), %rdi
leaq 0x157a(%rip), %rsi      # 0x403e
callq 0x2120
movq %rax, -0x80(%rbp)
jmp 0x2acf
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x20f0
movq %rax, -0x88(%rbp)
jmp 0x2ae5
movq -0x88(%rbp), %rdi
leaq 0x164d(%rip), %rsi      # 0x4140
callq 0x2120
movq %rax, -0x90(%rbp)
jmp 0x2b01
movq -0x90(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x20f0
movq %rax, -0x98(%rbp)
jmp 0x2b1a
movq -0x98(%rbp), %rdi
movq 0x34a0(%rip), %rsi      # 0x5fc8
callq 0x2130
jmp 0x2b2f
movl $0x0, -0x48(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2090
addq $0xa0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2200
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)