// File: chulchultrain[P]FactoryHead/WorkingStats/WorkingStats.cpp
// Function: CalculateEVs(std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>> const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<int> CalculateEVs(const vector<int> &ws, const vector<int> &bs, int IV,string nature) {
	vector<int> res(6,-1);
	int splitAcross = 0;
	if( CalcHP(bs[0],0,IV,100) == ws[0])
		res[0] = 0;
	for(int i = 1; i < 6; i++)
		if( CalcNonHP(i,bs[i],0,IV,100,nature) == ws[i])
			res[i] = 0;
	for(int j = 0; j < 6; j++)
		if( res[j] == -1)
			splitAcross++;
	if(splitAcross > 0 && splitAcross < 6) {
		for(int j = 0; j < 6; j++)
			if( res[j] == -1)
				res[j] = 510 / splitAcross;

		if( CalcHP(bs[0],res[0],IV,100) != ws[0]) {
				cout << "ERROR:WORKINGSTATS.CPP/CALCULATEEVS EV CANNOT MATCH STATS\n";
				cout << 0 << " " << res[0] << endl;			
		}
		for(int i = 1; i < 6; i++)
			if(CalcNonHP(i,bs[i],res[i],IV,100,nature) != ws[i]) {
				cout << "ERROR:WORKINGSTATS.CPP/CALCULATEEVS EV CANNOT MATCH STATS\n";
				cout << i << " " << res[i] << endl;
				return res;
			}			
	}
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %r8, -0xc8(%rbp)
movq %rdi, -0xb8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
leaq -0x31(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x70a0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rcx
movl $0x6, %esi
leaq -0x30(%rbp), %rdx
callq 0x78d0
jmp 0x20a7f
leaq -0x31(%rbp), %rdi
callq 0x7130
movl $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, -0xd0(%rbp)
movl %eax, %esi
callq 0x80f0
movl -0xd0(%rbp), %esi
movl (%rax), %edi
movl -0x1c(%rbp), %edx
movl $0x64, %ecx
callq 0x205b0
movl %eax, -0xcc(%rbp)
jmp 0x20abf
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x80f0
movq %rax, %rcx
movl -0xcc(%rbp), %eax
cmpl (%rcx), %eax
jne 0x20b1c
movq -0xb8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7150
movl $0x0, (%rax)
jmp 0x20b1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x7130
jmp 0x20f5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x20f4e
movl $0x1, -0x4c(%rbp)
cmpl $0x6, -0x4c(%rbp)
jge 0x20c00
movl -0x4c(%rbp), %eax
movl %eax, -0xdc(%rbp)
movq -0x18(%rbp), %rdi
movslq %eax, %rsi
callq 0x80f0
movq -0xc8(%rbp), %rsi
movl (%rax), %eax
movl %eax, -0xd8(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0xd4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3100
jmp 0x20b65
movl -0xd4(%rbp), %ecx
movl -0xd8(%rbp), %esi
movl -0xdc(%rbp), %edi
xorl %edx, %edx
movl $0x64, %r8d
leaq -0x70(%rbp), %r9
callq 0x20610
movl %eax, -0xe0(%rbp)
jmp 0x20b90
movq -0x10(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0x80f0
movl (%rax), %eax
movl %eax, -0xe4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3180
movl -0xe4(%rbp), %ecx
movl -0xe0(%rbp), %eax
cmpl %ecx, %eax
jne 0x20bf0
movq -0xb8(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0x7150
movl $0x0, (%rax)
jmp 0x20bf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3180
jmp 0x20f4e
jmp 0x20bf2
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x20b23
movl $0x0, -0x74(%rbp)
cmpl $0x6, -0x74(%rbp)
jge 0x20c38
movq -0xb8(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0x7150
cmpl $-0x1, (%rax)
jne 0x20c2b
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x20c2d
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x20c07
cmpl $0x0, -0x48(%rbp)
jle 0x20f1e
cmpl $0x6, -0x48(%rbp)
jge 0x20f1e
movl $0x0, -0x78(%rbp)
cmpl $0x6, -0x78(%rbp)
jge 0x20ca2
movq -0xb8(%rbp), %rdi
movslq -0x78(%rbp), %rsi
callq 0x7150
cmpl $-0x1, (%rax)
jne 0x20c95
movq -0xb8(%rbp), %rdi
movl $0x1fe, %eax            # imm = 0x1FE
cltd
idivl -0x48(%rbp)
movl %eax, -0xe8(%rbp)
movslq -0x78(%rbp), %rsi
callq 0x7150
movl -0xe8(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x20c97
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x20c53
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0xf8(%rbp)
callq 0x80f0
movq -0xb8(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movl (%rax), %eax
movl %eax, -0xf0(%rbp)
callq 0x7150
movl -0xf0(%rbp), %edi
movl (%rax), %esi
movl -0x1c(%rbp), %edx
movl $0x64, %ecx
callq 0x205b0
movl %eax, -0xec(%rbp)
jmp 0x20cee
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x80f0
movq %rax, %rcx
movl -0xec(%rbp), %eax
cmpl (%rcx), %eax
je 0x20d92
movq 0x262c5(%rip), %rdi     # 0x46fd8
leaq 0xe4e6(%rip), %rsi      # 0x2f200
callq 0x3220
jmp 0x20d21
movq 0x262b0(%rip), %rdi     # 0x46fd8
xorl %esi, %esi
callq 0x3400
movq %rax, -0x100(%rbp)
jmp 0x20d38
movq -0x100(%rbp), %rdi
leaq 0xe8ca(%rip), %rsi      # 0x2f610
callq 0x3220
movq %rax, -0x108(%rbp)
jmp 0x20d54
movq -0xb8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7150
movq -0x108(%rbp), %rdi
movl (%rax), %esi
callq 0x3400
movq %rax, -0x110(%rbp)
jmp 0x20d7b
movq -0x110(%rbp), %rdi
movq 0x2623f(%rip), %rsi     # 0x46fc8
callq 0x3260
jmp 0x20d90
jmp 0x20d92
movl $0x1, -0x7c(%rbp)
cmpl $0x6, -0x7c(%rbp)
jge 0x20f1c
movl -0x7c(%rbp), %eax
movl %eax, -0x120(%rbp)
movq -0x18(%rbp), %rdi
movslq %eax, %rsi
callq 0x80f0
movq -0xb8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
movslq -0x7c(%rbp), %rsi
callq 0x7150
movq -0xc8(%rbp), %rsi
movl (%rax), %eax
movl %eax, -0x118(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x114(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3100
jmp 0x20df6
movl -0x114(%rbp), %ecx
movl -0x118(%rbp), %edx
movl -0x11c(%rbp), %esi
movl -0x120(%rbp), %edi
movl $0x64, %r8d
leaq -0xa0(%rbp), %r9
callq 0x20610
movl %eax, -0x124(%rbp)
jmp 0x20e28
movq -0x10(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x80f0
movl (%rax), %eax
movl %eax, -0x128(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3180
movl -0x128(%rbp), %ecx
movl -0x124(%rbp), %eax
cmpl %ecx, %eax
je 0x20f0c
movq 0x26174(%rip), %rdi     # 0x46fd8
leaq 0xe395(%rip), %rsi      # 0x2f200
callq 0x3220
jmp 0x20e72
movl -0x7c(%rbp), %esi
movq 0x2615c(%rip), %rdi     # 0x46fd8
callq 0x3400
movq %rax, -0x130(%rbp)
jmp 0x20e8a
movq -0x130(%rbp), %rdi
leaq 0xe778(%rip), %rsi      # 0x2f610
callq 0x3220
movq %rax, -0x138(%rbp)
jmp 0x20ea6
movq -0xb8(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
callq 0x7150
movq -0x138(%rbp), %rdi
movl (%rax), %esi
callq 0x3400
movq %rax, -0x140(%rbp)
jmp 0x20ecd
movq -0x140(%rbp), %rdi
movq 0x260ed(%rip), %rsi     # 0x46fc8
callq 0x3260
jmp 0x20ee2
movb $0x1, -0x29(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x20f2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3180
jmp 0x20f4e
jmp 0x20f0e
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x20d99
jmp 0x20f1e
movb $0x1, -0x29(%rbp)
movl $0x1, -0xa4(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x20f3e
movq -0xb8(%rbp), %rdi
callq 0x74a0
movq -0xc0(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x74a0
movq -0x40(%rbp), %rdi
callq 0x3410
nopw %cs:(%rax,%rax)