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

Disassembly:
push edi
push esi
push ebp
push ebx
sub esp, 0x6c
cmp eax, 2
jg 0x401079
mov eax, 1
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
xor eax, eax
push eax
push eax
push 3
push eax
push 7
push dword [0x422020]
push dword [edx + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edi, eax
cmp edi, 0xffffffff
je 0x40109c
test edi, edi
jne 0x4010a9
mov eax, 2
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
mov dword [esp + 0x28], 0xffffffff
lea eax, [esp + 0x28]
mov edx, 0xfffffff8
mov dword [esp + 0x24], edx
push 2
push eax
push edx
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [esp + 0x24], eax
lea edx, [esp + 0x58]
xor eax, eax
mov dword [0x444108], eax
mov dword [esp + 0x58], eax
push eax
push edx
push 4
push 0x444108
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
lea edx, [esp + 0x5c]
xor eax, eax
mov dword [0x444100], eax
mov dword [0x444104], eax
mov dword [esp + 0x5c], eax
push eax
push edx
push 4
push 0x444100
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ebp, dword [0x444108]
push ebp
push str.n_seg_i_n
call dword [sym.imp.MSVCRT.dll_printf]
mov esi, dword [0x444100]
mov ebx, dword [0x444104]
push esi
push str.flbufsize_i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 0x10
lea ecx, [esp + 0x30]
xor edx, edx
xor eax, eax
sub eax, esi
sbb edx, ebx
shl ebp, 4
sub eax, ebp
sbb edx, 0
add eax, 0xfffffff8
adc edx, 0xffffffff
mov dword [esp + 0x2c], eax
mov dword [esp + 0x30], edx
push 2
push ecx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [0x444108]
mov dword [esp + 0x2c], eax
lea eax, [edx*4]
shl edx, 5
sub edx, eax
push edx
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
pop ecx
mov dword [0x44410c], eax
test eax, eax
je 0x4015e8
mov ebx, dword [0x444108]
lea ecx, [esp + 0x54]
shl ebx, 4
xor edx, edx
mov dword [esp + 0x54], edx
push edx
push ecx
push ebx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov esi, dword [0x44410c]
mov edx, dword [0x444108]
lea ebp, [edx - 1]
lea eax, [edx*4 - 4]
lea ebx, [eax*8]
sub ebx, eax
cmp ebp, 0xffffffff
je 0x401210
mov dword [esp], edx
mov dword [esp + 0x50], edi
mov edi, ebp
shl edi, 4
mov ecx, dword [esi + edi]
mov eax, dword [esi + edi + 4]
mov edx, dword [esi + edi + 8]
mov edi, dword [esi + edi + 0xc]
mov dword [ebx + esi], ecx
mov dword [ebx + esi + 4], eax
dec ebp
mov dword [ebx + esi + 8], edx
mov dword [ebx + esi + 0xc], edi
add ebx, 0xffffffe4
cmp ebp, 0xffffffff
jne 0x4011dd
mov edx, dword [esp]
mov edi, dword [esp + 0x50]
mov ebp, dword [0x444100]
mov ebx, dword [0x444104]
mov dword [0x444110], edx
mov edx, ebp
xor ecx, ecx
mov dword [0x444114], ecx
mov eax, 0x10000000
sub edx, eax
sbb ebx, ecx
jb 0x401244
mov eax, 4
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
inc ebp
push ebp
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
pop ecx
mov dword [0x444114], eax
test eax, eax
je 0x401237
lea ecx, [esp + 0x48]
xor edx, edx
mov dword [esp + 0x48], edx
push edx
push ecx
push dword [0x444100]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edx, dword [esp + 0x48]
mov ebp, dword [0x444100]
sub edx, ebp
xor eax, eax
sub eax, dword [0x444104]
or edx, eax
je 0x401294
mov eax, 4
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
mov ecx, dword [0x44410c]
mov eax, dword [0x444114]
mov dword [esp], eax
mov dword [esp + 4], ecx
mov dword [esp + 0x50], edi
xor eax, eax
xor ebx, ebx
xor edx, edx
xor esi, esi
mov dword [esp + 8], esi
mov esi, dword [esp]
cmp eax, ebp
jne 0x4012c4
mov ecx, 0xa
jmp 0x4012c8
movzx ecx, byte [eax + esi]
cmp ecx, 0x20
jae 0x4012ff
mov edi, 1
shl edi, cl
test edi, 0x2401
je 0x4012ff
mov byte [eax + esi], 0
cmp eax, ebx
jbe 0x4012fa
mov ecx, dword [esp + 4]
mov edi, dword [esp + 8]
add ebx, esi
mov dword [edi + ecx + 0x18], ebx
add edi, 0x1c
mov dword [esp + 8], edi
inc edx
inc eax
mov ebx, eax
jmp 0x401300
inc eax
cmp eax, ebp
jbe 0x4012b9
mov edi, dword [esp + 0x50]
mov dword [0x444108], edx
lea eax, [esp + 4]
xor edx, edx
mov dword [esp], edx
mov dword [esp + 4], edx
push edx
push eax
push edx
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ebp, dword [0x444108]
mov dword [esp], eax
push ebp
push str.n_seg_i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
xor ebx, ebx
mov dword [esp + 8], ebx
test ebp, ebp
jbe 0x401365
mov eax, dword [0x44410c]
mov esi, ebx
xor ecx, ecx
xor edx, edx
add ebx, dword [edx + eax]
adc esi, dword [edx + eax + 4]
add edx, 0x1c
inc ecx
cmp ecx, ebp
jb 0x401352
mov dword [esp + 8], esi
call fcn.00402120
mov esi, eax
test esi, esi
jne 0x40137d
mov eax, 6
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
push 0x422024
push dword [esp + 0xc]
push ebx
mov eax, 1
push eax
push eax
push esi
call fcn.00418cc0
push 0x10000
push 0x423000
push esi
call fcn.00418ab0
cmp dword [0x444108], 0
jbe 0x4014d7
mov dword [esp + 8], esi
mov dword [esp + 0x50], edi
xor ebp, ebp
mov dword [esp + 0x18], ebp
mov dword [esp + 0x4c], ebp
xor ebx, ebx
mov edi, dword [0x44410c]
xor eax, eax
push eax
push eax
push dword [0x422050]
push eax
push 7
push dword [0x422054]
push dword [edi + ebx + 0x18]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
push dword [edi + ebx + 0x18]
push str.__s_:
cmp esi, 0xffffffff
jne 0x4013fd
mov esi, 0
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
test esi, esi
jne 0x40141b
push str.Error_n
call dword [sym.imp.MSVCRT.dll_printf]
pop ecx
jmp 0x4014b7
mov eax, dword [edi + ebx]
mov edx, dword [edi + ebx + 4]
mov dword [esp + 0x3c], edx
push edx
push eax
push dword [edi + ebx + 0xc]
push dword [edi + ebx + 8]
push str._I64i_____I64i_n
mov dword [esp + 0x34], eax
call dword [sym.imp.MSVCRT.dll_printf]
mov eax, dword [esp + 0x34]
add esp, 0x14
test ebp, ebp
je 0x4014a8
mov edx, dword [esp + 0x18]
mov dword [esp + 0x1c], edx
xor ecx, ecx
sub edx, eax
sbb ecx, dword [esp + 0x3c]
jb 0x401464
or edx, ecx
je 0x401464
mov dword [esp + 0x1c], eax
lea ecx, [esp + 0x14]
xor edx, edx
mov dword [esp + 0x14], edx
push edx
push ecx
push dword [esp + 0x24]
push ebp
push esi
mov dword [esp + 0x34], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x3c]
mov edi, dword [esp + 0x18]
sub eax, ecx
sbb edx, 0
mov dword [esp + 0x3c], edx
add ebp, ecx
sub edi, ecx
mov dword [esp + 0x18], edi
jne 0x4014a8
mov ebp, 0
mov edx, eax
or edx, dword [esp + 0x3c]
jne 0x4014f4
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x4c]
add ebx, 0x1c
inc eax
cmp eax, dword [0x444108]
mov dword [esp + 0x4c], eax
jb 0x4013c5
mov esi, dword [esp + 8]
mov edi, dword [esp + 0x50]
push esi
call fcn.00418b20
push esi
call fcn.00402160
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret
mov edi, dword [esp + 8]
lea edx, [esp + 0x38]
mov dword [esp + 0x40], esi
mov esi, eax
mov dword [esp + 0x10], ebx
mov dword [esp + 0xc], ebp
push edi
call fcn.00402180
mov ebx, eax
cmp ebx, 1
jne 0x401548
lea ecx, [esp + 0x34]
xor edx, edx
mov dword [esp + 0x34], edx
push edx
push ecx
push 0x10000
push 0x434000
push dword [esp + 0x60]
call dword [sym.imp.KERNEL32.dll_ReadFile]
push dword [esp + 0x34]
push 0x434000
push edi
call fcn.00418ab0
jmp 0x40150a
push edi
call fcn.00418aa0
mov dword [esp + 0x44], eax
mov ebp, eax
mov eax, ebp
xor edx, edx
sub eax, esi
sbb edx, dword [esp + 0x3c]
jb 0x40156a
or eax, edx
je 0x40156a
sub dword [esp + 0x44], esi
mov ebp, esi
xor edx, edx
mov dword [esp + 0x38], edx
push edx
lea ecx, [esp + 0x3c]
push ecx
push ebp
push 0x423000
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edx, dword [esp + 0x3c]
sub esi, ebp
sbb edx, 0
mov dword [esp + 0x3c], edx
push 0x10000
push 0x423000
push edi
call fcn.00418ab0
mov edx, esi
or edx, dword [esp + 0x3c]
je 0x4015c9
cmp ebx, 2
je 0x40150a
mov esi, dword [esp + 0x40]
mov ebx, dword [esp + 0x10]
mov ebp, dword [esp + 0xc]
mov dword [esp + 8], edi
jmp 0x4014b0
mov eax, dword [esp + 0x44]
mov esi, dword [esp + 0x40]
mov ebx, dword [esp + 0x10]
mov dword [esp + 8], edi
lea ebp, [ebp + 0x423000]
mov dword [esp + 0x18], eax
jmp 0x4014b0
mov eax, 5
add esp, 0x6c
pop ebx
pop ebp
pop esi
pop edi
ret