Function at 0x58c450
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x34
mov eax, dword [0x65ada4]
xor eax, esp
mov dword [esp + 0x30], eax
mov cx, word [esp + 0x44]
mov edx, dword [esp + 0x38]
mov eax, dword [esp + 0x48]
push ebx
mov ebx, dword [esp + 0x40]
push ebp
mov ebp, dword [esp + 0x54]
push esi
mov esi, 0x110d
push edi
mov dword [esp + 0x20], edx
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], ebp
mov byte [esp + 0x13], 0
cmp si, cx
je 0x58c5a0
mov esi, 0x1110
cmp si, cx
jne 0x58c4a7
mov ebx, dword [ebx]
jmp 0x58c5a0
mov eax, 0x310d
xor ebp, ebp
cmp ax, cx
jne 0x58c4b9
mov dword [esp + 0x14], ebx
jmp 0x58c4c1
mov ecx, dword [ebx]
mov dword [esp + 0x14], ecx
mov ebx, ecx
mov eax, ebx
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x58c4c6
sub eax, edx
sar eax, 1
mov edi, eax
xor esi, esi
test edi, edi
jle 0x58c4ff
lea ecx, [ecx]
movzx edx, word [ebx + esi*2]
push edx
lea eax, [esp + 0x3c]
push eax
call dword [sym.imp.MSVCR90.dll_wctomb]
add esp, 8
cmp eax, 0xffffffff
je 0x58c4ff
inc esi
add ebp, eax
cmp esi, edi
jl 0x58c4e0
cmp esi, edi
je 0x58c532
push str.widechar
push 0x6784
push 0x25ea
call fcn.00406f10
add esp, 0xc
pop edi
pop esi
pop ebp
mov eax, 0x25ea
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
push 1
inc ebp
push ebp
call dword [sym.imp.MSVCR90.dll_calloc]
mov ebx, eax
add esp, 8
test ebx, ebx
jne 0x58c56a
push 0x6784
push 6
call fcn.00406f10
add esp, 8
pop edi
pop esi
pop ebp
lea eax, [ebx + 6]
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
xor esi, esi
xor ebp, ebp
mov byte [esp + 0x13], 1
test edi, edi
jle 0x58c594
mov ecx, dword [esp + 0x14]
movzx edx, word [ecx + esi*2]
push edx
lea eax, [ebx + ebp]
push eax
call dword [sym.imp.MSVCR90.dll_wctomb]
inc esi
add esp, 8
add ebp, eax
cmp esi, edi
jl 0x58c577
mov ebp, dword [esp + 0x1c]
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x20]
movzx ecx, word [edx + 1]
cmp cx, 0xd
jne 0x58c64d
cmp dword [esp + 0x50], 0
mov edi, dword [edx + 0x185]
je 0x58c62b
cmp byte [eax + 0x8c], 0
mov dword [esp + 0x24], 1
mov dword [esp + 0x2c], ebx
je 0x58c5d5
or ecx, 0xffffffff
jmp 0x58c5db
mov ecx, dword [eax + 4]
mov ecx, dword [ecx + 0x1d]
mov eax, dword [eax + 0x72]
lea edx, [esp + 0x24]
push edx
push edi
push ecx
push eax
call fcn.00407900
mov esi, eax
add esp, 0x10
test esi, esi
je 0x58c61a
cmp byte [esp + 0x13], 0
je 0x58c605
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
cmp byte [esp + 0x13], 0
je 0x58c62b
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
test ebp, ebp
je 0x58c817
mov ecx, dword [edi]
pop edi
pop esi
mov dword [ebp], ecx
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
cmp cx, 0x1c
jne 0x58c6fa
cmp dword [esp + 0x50], 0
mov edx, dword [edx + 0x185]
je 0x58c6d6
cmp byte [eax + 0x8c], 0
mov dword [esp + 0x24], 1
mov dword [esp + 0x2c], ebx
je 0x58c67e
or ecx, 0xffffffff
jmp 0x58c684
mov ecx, dword [eax + 4]
mov ecx, dword [ecx + 0x1d]
lea esi, [esp + 0x24]
push esi
push edx
mov edx, dword [eax + 0x72]
push ecx
push edx
call fcn.004079f0
mov esi, eax
add esp, 0x10
test esi, esi
jne 0x58c5f4
test ebp, ebp
je 0x58c6ac
mov eax, dword [esp + 0x28]
mov dword [ebp], eax
cmp byte [esp + 0x13], 0
je 0x58c817
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
test ebp, ebp
je 0x58c817
pop edi
pop esi
mov dword [ebp], 0xffffffff
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
cmp cx, 0xc
jne 0x58c82c
cmp dword [esp + 0x50], 0
mov edi, dword [edx + 0x185]
je 0x58c80e
push 0x5a8524
push ebx
call dword [sym.imp.MSVCR90.dll_fopen]
mov esi, eax
add esp, 8
test esi, esi
jne 0x58c76b
push 0x5a8524
push ebx
push 0x6784
push 0x713
call fcn.00406f10
add esp, 0x10
cmp byte [esp + 0x13], 0
je 0x58c753
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 0x713
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
mov ecx, dword [edi]
push esi
push ecx
lea edx, [edi + 4]
push 1
push edx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
cmp dword [edi], eax
je 0x58c7c4
push 0x6784
push 0x715
call fcn.00406f10
push esi
call dword [sym.imp.MSVCR90.dll_fclose]
add esp, 0xc
cmp byte [esp + 0x13], 0
je 0x58c7ac
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 0x715
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
push esi
call dword [sym.imp.MSVCR90.dll_fclose]
add esp, 4
cmp eax, 0xffffffff
jne 0x58c80e
push 0x6784
push 0x711
call fcn.00406f10
add esp, 8
cmp byte [esp + 0x13], 0
je 0x58c7f6
push ebx
call dword [sym.imp.MSVCR90.dll_free]
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 0x711
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
test ebp, ebp
je 0x58c817
mov eax, dword [edi]
mov dword [ebp], eax
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00586584
add esp, 0x34
ret
mov ecx, dword [esp + 0x40]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
mov eax, 0x4276
call fcn.00586584
add esp, 0x34
ret