Function at 0x40d020
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x70
mov eax, dword [0x45bb34]
push ebx
push ebp
mov ebp, dword [esp + 0x8c]
push esi
xor esi, esi
test ebp, 0x200
mov dword [esp + 0x78], eax
push edi
mov dword [esp + 0x10], esi
mov dword [esp + 0x1c], esi
mov dword [esp + 0x18], esi
mov dword [esp + 0x14], esi
mov eax, 0x57
je 0x40d05a
mov dword [esp + 0x10], eax
test ebp, 0x100
mov ebx, dword [esp + 0x8c]
je 0x40d0a8
mov dword [esp + 0x10], eax
test ebx, ebx
je 0x40d083
mov ebx, dword [ebx + 8]
test ebx, ebx
je 0x40d083
or edx, 0xffffffff
mov dword [ebx], edx
mov dword [ebx + 4], edx
mov dword [ebx + 8], edx
mov eax, dword [esp + 0xa0]
test eax, eax
pop edi
pop esi
pop ebp
pop ebx
je 0x40d098
mov ecx, dword [esp + 8]
mov dword [eax], ecx
mov ecx, dword [esp + 0x6c]
mov eax, dword [esp]
call fcn.004296f9
add esp, 0x70
ret
cmp dword [esp + 0x10], esi
jne 0x40d06d
mov ecx, dword [esp + 0x88]
lea eax, [esp + 0x1c]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
cmp dword [esp + 0x1c], esi
je 0x40d0d3
mov dword [esp + 0x10], 0x503
jmp 0x40d06d
mov edx, dword [esp + 0x90]
mov esi, dword [esp + 0x84]
push edx
push esi
call fcn.0040f170
add esp, 8
test eax, eax
mov dword [ebx + 8], eax
je 0x40d168
test ebp, ebp
js 0x40d10a
mov dword [esp + 0x10], 0xb7
mov dword [ebx + 8], 0
jmp 0x40d06d
mov eax, dword [eax + 8]
mov ecx, dword [esi + 0x154]
lea eax, [eax + eax*4]
lea edx, [ecx + eax*4]
mov dword [ebx + 0xc], edx
xor edx, edx
mov eax, edi
div dword [esi + 0x138]
xor edx, edx
mov dword [esp + 0x18], 1
lea ecx, [eax + 1]
mov eax, edi
mov dword [ebx + 0x2c], ecx
div dword [esi + 0x138]
test edx, edx
je 0x40d146
inc ecx
mov dword [ebx + 0x2c], ecx
mov eax, dword [esi + 0x138]
push eax
call fcn.0042a10c
mov edi, eax
add esp, 4
test edi, edi
mov dword [ebx + 0x34], edi
jne 0x40d175
mov dword [esp + 0x10], 8
jmp 0x40d18b
mov dword [esp + 0x10], 0x27
jmp 0x40d06d
mov ecx, dword [esi + 0x138]
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [ebx + 0x34]
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x10]
test eax, eax
jne 0x40d06d
mov ecx, dword [ebx + 0x18]
cmp ecx, dword [esi + 0x128]
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
jne 0x40d1ba
mov edx, dword [ebx + 0x1c]
cmp edx, dword [esi + 0x12c]
je 0x40d1df
mov ecx, dword [ebx + 0x18]
mov edx, dword [esi + 0x108]
push 0
lea eax, [ebx + 0x1c]
push eax
push ecx
push edx
call edi
mov eax, dword [ebx + 0x18]
mov dword [esi + 0x128], eax
mov ecx, dword [ebx + 0x1c]
mov dword [esi + 0x12c], ecx
lea edx, [esp + 0x8c]
push edx
call fcn.00409c10
lea eax, [esp + 0x28]
push eax
call fcn.00409a00
mov ecx, dword [esp + 0x90]
add esp, 8
push 0
push 0
push 0
push ecx
call edi
mov edx, dword [ebx + 0x2c]
xor ebp, ebp
dec edx
je 0x40d2f8
mov eax, dword [esi + 0x138]
mov edx, dword [ebx + 0x34]
push 0
lea ecx, [esp + 0x98]
push ecx
push eax
mov dword [esp + 0xa0], eax
mov eax, dword [esp + 0x94]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x94]
test eax, eax
je 0x40d2f8
mov ecx, dword [ebx + 0x38]
test ecx, ecx
je 0x40d271
mov ecx, dword [ebx + 0x34]
push eax
push ecx
lea edx, [esp + 0x94]
push edx
call fcn.00409c20
mov eax, dword [esp + 0xa0]
add esp, 0xc
mov ecx, dword [ebx + 0x40]
test ecx, ecx
je 0x40d291
push eax
mov eax, dword [ebx + 0x34]
push eax
lea ecx, [esp + 0x2c]
push ecx
call fcn.00409a30
mov eax, dword [esp + 0xa0]
add esp, 0xc
mov ecx, dword [esi + 0x108]
push 0
lea edx, [esp + 0x18]
push edx
push eax
mov edi, eax
mov eax, dword [esp + 0x2c]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x14]
cmp eax, edi
jne 0x40d2f0
mov ecx, dword [esi + 0x128]
mov edi, dword [esi + 0x198]
add ecx, eax
mov eax, dword [esi + 0x12c]
adc eax, 0
or edi, 1
mov dword [esi + 0x128], ecx
mov dword [esi + 0x12c], eax
mov dword [esi + 0x198], edi
mov edx, dword [ebx + 0x2c]
inc ebp
dec edx
cmp ebp, edx
jb 0x40d215
jmp 0x40d2f8
mov dword [esp + 0x10], 0x70
mov eax, dword [ebx + 0x38]
test eax, eax
je 0x40d310
push eax
lea eax, [esp + 0x90]
push eax
call fcn.00409c60
add esp, 8
mov eax, dword [ebx + 0x40]
test eax, eax
je 0x40d325
push eax
lea ecx, [esp + 0x28]
push ecx
call fcn.00409b00
add esp, 8
mov eax, dword [esp + 0x10]
test eax, eax
jne 0x40d06d
xor eax, eax
mov dword [esi + 0x13c], eax
mov dword [esi + 0x140], eax
mov dword [esi + 0x148], eax
jmp 0x40d083