Function at 0x418480
Capabilities:
Get file size
Print debug messages
Write file on windows

Disassembly:
sub esp, 0x20
push ebx
mov ebx, ecx
mov ecx, dword [esp + 0x28]
push ebp
xor ebp, ebp
push esi
cmp ecx, ebp
mov dword [esp + 0xc], ebx
je 0x418695
cmp dword [ebx + 0xc], ebp
je 0x418695
mov eax, dword [ebx + 8]
cmp eax, ebp
je 0x418695
test cl, 1
je 0x4184be
push eax
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
mov ecx, dword [esp + 0x30]
test cl, 2
je 0x418695
push 0x20a
push 8
mov dword [esp + 0x18], ebp
mov dword [esp + 0x1c], ebp
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
cmp esi, ebp
je 0x418695
push edi
push 0x104
push esi
push ebp
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
test eax, eax
je 0x418685
mov edi, dword [sym.imp.MSVCRT.dll_wcsrchr]
push 0x5c
push esi
call edi
add esp, 8
test eax, eax
je 0x418685
push 0x5c
push esi
call edi
mov edi, dword [sym.imp.MSVCRT.dll_wcscat]
push 0x427f90
push esi
mov word [eax + 2], bp
call edi
mov eax, dword [ebx + 0xc]
push eax
push esi
call edi
push 0x427f84
push esi
call edi
add esp, 0x20
push ebp
push 0x80
push 3
push ebp
push 3
push 0xc0000000
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x418685
lea ecx, [esp + 0x14]
push ecx
push edi
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
cmp dword [esp + 0x18], ebp
jl 0x418593
jg 0x418582
cmp dword [esp + 0x14], 0x500000
jb 0x418593
push ebp
push ebp
push ebp
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push edi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
xor edx, edx
lea eax, [esp + 0x1c]
mov dword [esp + 0x1e], edx
push eax
mov dword [esp + 0x26], edx
mov word [esp + 0x20], bp
mov dword [esp + 0x2a], edx
mov word [esp + 0x2e], dx
call dword [sym.imp.KERNEL32.dll_GetLocalTime]
push 0x802
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
cmp ebx, ebp
je 0x41866b
mov ecx, dword [esp + 0x10]
mov eax, dword [esp + 0x2a]
and eax, 0xffff
mov edx, dword [ecx + 8]
mov ecx, dword [esp + 0x28]
push edx
mov edx, dword [esp + 0x2a]
push eax
mov eax, dword [esp + 0x2c]
and ecx, 0xffff
and edx, 0xffff
push ecx
mov ecx, dword [esp + 0x2e]
and eax, 0xffff
push edx
mov edx, dword [esp + 0x2e]
push eax
mov eax, dword [esp + 0x30]
and ecx, 0xffff
and edx, 0xffff
push ecx
and eax, 0xffff
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x42802c
push 0x400
push ebx
call dword [sym.imp.MSVCRT.dll__snwprintf]
add esp, 0x30
mov dword [esp + 0x34], ebp
push 2
push ebp
push ebp
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea ecx, [esp + 0x34]
push ebp
push ecx
push ebx
call dword [sym.imp.MSVCRT.dll_wcslen]
add esp, 4
shl eax, 1
push eax
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp ebx, ebp
je 0x418685
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push esi
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x20
ret 4