Function at 0x51f1c0
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x4340
call fcn.00531990
mov eax, dword [0x6e4770]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x14]
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
mov edi, ecx
cmp eax, 3
je 0x51f4ba
cmp eax, 2
je 0x51f20d
cmp eax, 1
je 0x51f20d
pop edi
pop esi
mov eax, 0x10000
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
cmp dword [edi + 4], 0xffffffff
je 0x51f21d
push dword [edi]
call fcn.00521f30
add esp, 4
mov eax, dword [edi]
mov esi, dword [ebp + 8]
mov dword [edi + 4], 0xffffffff
cmp esi, dword [eax + 4]
jge 0x51f1f5
cmp esi, dword [eax + 0x10]
jge 0x51f23c
push eax
call fcn.00521ff0
add esp, 4
mov eax, dword [edi]
cmp dword [eax + 0x10], esi
jge 0x51f254
push dword [edi]
call fcn.00522040
mov eax, dword [edi]
add esp, 4
cmp dword [eax + 0x10], esi
jl 0x51f243
lea eax, [ebp - 0x4338]
mov ecx, edi
push eax
push esi
call fcn.0051eb70
test byte [ebp - 0x4230], 0x10
je 0x51f2b5
cmp dword [ebp + 0x14], 1
je 0x51f2a0
push 0x103
lea eax, [ebp - 0x20c]
push eax
lea eax, [ebp - 0x4334]
push eax
call fcn.0051f070
lea eax, [ebp - 0x20c]
push eax
lea eax, [edi + 0x138]
push eax
call fcn.0051e8b0
add esp, 0x14
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
mov esi, dword [ebp + 0x14]
cmp esi, 1
je 0x51f3cc
movzx eax, word [ebx]
mov edx, ebx
mov ecx, ebx
test ax, ax
je 0x51f3b0
cmp ax, 0x2f
je 0x51f2dd
cmp ax, 0x5c
jne 0x51f2e0
lea edx, [ecx + 2]
movzx eax, word [ecx + 2]
add ecx, 2
test ax, ax
jne 0x51f2d1
cmp edx, ebx
je 0x51f3b0
lea esi, [ebp - 0x20c]
mov ecx, ebx
sub esi, ebx
mov edi, edi
movzx eax, word [ecx]
lea ecx, [ecx + 2]
mov word [esi + ecx - 2], ax
test ax, ax
jne 0x51f300
sub edx, ebx
sar edx, 1
lea edx, [edx*2 - 2]
cmp edx, 0x208
jae 0x51f57a
xor eax, eax
mov word [ebp + edx - 0x20c], ax
mov ax, word [ebp - 0x20c]
cmp ax, 0x2f
je 0x51f355
cmp ax, 0x5c
je 0x51f355
cmp word [ebp - 0x20a], 0x3a
mov byte [ebp - 0x4339], 0
jne 0x51f35c
mov byte [ebp - 0x4339], 1
lea eax, [ebp - 0x20c]
push 0x655214
push eax
call fcn.0053006e
mov esi, eax
lea eax, [ebp - 0x20c]
push 0x65521c
push eax
call fcn.0053006e
add esp, 0x10
test eax, eax
setne cl
test esi, esi
setne al
or cl, al
or cl, byte [ebp - 0x4339]
jne 0x51f3ad
lea eax, [ebp - 0x20c]
push eax
lea eax, [edi + 0x138]
push eax
call fcn.0051e8b0
add esp, 8
mov esi, dword [ebp + 0x14]
push 0
push dword [ebp - 0x4230]
push 2
push 0
push 0
push 0x40000000
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x51f3e9
pop edi
pop esi
mov eax, 0x200
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
push dword [edi]
call fcn.00522210
push 0x4000
lea eax, [ebp - 0x420c]
mov byte [ebp - 0x4339], 0
push eax
push dword [edi]
call fcn.005224e0
add esp, 0x10
test eax, eax
js 0x51f449
je 0x51f450
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 0x51f449
push 0x4000
lea eax, [ebp - 0x420c]
push eax
push dword [edi]
call fcn.005224e0
add esp, 0xc
test eax, eax
jns 0x51f411
mov byte [ebp - 0x4339], 1
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 1
jne 0x51f481
cmp byte [ebp - 0x4339], 0
jne 0x51f481
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 esi, 1
je 0x51f48d
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [edi]
call fcn.00521f30
add esp, 4
xor eax, eax
cmp byte [ebp - 0x4339], al
mov ecx, 0x400
cmovne eax, ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
mov eax, dword [edi + 4]
mov esi, dword [ebp + 8]
cmp esi, eax
je 0x51f51e
cmp eax, 0xffffffff
je 0x51f4d3
push dword [edi]
call fcn.00521f30
add esp, 4
mov eax, dword [edi]
mov dword [edi + 4], 0xffffffff
cmp esi, dword [eax + 4]
jge 0x51f1f5
cmp esi, dword [eax + 0x10]
jge 0x51f4f3
push eax
call fcn.00521ff0
add esp, 4
mov eax, dword [edi]
cmp dword [eax + 0x10], esi
jge 0x51f511
lea ebx, [ebx]
push dword [edi]
call fcn.00522040
mov eax, dword [edi]
add esp, 4
cmp dword [eax + 0x10], esi
jl 0x51f500
push dword [edi]
call fcn.00522210
add esp, 4
mov dword [edi + 4], esi
push dword [ebp + 0x10]
push ebx
push dword [edi]
call fcn.005224e0
mov esi, eax
add esp, 0xc
test esi, esi
jle 0x51f54a
pop edi
pop esi
mov eax, 0x600
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
push dword [edi]
call fcn.00521f30
mov ecx, dword [ebp - 4]
add esp, 4
neg esi
mov dword [edi + 4], 0xffffffff
sbb esi, esi
xor ecx, ebp
and esi, 0x5000000
pop edi
mov eax, esi
pop esi
pop ebx
call fcn.0052dfa4
mov esp, ebp
pop ebp
ret 0x10
call fcn.0052ed39
int3