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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x17c
push edi
push esi
push ebx
mov ebx, dword [ebp + 8]
mov edx, 0x40137f
mov esi, ebx
mov edi, edx
mov ecx, 2
cld
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x4013ec
sbb eax, eax
or al, 1
mov dword [ebp - 0x158], edx
test eax, eax
jne 0x401403
mov eax, dword [sym.imp.crtdll.dll__iob]
mov dword [ebp - 0x144], eax
jmp 0x40141a
add esp, 0xfffffff8
push 0x401381
push ebx
call sub.crtdll.dll_fopen
mov dword [ebp - 0x144], eax
add esp, 0x10
cmp dword [ebp - 0x144], 0
jne 0x401434
add esp, 0xfffffff8
mov edx, dword [ebp + 0xc]
push edx
push 0x401384
jmp 0x40157f
mov esi, dword [ebp - 0x144]
push esi
push 0x10
push 1
lea ebx, [ebp - 0x30]
push ebx
call sub.crtdll.dll_fread
movzx eax, byte [ebp - 0x29]
mov dword [ebp - 0x14c], eax
add esp, 0xfffffff4
lea eax, [ebp - 0x28]
push eax
call fcn.004011f0
mov dword [ebp - 0x150], eax
add esp, 0x20
add esp, 0xfffffff4
lea eax, [ebp - 0x24]
push eax
call fcn.004011f0
mov dword [ebp - 0x164], eax
add esp, 0xfffffff4
lea eax, [ebp - 0x2e]
push eax
call fcn.00401218
add eax, 0xfffffffe
add esp, 0x20
add esp, 0xfffffffc
push 0
push eax
push esi
call sub.crtdll.dll_fseek
push esi
push 6
push 1
lea edi, [ebp - 0x2f]
push edi
call sub.crtdll.dll_fread
add esp, 0x20
cmp byte [ebp - 0x30], 0x80
jne 0x4014c3
mov eax, edi
mov edi, 0x40139a
mov ecx, 6
mov esi, eax
cld
test al, 0
repe cmpsb byte [esi], byte es:[edi]
je 0x4014e0
add esp, 0xfffffff4
push 0x4013a1
call sub.crtdll.dll_puts
mov eax, 0xffffffff
jmp 0x401746
mov eax, dword [ebp - 0x14c]
mov word [0x40201e], ax
mov edx, dword [ebp - 0x150]
mov dword [0x402020], edx
mov esi, eax
add esi, esi
mov word [0x402028], si
movsx eax, si
imul eax, edx
mov dword [0x402024], eax
movsx eax, si
imul eax, dword [ebp - 0x164]
mov dword [0x402030], eax
add eax, 0x24
mov dword [0x40200c], eax
mov eax, dword [ebp + 0xc]
mov edi, dword [ebp - 0x158]
mov ecx, 2
mov esi, eax
cld
test al, 0
repe cmpsb byte [esi], byte es:[edi]
jne 0x401550
mov eax, dword [sym.imp.crtdll.dll__iob]
add eax, 0x20
mov dword [ebp - 0x148], eax
jmp 0x40156a
add esp, 0xfffffff8
push 0x4013aa
mov edx, dword [ebp + 0xc]
push edx
call sub.crtdll.dll_fopen
mov dword [ebp - 0x148], eax
add esp, 0x10
cmp dword [ebp - 0x148], 0
jne 0x401590
add esp, 0xfffffff8
mov esi, dword [ebp + 0xc]
push esi
push 0x4013ad
call sub.crtdll.dll_printf
mov eax, 0xffffffff
jmp 0x401746
mov eax, dword [ebp - 0x148]
push eax
push 0x2c
push 1
push str.RIFF
call sub.crtdll.dll_fwrite
mov dword [ebp - 0xc0], 0
mov dword [ebp - 0xbc], 0
mov dword [ebp - 0xb8], 0
mov dword [ebp - 0xb4], 0
add esp, 0x10
cmp dword [ebp - 0x14c], 1
jne 0x401650
cmp dword [ebp - 0x164], 0
je 0x401726
lea edi, [ebp - 0xb0]
lea esi, [esi]
mov edx, dword [ebp - 0x144]
push edx
push 0x12
push 1
push ebx
call sub.crtdll.dll_fread
add esp, 0xfffffffc
lea eax, [ebp - 0xc0]
push eax
push ebx
push edi
call fcn.00401230
add esp, 0x20
mov eax, dword [ebp - 0x164]
cmp eax, 0x20
jle 0x401625
mov eax, 0x20
sub dword [ebp - 0x164], eax
mov esi, dword [ebp - 0x148]
push esi
add eax, eax
push eax
push 1
push edi
call sub.crtdll.dll_fwrite
add esp, 0x10
cmp dword [ebp - 0x164], 0
jne 0x4015f0
jmp 0x401726
cmp dword [ebp - 0x14c], 2
jne 0x401726
cmp dword [ebp - 0x164], 0
je 0x401726
mov dword [ebp - 0x154], ebx
lea ebx, [ebp - 0x140]
lea edi, [ebp - 0xb0]
lea esi, [esi]
mov eax, dword [ebp - 0x144]
push eax
push 0x24
push 1
mov edx, dword [ebp - 0x154]
push edx
call sub.crtdll.dll_fread
add esp, 0xfffffffc
lea eax, [ebp - 0xc0]
push eax
mov esi, dword [ebp - 0x154]
push esi
push ebx
call fcn.00401230
add esp, 0x20
add esp, 0xfffffffc
lea eax, [ebp - 0xb8]
push eax
lea eax, [ebp - 0x1e]
push eax
lea eax, [ebp - 0x100]
push eax
call fcn.00401230
add esp, 0x10
xor edx, edx
mov ecx, 0x1f
movzx eax, word [ebx + edx]
mov word [edi + edx*2], ax
movzx eax, word [ebx + edx + 0x40]
mov word [edi + edx*2 + 2], ax
add edx, 2
dec ecx
jns 0x4016d5
mov eax, dword [ebp - 0x164]
cmp eax, 0x20
jle 0x4016fd
mov eax, 0x20
sub dword [ebp - 0x164], eax
mov edx, dword [ebp - 0x148]
push edx
shl eax, 2
push eax
push 1
push edi
call sub.crtdll.dll_fwrite
add esp, 0x10
cmp dword [ebp - 0x164], 0
jne 0x401680
add esp, 0xfffffff4
mov esi, dword [ebp - 0x144]
push esi
call sub.crtdll.dll_fclose
add esp, 0xfffffff4
mov eax, dword [ebp - 0x148]
push eax
call sub.crtdll.dll_fclose
xor eax, eax
lea esp, [ebp - 0x188]
pop ebx
pop esi
pop edi
leave
ret