//
// SHA1_Final from 0xddd36c to 0xddd46c (256 bytes)
//
// 7 xrefs:
// > sub_DAAF14 @ 0xdaaf58
// > sub_DAAF94 @ 0xdab088
// > sub_DAB164 @ 0xdab188
// > sub_DAB1A0 @ 0xdab234
// > SHA1 @ 0xddd1cc
// > sub_E5DAFC @ 0xe5db20
// > ??> @ 0xad388
//
// 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 SHA1_Final(_DWORD *a1, uint32x4_t *a2)
{
int8x16_t *v3; // x21
__int64 v4; // x1
__int64 v6; // x0
size_t v7; // x2
unsigned int v8; // w3
double v9; // d0
double v10; // d1
int32x4_t v11; // q2
double v13; // d0
double v14; // d1
int32x4_t v15; // q2
v3 = (uint32x4_t *)((char *)a2 + 28);
v4 = a2[5].n128_u32[3];
v6 = v4 + 1;
v3->n128_u8[v4] = 0x80;
if ( (unsigned __int64)(v4 + 1) > 0x38 )
{
memset((char *)v3 + v6, 0, 63 - v4);
sha1_block_data_order(a2, v3, 1, v13, v14, v15);
v7 = 56;
v6 = 0;
}
else
{
v7 = 55 - v4;
}
memset((char *)v3 + v6, 0, v7);
v8 = bswap32(a2[1].n128_u32[1]);
a2[5].n128_u32[1] = bswap32(a2[1].n128_u32[2]);
a2[5].n128_u32[2] = v8;
sha1_block_data_order(a2, v3, 1, v9, v10, v11);
a2[5].n128_u32[3] = 0;
OPENSSL_cleanse(v3, 0x40u);
*a1 = bswap32(a2->n128_u32[0]);
a1[1] = bswap32(a2->n128_u32[1]);
a1[2] = bswap32(a2->n128_u32[2]);
a1[3] = bswap32(a2->n128_u32[3]);
a1[4] = bswap32(a2[1].n128_u32[0]);
return 1;
}