//
// sub_180078760 from 0x180078760 to 0x1800787f3 (147 bytes)
//
// 8 xrefs:
// > sub_1800792B0 @ 0x18007935b
// > sub_1800954A0 @ 0x180095612
// > sub_1800954A0 @ 0x18009575c
// > cocos2d::ZipUtils::encryptDecrypt @ 0x1800a435d
// > cocos2d::ZipUtils::encryptDecryptWKey @ 0x1800a4421
// > ??> @ 0x18013b2b8
// > ??> @ 0x18013b2cc
// > ??> @ 0x1801b4a7c
//
// 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
//
_QWORD *__fastcall sub_180078760(_QWORD *a1, unsigned __int64 a2, char a3)
{
unsigned __int64 v3; // r9
unsigned __int64 v4; // r10
unsigned __int64 v5; // rdi
char *v6; // rbx
_QWORD *result; // rax
v3 = a1[2];
if ( a2 > v3 )
{
v4 = a1[3];
v5 = a2 - v3;
if ( a2 - v3 > v4 - v3 )
{
return sub_180074F80(a1, v5, 0, a2 - v3, a3);
}
else
{
a1[2] = a2;
if ( v4 > 0xF )
a1 = (_QWORD *)*a1;
v6 = (char *)a1 + v3;
result = memset((char *)a1 + v3, a3, v5);
v6[v5] = 0;
}
}
else
{
a1[2] = a2;
if ( a1[3] > 0xFu )
a1 = (_QWORD *)*a1;
*((_BYTE *)a1 + a2) = 0;
}
return result;
}