// File: moloch--[P]cli-Blackjack/./Blackjack/Player.cpp
// Function: Player::hit(Card)
void Player::hit(Card card)
{
	if (card.getRank() == "A" && (hand.getScore() + 11) > 21)
	{
		card.setValue(1);
	}
	else if (card.getRank() == "A")
	{
		card.setValue(11);
	}
	hand.putInHand(card);
	if(isBust()) // Look for aces if player went bust from new card
	{
		for (unsigned int index = 0; index < hand.getSize(); ++index)
		{
			if (hand.getCardRank(index) == "A" && hand.getCardValue(index) == 11)
			{
				hand.setCardValue(index, 1); // Change ace's value to 1
			}
		}
	}
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rsi, 0x50(%rsp)
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x118(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x6610
movq 0x60(%rsp), %rdi
leaq 0x1b4a(%rip), %rsi      # 0xa2f1
callq 0x44f0
movb %al, 0x6f(%rsp)
jmp 0x87b2
movb 0x6f(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x4f(%rsp)
jne 0x87c3
jmp 0x87e8
movq 0x58(%rsp), %rdi
addq $0x60, %rdi
callq 0x6870
movl %eax, 0x48(%rsp)
jmp 0x87d7
movl 0x48(%rsp), %eax
addl $0xb, %eax
cmpl $0x15, %eax
setg %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
movb %al, 0x47(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x2110
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x8807
jmp 0x8841
movq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0x6300
jmp 0x88bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x2110
jmp 0x8a54
movq 0x50(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x6610
movq 0x38(%rsp), %rdi
leaq 0x1a8d(%rip), %rsi      # 0xa2f1
callq 0x44f0
movb %al, 0x46(%rsp)
jmp 0x886f
leaq 0xe8(%rsp), %rdi
callq 0x2110
movb 0x46(%rsp), %al
testb $0x1, %al
jne 0x8886
jmp 0x88bd
movq 0x50(%rsp), %rdi
movl $0xb, %esi
callq 0x6300
jmp 0x88bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x2110
jmp 0x8a54
jmp 0x88bf
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x28(%rsp)
leaq 0x98(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x7db0
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x6a00
jmp 0x88f5
leaq 0x98(%rsp), %rdi
callq 0x64c0
movq 0x58(%rsp), %rdi
callq 0x86c0
testb $0x1, %al
jne 0x8915
jmp 0x8a4c
movl $0x0, 0x94(%rsp)
movq 0x58(%rsp), %rdi
movl 0x94(%rsp), %eax
movl %eax, 0x24(%rsp)
addq $0x60, %rdi
callq 0x6920
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
jae 0x8a4a
movq 0x58(%rsp), %rsi
addq $0x60, %rsi
movl 0x94(%rsp), %edx
leaq 0x70(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x69b0
movq 0x18(%rsp), %rdi
leaq 0x197f(%rip), %rsi      # 0xa2f1
callq 0x44f0
movb %al, 0x23(%rsp)
jmp 0x897d
movb 0x23(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x17(%rsp)
jne 0x898e
jmp 0x89b7
movq 0x58(%rsp), %rdi
addq $0x60, %rdi
movl 0x94(%rsp), %esi
callq 0x6940
movl %eax, 0x10(%rsp)
jmp 0x89a9
movl 0x10(%rsp), %eax
cmpl $0xb, %eax
sete %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
movb %al, 0xf(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x2110
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x89d3
jmp 0x8a32
movq 0x58(%rsp), %rdi
addq $0x60, %rdi
movl 0x94(%rsp), %esi
movl $0x1, %edx
callq 0x6970
jmp 0x8a32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x64c0
jmp 0x8a54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x2110
jmp 0x8a54
jmp 0x8a34
movl 0x94(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x94(%rsp)
jmp 0x8920
jmp 0x8a4c
addq $0x148, %rsp            # imm = 0x148
retq
movq 0x110(%rsp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)