//
// wcsrchr from 0x18014270c to 0x1801427b9 (173 bytes)
//
// 1 xrefs:
// > convert_to_stat_mode @ 0x1801295a4
//
// 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 10:55:05 +0000
//
wchar_t *__cdecl wcsrchr(const wchar_t *Str, wchar_t Ch)
{
const __m128i *v2; // r8
unsigned int v3; // r9d
__int16 v4; // ax
wchar_t *v6; // rdx
__m128i v7; // xmm1
__m128i v8; // xmm0
int v9; // ecx
__m128i v10; // xmm1
__m128i v11; // xmm0
unsigned __int8 v12; // zf
int v13; // ecx
v2 = (const __m128i *)Str;
v3 = Ch;
if ( dword_1801B1700 >= 2 )
{
v6 = nullptr;
while ( (((_BYTE)v2 + 1) & 0xE) != 0 )
{
if ( v2->m128i_i16[0] == (_WORD)v3 )
v6 = (wchar_t *)v2;
if ( !v2->m128i_i16[0] )
return v6;
v2 = (const __m128i *)((char *)v2 + 2);
}
if ( (_WORD)v3 )
{
v10 = _mm_cvtsi32_si128(v3);
while ( 1 )
{
v11 = _mm_loadu_si128(v2);
v13 = _mm_cmpistri(v10, v11, 65);
v12 = _mm_cmpistrz(v10, v11, 65);
if ( _mm_cmpistrc(v10, v11, 65) )
v6 = (wchar_t *)v2 + v13;
if ( v12 )
break;
++v2;
}
return v6;
}
v7 = _mm_cvtsi32_si128(0xFFFF0001);
while ( 1 )
{
v8 = _mm_loadu_si128(v2);
v9 = _mm_cmpistri(v7, v8, 21);
if ( _mm_cmpistrz(v7, v8, 21) )
break;
++v2;
}
return (wchar_t *)v2 + v9;
}
else
{
do
{
v4 = v2->m128i_i16[0];
v2 = (const __m128i *)((char *)v2 + 2);
}
while ( v4 );
while ( 1 )
{
v2 = (const __m128i *)((char *)v2 - 2);
if ( v2 == (const __m128i *)Str )
break;
if ( v2->m128i_i16[0] == Ch )
return (wchar_t *)v2;
}
if ( v2->m128i_i16[0] == Ch )
return (wchar_t *)v2;
return nullptr;
}
}