// File: /workspace/github_cpp_makefile_star2_O2/chulchultrain[P]FactoryHead/PokemonEntry/PokemonEntry.cpp
// Function: PokemonEntry::getMoveDamageRange(PokemonEntry&, int)
pair<int,int> PokemonEntry::getMoveDamageRange(PokemonEntry &defender,int which) {
	const MoveData &md = moves[which];
	double dStat = 0,aStat = 0;
	if(md.category == "Physical") {
		aStat = this->getStat(1);
		dStat = defender.getStat(2);
	}
	else if(md.category == "Special") {
		aStat = this->getStat(3);
		dStat = defender.getStat(4);
	}
	else {
//		cout << "HIT STATUS\n";
		return pair<int,int>(0,0);
	}
	double damage = double((2 * 100 + 10)) / double(250);
//	cout << aStat << ' ' << dStat << '\n';
	damage *= (double(aStat) / double(dStat));
	damage *= md.damage;
	damage += 2;
//	cout << damage << endl;
	for(unsigned i = 0; i < types.size(); i++)
		if(md.type == types[i]) {
			damage *= 1.5;
			break;
		}
	vector<string> defTypes = defender.getTypes();
	for(unsigned i = 0; i < defTypes.size(); i++) {
//		cout << defTypes[i] << " " << dmgMultiplier(md.type,defTypes[i]);
		damage *= dmgMultiplier(md.type,defTypes[i]);
//		cout << damage << '\n';
	}
	return pair<int,int>(int(.85 * damage),int(damage));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %r15
movslq %edx, %rax
movq 0x38(%rdi), %rbx
imulq $0x88, %rax, %r13
leaq (%rbx,%r13), %r12
addq $0x60, %r12
leaq 0x6cee(%rip), %rsi      # 0x12190
movq %r12, %rdi
callq 0x827a
testb %al, %al
je 0xb4c4
movq 0x20(%r15), %rax
movq 0x28(%r15), %rcx
subq %rax, %rcx
cmpq $0x18, %rcx
jne 0xb4ed
movl 0x4(%rax), %eax
jmp 0xb4f0
leaq 0x6cce(%rip), %rsi      # 0x12199
movq %r12, %rdi
callq 0x827a
testb %al, %al
je 0xb507
movq 0x20(%r15), %rax
movq 0x28(%r15), %rcx
subq %rax, %rcx
cmpq $0x18, %rcx
jne 0xb50e
movl 0xc(%rax), %eax
jmp 0xb511
pushq $-0x1
popq %rax
movq 0x20(%r14), %rcx
movq 0x28(%r14), %rdx
subq %rcx, %rdx
cmpq $0x18, %rdx
jne 0xb52c
addq $0x8, %rcx
jmp 0xb526
xorl %ebx, %ebx
jmp 0xb64e
pushq $-0x1
popq %rax
movq 0x20(%r14), %rcx
movq 0x28(%r14), %rdx
subq %rcx, %rdx
cmpq $0x18, %rdx
jne 0xb52c
addq $0x10, %rcx
cvtsi2sdl (%rcx), %xmm0
jmp 0xb534
movsd 0x6c34(%rip), %xmm0     # 0x12168
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
mulsd 0x6c2c(%rip), %xmm1     # 0x12170
addq %r13, %rbx
cvtsi2sdl 0x80(%rbx), %xmm0
mulsd %xmm1, %xmm0
addsd 0x6c1d(%rip), %xmm0     # 0x12178
movsd %xmm0, -0x30(%rbp)
addq $0x40, %rbx
xorl %ecx, %ecx
movl %ecx, %r12d
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0xb5aa
movq %r12, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0xa303
leal 0x1(%r12), %ecx
testb %al, %al
je 0xb566
movsd -0x30(%rbp), %xmm0
mulsd 0x6bdb(%rip), %xmm0     # 0x12180
movsd %xmm0, -0x30(%rbp)
addq $0x50, %r14
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x5c94
xorl %r12d, %r12d
leaq -0x88(%rbp), %r14
leaq -0x68(%rbp), %r15
movl %r12d, %r12d
movq -0x40(%rbp), %rax
subq -0x48(%rbp), %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0xb628
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2240
movq %r12, %rsi
shlq $0x5, %rsi
addq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x2240
movq %r14, %rsi
movq %r15, %rdx
callq 0xb694
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movq %r15, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x20e0
incl %r12d
jmp 0xb5c8
movsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %r14d
mulsd 0x6b4e(%rip), %xmm0     # 0x12188
cvttsd2si %xmm0, %ebx
leaq -0x48(%rbp), %rdi
callq 0x4ed4
shlq $0x20, %r14
orq %r14, %rbx
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x20e0
jmp 0xb671
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20e0
jmp 0xb682
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x4ed4
movq %rbx, %rdi
callq 0x22e0
nop