//
// BLAKE2s_Update from 0x8e0364 to 0x8e0428 (196 bytes)
//
// 2 xrefs:
// > sub_8C9100 @ 0x8c911c
// > ??> @ 0x6b9bc
//
// 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
//
int __fastcall BLAKE2s_Update(char *a1, char *a2, size_t a3)
{
int v3; // r3
int v5; // r7
size_t v6; // r4
char *v7; // r6
int v8; // r3
size_t v9; // r7
unsigned int v10; // r2
v3 = *((_DWORD *)a1 + 28);
v5 = 64 - v3;
v6 = a3;
v7 = a2;
if ( 64 - v3 < a3 )
{
if ( v3 )
{
memcpy(&a1[v3 + 48], a2, 64 - v3);
v6 -= v5;
sub_8DE664((int *)a1, a1 + 48, 0x40u);
*((_DWORD *)a1 + 28) = 0;
v7 += v5;
if ( v6 <= 0x40 )
{
v3 = 0;
goto LABEL_8;
}
}
else if ( a3 <= 0x40 )
{
v3 = 0;
goto LABEL_8;
}
v8 = v6 & 0x3F;
if ( (v6 & 0x3F) == 0 )
v8 = 64;
v9 = v6 - v8;
v10 = v6 - v8;
v6 = v8;
sub_8DE664((int *)a1, v7, v10);
v3 = *((_DWORD *)a1 + 28);
v7 += v9;
}
LABEL_8:
memcpy(&a1[v3 + 48], v7, v6);
*((_DWORD *)a1 + 28) += v6;
return 1;
}