//
// __scrt_common_main_seh from 0x140677dfc to 0x140677f64 (360 bytes)
//
// 2 xrefs:
// > start @ 0x140677f7d
// > ??> @ 0x14093278c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:36:00 +0000
//
__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) )
{
sub_1406782F8(7);
goto LABEL_19;
}
v1 = 0;
LOBYTE(v0) = _scrt_acquire_startup_lock();
if ( dword_1409096F0 == 1 )
{
LABEL_19:
sub_1406782F8(7);
goto LABEL_20;
}
if ( dword_1409096F0 )
{
v1 = 1;
}
else
{
dword_1409096F0 = 1;
if ( initterm_e((_PIFV *)&First, (_PIFV *)&Last) )
return 255;
initterm((_PVFV *)&qword_1406D04D8, (_PVFV *)&qword_1406D22C0);
dword_1409096F0 = 2;
}
_scrt_release_startup_lock(v0);
v4 = (_QWORD *)sub_140678640(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_140678648(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)sub_140678488(v12) )
LABEL_20:
exit(v0);
if ( !v1 )
cexit();
LOBYTE(v13) = 1;
_scrt_uninitialize_crt(v13, 0);
return v0;
}