Function at 0x40b577
Capabilities:
Create thread
Hide graphical window

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48c
push 0
push str.DAIVA_STORY3__TRIAL_OF_NIRVANA_
call dword [sym.imp.USER32.dll_FindWindowA]
mov dword [ebp - 0x108], eax
cmp dword [ebp - 0x108], 0
je 0x40b5bf
push 9
mov eax, dword [ebp - 0x108]
push eax
call dword [sym.imp.USER32.dll_ShowWindow]
mov ecx, dword [ebp - 0x108]
push ecx
call dword [sym.imp.USER32.dll_SetForegroundWindow]
xor eax, eax
jmp 0x40bc0d
mov edx, dword [ebp + 8]
mov dword [0x4f46a4], edx
push 0x104
lea eax, [ebp - 0x218]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea ecx, [ebp - 0x478]
push ecx
push 0x4dc440
push 0x104
lea edx, [ebp - 0x218]
push edx
call dword [sym.imp.KERNEL32.dll_GetFullPathNameA]
push str.DAIVA3
push str._s.EXE
lea eax, [ebp - 0x348]
push eax
call fcn.00420739
add esp, 0xc
push 0x4dc440
call fcn.0040bef1
add esp, 4
push 0x104
lea ecx, [ebp - 0x218]
push ecx
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
push 0
lea edx, [ebp - 0x100]
push edx
lea eax, [ebp - 0x458]
push eax
lea ecx, [ebp - 0x47c]
push ecx
lea edx, [ebp - 0x218]
push edx
call fcn.00420f35
add esp, 0x14
lea eax, [ebp - 0x47c]
push eax
push 0x4dc440
call fcn.00421360
add esp, 8
lea ecx, [ebp - 0x458]
push ecx
push 0x4dc440
call fcn.00421370
add esp, 8
push 0x4dc440
push 0x4dc560
call fcn.00421360
add esp, 8
lea edx, [ebp - 0x100]
push edx
push 0x4dc560
call fcn.00421370
add esp, 8
push str..ini
push 0x4dc560
call fcn.00421370
add esp, 8
push 0
call dword [sym.imp.ole32.dll_CoInitialize]
test eax, eax
jge 0x40b6db
mov eax, dword [0x481d5c]
push eax
call fcn.004038c0
add esp, 4
xor eax, eax
jmp 0x40bc0d
call fcn.00404b74
cmp dword [ebp + 0xc], 0
jne 0x40b791
mov dword [ebp - 0x240], 0x1003
mov dword [ebp - 0x23c], 0x40a919
mov dword [ebp - 0x238], 0
mov dword [ebp - 0x234], 0
mov ecx, dword [ebp + 8]
mov dword [ebp - 0x230], ecx
push 0x65
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.USER32.dll_LoadIconA]
mov dword [ebp - 0x22c], eax
push 0x7f00
push 0
call dword [sym.imp.USER32.dll_LoadCursorA]
mov dword [ebp - 0x228], eax
push 4
call dword [sym.imp.GDI32.dll_GetStockObject]
mov dword [ebp - 0x224], eax
mov dword [ebp - 0x220], 0x66
mov dword [ebp - 0x21c], str.DAIVA_STORY3__TRIAL_OF_NIRVANA_
push 0x67
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.USER32.dll_LoadAcceleratorsA]
mov dword [ebp - 0x34c], eax
lea ecx, [ebp - 0x240]
push ecx
call dword [sym.imp.USER32.dll_RegisterClassA]
and eax, 0xffff
test eax, eax
jne 0x40b791
xor eax, eax
jmp 0x40bc0d
push 0
mov edx, dword [ebp + 8]
push edx
push 0
push 0
push 0x190
push 0x280
push DirectSoundCreate
push DirectSoundCreate
push 0xca0000
push str.DAIVA_STORY3__TRIAL_OF_NIRVANA_
push str.DAIVA_STORY3__TRIAL_OF_NIRVANA_
push 0
call dword [sym.imp.USER32.dll_CreateWindowExA]
mov dword [0x4dc420], eax
mov dword [0x49fc4c], 0xfffe7961
mov dword [0x49fc50], 0xfffe7961
call fcn.00406cb0
call fcn.0040b1db
call fcn.00409b9e
cmp dword [0x49fc4c], 0xfffe7961
jne 0x40b87e
cmp dword [0x49fc50], 0xfffe7961
jne 0x40b87e
mov dword [0x49fc4c], 0
mov dword [0x49fc50], 0
push 0x190
push 0x280
call fcn.00407bb0
add esp, 8
push 0
call fcn.00407c2b
add esp, 4
lea eax, [ebp - 0x48c]
push eax
mov ecx, dword [0x4dc420]
push ecx
call dword [sym.imp.USER32.dll_GetWindowRect]
push 0
call dword [sym.imp.USER32.dll_GetSystemMetrics]
sub eax, dword [ebp - 0x484]
cdq
sub eax, edx
sar eax, 1
mov dword [0x49fc4c], eax
push 1
call dword [sym.imp.USER32.dll_GetSystemMetrics]
sub eax, dword [ebp - 0x480]
cdq
sub eax, edx
sar eax, 1
mov dword [0x49fc50], eax
push 0x190
push 0x280
call fcn.00407bb0
add esp, 8
push 0
call fcn.00407c2b
add esp, 4
mov edx, dword [ebp + 0x14]
push edx
mov eax, dword [0x4dc420]
push eax
call dword [sym.imp.USER32.dll_ShowWindow]
mov ecx, dword [0x4dc420]
push ecx
call dword [sym.imp.USER32.dll_UpdateWindow]
call fcn.00409b9e
call fcn.00407d84
call fcn.004080c7
test eax, eax
jne 0x40b8e3
call fcn.004086f6
push str.DirectDraw
call fcn.004038c0
add esp, 4
xor eax, eax
jmp 0x40bc0d
call fcn.0040b4c6
test eax, eax
jne 0x40b8fd
call fcn.0040b4f8
call fcn.004086f6
xor eax, eax
jmp 0x40bc0d
push 0x19
mov edx, dword [0x57efac]
push edx
call fcn.004044b0
add esp, 8
call fcn.00404740
call fcn.004060c1
push 1
call dword [sym.imp.WINMM.dll_timeBeginPeriod]
call fcn.00407ae0
call dword [sym.imp.WINMM.dll_timeGetTime]
mov dword [0x4a00c0], eax
push 0
push 0x3e8
push 1
mov eax, dword [0x4dc420]
push eax
call dword [sym.imp.USER32.dll_SetTimer]
mov dword [0x4a0154], eax
call fcn.0040bc13
cmp dword [str.GAME_A], 0
je 0x40b96b
mov ecx, dword [str.DAIVA_1.D88]
push ecx
push 0
push 0
call fcn.00401345
add esp, 0xc
cmp dword [str.GAME_B], 0
je 0x40b987
mov edx, dword [str.DAIVA_2.D88]
push edx
push 0
push 1
call fcn.00401345
add esp, 0xc
push 0
push 0x9dd1
push 0x9dd5
push 0x9dd0
mov eax, dword [0x4dc420]
push eax
call dword [sym.imp.USER32.dll_GetMenu]
push eax
call dword [sym.imp.USER32.dll_CheckMenuRadioItem]
xor ecx, ecx
mov cl, byte [0x57efa9]
test ecx, ecx
je 0x40b9c1
push 1
call fcn.0040a4c6
add esp, 4
lea edx, [ebp - 0x354]
push edx
push 0
push 0
push 0x40bec4
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
mov dword [ebp - 0x10c], eax
cmp dword [ebp - 0x10c], 0
je 0x40bb7b
mov eax, 1
test eax, eax
je 0x40bb7b
push 0
push 0
push 0
push 0
lea ecx, [ebp - 0x474]
push ecx
call dword [sym.imp.USER32.dll_PeekMessageA]
test eax, eax
je 0x40ba6e
push 0
push 0
push 0
lea edx, [ebp - 0x474]
push edx
call dword [sym.imp.USER32.dll_GetMessageA]
test eax, eax
jne 0x40ba30
jmp 0x40bb7b
lea eax, [ebp - 0x474]
push eax
mov ecx, dword [ebp - 0x34c]
push ecx
mov edx, dword [ebp - 0x474]
push edx
call dword [sym.imp.USER32.dll_TranslateAcceleratorA]
test eax, eax
jne 0x40ba5c
lea eax, [ebp - 0x474]
push eax
call dword [sym.imp.USER32.dll_TranslateMessage]
lea ecx, [ebp - 0x474]
push ecx
call dword [sym.imp.USER32.dll_DispatchMessageA]
jmp 0x40bb76
cmp dword [0x4a0168], 0
je 0x40bada
call fcn.00407b18
and eax, 0xffff
test eax, eax
je 0x40bad5
push 0
call fcn.00407b09
add esp, 4
mov edx, dword [0x4a016c]
and edx, 1
test edx, edx
jne 0x40baa1
call fcn.0040bc75
mov eax, dword [0x4a016c]
mov ecx, dword [0x4a016c]
add ecx, 1
mov dword [0x4a016c], ecx
cmp eax, 0x120
jl 0x40bad5
mov dword [0x4a0168], 0
call fcn.0040bc4f
call fcn.004094b1
call fcn.0040b367
jmp 0x40bb76
xor edx, edx
mov dl, byte [0x4a00c8]
test edx, edx
jne 0x40bb76
call fcn.00407b18
and eax, 0xffff
mov dword [ebp - 0x104], eax
cmp dword [ebp - 0x104], 0
je 0x40bb76
xor eax, eax
cmp dword [0x4a015c], 0
sete al
xor ecx, ecx
cmp dword [0x4f46ac], 0
sete cl
and eax, ecx
test eax, eax
je 0x40bb76
push 0
call fcn.00407b09
add esp, 4
mov ecx, dword [ebp - 0x104]
imul ecx, ecx, 0x3e8
call fcn.0040c8c7
call fcn.0042025e
mov dl, byte [0x4a0158]
add dl, 1
mov byte [0x4a0158], dl
xor eax, eax
mov al, byte [0x4a0158]
xor ecx, ecx
mov cl, byte [0x4dc425]
cmp eax, ecx
jl 0x40bb71
mov byte [0x4a0158], 0
call fcn.00417e83
jmp 0x40bb76
call fcn.00417f90
jmp 0x40b9ee
call fcn.0040233e
cmp dword [0x49fc5c], 0
je 0x40bb96
mov edx, dword [0x49fc5c]
push edx
call dword [sym.imp.USER32.dll_DestroyWindow]
cmp dword [0x4a0154], 0
je 0x40bbb2
mov eax, dword [0x4a0154]
push eax
mov ecx, dword [0x4dc420]
push ecx
call dword [sym.imp.USER32.dll_KillTimer]
push 1
call dword [sym.imp.WINMM.dll_timeEndPeriod]
call fcn.00406421
call fcn.00404784
call fcn.0040c7dc
call fcn.0040b4f8
call fcn.004086f6
call fcn.0040b296
call fcn.004070a5
call fcn.0040bc4f
call fcn.00405310
cmp dword [0x4f46ac], 0
je 0x40bc01
push 0xa
mov edx, dword [ebp - 0x10c]
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
jmp 0x40bbe7
call dword [sym.imp.ole32.dll_CoUninitialize]
mov eax, dword [ebp - 0x46c]
mov esp, ebp
pop ebp
ret 0x10