// File: 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
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
addq $0x38, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x1ee00
movq %rax, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq 0x11be7(%rip), %rsi     # 0x2f1a8
callq 0x12b30
testb $0x1, %al
jne 0x1d5cc
jmp 0x1d5ff
movq -0xd0(%rbp), %rdi
movl $0x1, %esi
callq 0x1d460
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0x1d460
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x1d672
movq -0x28(%rbp), %rdi
addq $0x60, %rdi
leaq 0x11ba3(%rip), %rsi     # 0x2f1b1
callq 0x12b30
testb $0x1, %al
jne 0x1d619
jmp 0x1d64c
movq -0xd0(%rbp), %rdi
movl $0x3, %esi
callq 0x1d460
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x1d460
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x1d670
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1ef60
jmp 0x1d8bf
jmp 0x1d672
movsd 0x11af6(%rip), %xmm0    # 0x2f170
movsd %xmm0, -0x48(%rbp)
movsd -0x38(%rbp), %xmm0
divsd -0x30(%rbp), %xmm0
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x28(%rbp), %rax
cvtsi2sdl 0x80(%rax), %xmm0
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x11ab7(%rip), %xmm0    # 0x2f168
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0xd0(%rbp), %rdi
movl -0x4c(%rbp), %eax
movq %rax, -0xd8(%rbp)
addq $0x50, %rdi
callq 0x6bf0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jae 0x1d748
movq -0xd0(%rbp), %rdi
movq -0x28(%rbp), %rax
addq $0x40, %rax
movq %rax, -0xe0(%rbp)
addq $0x50, %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x6c10
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0x1a410
testb $0x1, %al
jne 0x1d724
jmp 0x1d738
movsd 0x11a4c(%rip), %xmm0    # 0x2f178
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x1d748
jmp 0x1d73a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1d6c2
movq -0x18(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x1ef90
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq %rax, -0xe8(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x6bf0
movq %rax, %rcx
movq -0xe8(%rbp), %rax
cmpq %rcx, %rax
jae 0x1d86a
movq -0x28(%rbp), %rsi
addq $0x40, %rsi
leaq -0x90(%rbp), %rdi
callq 0x3100
jmp 0x1d798
movl -0x6c(%rbp), %eax
movl %eax, %esi
leaq -0x68(%rbp), %rdi
callq 0x6c10
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x3100
jmp 0x1d7b7
movq -0xd0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x1d8e0
movsd %xmm0, -0xf0(%rbp)
jmp 0x1d7db
movsd -0xf0(%rbp), %xmm0
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3180
leaq -0x90(%rbp), %rdi
callq 0x3180
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x1d75c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1d8b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1d85c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3180
leaq -0x90(%rbp), %rdi
callq 0x3180
jmp 0x1d8b4
movsd -0x48(%rbp), %xmm0
movsd 0x11909(%rip), %xmm1    # 0x2f180
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xc4(%rbp)
cvttsd2si -0x48(%rbp), %eax
movl %eax, -0xc8(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x1ef60
jmp 0x1d8a9
leaq -0x68(%rbp), %rdi
callq 0x7b40
jmp 0x1d8bf
leaq -0x68(%rbp), %rdi
callq 0x7b40
jmp 0x1d8cc
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x3410
nopl (%rax,%rax)