Function at 0x401f40
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
mov eax, dword [0x419004]
xor eax, ebp
mov dword [ebp - 8], eax
mov eax, dword [ebp + 0x10]
push ebx
mov ebx, edx
mov dword [ebp - 0x20], ecx
mov edx, dword [ebp + 0xc]
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0xc], 0
push esi
push edi
cmp edx, 0x14
jne 0x401fcc
test eax, eax
jne 0x401fcc
mov edi, dword [ecx + 0x14]
mov ebx, dword [ecx + 0x10]
push eax
push 0x64
push edi
push ebx
call fcn.00411ac0
mov ecx, eax
mov dword [ebp - 0x30], 3
mov esi, edx
shld esi, ecx, 3
push 0
shl ecx, 3
sub ecx, eax
mov dword [ebp - 0x14], ecx
mov eax, ecx
sbb esi, edx
mov edx, ecx
mov ecx, esi
mov dword [ebp - 0x1c], esi
shld ecx, eax, 1
push 2
add eax, eax
add edx, eax
adc esi, ecx
sub ebx, edx
sbb edi, esi
push edi
push ebx
call fcn.00411ac0
mov ebx, dword [ebp - 0x18]
mov esi, eax
mov edi, dword [ebp - 0x1c]
mov dword [ebp - 0x34], esi
mov dword [ebp - 0x38], edx
jmp 0x40201b
cmp edx, 0x32
jne 0x40218b
test eax, eax
jne 0x40218b
push eax
push 0x64
push dword [ecx + 0x14]
push dword [ecx + 0x10]
call fcn.00411ac0
mov edi, edx
mov dword [ebp - 0x30], 5
mov edx, eax
mov esi, edi
mov ecx, edx
shld esi, ecx, 2
shl ecx, 2
add edx, ecx
adc edi, esi
shld edi, edx, 1
add edx, edx
mov dword [ebp - 0x1c], edi
mov dword [ebp - 0x14], edx
mov esi, edx
mov dword [ebp - 0x34], edx
mov edx, edi
mov dword [ebp - 0x38], edi
xor ecx, ecx
mov dword [ebp - 0x28], ecx
xorps xmm0, xmm0
movlpd qword [ebp - 0x44], xmm0
test ecx, ecx
je 0x402151
push 1
push 0
push edx
push esi
mov esi, dword [ebp - 0x20]
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x402175
mov ecx, dword [ebp - 0x28]
test edi, edi
jl 0x402162
mov edx, dword [ebp - 0x14]
jg 0x402062
test edx, edx
je 0x402162
mov eax, dword [ebp - 0x44]
mov edi, dword [ebp - 0x40]
mov dword [ebp - 0x24], eax
nop dword [eax + eax]
mov ecx, edx
sub ecx, eax
mov eax, dword [ebp - 0x1c]
sbb eax, edi
mov dword [ebp - 0x40], eax
js 0x40208d
jg 0x402088
cmp ecx, 0x500000
jbe 0x40208d
mov ecx, 0x500000
push 0
lea eax, [ebp - 0xc]
push eax
push ecx
push ebx
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40215c
mov esi, dword [ebp - 0xc]
mov dword [ebp - 0x2c], esi
test esi, esi
je 0x40215c
add dword [ebp - 0x24], esi
mov edx, ebx
push esi
adc edi, 0
mov dword [ebp - 0x40], edi
mov edi, dword [ebp - 0x20]
push ebx
lea ecx, [edi + 0x44]
call section..text
mov ecx, dword [ebp - 0xc]
add esp, 8
xor eax, eax
neg ecx
adc eax, eax
push 1
push 0
neg eax
push eax
push ecx
push dword [edi + 4]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x40215c
mov ecx, dword [edi + 4]
xor ebx, ebx
mov edi, esi
mov dword [ebp - 0x48], ecx
xor esi, esi
mov dword [ebp - 0x10], ebx
test edi, edi
je 0x40212d
push 0
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ebp - 0x18]
push edi
add eax, esi
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402159
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x402159
mov ecx, dword [ebp - 0x48]
add ebx, eax
add esi, eax
sub edi, eax
cmp ebx, dword [ebp - 0x2c]
jne 0x402100
mov edi, dword [ebp - 0x40]
mov ebx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x24]
mov esi, dword [ebp - 0x20]
mov edx, dword [ebp - 0x14]
cmp edi, dword [ebp - 0x1c]
jl 0x402070
jg 0x40215c
cmp eax, edx
jb 0x402070
jmp 0x40215c
mov esi, dword [ebp - 0x20]
jmp 0x40204d
mov ebx, dword [ebp - 0x18]
mov edi, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x28]
mov esi, dword [ebp - 0x34]
inc ecx
mov edx, dword [ebp - 0x38]
mov dword [ebp - 0x28], ecx
cmp ecx, dword [ebp - 0x30]
jl 0x402020
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.004054b8
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 8]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004054b8
mov esp, ebp
pop ebp
ret