Function at 0x40c870
Capabilities:
Get file size
Read file on windows
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4695d0
mov eax, dword fs:[0]
push eax
sub esp, 0x20
push ebx
push esi
push edi
mov eax, dword [0x486a20]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x10], esp
mov esi, dword [ebp + 8]
call fcn.0041e610
xor ecx, ecx
xor edi, edi
cmp eax, edi
setne cl
cmp ecx, edi
jne 0x40c8ba
push 0x80004005
call fcn.00401aa0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x14], eax
mov dword [ebp - 4], edi
call fcn.0041e610
xor ecx, ecx
cmp eax, edi
setne cl
cmp ecx, edi
jne 0x40c8e6
push 0x80004005
call fcn.00401aa0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x24], eax
mov byte [ebp - 4], 1
call fcn.0041e610
xor ecx, ecx
cmp eax, edi
setne cl
cmp ecx, edi
jne 0x40c913
push 0x80004005
call fcn.00401aa0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x1c], eax
mov byte [ebp - 4], 2
call fcn.0041e610
xor ecx, ecx
cmp eax, edi
setne cl
cmp ecx, edi
jne 0x40c940
push 0x80004005
call fcn.00401aa0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [ebp - 0x18], eax
push 0x61a80
mov byte [ebp - 4], 3
call fcn.0041a3db
push 0x30d40
mov dword [esi + 0x464], eax
call fcn.0041a3db
push 0x61a80
mov dword [esi + 0x468], eax
call fcn.0041a3db
push 0x61a80
mov dword [esi + 0x46c], eax
call fcn.0041a3db
mov ebx, dword [ebp + 0xc]
add esp, 0x10
cmp ebx, edi
mov dword [esi + 0x470], eax
mov dword [esi + 0x460], edi
jne 0x40c9a7
xor eax, eax
jmp 0x40c9bf
mov eax, ebx
lea edx, [eax + 2]
lea esp, [esp]
mov cx, word [eax]
add eax, 2
cmp cx, di
jne 0x40c9b0
sub eax, edx
sar eax, 1
push eax
push ebx
lea ecx, [ebp - 0x14]
call fcn.00401cf0
push 0x475724
lea ecx, [ebp - 0x14]
push ecx
lea edx, [ebp - 0x28]
push edx
call fcn.0040e270
add esp, 0xc
push eax
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 4
call fcn.0040fee0
mov byte [ebp - 4], 3
mov eax, dword [ebp - 0x28]
add eax, 0xfffffff0
or edi, 0xffffffff
lea ecx, [eax + 0xc]
mov edx, edi
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ca10
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push str.Index
lea ecx, [ebp - 0x14]
push ecx
lea edx, [ebp - 0x28]
push edx
call fcn.0040e270
add esp, 0xc
push eax
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 5
call fcn.0040fee0
mov byte [ebp - 4], 3
mov eax, dword [ebp - 0x28]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
mov edx, edi
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ca54
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
push ebx
mov ecx, esi
call fcn.0040d3c0
mov eax, dword [ebp + 0x10]
cmp eax, 2
jne 0x40ca9c
push str._content
lea ecx, [ebp + 0x10]
call fcn.0040fda0
lea ecx, [ebp + 0x10]
push ecx
lea edx, [ebp - 0x14]
push edx
lea eax, [ebp - 0x28]
push eax
mov byte [ebp - 4], 6
call fcn.0040e1b0
add esp, 0xc
push eax
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 7
call fcn.0040fee0
mov byte [ebp - 4], 6
jmp 0x40cad7
cmp eax, 1
jne 0x40cb17
push str._desc
lea ecx, [ebp + 0x10]
call fcn.0040fda0
lea ecx, [ebp + 0x10]
push ecx
lea edx, [ebp - 0x14]
push edx
lea eax, [ebp - 0x28]
mov bl, 8
push eax
mov byte [ebp - 4], bl
call fcn.0040e1b0
add esp, 0xc
push eax
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 9
call fcn.0040fee0
mov byte [ebp - 4], bl
mov eax, dword [ebp - 0x28]
add eax, 0xfffffff0
mov edx, edi
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40caf5
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 3
mov eax, dword [ebp + 0x10]
add eax, 0xfffffff0
mov edx, edi
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40cb17
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [ebp - 0x14]
push ecx
lea ecx, [ebp - 0x1c]
call fcn.0040fee0
push str._idx.h
lea edx, [ebp - 0x1c]
push edx
lea eax, [ebp + 0x10]
push eax
call fcn.0040e270
add esp, 0xc
push eax
lea ecx, [ebp - 0x1c]
mov byte [ebp - 4], 0xa
call fcn.0040fee0
mov byte [ebp - 4], 3
mov eax, dword [ebp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
mov edx, edi
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40cb67
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [ebp - 0x14]
push ecx
lea ecx, [ebp - 0x18]
call fcn.0040fee0
push str._idx.m
lea edx, [ebp - 0x18]
push edx
lea eax, [ebp + 0x10]
push eax
call fcn.0040e270
add esp, 0xc
push eax
lea ecx, [ebp - 0x18]
mov byte [ebp - 4], 0xb
call fcn.0040fee0
mov byte [ebp - 4], 3
mov eax, dword [ebp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
mov edx, edi
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40cbb7
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor ebx, ebx
push edi
mov byte [ebp - 4], 0xc
push ebx
lea ecx, [esi + 0x480]
mov dword [esi + 0x454], edi
mov dword [esi + 0x458], edi
mov dword [esi + 0x45c], ebx
mov dword [esi + 0x474], ebx
mov dword [esi + 0x4a8], ebx
call fcn.0042f532
mov ecx, dword [ebp - 0x1c]
push ebx
push 0x80
push 3
push ebx
push ebx
push SysReAllocString
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, edi
mov dword [esi + 0x454], eax
jne 0x40cc14
push ebx
push edi
push 6
call fcn.0042fb10
lea edx, [ebp - 0x20]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebx, eax
test ebx, ebx
push 0
ja 0x40cc2f
push edi
push 6
call fcn.0042fb10
mov ecx, dword [esi + 0x46c]
mov edx, dword [esi + 0x454]
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea eax, [ebp - 0x20]
push eax
push 0x61a80
push ecx
push edx
call edi
mov ecx, dword [esi + 0x468]
mov edx, dword [esi + 0x454]
push 0
lea eax, [ebp - 0x20]
push eax
push 0x30d40
push ecx
push edx
call edi
mov ecx, dword [esi + 0x464]
mov edx, dword [esi + 0x454]
push 0
lea eax, [ebp - 0x20]
push eax
push 0x61a80
push ecx
push edx
call edi
mov ecx, dword [esi + 0x470]
mov edx, dword [esi + 0x454]
push 0
lea eax, [ebp - 0x20]
push eax
push 0x61a80
push ecx
push edx
call edi
lea eax, [ebx - 0x155cc0]
shr eax, 2
cmp eax, dword [esi + 0x47c]
mov dword [esi + 0x478], eax
jbe 0x40ccbc
mov dword [esi + 0x47c], eax
xor ecx, ecx
mov dword [esi + 0x47c], eax
mov edx, 4
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0041a3db
mov edx, dword [esi + 0x478]
add esp, 4
push 0
lea ecx, [ebp - 0x20]
push ecx
add edx, edx
add edx, edx
push edx
push eax
mov dword [esi + 0x460], eax
mov eax, dword [esi + 0x454]
push eax
call edi
mov ecx, dword [esi + 0x454]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [ebp - 0x18]
push 0
push 0x80
push 3
push 0
push 0
push SysReAllocString
push edx
mov dword [esi + 0x454], 0
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esi + 0x458], eax
push 0
jne 0x40cd44
push eax
push 6
call fcn.0042fb10
push 0
push 0
push 2
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
test eax, eax
mov dword [esi + 0x45c], eax
push 0
jne 0x40cd68
push 0xffffffffffffffff
push 6
call fcn.0042fb10
push 0
push 0
push 4
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
test eax, eax
mov dword [esi + 0x474], eax
jne 0x40cd89
push eax
push 0xffffffffffffffff
push 6
call fcn.0042fb10
mov eax, dword [ebp + 0xc]
push eax
lea ecx, [esi + 8]
call fcn.004034e0
test al, al
jne 0x40cda4
push 0
push 0xffffffffffffffff
push 6
call fcn.0042fb10
lea ecx, [ebp - 0x18]
call fcn.00401a70
lea ecx, [ebp - 0x1c]
call fcn.00401a70
lea ecx, [ebp - 0x24]
call fcn.00401a70
lea ecx, [ebp - 0x14]
call fcn.00401a70
mov eax, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0xc