Function at 0x406940
Capabilities:
Check if file exists
Get geographical location
Resolve function by parsing pe exports

Disassembly:
push 0xffffffffffffffff
push 0x52a971
mov eax, dword fs:[0]
push eax
sub esp, 0x280
mov eax, dword [0x56b1dc]
xor eax, esp
mov dword [esp + 0x278], eax
push ebx
push ebp
push esi
push edi
mov eax, dword [0x56b1dc]
xor eax, esp
push eax
lea eax, [esp + 0x294]
mov dword fs:[0], eax
mov ebp, dword [esp + 0x2a4]
lea ebx, [esp + 0x24]
mov dword [esp + 0x40], ebp
call fcn.0045e390
mov dword [esp + 0x29c], 0
mov edx, dword [esp + 0x24]
mov eax, dword [edx - 0xc]
test eax, eax
jle 0x4069cb
lea ecx, [eax - 1]
test ecx, ecx
jl 0x406c26
cmp ecx, eax
jg 0x406c26
movzx eax, word [edx + ecx*2]
cmp ax, 0x5c
je 0x4069cb
push 0x5c
mov edi, ebx
call fcn.004118c0
lea edi, [esp + 0x20]
call fcn.0045e680
mov byte [esp + 0x29c], 1
mov edx, dword [esp + 0x20]
mov eax, dword [edx - 0xc]
test eax, eax
jle 0x406a0b
lea ecx, [eax - 1]
test ecx, ecx
jl 0x406c26
cmp ecx, eax
jg 0x406c26
movzx eax, word [edx + ecx*2]
cmp ax, 0x5c
je 0x406a0b
push 0x5c
call fcn.004118c0
lea eax, [esp + 0x20]
push eax
lea ecx, [esp + 0x1c]
push ecx
mov ebx, str.celldict.dat
call fcn.004036c0
add esp, 8
mov byte [esp + 0x29c], 2
mov edx, dword [esp + 0x18]
mov esi, dword [0x5313c0]
push edx
call esi
test eax, eax
jne 0x406a86
lea eax, [esp + 0x24]
push eax
lea ecx, [esp + 0x34]
push ecx
call fcn.004036c0
add esp, 8
lea edi, [esp + 0x18]
mov byte [esp + 0x29c], 3
call fcn.00401dd0
mov byte [esp + 0x29c], 2
mov eax, dword [esp + 0x30]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x406a86
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ecx, dword [esp + 0x18]
push ecx
call esi
test eax, eax
je 0x407026
mov eax, ebp
call fcn.00407860
mov edx, dword [esp + 0x18]
xor eax, eax
push edx
push 0x14
mov dword [esp + 0x5e], eax
mov dword [esp + 0x62], eax
mov dword [esp + 0x66], eax
mov dword [esp + 0x6a], eax
mov dword [esp + 0x6e], eax
mov dword [esp + 0x72], eax
mov dword [esp + 0x76], eax
mov dword [esp + 0x7a], eax
mov dword [esp + 0x7e], eax
mov word [esp + 0x82], ax
lea eax, [esp + 0x5c]
push eax
xor edi, edi
push edi
push str.provincecounts
push str.setting
mov word [esp + 0x6c], di
call dword [0x531350]
push 0xa
lea ecx, [esp + 0x58]
push edi
push ecx
call fcn.0050095a
add esp, 0xc
push 0x208
lea edx, [esp + 0x82]
mov esi, eax
push edi
push edx
mov dword [esp + 0x5c], esi
mov word [esp + 0x88], di
call fcn.00508d80
mov eax, dword [0x5759e8]
mov edx, dword [eax + 0xc]
add esp, 0xc
mov ecx, 0x5759e8
call edx
add eax, 0x10
mov dword [esp + 0x2c], eax
cmp esi, edi
mov byte [esp + 0x29c], 4
mov dword [esp + 0x3c], edi
jbe 0x406ffe
mov eax, dword [esp + 0x3c]
push eax
push str.province_u
lea edi, [esp + 0x34]
call fcn.00401f20
mov edx, dword [0x5759e8]
mov eax, dword [edx + 0xc]
add esp, 8
mov ecx, 0x5759e8
call eax
add eax, 0x10
mov dword [esp + 0x1c], eax
mov byte [esp + 0x29c], 5
mov ecx, dword [esp + 0x18]
mov esi, dword [esp + 0x2c]
xor eax, eax
push ecx
push 0x14
lea edx, [esp + 0x5c]
push edx
push eax
push str.province
push esi
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
mov dword [esp + 0x74], eax
mov dword [esp + 0x78], eax
mov dword [esp + 0x7c], eax
mov dword [esp + 0x80], eax
mov dword [esp + 0x84], eax
mov dword [esp + 0x88], eax
mov dword [esp + 0x8c], eax
mov dword [esp + 0x90], eax
call dword [0x531350]
lea eax, [esp + 0x54]
lea edx, [eax + 2]
mov edi, edi
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x406be0
sub eax, edx
sar eax, 1
lea ecx, [esp + 0x54]
mov ebx, eax
push ecx
lea eax, [esp + 0x20]
call fcn.004026c0
mov ebp, dword [esp + 0x1c]
cmp dword [ebp - 0xc], 0
jne 0x406c30
lea eax, [ebp - 0x10]
mov byte [esp + 0x29c], 4
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jmp 0x406fdd
push 0x80070057
call fcn.004026a0
mov ecx, dword [esp + 0x18]
xor eax, eax
push ecx
push 0x14
lea edx, [esp + 0x5c]
push edx
push eax
push str.citycounts
push esi
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
mov dword [esp + 0x74], eax
mov dword [esp + 0x78], eax
mov dword [esp + 0x7c], eax
mov dword [esp + 0x80], eax
mov dword [esp + 0x84], eax
mov dword [esp + 0x88], eax
mov dword [esp + 0x8c], eax
mov dword [esp + 0x90], eax
call dword [0x531350]
push 0xa
lea eax, [esp + 0x58]
push 0
push eax
call fcn.0050095a
mov edx, dword [0x5759e8]
mov edi, eax
mov eax, dword [edx + 0xc]
add esp, 0xc
mov ecx, 0x5759e8
mov dword [esp + 0x4c], edi
call eax
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x29c], 6
mov edx, dword [0x5759e8]
mov eax, dword [edx + 0xc]
mov ecx, 0x5759e8
call eax
add eax, 0x10
mov dword [esp + 0x34], eax
xor eax, eax
test edi, edi
mov byte [esp + 0x29c], 7
mov dword [esp + 0x30], eax
jbe 0x406f75
jmp 0x406cf4
mov esi, dword [esp + 0x2c]
push eax
push str.city_u
lea edi, [esp + 0x40]
call fcn.00401f20
push 0x20a
lea ecx, [esp + 0x88]
push 0
push ecx
call fcn.00508d80
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x4c]
add esp, 0x14
push edx
push 0x105
lea eax, [esp + 0x84]
push eax
push 0
push ecx
push esi
call dword [0x531350]
lea eax, [esp + 0x7c]
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x406d41
sub eax, edx
sar eax, 1
lea edx, [esp + 0x7c]
mov ebx, eax
push edx
lea eax, [esp + 0x38]
call fcn.004026c0
mov eax, dword [esp + 0x34]
cmp dword [eax - 0xc], 0
je 0x406f60
push 0x18
call fcn.00500104
add esp, 4
test eax, eax
je 0x406f60
mov esi, eax
call fcn.004070d0
mov esi, eax
test esi, esi
mov dword [esp + 0x44], esi
je 0x406f60
push esi
lea ecx, [esp + 0x38]
push ecx
call fcn.004072e0
test eax, eax
je 0x406f52
mov esi, dword [esp + 0x40]
mov eax, dword [esi + 0x2c]
mov edi, dword [eax]
add esi, 0x28
mov dword [esp + 0x28], 0
lea esp, [esp]
cmp esi, esi
mov ebx, dword [esi + 4]
je 0x406dcc
call fcn.00500ad0
cmp edi, ebx
je 0x406e44
cmp edi, dword [esi + 4]
jne 0x406dda
call fcn.00500ad0
mov edx, dword [edi + 8]
mov eax, dword [edx]
push ebp
push eax
call fcn.005006a9
add esp, 8
test eax, eax
jne 0x406e2c
cmp edi, dword [esi + 4]
mov dword [esp + 0x28], 1
jne 0x406dff
call fcn.00500ad0
mov esi, dword [edi + 8]
mov ebx, dword [esi + 8]
mov ecx, dword [ebx + 4]
add esi, 4
lea eax, [esp + 0x44]
push eax
push ecx
push ebx
call fcn.0042dd20
mov ecx, esi
mov ebp, eax
call fcn.0042dd60
mov dword [ebx + 4], ebp
mov edx, dword [ebp + 4]
mov dword [edx], ebp
mov ebp, dword [esp + 0x1c]
mov esi, dword [esp + 0x40]
add esi, 0x28
cmp edi, dword [esi + 4]
jne 0x406e3d
call fcn.00500ad0
mov edi, dword [edi]
jmp 0x406dc0
cmp dword [esp + 0x28], 0
jne 0x406f60
push 0x10
call fcn.00500104
mov edi, eax
add esp, 4
mov dword [esp + 0x48], edi
test edi, edi
mov byte [esp + 0x29c], 8
je 0x406e98
mov eax, dword [0x5759e8]
mov edx, dword [eax + 0xc]
mov ecx, 0x5759e8
call edx
add eax, 0x10
mov dword [edi], eax
mov byte [esp + 0x29c], 9
call fcn.0040dcc0
mov dword [edi + 8], eax
mov dword [edi + 0xc], 0
jmp 0x406e9a
xor edi, edi
test edi, edi
mov byte [esp + 0x29c], 7
mov dword [esp + 0x48], edi
je 0x406f60
mov ebx, dword [edi]
lea eax, [ebp - 0x10]
sub ebx, 0x10
cmp eax, ebx
je 0x406f03
cmp dword [ebx + 0xc], 0
lea ebp, [ebx + 0xc]
jl 0x406ef4
mov ecx, dword [eax]
cmp ecx, dword [ebx]
jne 0x406ef4
call fcn.004020b0
mov dword [esp + 0x28], eax
or edx, 0xffffffff
lock xadd dword [ebp], edx
dec edx
test edx, edx
jg 0x406ee9
mov ecx, dword [ebx]
mov eax, dword [ecx]
mov edx, dword [eax + 4]
push ebx
call edx
mov eax, dword [esp + 0x28]
add eax, 0x10
mov dword [edi], eax
jmp 0x406f03
mov eax, dword [esp + 0x1c]
mov ebx, dword [eax - 0xc]
push eax
mov eax, edi
call fcn.004026c0
lea ebp, [edi + 4]
mov edi, dword [ebp + 4]
mov edx, dword [edi + 4]
lea ecx, [esp + 0x44]
push ecx
push edx
push edi
call fcn.0042dd20
mov ecx, ebp
mov ebx, eax
call fcn.0042dd60
mov dword [edi + 4], ebx
mov eax, dword [ebx + 4]
mov dword [eax], ebx
mov edi, dword [esi + 4]
mov ecx, dword [edi + 4]
lea eax, [esp + 0x48]
push eax
push ecx
push edi
call fcn.0042dd20
mov ecx, esi
mov ebx, eax
call fcn.0042dd60
mov ebp, dword [esp + 0x1c]
mov dword [edi + 4], ebx
mov eax, dword [ebx + 4]
mov dword [eax], ebx
jmp 0x406f60
call fcn.00407140
push esi
call fcn.004ffbbe
add esp, 4
mov eax, dword [esp + 0x30]
add eax, 1
cmp eax, dword [esp + 0x4c]
mov dword [esp + 0x30], eax
jb 0x406cf0
mov byte [esp + 0x29c], 6
mov eax, dword [esp + 0x34]
add eax, 0xfffffff0
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x406f9d
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x29c], 5
mov eax, dword [esp + 0x38]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x406fc5
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea eax, [ebp - 0x10]
mov byte [esp + 0x29c], 4
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x406fe9
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, dword [esp + 0x3c]
add eax, 1
cmp eax, dword [esp + 0x50]
mov dword [esp + 0x3c], eax
jb 0x406b4c
mov byte [esp + 0x29c], 2
mov eax, dword [esp + 0x2c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x407026
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x29c], 1
mov eax, dword [esp + 0x18]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40704e
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x29c], 0
mov eax, dword [esp + 0x20]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x407076
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [esp + 0x29c], 0xffffffff
mov eax, dword [esp + 0x24]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4070a1
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 1
mov ecx, dword [esp + 0x294]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x278]
xor ecx, esp
call fcn.004ff939
add esp, 0x28c
ret 4