//
// sub_1005EF0C4 from 0x1005ef0c4 to 0x1005ef240 (380 bytes)
//
// 3 xrefs:
// > sub_1005EF834 @ 0x1005ef8a8
// > sub_100600B08 @ 0x100600e7c
// > sub_100600F44 @ 0x100600fac
//
// 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
//
const char **__fastcall sub_1005EF0C4(const char **a1, time_t a2, int a3, __int64 a4)
{
const char **v6; // x19
int v7; // w23
tm *v8; // x0
tm *v9; // x20
int tm_year; // w8
const char *v11; // x21
char *v12; // x0
tm v14; // [xsp+30h] [xbp-70h] BYREF
time_t v15; // [xsp+68h] [xbp-38h] BYREF
v6 = a1;
v15 = a2;
if ( a1 )
{
v7 = 0;
}
else
{
v6 = (const char **)sub_1005FBAFC(23);
if ( !v6 )
return nullptr;
v7 = 1;
}
v8 = sub_10058A068(&v15, &v14);
v9 = v8;
if ( !v8
|| (a3 || a4) && !(unsigned int)sub_10058A08C(&v8->tm_sec, a3, a4)
|| (tm_year = v9->tm_year, (unsigned int)(tm_year - 50) > 0x63) )
{
LABEL_18:
if ( v7 )
sub_1005FBA78(v6);
return nullptr;
}
v11 = v6[1];
if ( !v11 || *(_DWORD *)v6 <= 0x13u )
{
v11 = sub_100588710(20, (__int64)"a_utctm.c", 264);
if ( v11 )
{
v12 = (char *)v6[1];
if ( v12 )
sub_100588C44(v12);
v6[1] = v11;
tm_year = v9->tm_year;
goto LABEL_16;
}
sub_1005E0E48(13, 218, 65, (__int64)"a_utctm.c", 266);
goto LABEL_18;
}
LABEL_16:
sub_1005DD744(
(__int64)v11,
0x14u,
"%02d%02d%02d%02d%02d%02dZ",
tm_year % 100,
v9->tm_mon + 1,
v9->tm_mday,
v9->tm_hour,
v9->tm_min,
v9->tm_sec);
*(_DWORD *)v6 = strlen(v11);
*((_DWORD *)v6 + 1) = 23;
return v6;
}