//
// sub_77B174 from 0x77b174 to 0x77b1f2 (126 bytes)
//
// 0 xrefs:
//
// 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
//
unsigned int __fastcall sub_77B174(int a1, unsigned int a2, unsigned int a3, char a4, _BYTE *a5)
{
_BYTE *v8; // r4
unsigned int v9; // r5
unsigned int v10; // r8
wint_t v11; // t1
int v12; // r0
unsigned int v14; // r5
unsigned int v15; // r8
wint_t v16; // r0
unsigned int v17; // t1
int v18; // r1
int v19; // r0
v8 = a5;
if ( *(_BYTE *)(a1 + 12) )
{
if ( a2 < a3 )
{
v14 = a2 - 4;
v15 = (unsigned int)&a5[((~a2 + a3) >> 2) + 1];
do
{
v17 = *(_DWORD *)(v14 + 4);
v14 += 4;
v16 = v17;
v18 = a1 + v17;
if ( v17 <= 0x7F )
{
*v8 = *(_BYTE *)(v18 + 13);
}
else
{
v19 = wctob(v16);
if ( v19 == -1 )
LOBYTE(v19) = a4;
*v8 = v19;
}
++v8;
}
while ( v8 != (_BYTE *)v15 );
}
}
else if ( a2 < a3 )
{
v9 = a2 - 4;
v10 = (unsigned int)&a5[((~a2 + a3) >> 2) + 1];
do
{
v11 = *(_DWORD *)(v9 + 4);
v9 += 4;
v12 = wctob(v11);
if ( v12 == -1 )
LOBYTE(v12) = a4;
*v8++ = v12;
}
while ( v8 != (_BYTE *)v10 );
}
return a3;
}