Function at 0x491530
Capabilities:
Get file size
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x34
mov eax, dword [0x54b144]
xor eax, esp
mov dword [esp + 0x30], eax
mov eax, dword [ebp + 8]
push ebx
mov ebx, dword [ebp + 0x14]
push esi
push edi
sub esp, 0xc
mov edi, ecx
push ebx
push dword [ebp + 0x10]
push 0xc0000000
push eax
call fcn.004714d0
test eax, eax
js 0x4917a2
mov esi, dword [ebp + 0xc]
mov eax, dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp esi, 0xffffffff
jne 0x491728
cmp ebx, 4
jne 0x491717
lea ecx, [esp + 0x14]
mov dword [ebp + 0xc], 0
push ecx
push dword [edi]
call eax
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
jne 0x4915ad
call fcn.004714b0
test eax, eax
js 0x491720
mov eax, dword [esp + 0x10]
cmp dword [esp + 0x14], 0
ja 0x4915bd
cmp eax, 2
jb 0x491720
mov esi, dword [edi]
lea eax, [esp + 0x1c]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push 0
push eax
push dword [esp + 0x24]
mov dword [esp + 0x24], eax
push 2
push 0
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov ebx, eax
mov dword [esp + 0x24], ebx
test ebx, ebx
jne 0x4915f8
call fcn.004714b0
mov dword [edi + 8], ebx
jmp 0x49177c
mov esi, dword [esp + 0x18]
push 0
push esi
push 0
push 0
push 4
push ebx
mov dword [esp + 0x28], esi
call dword [sym.imp.KERNEL32.dll_MapViewOfFileEx]
mov dword [esp + 0x20], eax
test eax, eax
jne 0x491630
call fcn.004714b0
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi + 8], 0
jmp 0x49177c
movzx ecx, word [eax]
mov edx, 0xfeff
cmp cx, dx
je 0x49170e
mov edx, 0xfffe
cmp cx, dx
je 0x49170e
lea ecx, [esp + 0x18]
mov dword [esp + 0x18], 0xffffffff
push ecx
push esi
push eax
call dword [sym.imp.ADVAPI32.dll_IsTextUnicode]
test eax, eax
je 0x4916f4
cmp dword [esp + 0x18], 2
jne 0x4916aa
mov ebx, dword [esp + 0x20]
lea eax, [esp + 0x28]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetCPInfo]
cmp dword [esp + 0x28], 1
jbe 0x4916aa
xor esi, esi
cmp dword [esp + 0x10], esi
jle 0x4916aa
mov al, byte [ebx]
push eax
call dword [sym.imp.KERNEL32.dll_IsDBCSLeadByte]
lea ebx, [ebx + 1]
test eax, eax
jne 0x4916b1
inc esi
cmp esi, dword [esp + 0x10]
jl 0x491693
mov dword [ebp + 0xc], 1
mov eax, dword [esp + 0x20]
mov esi, dword [ebp + 0xc]
push eax
mov dword [esp + 0x1c], 0
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
test eax, eax
jne 0x4916d4
call fcn.004714b0
mov dword [esp + 0x18], eax
mov ebx, dword [esp + 0x24]
test ebx, ebx
je 0x491723
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x491723
cmp dword [esp + 0x18], eax
jl 0x491723
call fcn.004714b0
jmp 0x491723
mov ecx, dword [esp + 0x20]
xor esi, esi
mov dword [esp + 0x18], 0
mov eax, ecx
mov dword [esp + 0x24], ebx
test ecx, ecx
je 0x4916d8
jmp 0x4916b8
mov dword [ebp + 0xc], 1
jmp 0x4916b5
mov dword [edi + 8], 1
jmp 0x491730
mov esi, dword [ebp + 0xc]
mov eax, dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [edi + 8], esi
cmp esi, 1
jne 0x49177c
lea ecx, [esp + 0x14]
push ecx
push dword [edi]
call eax
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
jne 0x49174f
call fcn.004714b0
test eax, eax
js 0x491755
mov eax, dword [esp + 0x10]
or eax, dword [esp + 0x14]
jne 0x49177c
push 0
lea eax, [esp + 0x1c]
mov dword [esp + 0x14], 0xfeff
push eax
push 2
lea eax, [esp + 0x1c]
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x49177c
call fcn.004714b0
push 2
lea eax, [esp + 0x18]
xorps xmm0, xmm0
push eax
push 0
push dword [edi]
movlpd qword [esp + 0x20], xmm0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x4917a0
call fcn.004714b0
xor eax, eax
mov ecx, dword [esp + 0x3c]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.004dafe6
mov esp, ebp
pop ebp
ret 0x14