//
// sub_100206760 from 0x100206760 to 0x10020681e (190 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x100285787
//
// 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
//
__int64 __fastcall sub_100206760(const char *a1, void **a2)
{
gzFile v2; // rcx
__int64 result; // rax
char *v4; // rax
unsigned int v5; // r13d
unsigned int v6; // ebx
size_t v7; // r12
int v8; // eax
gzFile_s *file; // [rsp+0h] [rbp-30h]
v2 = gzopen(a1, "rb");
result = 0xFFFFFFFFLL;
file = v2;
if ( v2 )
{
v4 = (char *)malloc(0x80000u);
v5 = 0x80000;
v6 = 0;
LODWORD(v7) = 0x80000;
while ( 1 )
{
*a2 = v4;
v8 = gzread(file, &v4[v6], v5);
if ( v8 < 0 )
{
LABEL_7:
free(*a2);
*a2 = nullptr;
return 0xFFFFFFFFLL;
}
if ( !v8 )
break;
v6 += v8;
if ( v8 < v5 )
break;
v7 = (unsigned int)v7 + 2 * v5;
v4 = (char *)realloc(*a2, v7);
v5 *= 2;
if ( !v4 )
goto LABEL_7;
}
gzclose(file);
return v6;
}
return result;
}