//
// CRYPTO_ccm128_setiv from 0xa25ab0 to 0xa25b18 (104 bytes)
//
// 4 xrefs:
// > sub_A11F9C @ 0xa12038
// > sub_A11F9C @ 0xa12134
// > sub_A11F9C @ 0xa123d8
// > ??> @ 0x7c6ac
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:58 +0000
//
int __fastcall CRYPTO_ccm128_setiv(char *a1, const void *a2, size_t a3, int a4)
{
char v4; // lr
size_t v5; // r12
v4 = *a1;
v5 = 14 - (*a1 & 7);
if ( v5 > a3 )
return -1;
*((_QWORD *)a1 + 1) = 0;
a1[15] = a4;
a1[12] = HIBYTE(a4);
a1[13] = BYTE2(a4);
a1[14] = BYTE1(a4);
*a1 = v4 & 0xBF;
memcpy(a1 + 1, a2, v5);
return 0;
}