Skip to content

Instantly share code, notes, and snippets.

@lukaville
Created April 3, 2018 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukaville/204ddc485ea6f0a1db013ed0e977c35a to your computer and use it in GitHub Desktop.
Save lukaville/204ddc485ea6f0a1db013ed0e977c35a to your computer and use it in GitHub Desktop.
int __fastcall sub_0(int a1, signed int a2, int a3)
{
signed int v3; // r4
signed int v4; // r3
signed int i; // r6
int v6; // r0
int v7; // r2
int v8; // r1
int v9; // r1
int v10; // r1
int result; // r0
int v12; // [sp+0h] [bp-30h]
int v13; // [sp+4h] [bp-2Ch]
int v14; // [sp+8h] [bp-28h]
int v15; // [sp+Ch] [bp-24h]
int v16; // [sp+10h] [bp-20h]
int v17; // [sp+14h] [bp-1Ch]
int v18; // [sp+18h] [bp-18h]
int v19; // [sp+1Ch] [bp-14h]
v3 = 0;
v4 = 50;
if ( a2 > 396 )
a2 = 396;
for ( i = 0; i < 8; ++i )
{
if ( a1 == 1 )
*(&v12 + i) = *(unsigned __int8 *)(i + a3 + 2);
if ( a1 == 2 )
*(&v12 + i) = *(unsigned __int8 *)(i + a3 + 10);
if ( a1 == 3 )
*(&v12 + i) = *(unsigned __int8 *)(i + a3 + 18);
if ( a1 == 4 )
*(&v12 + i) = *(unsigned __int8 *)(i + a3 + 26);
if ( a1 == 5 )
*(&v12 + i) = *(unsigned __int8 *)(i + a3 + 34);
}
if ( a2 >= 50 )
{
if ( a2 >= 100 )
{
if ( a2 >= 150 )
{
if ( a2 >= 200 )
{
if ( a2 >= 250 )
{
v3 = 275;
if ( a2 >= 275 )
{
v7 = v19;
if ( a2 >= 396 )
{
v3 = 396;
v6 = v19;
}
else
{
v4 = 25;
v6 = v18;
}
}
else
{
v4 = 25;
v3 = 250;
v6 = v17;
v7 = v18;
}
}
else
{
v3 = 200;
v6 = v16;
v7 = v17;
}
}
else
{
v3 = 150;
v6 = v15;
v7 = v16;
}
}
else
{
v3 = 100;
v6 = v14;
v7 = v15;
}
}
else
{
v3 = 50;
v6 = v13;
v7 = v14;
}
}
else
{
v6 = v12;
v7 = v13;
}
v8 = a2 - v3;
if ( v6 >= v7 )
v9 = v8 * (v6 - v7);
else
v9 = v8 * (v7 - v6);
v10 = v9 / v4;
if ( v6 >= v7 )
result = v6 - v10;
else
result = v6 + v10;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment