int *__cdecl ImageRenderScanline(int a1, int a2, int n0x100, int a4)
{
int n0x100_1; // ebp
int n0x100_3; // ebx
int *Pool_1; // edi
int *Pool; // eax
int v8; // eax
_BYTE *v9; // eax
int v10; // edx
int v11; // ecx
int v12; // ecx
_BYTE *v13; // eax
int n0x100_2; // ecx
bool v15; // sf
int n0x100_4; // esi
int v17; // ecx
unsigned __int8 v18; // al
int Line; // eax
char v20; // al
_BYTE *v21; // esi
int v22; // eax
int n0x100_5; // [esp+Ch] [ebp-8h]
n0x100_1 = n0x100;
n0x100_3 = 0;
Pool_1 = 0;
if ( (unsigned int)n0x100 < 0x100 && a4 >= 0 && a4 < 255 - n0x100 )
{
Pool = (int *)PeiAllocatePool((void *)0x30);
Pool_1 = Pool;
if ( Pool )
{
SetMem(Pool, 0x30u, 0);
Pool_1[9] = a4;
*Pool_1 = 8;
Pool_1[1] = 255;
v8 = PeiAllocatePool((void *)0x100);
Pool_1[2] = v8;
if ( !v8 )
return 0;
v9 = (_BYTE *)PeiAllocatePool((void *)(Pool_1[1] + 1));
Pool_1[3] = (int)v9;
if ( !v9 )
return 0;
v10 = 0;
*v9 = *((_BYTE *)Pool_1 + 4);
*(_BYTE *)(Pool_1[1] + Pool_1[2]) = 0;
v11 = 1;
if ( Pool_1[1] > 0 )
{
do
{
*(_BYTE *)(v11 + Pool_1[3]) = v10;
*(_BYTE *)(v10 + Pool_1[2]) = v11;
v12 = 2 * v11;
if ( (v12 & 0x100) != 0 )
v12 ^= 0x11Du;
v11 = Pool_1[1] & v12;
++v10;
}
while ( v10 < Pool_1[1] );
if ( v11 != 1 )
return 0;
}
v13 = (_BYTE *)PeiAllocatePool((void *)(n0x100 + 1));
Pool_1[4] = (int)v13;
if ( v13 )
{
Pool_1[6] = 0;
n0x100_2 = 0;
Pool_1[7] = 1;
Pool_1[5] = n0x100;
Pool_1[10] = 285;
Pool_1[8] = 1;
*v13 = 1;
n0x100_5 = 0;
v15 = n0x100 < 0;
if ( n0x100 > 0 )
{
do
{
n0x100_4 = n0x100_2;
*(_BYTE *)(Pool_1[4] + n0x100_2 + 1) = 1;
if ( n0x100_2 > 0 )
{
do
{
v17 = Pool_1[4];
v18 = *(_BYTE *)(v17 + n0x100_4);
if ( v18 )
{
Line = ImageRenderNextLine(Pool_1, n0x100_5 + *(unsigned __int8 *)(v18 + Pool_1[3]));
v17 = Pool_1[4];
v20 = *(_BYTE *)(v17 + n0x100_4 - 1) ^ *(_BYTE *)(Line + Pool_1[2]);
}
else
{
v20 = *(_BYTE *)(v17 + n0x100_4 - 1);
}
*(_BYTE *)(v17 + n0x100_4--) = v20;
}
while ( n0x100_4 > 0 );
n0x100_1 = n0x100;
}
v21 = (_BYTE *)Pool_1[4];
v22 = ImageRenderNextLine(Pool_1, n0x100_5 + *(unsigned __int8 *)((unsigned __int8)*v21 + Pool_1[3]));
n0x100_2 = n0x100_5 + 1;
*v21 = *(_BYTE *)(v22 + Pool_1[2]);
n0x100_5 = n0x100_2;
}
while ( n0x100_2 < n0x100_1 );
v15 = n0x100_1 < 0;
}
if ( !v15 )
{
do
{
*(_BYTE *)(Pool_1[4] + n0x100_3) = *(_BYTE *)(*(unsigned __int8 *)(Pool_1[4] + n0x100_3) + Pool_1[3]);
++n0x100_3;
}
while ( n0x100_3 <= n0x100_1 );
}
}
else
{
return 0;
}
}
}
return Pool_1;
}