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

Disassembly:
push edi
push esi
push ebp
push ebx
sub esp, 0x44
cmp eax, 2
jg 0x401081
mov eax, 1
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret
xor eax, eax
push eax
push eax
push 3
push eax
push 7
push dword [0x406010]
push dword [edx + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x4010a4
test ebx, ebx
jne 0x4010b1
mov eax, 2
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret
mov dword [esp + 0x18], 0xffffffff
lea eax, [esp + 0x18]
mov edx, 0xfffffff8
mov dword [esp + 0x14], edx
push 2
push eax
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [esp + 0x14], eax
lea edx, [esp + 0x34]
xor eax, eax
mov dword [0x431114], eax
mov dword [esp + 0x34], eax
push eax
push edx
push 4
push 0x431114
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
lea edx, [esp + 0x38]
xor eax, eax
mov dword [0x431100], eax
mov dword [0x431104], eax
mov dword [esp + 0x38], eax
push eax
push edx
push 4
push 0x431100
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edi, dword [0x431114]
push edi
push str.n_seg_i_n
call dword [sym.imp.MSVCRT.dll_printf]
mov ebp, dword [0x431100]
mov esi, dword [0x431104]
push ebp
push str.flbufsize_i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 0x10
lea ecx, [esp + 0x20]
xor edx, edx
xor eax, eax
sub eax, ebp
sbb edx, esi
shl edi, 4
sub eax, edi
sbb edx, 0
add eax, 0xfffffff8
adc edx, 0xffffffff
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], edx
push 2
push ecx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [0x43110c]
mov dword [esp + 0x1c], 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 [0x431110], eax
test eax, eax
je 0x40156f
mov ebp, dword [0x431114]
lea ecx, [esp + 0x30]
shl ebp, 4
xor edx, edx
mov dword [esp + 0x30], edx
push edx
push ecx
push ebp
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ebp, dword [0x431110]
mov ecx, dword [0x431114]
lea esi, [ecx - 1]
lea eax, [ecx*4 - 4]
lea edx, [eax*8]
sub edx, eax
cmp esi, 0xffffffff
je 0x401213
mov dword [esp + 0x40], ebx
mov eax, esi
shl eax, 4
mov ebx, dword [ebp + eax]
mov edi, dword [ebp + eax + 4]
dec esi
mov dword [edx + ebp], ebx
mov dword [edx + ebp + 4], edi
mov ebx, dword [ebp + eax + 8]
mov eax, dword [ebp + eax + 0xc]
mov dword [edx + ebp + 8], ebx
mov dword [edx + ebp + 0xc], eax
add edx, 0xffffffe4
cmp esi, 0xffffffff
jne 0x4011e2
mov ebx, dword [esp + 0x40]
mov esi, dword [0x431100]
mov ebp, dword [0x431104]
mov dword [0x43110c], ecx
mov edx, esi
xor ecx, ecx
mov dword [0x431108], ecx
mov eax, 0x10000000
sub edx, eax
sbb ebp, ecx
jb 0x401247
mov eax, 4
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret
inc esi
push esi
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
pop ecx
mov dword [0x431108], eax
test eax, eax
je 0x40123a
lea ecx, [esp + 0x24]
xor edx, edx
mov dword [esp + 0x24], edx
push edx
push ecx
push dword [0x431100]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [esp + 0x24]
mov edx, dword [0x431100]
sub ecx, edx
xor eax, eax
sub eax, dword [0x431104]
or ecx, eax
je 0x401297
mov eax, 4
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret
mov dword [esp + 0x40], ebx
xor ebp, ebp
xor edi, edi
xor esi, esi
xor eax, eax
cmp ebp, edx
jne 0x4012ae
mov ecx, 0xa
jmp 0x4012b8
mov ecx, dword [0x431108]
movzx ecx, byte [ecx + ebp]
cmp ecx, 0x20
jae 0x4012f3
mov ebx, 1
shl ebx, cl
test ebx, 0x2401
je 0x4012f3
mov ecx, dword [0x431108]
mov byte [ecx + ebp], 0
cmp ebp, edi
jbe 0x4012ee
add edi, dword [0x431108]
mov ecx, dword [0x431110]
inc esi
mov dword [ecx + eax + 0x18], edi
add eax, 0x1c
inc ebp
mov edi, ebp
jmp 0x4012f4
inc ebp
cmp ebp, edx
jbe 0x4012a3
mov ebx, dword [esp + 0x40]
mov dword [0x431114], esi
lea eax, [esp + 4]
xor edx, edx
mov dword [esp], edx
mov dword [esp + 4], edx
push edx
push eax
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [esp], eax
push dword [0x431114]
push str.n_seg_i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
xor eax, eax
cmp dword [0x431114], 0
mov dword [0x41000c], eax
mov dword [0x410010], 0x421000
mov dword [0x410008], eax
mov dword [0x410014], 0x421000
mov dword [0x410004], eax
mov dword [0x410000], eax
mov eax, 0x431000
mov dword [0x410018], eax
jbe 0x4013d6
mov dword [esp + 0x40], ebx
xor esi, esi
xor ebp, ebp
mov edi, dword [0x431110]
xor eax, eax
push eax
push eax
push dword [0x406018]
push eax
push 7
push dword [0x406014]
push dword [edi + ebp + 0x18]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
push dword [edi + ebp + 0x18]
push str.__s_:
cmp ebx, 0xffffffff
jne 0x4013ad
mov ebx, 0
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
test ebx, ebx
jne 0x4013e7
push str.Error_n
call dword [sym.imp.MSVCRT.dll_printf]
pop ecx
add ebp, 0x1c
inc esi
cmp esi, dword [0x431114]
jb 0x401375
mov ebx, dword [esp + 0x40]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret
mov eax, dword [edi + ebp]
mov edi, dword [edi + ebp + 4]
push edi
push eax
push str._I64i_n
mov dword [esp + 0x1c], eax
call dword [sym.imp.MSVCRT.dll_printf]
mov eax, dword [esp + 0x1c]
add esp, 0xc
mov dword [0x41001c], 0
mov dword [0x410048], eax
mov edx, 0x421000
mov dword [0x41004c], edi
mov dword [esp + 0x2c], ebx
mov dword [esp + 0xc], ebp
mov dword [esp + 8], esi
mov eax, 0x410020
xchg esp, eax
add esp, 4
call 0x40143a
add dword [esp], 0xb
mov dword [esp + 4], eax
xchg esp, eax
xor eax, eax
test eax, eax
jne 0x401461
mov eax, dword [0x410000]
test eax, eax
jne 0x40155b
mov ecx, 0x410000
push ecx
call fcn.00401580
mov ebx, dword [0x410000]
cmp ebx, 3
jb 0x401473
xor ebx, ebx
jmp 0x4014f4
cmp ebx, 1
jne 0x4014e7
mov ebp, dword [0x410048]
mov ebx, 0x10000
mov ecx, dword [0x41004c]
mov eax, ebp
xor edx, edx
sub eax, ebx
sbb ecx, edx
jb 0x401495
mov ebp, ebx
lea edx, [esp + 0x3c]
xor eax, eax
mov dword [esp + 0x3c], eax
push eax
push edx
push ebp
push 0x411000
push dword [esp + 0x50]
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x3c]
test eax, eax
jne 0x4014c3
mov dword [0x41001c], 1
mov dword [0x410004], 0x411000
lea eax, [eax + 0x411000]
mov dword [0x41000c], eax
mov dword [0x410008], 0x411000
jmp 0x40142c
test ebx, ebx
je 0x4014f4
cmp ebx, 2
jne 0x40142c
mov ebp, dword [0x410010]
mov eax, 0x421000
sub ebp, eax
xor edx, edx
mov dword [esp + 0x28], edx
push edx
lea ecx, [esp + 0x2c]
push ecx
push ebp
push 0x421000
push dword [esp + 0x3c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [0x410010], 0x421000
test ebx, ebx
mov dword [0x410014], 0x421000
mov dword [0x410018], 0x431000
jne 0x40142c
mov ebx, dword [esp + 0x2c]
mov ebp, dword [esp + 0xc]
mov esi, dword [esp + 8]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x4013c6
mov ebx, 0x410040
mov esp, dword [ebx + 4]
mov eax, 1
jmp dword [ebx]
mov eax, 5
add esp, 0x44
pop ebx
pop ebp
pop esi
pop edi
ret