//
// __scrt_common_main_seh from 0x1404d0e9c to 0x1404d1004 (360 bytes)
//
// 2 xrefs:
// > start @ 0x1404d101d
// > ??> @ 0x1406dd754
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall __scrt_common_main_seh()
{
unsigned int v0; // ebx
char v1; // di
__int64 v3; // rcx
_QWORD *v4; // rax
__int64 v5; // rcx
void (__fastcall **v6)(_QWORD, __int64); // rbx
_tls_callback_type *v7; // rax
__int64 v8; // rcx
_tls_callback_type *v9; // rbx
int show_window_mode; // ebx
CHAR *wide_winmain_command_line; // rax
__int64 v12; // rcx
__int64 v13; // rcx
if ( !_scrt_initialize_crt(1) )
{
_scrt_fastfail(7);
goto LABEL_19;
}
v1 = 0;
LOBYTE(v0) = _scrt_acquire_startup_lock();
if ( dword_1406C1030 == 1 )
{
LABEL_19:
_scrt_fastfail(7);
goto LABEL_20;
}
if ( dword_1406C1030 )
{
v1 = 1;
}
else
{
dword_1406C1030 = 1;
if ( initterm_e((_PIFV *)&First, (_PIFV *)&Last) )
return 255;
initterm((_PVFV *)&qword_1405171A8, (_PVFV *)&qword_140518860);
dword_1406C1030 = 2;
}
_scrt_release_startup_lock(v0);
v4 = (_QWORD *)sub_1404D15E0(v3);
v6 = (void (__fastcall **)(_QWORD, __int64))v4;
if ( *v4 && _scrt_is_nonwritable_in_current_image((__int64)v4) )
(*v6)(0, 2);
v7 = (_tls_callback_type *)sub_1404D15E8(v5);
v9 = v7;
if ( *v7 && _scrt_is_nonwritable_in_current_image((__int64)v7) )
register_thread_local_exe_atexit_callback(*v9);
show_window_mode = (unsigned __int16)_scrt_get_show_window_mode(v8);
wide_winmain_command_line = (CHAR *)get_wide_winmain_command_line();
v0 = WinMain((HINSTANCE)0x140000000LL, nullptr, wide_winmain_command_line, show_window_mode);
if ( !(unsigned __int8)_scrt_is_managed_app(v12) )
LABEL_20:
exit(v0);
if ( !v1 )
cexit();
LOBYTE(v13) = 1;
_scrt_uninitialize_crt(v13, 0);
return v0;
}