// File: Oralf[P]Heros/Hero.cpp
// Function: Hero::BuyCretures(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
bool Hero:: BuyCretures(string creatureType, int numToBuy){
	int totalCost=0;
	if(creatureType=="BlackDragon"){
		totalCost=(armyCreatures[blackDragon_e]->getCost()) * numToBuy;
		gold=gold-totalCost;
		numOfCretures[blackDragon_e]= numOfCretures[blackDragon_e]+ numToBuy;
		totalCreatures+= numToBuy;
		return true;
	}
	else if( creatureType=="Wizard"){
		totalCost=(armyCreatures[wizard_e]->getCost()) * numToBuy;
		gold=gold-totalCost;
		numOfCretures[wizard_e]= numOfCretures[wizard_e]+ numToBuy;
		totalCreatures+= numToBuy;
		return true;
	}
	else if (creatureType=="Archer"){
		totalCost=(armyCreatures[archer_e]->getCost()) * numToBuy;
		gold=gold-totalCost;
		numOfCretures[archer_e]= numOfCretures[archer_e]+ numToBuy;
		totalCreatures+= numToBuy;
		return true;
	}
	else if ( creatureType=="Vampire"){
		totalCost=(armyCreatures[vampire_e]->getCost()) * numToBuy;
		gold=gold-totalCost;
		numOfCretures[vampire_e]= numOfCretures[vampire_e]+ numToBuy;
		totalCreatures+= numToBuy;
		return true;
	}
	else if( creatureType=="Zombie"){
		totalCost=(armyCreatures[zombie_e]->getCost()) * numToBuy;
		gold=gold-totalCost;
		numOfCretures[zombie_e]= numOfCretures[zombie_e]+ numToBuy;
		totalCreatures+= numToBuy;
		return true;
	}
	else{
		return false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %rax
movq -0x38(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq %rax, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
leaq 0x7991(%rip), %rsi      # 0xc059
callq 0x3b10
testb $0x1, %al
jne 0x46d3
jmp 0x4721
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x4140
movl %eax, %ecx
movq -0x28(%rbp), %rax
imull -0x1c(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movsd 0x48(%rax), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rax)
movl 0x78(%rax), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x78(%rax)
movl -0x1c(%rbp), %ecx
addl 0x8c(%rax), %ecx
movl %ecx, 0x8c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48c1
movq -0x30(%rbp), %rdi
leaq 0x7995(%rip), %rsi      # 0xc0c1
callq 0x3b10
testb $0x1, %al
jne 0x4737
jmp 0x4785
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x4140
movl %eax, %ecx
movq -0x28(%rbp), %rax
imull -0x1c(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movsd 0x48(%rax), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rax)
movl 0x7c(%rax), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x7c(%rax)
movl -0x1c(%rbp), %ecx
addl 0x8c(%rax), %ecx
movl %ecx, 0x8c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48c1
movq -0x30(%rbp), %rdi
leaq 0x7939(%rip), %rsi      # 0xc0c9
callq 0x3b10
testb $0x1, %al
jne 0x479b
jmp 0x47ef
movq -0x28(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x4140
movl %eax, %ecx
movq -0x28(%rbp), %rax
imull -0x1c(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movsd 0x48(%rax), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rax)
movl 0x80(%rax), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x80(%rax)
movl -0x1c(%rbp), %ecx
addl 0x8c(%rax), %ecx
movl %ecx, 0x8c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48c1
movq -0x30(%rbp), %rdi
leaq 0x78d7(%rip), %rsi      # 0xc0d1
callq 0x3b10
testb $0x1, %al
jne 0x4805
jmp 0x4856
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x4140
movl %eax, %ecx
movq -0x28(%rbp), %rax
imull -0x1c(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movsd 0x48(%rax), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rax)
movl 0x84(%rax), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x84(%rax)
movl -0x1c(%rbp), %ecx
addl 0x8c(%rax), %ecx
movl %ecx, 0x8c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48c1
movq -0x30(%rbp), %rdi
leaq 0x7879(%rip), %rsi      # 0xc0da
callq 0x3b10
testb $0x1, %al
jne 0x486c
jmp 0x48bd
movq -0x28(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x4140
movl %eax, %ecx
movq -0x28(%rbp), %rax
imull -0x1c(%rbp), %ecx
movl %ecx, -0x20(%rbp)
movsd 0x48(%rax), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rax)
movl 0x88(%rax), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x88(%rax)
movl -0x1c(%rbp), %ecx
addl 0x8c(%rax), %ecx
movl %ecx, 0x8c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48c1
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)