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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r12
movl 0x8(%rdi), %r15d
movq %rsi, %rdi
callq 0x23f8
movl %eax, %ebp
movq %rbx, %rdi
callq 0x23f4
cmpb $0x72, %al
jne 0x281d
addl %r15d, %r15d
movl %ebp, %r14d
shrl $0x1f, %r14d
addl %ebp, %r14d
sarl %r14d
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x23fc
movb %al, 0x7(%rsp)
jmp 0x2862
movq %rbx, %rdi
callq 0x23f4
cmpb $0x73, %al
jne 0x284e
movl %r15d, %r14d
shrl $0x1f, %r14d
addl %r15d, %r14d
sarl %r14d
addl %ebp, %ebp
movq %r12, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x23fc
movb %al, 0x7(%rsp)
movl %r14d, %r15d
jmp 0x285f
movq %r12, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x23fc
movb %al, 0x7(%rsp)
movl %ebp, %r14d
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
movq 0x575d(%rip), %rbp      # 0x7fd0
movq %rbp, %rdi
callq 0x2120
movq %rax, %r13
leaq 0x2a0a(%rip), %rsi      # 0x528f
movl $0xb, %edx
movq %rax, %rdi
callq 0x2120
movl 0x8(%r12), %esi
movq %r13, %rdi
callq 0x2170
movq %rax, %r13
leaq 0x2761(%rip), %r12      # 0x500a
movl $0x8, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2120
movq %r13, %rdi
movl %r15d, %esi
callq 0x2170
movq %rax, %r13
leaq 0x27fd(%rip), %r15      # 0x50cb
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2414
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbp, %rdi
callq 0x2120
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x2960(%rip), %rsi      # 0x528f
callq 0x2120
movq %rbx, %rdi
callq 0x23f8
movq %r13, %rdi
movl %eax, %esi
callq 0x2170
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2120
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2170
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movb 0x7(%rsp), %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)