Skip to content

Instantly share code, notes, and snippets.

@Jackarain
Created August 16, 2012 15:00
Show Gist options
  • Save Jackarain/3370830 to your computer and use it in GitHub Desktop.
Save Jackarain/3370830 to your computer and use it in GitHub Desktop.
int __cdecl sub_49989E(int a1)
{
int result; // eax@1
signed int v2; // esi@1
int v3; // ecx@1
int v4; // edi@2
int v5; // edx@2
char *v6; // ecx@3
signed int v7; // edx@3
int v8; // esi@4
int v9; // ecx@5
int v10; // edx@5
int v11; // esi@5
int v12; // ecx@5
int v13; // esi@6
int v14; // esi@6
int v15; // esi@6
int v16; // edi@6
int v17; // ecx@6
int v18; // esi@8
int v19; // esi@8
int v20; // ecx@8
int v21; // edi@10
int v22; // esi@10
int v23; // ecx@10
int v24; // edi@12
int v25; // ebx@12
int v26; // esi@12
int v27; // ecx@12
int v28; // edi@13
int v29; // esi@13
int v30; // ecx@13
int v31; // edx@13
int v32; // ecx@13
int v33[2]; // [sp+Ch] [bp-14Ch]@2
char v34; // [sp+14h] [bp-144h]@3
int v35; // [sp+14Ch] [bp-Ch]@5
int v36; // [sp+150h] [bp-8h]@5
int v37; // [sp+154h] [bp-4h]@5
signed int v38; // [sp+160h] [bp+8h]@5
signed int v39; // [sp+160h] [bp+8h]@7
signed int v40; // [sp+160h] [bp+8h]@9
signed int v41; // [sp+160h] [bp+8h]@11
result = a1;
v2 = 0;
v3 = a1 + 33;
do
{
v4 = *(_BYTE *)(v3 + 1);
BYTE3(v5) = 0;
*(_WORD *)((char *)&v5 + 1) = *(_BYTE *)(v3 - 1);
LOBYTE(v5) = *(_BYTE *)v3;
v3 += 4;
v33[v2++] = *(_BYTE *)(v3 - 2) | ((v4 | (v5 << 8)) << 8);
}
while ( v2 < 16 );
v6 = &v34;
v7 = 64;
do
{
v8 = *(_DWORD *)v6 ^ *((_DWORD *)v6 - 2) ^ *((_DWORD *)v6 + 6) ^ *((_DWORD *)v6 + 11);
v6 += 4;
--v7;
v8 = __ROL__(v8, 1);
*((_DWORD *)v6 + 13) = v8;
}
while ( v7 );
v9 = *(_DWORD *)a1;
v10 = *(_DWORD *)(a1 + 8);
v38 = 0;
v37 = *(_DWORD *)(result + 12);
v11 = *(_DWORD *)(result + 16);
v36 = v9;
v12 = *(_DWORD *)(result + 4);
v35 = v11;
do
{
v13 = __ROL__(v36, 5);
v14 = v33[v38++] + (v12 & v10 | v37 & ~v12) + v13;
v15 = v14 + v35 + 1518500249;
v16 = v37;
v17 = __ROR__(v12, 2);
v37 = v10;
v10 = v17;
v12 = v36;
v35 = v16;
v36 = v15;
}
while ( v38 < 20 );
v39 = 20;
do
{
v18 = __ROL__(v15, 5);
v19 = v33[v39++] + (v12 ^ v10 ^ v37) + v18;
v15 = v19 + v16 + 1859775393;
v16 = v37;
v20 = __ROR__(v12, 2);
v37 = v10;
v10 = v20;
v12 = v36;
v36 = v15;
}
while ( v39 < 40 );
v35 = v16;
v40 = 40;
do
{
v21 = v33[v40] + (v12 & v10 | v37 & (v12 | v10));
v22 = __ROL__(v15, 5);
++v40;
v15 = v21 + v35 + v22 - 1894007588;
v23 = __ROR__(v12, 2);
v35 = v37;
v37 = v10;
v10 = v23;
v12 = v36;
v36 = v15;
}
while ( v40 < 60 );
v41 = 60;
do
{
v24 = v33[v41] + (v12 ^ v10 ^ v37);
v25 = v37;
v26 = __ROL__(v15, 5);
++v41;
v27 = __ROR__(v12, 2);
v37 = v10;
v15 = v24 + v35 + v26 - 899497514;
v10 = v27;
v12 = v36;
v35 = v25;
v36 = v15;
}
while ( v41 < 80 );
v28 = v15 + *(_DWORD *)result;
v29 = v12 + *(_DWORD *)(result + 4);
v30 = v10 + *(_DWORD *)(result + 8);
v31 = v37;
*(_DWORD *)(result + 8) = v30;
*(_DWORD *)(result + 12) += v31;
v32 = *(_DWORD *)(result + 16);
*(_DWORD *)result = v28;
*(_DWORD *)(result + 28) = 0;
*(_DWORD *)(result + 4) = v29;
*(_DWORD *)(result + 16) = v25 + v32;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment