Function at 0x50996b
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x64
mov eax, dword [0x5b31c8]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, ecx
push esi
push edi
push 0x5c
mov eax, dword [ebx]
mov dword [ebp - 0x4c], ebx
mov eax, dword [eax + 0x8684]
mov dword [ebp - 0x44], eax
push dword [eax]
call dword [sym.imp.MSVCR120.dll_strchr]
mov ebx, dword [ebx]
xorps xmm0, xmm0
pop ecx
pop ecx
mov dword [ebp - 0x50], eax
movlpd qword [ebp - 0x60], xmm0
call fcn.00508db9
mov ecx, dword [ebx + 0x154]
mov edi, edx
mov edx, dword [ebp - 0x4c]
mov esi, eax
mov dword [edx + 0x284], ecx
lea ecx, [ebx + 0x55c]
mov eax, dword [ebx + 0x104]
mov dword [edx + 0x288], eax
mov eax, dword [edx]
mov dword [eax + 0xdc], ecx
mov eax, dword [ebp - 0x50]
test eax, eax
jne 0x5099e8
push 0x25
pop eax
jmp 0x509bf8
cmp byte [eax + 1], 0
je 0x5099e0
mov eax, dword [ebx + 0x8670]
or eax, dword [ebx + 0x8674]
je 0x509a03
push 0x58a428
jmp 0x509a47
mov eax, dword [edx]
push dword [eax + 0x334]
mov eax, dword [ebp - 0x44]
push 0x8301
push dword [eax]
call dword [sym.imp.MSVCR120.dll__open]
add esp, 0xc
test eax, eax
jns 0x509a39
mov eax, dword [ebp - 0x44]
push dword [eax]
push str.Cant_open__s_for_writing
push ebx
call fcn.00500d35
add esp, 0xc
push 0x17
jmp 0x5099e2
push eax
call dword [sym.imp.MSVCR120.dll__close]
mov dword [esp], 0x58a484
mov eax, dword [ebp - 0x44]
push dword [eax]
call dword [sym.imp.MSVCR120.dll_fopen]
mov dword [ebp - 0x48], eax
pop ecx
pop ecx
test eax, eax
je 0x509a22
mov edx, dword [ebx + 0x1b0]
mov ecx, dword [ebx + 0x1b4]
cmp edx, 0xffffffff
jne 0x509a70
cmp ecx, edx
je 0x509a7f
push ecx
push edx
mov ecx, ebx
call fcn.0050862e
mov eax, dword [ebp - 0x48]
add esp, 8
xor ecx, ecx
mov dword [ebp - 0x64], ecx
cmp dword [ebx + 0x8674], ecx
jg 0x509ada
jl 0x509a96
cmp dword [ebx + 0x8670], ecx
jae 0x509ada
lea ecx, [ebp - 0x40]
push ecx
push eax
call dword [sym.imp.MSVCR120.dll__fileno]
pop ecx
push eax
call dword [sym.imp.MSVCR120.dll__fstat64]
pop ecx
pop ecx
test eax, eax
je 0x509ac8
push dword [ebp - 0x48]
call dword [sym.imp.MSVCR120.dll_fclose]
mov eax, dword [ebp - 0x44]
pop ecx
push dword [eax]
push str.Cant_get_the_size_of__s
jmp 0x509a2c
mov eax, dword [ebp - 0x28]
mov dword [ebx + 0x8670], eax
mov eax, dword [ebp - 0x24]
mov dword [ebx + 0x8674], eax
mov eax, dword [ebp - 0x5c]
mov dword [ebp - 0x50], eax
mov eax, dword [ebp - 0x60]
mov dword [ebp - 0x58], eax
mov ecx, dword [ebp - 0x4c]
lea eax, [ebp - 0x5c]
push eax
mov edx, 0x4000
call fcn.005016cd
mov dword [ebp - 0x44], eax
pop ecx
test eax, eax
jne 0x509be9
mov ecx, dword [ebp - 0x5c]
mov dword [ebp - 0x54], ecx
test ecx, ecx
jle 0x509bd3
mov eax, dword [ebx + 0x8674]
mov edx, dword [ebx + 0x8670]
mov dword [ebp - 0x44], eax
mov eax, edx
or eax, dword [ebp - 0x44]
je 0x509b4b
mov eax, dword [ebp - 0x44]
cmp dword [ebp - 0x64], eax
jg 0x509bab
jl 0x509b35
cmp ecx, edx
ja 0x509bab
sub edx, ecx
push 0
pop ecx
sbb eax, ecx
mov dword [ebx + 0x8670], edx
mov dword [ebx + 0x8674], eax
mov dword [ebp - 0x54], ecx
lea edx, [ebx + 0x55c]
push dword [ebp - 0x48]
push ecx
push 1
push edx
call dword [sym.imp.MSVCR120.dll_fwrite]
mov ecx, dword [ebp - 0x54]
add esp, 0x10
cmp eax, ecx
jne 0x509bce
mov edx, dword [ebp - 0x58]
mov eax, dword [ebp - 0x50]
add edx, ecx
push 0
pop ecx
adc eax, ecx
mov dword [ebp - 0x58], edx
mov ecx, dword [ebp - 0x4c]
mov dword [ebp - 0x50], eax
mov dword [ebx + 0x458], edx
mov dword [ebx + 0x45c], eax
call fcn.0050865f
test eax, eax
jne 0x509bca
push edi
push esi
mov ecx, ebx
call fcn.00508e22
mov dword [ebp - 0x44], eax
pop ecx
pop ecx
test eax, eax
je 0x509ae6
jmp 0x509be9
mov eax, edx
lea edx, [ebx + 0x55c]
sub ecx, eax
add edx, eax
xor eax, eax
mov dword [ebp - 0x54], ecx
mov dword [ebx + 0x8670], eax
mov dword [ebx + 0x8674], eax
jmp 0x509b51
push 0x2a
jmp 0x509bd0
push 0x37
pop esi
jmp 0x509bec
mov ecx, dword [ebp - 0x4c]
call fcn.0050865f
mov ecx, dword [ebp - 0x44]
test eax, eax
push 0x2a
pop edx
cmovne ecx, edx
mov dword [ebp - 0x44], ecx
mov esi, dword [ebp - 0x44]
push dword [ebp - 0x48]
call dword [sym.imp.MSVCR120.dll_fclose]
pop ecx
mov eax, esi
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0054e63c
mov esp, ebp
pop ebp
ret