Function at 0x4012ad
Capabilities:
Write file on windows

Disassembly:
push ebx
xor ebx, ebx
cmp dword [0x4041e4], ebx
push ebp
push esi
push edi
je case.0x4013f7.1
cmp dword [0x405c28], ebx
mov dword [0x4041e4], ebx
jne 0x4012d3
mov dword [0x405c28], 1
cmp dword [0x405c2c], ebx
jne 0x4012e5
mov dword [0x405c2c], sym.imp.MSVCRT.dll__iob
cmp dword [0x405c30], ebx
jne 0x4012f7
mov dword [0x405c30], sym.imp.MSVCRT.dll___p__commode
cmp dword [0x405c20], ebx
jne 0x401316
push 0x4000
push dword [0x405c2c]
call fcn.004018f2
pop ecx
mov dword [0x405c20], eax
pop ecx
call fcn.004018c6
mov esi, dword [0x405c24]
mov al, byte [0x405c10]
mov ebp, esi
mov byte [esi], al
mov edi, dword [0x405c28]
jmp 0x401334
xor ebx, ebx
movzx eax, byte [esi]
mov dl, byte [eax*4 + 0x404230]
lea eax, [edi + edi]
cmp word [eax + 0x4041e8], bx
je 0x401356
mov dword [0x405c1c], edi
mov dword [0x405c18], esi
movsx ebx, word [eax + 0x404664]
movzx ecx, dl
add ebx, ecx
movsx ebx, word [ebx*2 + 0x40479c]
cmp ebx, edi
je 0x401386
movsx edi, word [eax + 0x4046b0]
cmp edi, 0x24
jl 0x401381
mov dl, byte [ecx*4 + 0x404630]
lea eax, [edi + edi]
jmp 0x401356
movsx eax, word [edi*2 + 0x404664]
movzx ecx, dl
add eax, ecx
inc esi
movsx edi, word [eax*2 + 0x4046fc]
cmp word [edi*2 + 0x404664], 0x42
jne 0x401332
xor ebx, ebx
movsx eax, word [edi*2 + 0x4041e8]
cmp eax, ebx
jne 0x4013c8
mov eax, dword [0x405c1c]
mov esi, dword [0x405c18]
movsx eax, word [eax*2 + 0x4041e8]
mov ecx, esi
mov dword [0x40606c], ebp
sub ecx, ebp
mov dword [0x406068], ecx
mov cl, byte [esi]
mov byte [0x405c10], cl
mov byte [esi], bl
mov ecx, dword [0x40606c]
mov dword [0x405c24], esi
cmp eax, 0xc
ja case.default.0x4013f7
jmp dword [eax*4 + 0x4015c7]
mov al, byte [0x405c10]
mov edi, esi
mov byte [esi], al
mov eax, dword [0x405c20]
sub edi, ecx
dec edi
cmp dword [eax + 0x24], ebx
jne 0x401436
mov ecx, dword [eax + 0x10]
mov dword [0x405c14], ecx
mov ecx, dword [0x405c2c]
mov dword [eax], ecx
mov eax, dword [0x405c20]
mov dword [eax + 0x24], 1
mov eax, dword [0x405c20]
mov eax, dword [eax + 4]
add eax, dword [0x405c14]
cmp dword [0x405c24], eax
jbe 0x4014d7
call fcn.004015fb
sub eax, ebx
je 0x401519
dec eax
jne 0x40148d
mov dword [0x405c0c], ebx
call fcn.0040106a
test eax, eax
je 0x40156e
mov eax, dword [0x405c28]
mov ecx, dword [0x40606c]
dec eax
mov dword [0x405c24], ecx
cdq
sub eax, edx
sar eax, 1
add eax, 0xc
jmp 0x4013ee
dec eax
jne case.0x4013f7.1
mov eax, dword [0x405c20]
mov eax, dword [eax + 4]
add eax, dword [0x405c14]
mov dword [0x405c24], eax
call fcn.00401773
mov esi, dword [0x405c24]
mov ebp, dword [0x40606c]
mov edi, eax
jmp 0x4013a9
mov al, byte [0x405c10]
mov byte [esi], al
mov esi, dword [0x405c18]
mov edi, dword [0x405c1c]
jmp 0x4013a9
mov eax, dword [0x40606c]
add eax, edi
mov dword [0x405c24], eax
call fcn.00401773
mov edi, eax
push edi
call fcn.00401807
mov ebp, dword [0x40606c]
cmp eax, ebx
pop ecx
jne 0x401506
mov esi, dword [0x405c24]
jmp 0x4013a9
inc dword [0x405c24]
mov esi, dword [0x405c24]
mov edi, eax
jmp 0x401334
mov eax, dword [0x40606c]
add eax, edi
mov dword [0x405c24], eax
call fcn.00401773
mov esi, dword [0x405c24]
mov ebp, dword [0x40606c]
mov edi, eax
jmp 0x401334
movsx eax, byte [ecx]
push eax
push 0x404870
call sub.MSVCRT.dll_printf
pop ecx
pop ecx
jmp case.0x4013f7.1
push dword [0x405c30]
push 1
push dword [0x406068]
push ecx
call sub.MSVCRT.dll_fwrite
add esp, 0x10
jmp case.0x4013f7.1
cmp dword [0x405c0c], ebx
jne case.0x4013f7.1
push dword [0x405c2c]
call fcn.00401895
jmp 0x40154c
push 0x40483c
call fcn.004019b4
jmp 0x40154c
movsx eax, byte [ecx]
jmp 0x4015c2
push ecx
push 0x405c60
call sub.MSVCRT.dll_strcpy
pop ecx
mov eax, 0x102
pop ecx
jmp 0x4015c2
push 0x405c60
push ecx
call fcn.004010ad
pop ecx
mov eax, 0x103
pop ecx
jmp 0x4015c2
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
ret