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

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x10
mov ebp, edx
mov edi, dword [esp + 0x28]
mov edx, dword [esp + 0x24]
mov eax, dword [esp + 0x2c]
mov dword [esp + 4], 0
cmp eax, 1
jne 0x422137
mov esi, dword [ecx + 0xc]
jmp 0x422147
test eax, eax
js 0x422143
mov esi, dword [ecx + 0xc]
imul esi, eax
jmp 0x422147
mov esi, eax
neg esi
mov eax, esi
sar eax, 0x1f
add dword [ebp + 0x408], esi
adc dword [ebp + 0x40c], eax
mov dword [esp], ecx
mov ecx, dword [ecx + 0xc]
mov eax, ecx
mul edx
mov ebx, eax
imul edi, ecx
add edx, edi
mov edi, dword [esp + 0x30]
add ebx, dword [ebp + 0x328]
adc edx, dword [ebp + 0x32c]
mov dword [esp + 0xc], edx
movzx eax, byte [ebp + 0x318]
mov byte [esp + 8], al
push 0
push 0
push ebx
push dword [ebp + 0x108]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
test byte [esp + 8], 8
jne 0x4221fa
cmp eax, 0xffffffff
je 0x4222f4
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [esp]
mov eax, dword [eax + 0x60]
test eax, eax
je 0x4221c4
dec eax
mov ecx, edi
or ecx, esi
test eax, ecx
jne 0x422203
lea eax, [esp + 4]
push 0
push eax
push esi
push edi
push dword [ebp + 0x108]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4222f4
mov eax, 0x7f2bb725
xor ecx, ecx
cmp dword [esp + 4], esi
mov edx, dword [esp]
jne 0x4222fd
jmp 0x42231b
cmp eax, 0xffffffff
je 0x4222f4
xor ecx, ecx
test esi, esi
jle 0x42231b
mov eax, dword [esp]
mov eax, dword [eax + 0xc]
mov dword [esp + 8], ebp
nop word [eax + eax]
cmp esi, eax
jge 0x422277
push 0
lea ecx, [esp + 8]
push ecx
push eax
push dword [ebp + 0x3f0]
push dword [ebp + 0x108]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4222f4
mov eax, dword [esp + 4]
mov edx, dword [esp]
mov ecx, dword [edx + 0xc]
sub ecx, eax
je 0x422277
add eax, dword [ebp + 0x3f0]
push ecx
push 0
push eax
mov ebp, esi
mov esi, edi
mov edi, edx
call sub.api_ms_win_crt_string_l1_1_0.dll_memset
add esp, 0xc
mov eax, dword [edi + 0xc]
mov edi, esi
mov esi, ebp
mov ebp, dword [esp + 8]
cmp esi, eax
cmovl eax, esi
mov dword [esp + 4], eax
push eax
push edi
push dword [ebp + 0x3f0]
call sub.api_ms_win_crt_private_l1_1_0.dll_memcpy
add esp, 0xc
push 0
push 0
push ebx
push dword [ebp + 0x108]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
je 0x4222f4
mov eax, ebp
mov ebp, edi
push 0
lea ecx, [esp + 8]
push ecx
mov edi, dword [esp + 8]
push dword [edi + 0xc]
push dword [eax + 0x3f0]
push dword [eax + 0x108]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x422325
mov eax, dword [esp + 4]
cmp eax, dword [edi + 0xc]
jne 0x422331
sub esi, eax
mov edi, ebp
add edi, eax
add ebx, eax
adc dword [esp + 0xc], 0
test esi, esi
mov ebp, dword [esp + 8]
jg 0x422220
xor ecx, ecx
jmp 0x42231b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [esp]
mov ecx, dword [edx + 0x14]
test ecx, ecx
je 0x422319
push eax
push dword [esp + 8]
push esi
push edi
push dword [esp + 0x3c]
push dword [esp + 0x38]
push edx
call ecx
add esp, 0x1c
mov ecx, eax
mov eax, ecx
add esp, 0x10
pop esi
pop edi
pop ebx
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, edi
mov edi, ebp
jmp 0x4222fd
mov edx, edi
mov eax, 0x7f2bb725
mov edi, ebp
jmp 0x4222fd