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

Disassembly:
push edi
push esi
push ebp
push ebx
sub esp, 0x5c
mov esi, edx
cmp eax, 3
jg 0x40161b
mov eax, 1
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
xor ebx, ebx
push ebx
push ebx
push dword [0x422050]
push ebx
push 7
push dword [0x422054]
push dword [esi + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x401642
test ebp, ebp
jne 0x40164f
mov eax, 2
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
push ebx
push ebx
push 3
push ebx
push 7
push dword [0x422020]
push dword [esi + 0xc]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edi, eax
cmp edi, 0xffffffff
je 0x401670
test edi, edi
jne 0x40167d
mov eax, 3
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
mov dword [esp + 0x40], ebx
mov dword [esp + 0x44], ebx
lea eax, [esp + 0x44]
push 1
push eax
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, eax
mov edx, dword [esp + 0x44]
mov dword [esp + 0x40], ecx
mov dword [esp], edx
mov dword [esp + 0x48], ebx
mov dword [esp + 0x4c], ebx
lea esi, [esp + 0x4c]
push 2
push esi
push ebx
push edi
mov dword [esp + 0x14], ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [esp + 4]
mov esi, eax
mov edx, dword [esp + 0x4c]
mov eax, dword [esp]
mov dword [esp + 0x48], esi
mov dword [esp + 0x50], ecx
mov dword [esp + 0x54], eax
lea eax, [esp + 0x54]
push 0
push eax
push ecx
push edi
mov dword [esp + 0x14], edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [esp + 4]
mov dword [esp], eax
mov dword [0x444100], esi
mov ecx, esi
mov dword [0x444104], edx
mov dword [0x444114], ebx
mov eax, 0x10000000
sub ecx, eax
sbb edx, ebx
jb 0x40171b
mov eax, 4
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
mov eax, dword [esp]
mov dword [esp + 0x50], eax
inc esi
push esi
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
pop ecx
mov dword [0x444114], eax
test eax, eax
je 0x40170e
mov dword [esp + 0x58], ebx
lea edx, [esp + 0x58]
push ebx
push edx
push dword [0x444100]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edx, dword [esp + 0x58]
sub edx, dword [0x444100]
mov eax, ebx
sub eax, dword [0x444104]
or edx, eax
je 0x40176e
mov eax, 4
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [0x444100]
mov ecx, dword [0x444114]
mov esi, ebx
mov eax, esi
mov edi, eax
cmp eax, edx
je 0x401799
movzx ebx, byte [eax + ecx]
cmp ebx, 0xa
je 0x401799
cmp ebx, 0xd
jne 0x4017a3
cmp eax, edi
jbe 0x40179e
inc esi
inc eax
mov edi, eax
jmp 0x4017a4
inc eax
cmp eax, edx
jbe 0x401787
mov dword [0x444110], esi
push esi
push edx
xor ebx, ebx
push str.flbufsize_i_flcount_i_n
call dword [sym.imp.MSVCRT.dll_printf]
lea eax, [esi*4]
shl esi, 5
sub esi, eax
push esi
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
add esp, 0x10
mov ecx, eax
mov dword [0x44410c], ecx
test ecx, ecx
je 0x401d0c
mov eax, dword [0x444100]
mov edx, dword [0x444114]
mov dword [esp], edx
mov edx, ebx
mov ebx, dword [esp]
mov dword [esp + 4], ecx
mov edi, edx
mov dword [esp + 0x2c], ebp
mov esi, edi
mov dword [esp + 8], esi
cmp edx, eax
jne 0x401810
mov ecx, 0xa
jmp 0x401814
movzx ecx, byte [edx + ebx]
cmp ecx, 0x20
jae 0x40184b
mov ebp, 1
shl ebp, cl
test ebp, 0x2401
je 0x40184b
mov byte [edx + ebx], 0
cmp edx, edi
jbe 0x401846
mov ecx, dword [esp + 4]
mov ebp, dword [esp + 8]
add edi, ebx
mov dword [ebp + ecx + 0x18], edi
add ebp, 0x1c
mov dword [esp + 8], ebp
inc esi
inc edx
mov edi, edx
jmp 0x40184c
inc edx
cmp edx, eax
jbe 0x401805
mov ebp, dword [esp + 0x2c]
xor ebx, ebx
test esi, esi
jbe 0x401d01
mov dword [0x444108], esi
mov edi, ebx
mov dword [esp], edi
mov dword [esp + 0x2c], ebp
mov esi, edi
mov edx, esi
mov dword [esp + 8], esi
mov ecx, edx
mov dword [esp + 4], ecx
mov eax, ecx
mov dword [esp + 0x30], eax
mov ebp, dword [0x44410c]
xor ecx, ecx
push ecx
push ecx
push 3
push ecx
push 7
push dword [0x422020]
push dword [ebp + esi + 0x18]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x4019a0
test ebx, ebx
je 0x4019a0
lea ecx, [esp + 0x18]
xor eax, eax
mov dword [esp + 0x14], eax
mov dword [esp + 0x18], eax
push 1
push ecx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, eax
mov eax, dword [esp + 0x18]
mov dword [esp + 0x14], ecx
mov dword [esp + 0xc], eax
xor edx, edx
mov dword [esp + 0x1c], edx
mov dword [esp + 0x20], edx
lea eax, [esp + 0x20]
push 2
push eax
push edx
push ebx
mov dword [esp + 0x44], ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [esp + 0x34]
mov edx, eax
mov eax, dword [esp + 0x20]
mov dword [esp + 0x1c], edx
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0xc]
mov dword [esp + 0x24], ecx
mov dword [esp + 0x28], eax
lea eax, [esp + 0x28]
push 0
push eax
push ecx
push ebx
mov dword [esp + 0x48], edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [esp + 0x38]
add dword [esp], edx
mov dword [ebp + esi], edx
mov dword [esp + 0x3c], edi
mov edi, dword [0x44410c]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x10]
adc dword [esp + 8], eax
xor ecx, ecx
inc dword [esp + 4]
mov dword [ebp + esi + 4], eax
mov dword [ebp + esi + 8], ecx
mov dword [ebp + esi + 0xc], ecx
mov ecx, dword [esp + 0x30]
mov dword [edi + ecx], edx
mov dword [edi + ecx + 4], eax
mov edx, dword [ebp + esi + 8]
mov eax, dword [ebp + esi + 0xc]
mov dword [edi + ecx + 8], edx
mov dword [edi + ecx + 0xc], eax
mov edx, dword [ebp + esi + 0x10]
mov eax, dword [ebp + esi + 0x14]
mov dword [edi + ecx + 0x10], edx
mov dword [edi + ecx + 0x14], eax
mov ebp, dword [ebp + esi + 0x18]
mov dword [edi + ecx + 0x18], ebp
add ecx, 0x1c
mov dword [esp + 0x30], ecx
push ebx
mov edi, dword [esp + 0x40]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
add esi, 0x1c
inc edi
cmp edi, dword [0x444108]
jb 0x401881
mov edi, dword [esp]
mov ecx, dword [esp + 4]
mov esi, dword [esp + 8]
mov ebp, dword [esp + 0x2c]
xor ebx, ebx
mov dword [0x444108], ecx
call fcn.00402120
mov dword [esp + 0x30], eax
cmp dword [esp + 0x30], 0
jne 0x4019e4
mov eax, 6
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
push 0x422024
push esi
push edi
push 1
push 0
push dword [esp + 0x44]
call fcn.00418cc0
push 0x10000
push 0x423000
push dword [esp + 0x38]
call fcn.00418ab0
push esi
push edi
push str.l_total_I64i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 0xc
mov eax, dword [0x444108]
test eax, eax
jbe 0x401a83
mov eax, dword [sym.imp.MSVCRT.dll__iob]
mov dword [esp + 0x2c], ebp
mov edx, 9
mov esi, ebx
add eax, 0x20
mov dword [esp + 8], eax
mov edi, esi
mov dword [esp + 4], edx
mov ebp, edi
add ebp, dword [0x44410c]
xor eax, eax
push eax
push eax
push 3
push eax
push 7
push dword [0x422020]
push dword [ebp + 0x18]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x401a70
test ebx, ebx
jne 0x401be4
add edi, 0x1c
inc esi
mov eax, dword [0x444108]
cmp esi, eax
jb 0x401a41
mov ebp, dword [esp + 0x2c]
xor ebx, ebx
push eax
push str.n_seg_i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
push dword [esp + 0x30]
call fcn.00418b20
push dword [esp + 0x30]
call fcn.00402160
mov edx, dword [0x444114]
mov esi, dword [0x444108]
mov ecx, dword [0x44410c]
mov eax, edx
test esi, esi
jbe 0x401b0d
mov dword [esp + 4], edx
mov edi, ebx
mov dword [esp + 0x2c], ebp
mov ebp, edi
mov ebx, dword [ebp + ecx + 0x18]
movzx edx, byte [ebx]
cmp edx, 0x2e
je 0x401c73
movzx edx, byte [ebx]
inc ebx
cmp edx, 0x2f
je 0x401ae6
cmp edx, 0x5c
jne 0x401aec
mov byte [eax], 0x5f
inc eax
jmp 0x401ad8
mov byte [eax], dl
inc eax
test edx, edx
jne 0x401ad8
nop
lea esi, [esi]
add ebp, 0x1c
inc edi
cmp edi, esi
jb 0x401ac8
mov edx, dword [esp + 4]
mov ebp, dword [esp + 0x2c]
xor ebx, ebx
sub eax, edx
cdq
mov dword [0x444100], eax
mov dword [0x444104], edx
test esi, esi
jbe 0x401b70
mov dword [esp + 8], ecx
mov edx, ebx
mov dword [esp + 4], esi
mov dword [esp + 0x2c], ebp
mov eax, edx
mov ecx, dword [esp + 8]
mov edi, dword [eax + ecx]
mov esi, dword [eax + ecx + 4]
mov ebp, dword [eax + ecx + 8]
mov ebx, dword [eax + ecx + 0xc]
add eax, 0x1c
mov dword [esp + 0xc], edx
shl edx, 4
mov dword [ecx + edx], edi
mov dword [ecx + edx + 4], esi
mov dword [ecx + edx + 8], ebp
mov dword [ecx + edx + 0xc], ebx
mov edx, dword [esp + 0xc]
inc edx
cmp edx, dword [esp + 4]
jb 0x401b2f
mov esi, dword [esp + 4]
mov ebp, dword [esp + 0x2c]
xor ebx, ebx
mov dword [esp + 4], ebx
lea eax, [esp + 4]
push ebx
shl esi, 4
push eax
push esi
push ecx
push ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [esp + 8], ebx
lea eax, [esp + 8]
push ebx
push eax
push dword [0x444100]
push dword [0x444114]
push ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [esp + 0xc], ebx
lea eax, [esp + 0xc]
push ebx
push eax
push 4
push 0x444108
push ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [esp + 0x10], ebx
lea eax, [esp + 0x10]
push ebx
push eax
push 4
push 0x444100
push ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret
push dword [ebp + 0x18]
push str.__s_:
call dword [sym.imp.MSVCRT.dll_printf]
push dword [ebp + 4]
push dword [ebp]
push str._I64i
call dword [sym.imp.MSVCRT.dll_printf]
push dword [esp + 0x1c]
call dword [sym.imp.MSVCRT.dll_fflush]
add esp, 0x18
mov dword [esp + 0x10], ebp
mov ebp, dword [esp + 4]
add edi, 0x1c
inc esi
mov dword [esp + 0xc], edi
mov edi, dword [esp + 0x30]
cmp ebp, 1
je 0x401c30
cmp ebp, 9
jne 0x401c95
jmp 0x401c69
lea edx, [esp + 0x34]
xor eax, eax
mov dword [esp + 0x34], eax
push eax
push edx
push 0x10000
push 0x434000
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x34]
test eax, eax
jne 0x401c5d
cmp esi, dword [0x444108]
jb 0x401cd5
push eax
push 0x434000
push edi
call fcn.00418ab0
push edi
call fcn.00402180
mov ebp, eax
jmp 0x401c24
movzx edx, byte [ebx + 1]
cmp edx, 0x2e
jne 0x401ad8
mov edx, 0x5f
mov byte [ebx + 1], dl
mov byte [ebx], dl
mov esi, dword [0x444108]
jmp 0x401ad8
push edi
call fcn.00418aa0
mov edx, dword [esp + 0x10]
add dword [edx + 8], eax
adc dword [edx + 0xc], 0
lea edx, [esp]
xor ecx, ecx
mov dword [esp], ecx
push ecx
push edx
push eax
push 0x423000
push dword [esp + 0x3c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 0x10000
push 0x423000
push edi
call fcn.00418ab0
cmp ebp, 2
je 0x401c69
mov edi, dword [esp + 0xc]
mov dword [esp + 4], ebp
mov ebp, dword [esp + 0x10]
push dword [ebp + 0xc]
push dword [ebp + 8]
push str._____I64i_n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x401a74
mov edi, ebx
mov esi, edi
mov ecx, esi
jmp 0x4019c1
mov eax, 5
add esp, 0x5c
pop ebx
pop ebp
pop esi
pop edi
ret