//
// wcschr from 0x180142968 to 0x1801429e1 (121 bytes)
//
// 1 xrefs:
// > common_set_variable_in_environment_nolock @ 0x18013b10c
//
// 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
//
wchar_t *__cdecl wcschr(const wchar_t *Str, wchar_t Ch)
{
wchar_t *v3; // r9
__m128i v4; // xmm2
__m128i v5; // xmm0
unsigned int v6; // eax
__int64 v7; // rax
__int64 v8; // rcx
wchar_t *v9; // r8
v3 = nullptr;
v4 = _mm_shuffle_epi32(_mm_shufflelo_epi16(_mm_cvtsi32_si128(Ch), 0), 0);
while ( ((unsigned __int16)Str & 0xFFFu) > 0xFF0uLL )
{
if ( *Str == Ch )
return (wchar_t *)Str;
if ( !*Str )
return nullptr;
v7 = 2;
LABEL_8:
Str = (const wchar_t *)((char *)Str + v7);
}
v5 = _mm_loadu_si128((const __m128i *)Str);
v6 = _mm_movemask_epi8(_mm_or_si128(_mm_cmpeq_epi16((__m128i)0LL, v5), _mm_cmpeq_epi16(v5, v4)));
if ( !v6 )
{
v7 = 16;
goto LABEL_8;
}
_BitScanForward((unsigned int *)&v8, v6);
v9 = (wchar_t *)((char *)Str + v8);
if ( *v9 == Ch )
return v9;
return v3;
}