// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
movq %rdi, %r14
movslq %edx, %rax
movq 0x38(%rdi), %r12
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %r13
leaq (%r12,%r13), %r15
addq $0x60, %r15
leaq 0x98f4(%rip), %rsi      # 0x161a8
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0xc8da
leaq 0x98ea(%rip), %rsi      # 0x161b1
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0xc90a
xorl %ebx, %ebx
jmp 0xcaf3
movq 0x20(%r14), %rcx
movq 0x28(%r14), %rdx
subq %rcx, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x18, %rdx
jne 0xc8f3
movl 0x4(%rcx), %eax
movq 0x20(%rbx), %rcx
movq 0x28(%rbx), %rdx
subq %rcx, %rdx
cmpq $0x18, %rdx
jne 0xc93e
addq $0x8, %rcx
jmp 0xc938
movq 0x20(%r14), %rcx
movq 0x28(%r14), %rdx
subq %rcx, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x18, %rdx
jne 0xc923
movl 0xc(%rcx), %eax
movq 0x20(%rbx), %rcx
movq 0x28(%rbx), %rdx
subq %rcx, %rdx
cmpq $0x18, %rdx
jne 0xc93e
addq $0x10, %rcx
cvtsi2sdl (%rcx), %xmm0
jmp 0xc946
movsd 0x983a(%rip), %xmm0     # 0x16180
addq %r13, %r12
movq 0x50(%r14), %r15
movq 0x58(%r14), %r13
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
mulsd 0x9827(%rip), %xmm1     # 0x16188
xorps %xmm0, %xmm0
cvtsi2sdl 0x80(%r12), %xmm0
mulsd %xmm1, %xmm0
addsd 0x9816(%rip), %xmm0     # 0x16190
movsd %xmm0, -0x30(%rbp)
subq %r15, %r13
je 0xc9e0
movq %rbx, -0x38(%rbp)
sarq $0x5, %r13
movq 0x48(%r12), %r14
movl $0x1, %ebx
xorl %eax, %eax
shlq $0x5, %rax
cmpq 0x8(%r15,%rax), %r14
jne 0xc9bf
testq %r14, %r14
je 0xc9ca
addq %r15, %rax
movq (%rax), %rsi
movq 0x40(%r12), %rdi
movq %r14, %rdx
callq 0x21c0
testl %eax, %eax
je 0xc9ca
movl %ebx, %eax
incl %ebx
cmpq %rax, %r13
ja 0xc998
jmp 0xc9dc
movsd -0x30(%rbp), %xmm0
mulsd 0x97c1(%rip), %xmm0     # 0x16198
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rbx
addq $0x50, %rbx
leaq -0x90(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6e50
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0xcaca
movl $0x1, %r15d
xorl %r13d, %r13d
leaq -0x78(%rbp), %rbx
leaq -0x58(%rbp), %r14
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x88c2
movq -0x90(%rbp), %rax
shlq $0x5, %r13
leaq -0x48(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x88c2
movq %rbx, %rsi
movq %r14, %rdx
callq 0xcb58
movsd %xmm0, -0x38(%rbp)
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xca81
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21b0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xca9a
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21b0
movsd -0x30(%rbp), %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x88(%rbp), %rax
subq -0x90(%rbp), %rax
movl %r15d, %r13d
sarq $0x5, %rax
incl %r15d
cmpq %r13, %rax
ja 0xca14
movsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %r14d
mulsd 0x96c4(%rip), %xmm0     # 0x161a0
cvttsd2si %xmm0, %ebx
leaq -0x90(%rbp), %rdi
callq 0x5fa0
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
jmp 0xcb44
movq %rax, %rbx
jmp 0xcb2b
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcb2b
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21b0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xcb44
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21b0
leaq -0x90(%rbp), %rdi
callq 0x5fa0
movq %rbx, %rdi
callq 0x22d0