Function at 0x59bf5e
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x4340
call fcn.005a7e30
mov eax, dword [0x5ed758]
xor eax, ebp
mov dword [ebp - 4], eax
cmp dword [ebp + 0x14], 3
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x4340], ebx
je 0x59bfa7
cmp dword [ebp + 0x14], 2
je 0x59c026
cmp dword [ebp + 0x14], 1
je 0x59c026
mov eax, 0x10000
jmp 0x59c268
mov eax, dword [edi + 4]
mov esi, dword [ebp + 8]
cmp esi, eax
je 0x59bfed
cmp eax, 0xffffffff
je 0x59bfbe
push dword [edi]
call fcn.0059a3ca
pop ecx
mov eax, dword [edi]
or dword [edi + 4], 0xffffffff
cmp esi, dword [eax + 4]
jge 0x59bf9d
cmp esi, dword [eax + 0x10]
jge 0x59bfdc
push eax
call fcn.0059a09f
jmp 0x59bfdb
call fcn.0059a0e0
pop ecx
mov eax, dword [edi]
push eax
cmp dword [eax + 0x10], esi
jl 0x59bfd6
call fcn.0059bc70
pop ecx
mov dword [edi + 4], esi
push dword [ebp + 0x10]
push ebx
push dword [edi]
call fcn.0059bd61
mov esi, eax
add esp, 0xc
test esi, esi
jle 0x59c00b
mov eax, 0x600
jmp 0x59c268
push dword [edi]
call fcn.0059a3ca
or dword [edi + 4], 0xffffffff
mov eax, esi
neg eax
sbb eax, eax
and eax, 0x5000000
jmp 0x59c267
cmp dword [edi + 4], 0xffffffff
je 0x59c034
push dword [edi]
call fcn.0059a3ca
pop ecx
mov eax, dword [edi]
mov esi, dword [ebp + 8]
or dword [edi + 4], 0xffffffff
cmp esi, dword [eax + 4]
jge 0x59bf9d
cmp esi, dword [eax + 0x10]
jge 0x59c05b
push eax
call fcn.0059a09f
jmp 0x59c05a
push dword [edi]
call fcn.0059a0e0
pop ecx
mov eax, dword [edi]
cmp dword [eax + 0x10], esi
jl 0x59c053
lea eax, [ebp - 0x4338]
push eax
push esi
mov ecx, edi
call fcn.0059a4ad
test byte [ebp - 0x4230], 0x10
je 0x59c0b7
cmp dword [ebp + 0x14], 1
jne 0x59c087
xor eax, eax
jmp 0x59c268
lea eax, [ebp - 0x20c]
push eax
lea eax, [ebp - 0x4334]
push eax
mov esi, 0x103
call fcn.0059986a
lea eax, [ebp - 0x20c]
push eax
add edi, 0x138
push edi
call fcn.0059a904
add esp, 0x10
jmp 0x59c080
cmp dword [ebp + 0x14], 1
je 0x59c1a1
movzx eax, word [ebx]
mov esi, ebx
mov ecx, ebx
test ax, ax
je 0x59c186
cmp ax, 0x2f
je 0x59c0dd
cmp ax, 0x5c
jne 0x59c0e0
lea esi, [ecx + 2]
add ecx, 2
movzx eax, word [ecx]
test ax, ax
jne 0x59c0d1
cmp esi, ebx
je 0x59c186
lea eax, [ebp - 0x20c]
push ebx
push eax
call fcn.005a9006
sub esi, ebx
sar esi, 1
xor eax, eax
pop ecx
mov word [ebp + esi*2 - 0x20e], ax
cmp word [ebp - 0x20c], 0x2f
pop ecx
je 0x59c132
cmp word [ebp - 0x20c], 0x5c
je 0x59c132
cmp word [ebp - 0x20a], 0x3a
je 0x59c132
xor bl, bl
jmp 0x59c134
mov bl, 1
lea eax, [ebp - 0x20c]
push 0x5c47a8
push eax
call fcn.005a8990
mov esi, eax
lea eax, [ebp - 0x20c]
push 0x5c47a0
push eax
call fcn.005a8990
add esp, 0x10
test eax, eax
setne al
test esi, esi
setne cl
or al, cl
or al, bl
jne 0x59c180
lea eax, [ebp - 0x20c]
push eax
lea eax, [edi + 0x138]
push eax
call fcn.0059a904
pop ecx
pop ecx
mov ebx, dword [ebp - 0x4340]
xor eax, eax
push eax
push dword [ebp - 0x4230]
push 2
push eax
push eax
push 0x40000000
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x59c1b0
mov eax, 0x200
jmp 0x59c268
push dword [edi]
call fcn.0059bc70
mov esi, 0x4000
push esi
lea eax, [ebp - 0x420c]
push eax
push dword [edi]
mov byte [ebp - 0x4339], 0
call fcn.0059bd61
add esp, 0x10
jmp 0x59c207
je 0x59c212
push 0
lea ecx, [ebp - 0x4340]
push ecx
push eax
lea eax, [ebp - 0x420c]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x59c20b
push esi
lea eax, [ebp - 0x420c]
push eax
push dword [edi]
call fcn.0059bd61
add esp, 0xc
test eax, eax
jns 0x59c1d7
mov byte [ebp - 0x4339], 1
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 1
jne 0x59c243
cmp byte [ebp - 0x4339], 0
jne 0x59c243
lea eax, [ebp - 0x421c]
push eax
lea eax, [ebp - 0x422c]
push eax
lea eax, [ebp - 0x4224]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileTime]
cmp dword [ebp + 0x14], 1
je 0x59c250
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [edi]
call fcn.0059a3ca
movzx eax, byte [ebp - 0x4339]
neg eax
sbb eax, eax
and eax, 0x400
pop ecx
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.005a6e47
leave
ret 0x10