Function at 0x509a60
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x150
mov eax, dword [0x601018]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push edi
xor edi, edi
mov ebx, ecx
mov dword [ebp - 0x150], eax
cmp eax, edi
jne 0x509aa1
pop edi
mov dword [ebx + 0x10], 0x124f9
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00596083
mov esp, ebp
pop ebp
ret 8
cmp dword [ebp + 0xc], 1
jge 0x509abe
mov dword [ebx + 0x10], edi
pop edi
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00596083
mov esp, ebp
pop ebp
ret 8
push esi
xor esi, esi
mov dword [ebp - 0x144], 0x19
mov dword [ebp - 0x148], esi
jmp 0x509ad9
mov eax, dword [ebp - 0x150]
mov edx, dword [ebp + 0xc]
push edi
lea ecx, [ebp - 0x14c]
push ecx
push edx
push eax
mov eax, dword [ebx + 8]
push eax
mov dword [ebp - 0x14c], edi
mov dword [ebx + 0x10], edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x509c29
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebx + 0x10], eax
cmp eax, 0x5aa
je 0x509b23
cmp eax, 0x5ac
je 0x509b23
cmp eax, 0x299
jne 0x509c29
cmp esi, edi
jne 0x509bf9
mov eax, 1
lea ecx, [ebp - 0x138]
push 0x124ff
push str.ERROR__d:
lea esi, [ebp - 0x140]
mov dword [ebp - 0x140], ecx
mov dword [ebp - 0x13c], 0x100
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x38], edi
mov dword [ebp - 0x34], edi
mov byte [ebp - 0x24], 0
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], 0x124ff
call fcn.00506600
add esp, 8
push str.begin_write_operation_delay
mov eax, esi
mov byte [ebp - 0x24], 0
call fcn.00506660
lea eax, [ebx + 0x14]
cmp eax, edi
je 0x509b9f
cmp byte [eax], 0
je 0x509b9f
push eax
push str.filename___s_
call fcn.00506600
add esp, 8
mov edi, dword [ebx + 0x10]
lea ecx, [ebp - 0x140]
call fcn.005067d0
cmp dword [ebp - 0x30], 0
je 0x509bd7
mov edx, dword [ebp - 0x140]
mov eax, dword [ebp - 0x38]
push edx
push eax
push 0x5cb5f8
mov ecx, 0x610240
call fcn.00504670
add esp, 0xc
mov dword [ebp - 0x30], 0
mov eax, dword [ebp - 0x140]
lea ecx, [ebp - 0x138]
cmp eax, ecx
je 0x509bf1
push eax
call dword [sym.imp.MSVCR100.dll_void___cdecl_operator_delete___void__]
add esp, 4
mov esi, dword [ebp - 0x148]
xor edi, edi
mov edx, dword [ebp - 0x144]
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
mov eax, dword [ebp - 0x144]
add esi, eax
add eax, 0x19
mov dword [ebp - 0x148], esi
mov dword [ebp - 0x144], eax
cmp esi, 0xdbba0
jl 0x509ad3
mov eax, dword [ebx + 0x10]
cmp eax, edi
je 0x509c33
mov dword [ebx + 4], eax
cmp esi, edi
jle 0x509d01
lea eax, [ebp - 0x138]
mov dword [ebp - 0x140], eax
mov eax, 1
push 0x12500
push str.ERROR__d:
lea esi, [ebp - 0x140]
mov dword [ebp - 0x13c], 0x100
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x38], edi
mov dword [ebp - 0x34], edi
mov byte [ebp - 0x24], 0
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], 0x12500
call fcn.00506600
add esp, 8
push str.end_write_operation_delay
mov eax, esi
mov byte [ebp - 0x24], 0
call fcn.00506660
lea eax, [ebx + 0x14]
cmp eax, edi
je 0x509caf
cmp byte [eax], 0
je 0x509caf
push eax
push str.filename___s_
call fcn.00506600
add esp, 8
mov edi, dword [ebx + 0x10]
lea ecx, [ebp - 0x140]
call fcn.005067d0
cmp dword [ebp - 0x30], 0
je 0x509ce7
mov ecx, dword [ebp - 0x140]
mov edx, dword [ebp - 0x38]
push ecx
push edx
push 0x5cb5f8
mov ecx, 0x610240
call fcn.00504670
add esp, 0xc
mov dword [ebp - 0x30], 0
mov eax, dword [ebp - 0x140]
lea ecx, [ebp - 0x138]
cmp eax, ecx
je 0x509d01
push eax
call dword [sym.imp.MSVCR100.dll_void___cdecl_operator_delete___void__]
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0x14c]
pop esi
pop edi
xor ecx, ebp
pop ebx
call fcn.00596083
mov esp, ebp
pop ebp
ret 8