// File: LifeAlgorithm[P]RockPaperScissors/Rock.cpp
// Function: Rock::fight(Tool&)
char Rock::fight(Tool & toolIn)
{
	//Temporary strength holders
	int tempRockStrength = this->strength;
	int tempToolInStrength = toolIn.getStrength();

	char outcome;

	//Rock vs. Scissors
	if (toolIn.getType() == 's') {
		tempRockStrength *= 2; //rock is strong against scissors, so strength is doubled
		tempToolInStrength /= 2; //scissors are weak to rock, so strength is halved
		outcome = compareStrength(tempRockStrength, tempToolInStrength); //compare
	}

	//Rock vs. Paper
	else if (toolIn.getType() == 'p') {
		tempRockStrength /= 2; //rock is weak to paper, so strength is halved
		tempToolInStrength *= 2;//paper is strong to rock, so strength is doubled
		outcome = compareStrength(tempRockStrength, tempToolInStrength); //compare
	}

	//Rock vs. Rock
	else {
		outcome = compareStrength(tempRockStrength, tempToolInStrength); //no temporary modifiers, compare
	}

	cout << this->longType << " strength: " << this->strength << " (temp: " << tempRockStrength << ")" << endl;
	cout << toolIn.getLongType() << " strength: " << toolIn.getStrength() << " (temp: " << tempToolInStrength << ")"  << endl;

	return outcome;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26c0
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26a0
movsbl %al, %eax
cmpl $0x73, %eax
jne 0x2955
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x29a4
movq -0x10(%rbp), %rdi
callq 0x26a0
movsbl %al, %eax
cmpl $0x70, %eax
jne 0x2990
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x29a2
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x26e0
movb %al, -0x19(%rbp)
jmp 0x29a4
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
movq 0x661d(%rip), %rdi      # 0x8fd0
callq 0x2130
movq %rax, %rdi
leaq 0x38a1(%rip), %rsi      # 0x6263
callq 0x2160
movq %rax, %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x362a(%rip), %rsi      # 0x600a
callq 0x2160
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x36a5(%rip), %rsi      # 0x609f
callq 0x2160
movq %rax, %rdi
movq 0x65b7(%rip), %rsi      # 0x8fc0
callq 0x2190
movq -0x10(%rbp), %rdi
callq 0x2720
movq %rax, %rsi
movq 0x65af(%rip), %rdi      # 0x8fd0
callq 0x2130
movq %rax, %rdi
leaq 0x3833(%rip), %rsi      # 0x6263
callq 0x2160
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x26c0
movq -0x30(%rbp), %rdi
movl %eax, %esi
callq 0x2200
movq %rax, %rdi
leaq 0x35b3(%rip), %rsi      # 0x600a
callq 0x2160
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x2200
movq %rax, %rdi
leaq 0x362e(%rip), %rsi      # 0x609f
callq 0x2160
movq %rax, %rdi
movq 0x6540(%rip), %rsi      # 0x8fc0
callq 0x2190
movb -0x19(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nop