Skip to content

Instantly share code, notes, and snippets.

@eur0pa
Last active August 29, 2015 14:19
Show Gist options
  • Save eur0pa/114ed1b912508d203fcd to your computer and use it in GitHub Desktop.
Save eur0pa/114ed1b912508d203fcd to your computer and use it in GitHub Desktop.
C for IsaacRandom.asm
unsigned int __fastcall IsaacRandom(int a1, int a2)
{
int v2; // eax@1
signed int v3; // ecx@4
int v4; // eax@5
int v5; // eax@5
signed int v6; // ecx@7
int v7; // eax@8
unsigned int v8; // ecx@10
unsigned int v9; // ecx@10
v2 = dword_A583B8;
if ( dword_A583B8 >= 624 )
{
if ( dword_A583B8 == 625 )
sub_90A900(a1, a2);
v3 = 0;
do
{
v4 = dword_A7A1F8[v3] ^ dword_A7A1FC[v3];
++v3;
v5 = *&dword_A7A1F4[4 * v3] ^ v4 & 0x7FFFFFFF;
*&dword_A7A1F4[4 * v3] = dword_A7A828[v3] ^ dword_A78F6C[v5 & 1] ^ (v5 >> 1);
}
while ( v3 < 227 );
if ( v3 < 623 )
{
v6 = &dword_A7A1F8[v3];
do
{
v7 = *(v6 + 4) ^ *v6;
v6 += 4;
*(v6 - 4) = ((*(v6 - 4) ^ v7 & 0x7FFFFFFFu) >> 1) ^ *(v6 - 912) ^ dword_A78F6C[(*(v6 - 4) ^ v7) & 1];
}
while ( v6 < &dword_A7ABB4 );
}
dword_A7ABB4 = dword_A7A828[0] ^ dword_A78F6C[(dword_A7ABB4 ^ (dword_A7ABB4 ^ LOBYTE(dword_A7A1F8[0]))) & 1] ^ ((dword_A7ABB4 ^ (dword_A7ABB4 ^ dword_A7A1F8[0]) & 0x7FFFFFFFu) >> 1);
v2 = 0;
}
v8 = dword_A7A1F8[v2];
dword_A583B8 = v2 + 1;
v9 = ((((v8 >> 11) ^ v8) & 0xFF3A58AD) << 7) ^ (v8 >> 11) ^ v8;
return ((v9 & 0xFFFFDF8C) << 15) ^ v9 ^ ((((v9 & 0xFFFFDF8C) << 15) ^ v9) >> 18);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment