Function at 0x403720
Capabilities:
Print debug messages
Read file on windows
Write file on windows

Disassembly:
mov al, byte [0x40be58]
sub esp, 0xc3c
test al, 4
push ebx
push ebp
push esi
push edi
je 0x403aa1
xor ebx, ebx
mov ecx, 0xff
xor eax, eax
lea edi, [esp + 0x84d]
mov byte [esp + 0x84c], bl
mov byte [esp + 0x4c], bl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0xff
xor eax, eax
lea edi, [esp + 0x4d]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov eax, dword [esp + 0xc54]
push eax
push str._ERROR_
push 0xfff
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov esi, dword [sym.imp.MSVCRT.dll__snprintf]
push eax
push str._T_d__M_d__s:_s_n
lea ecx, [esp + 0x860]
push 0x3ff
push ecx
call esi
lea edx, [esp + 0xc74]
lea eax, [esp + 0x868]
push edx
push eax
lea ecx, [esp + 0x70]
push 0x3ff
push ecx
call dword [sym.imp.MSVCRT.dll__vsnprintf]
add esp, 0x2c
lea edx, [esp + 0x4c]
push edx
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
mov ecx, 0xff
xor eax, eax
lea edi, [esp + 0x44d]
mov byte [esp + 0x44c], bl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
lea eax, [esp + 0x20]
push eax
call dword [sym.imp.MSVCRT.dll_time]
lea ecx, [esp + 0x24]
push ecx
call dword [sym.imp.MSVCRT.dll_localtime]
mov ecx, dword [0x40b610]
add esp, 8
lea edx, [esp + 0x4c]
push edx
mov edx, dword [eax]
push ecx
mov ecx, dword [eax + 4]
push edx
mov edx, dword [eax + 8]
mov eax, dword [0x40b614]
push ecx
push edx
push eax
push str._d_t_d:_d:_d_t_P_d___s
lea ecx, [esp + 0x468]
push 0x3ff
push ecx
call esi
mov ecx, dword [0x40b614]
mov al, byte [0x40be58]
add esp, 0x24
inc ecx
test al, 0x18
mov dword [0x40b614], ecx
je 0x403aa1
cmp byte [0x40be5c], bl
jne 0x40399e
lea edx, [esp + 0x24]
lea eax, [esp + 0x24]
push edx
lea ecx, [esp + 0x28]
push eax
lea edx, [esp + 0x44]
push ecx
push edx
mov dword [esp + 0x4c], ebx
mov dword [esp + 0x50], ebx
mov dword [esp + 0x34], ebx
mov dword [esp + 0x38], ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcessTimes]
lea eax, [esp + 0x2c]
lea ecx, [esp + 0x3c]
push eax
push ecx
mov dword [esp + 0x34], ebx
mov dword [esp + 0x38], ebx
call dword [sym.imp.KERNEL32.dll_FileTimeToLocalFileTime]
mov edx, dword [esp + 0x2c]
mov eax, dword [esp + 0x30]
xor ecx, ecx
mov dword [esp + 0x34], edx
mov dword [esp + 0x12], ecx
mov dword [esp + 0x38], eax
mov dword [esp + 0x16], ecx
lea edx, [esp + 0x10]
lea eax, [esp + 0x34]
mov dword [esp + 0x1a], ecx
push edx
push eax
mov word [esp + 0x18], bx
mov word [esp + 0x26], cx
call dword [sym.imp.KERNEL32.dll_FileTimeToSystemTime]
mov al, byte [0x40be58]
test al, 0x10
je 0x403940
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x1a]
mov eax, dword [esp + 0x18]
and ecx, 0xffff
and edx, 0xffff
push ecx
mov ecx, dword [esp + 0x1a]
and eax, 0xffff
push edx
mov edx, dword [esp + 0x1a]
push eax
mov eax, dword [esp + 0x1c]
and ecx, 0xffff
and edx, 0xffff
push ecx
and eax, 0xffff
push edx
push eax
push 0xfff
call fcn.00402f70
push eax
push str._sLog_d__04d_02d_02d__02d_02d_02d.log
push 0x104
push 0x40be5c
call esi
add esp, 0x2c
jmp 0x40399e
test al, 8
je 0x40399e
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x1a]
mov eax, dword [esp + 0x18]
and ecx, 0xffff
and edx, 0xffff
push ecx
mov ecx, dword [esp + 0x1a]
and eax, 0xffff
push edx
mov edx, dword [esp + 0x1a]
push eax
mov eax, dword [esp + 0x1c]
and ecx, 0xffff
and edx, 0xffff
push ecx
and eax, 0xffff
push edx
push eax
call fcn.00402f70
push eax
push str._sLogMiniGame__04d_02d_02d__02d_02d_02d.log
push 0x104
push 0x40be5c
call esi
add esp, 0x28
push ebx
push 0x20
push 4
push ebx
push 1
push 0xc0000000
push 0x40be5c
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x403aa1
test byte [0x40be58], 8
je 0x403a5c
call fcn.004049e0
lea ecx, [esp + 0x20]
push ebx
push ecx
push ebx
push ebp
mov dword [esp + 0x44], eax
mov dword [esp + 0x48], edx
mov dword [esp + 0x30], ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea edx, [esp + 0x48]
push ebx
push edx
lea eax, [esp + 0x18]
push 8
push eax
push ebp
mov dword [esp + 0x5c], ebx
mov dword [esp + 0x24], ebx
mov dword [esp + 0x28], ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x403a2b
mov ecx, 2
lea edi, [esp + 0x34]
lea esi, [esp + 0x10]
xor edx, edx
repe cmpsd dword [esi], dword es:[edi]
mov eax, edx
setne al
cmp eax, ebx
je 0x403a5c
lea eax, [esp + 0x44]
push ebx
push eax
push ebx
push ebp
mov dword [esp + 0x54], ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea ecx, [esp + 0x3c]
push ebx
push ecx
lea edx, [esp + 0x3c]
push 8
push edx
push ebp
mov dword [esp + 0x50], ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebp
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
lea eax, [esp + 0x2c]
push 2
push eax
push ebx
push ebp
mov dword [esp + 0x3c], ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea ecx, [esp + 0x24]
push ebx
push ecx
lea edi, [esp + 0x454]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
lea edx, [esp + 0x454]
push ecx
push edx
push ebp
mov dword [esp + 0x38], ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc3c
ret