__int16 __fastcall VgaDisplayEnable(unsigned __int16 *a1, unsigned __int16 *a2, _WORD *dst, int a4)
{
unsigned __int16 *v4; // edi
int i; // ebx
__int16 result; // ax
unsigned int v8; // esi
_WORD *buf; // edi
_WORD *v10; // edi
int v11; // ecx
unsigned int v12; // [esp+10h] [ebp-Ch] BYREF
int v13; // [esp+14h] [ebp-8h] BYREF
int v14; // [esp+18h] [ebp-4h]
v4 = a2;
v12 = 0;
v14 = (int)a2;
v13 = 0;
SetMem(dst, 0x80u, 0);
VgaDisplayDisable(a1, &v13, (unsigned __int16 *)&v12, a4);
*dst = v13;
for ( i = 1; i < 64; ++i )
{
VgaDisplayDisable(v4, &v13, (unsigned __int16 *)&v12, a4);
result = 0;
if ( !(_WORD)v12 )
break;
v8 = (unsigned __int8)v12 >> 4;
v12 = v8;
if ( v8 )
{
buf = &dst[i];
memset(buf, 0, 4 * (v8 >> 1));
v10 = &buf[2 * (v8 >> 1)];
v11 = v8 & 1;
i += v8;
while ( v11 )
{
*v10++ = 0;
--v11;
}
do
v8 += 0xFFFF;
while ( (_WORD)v8 );
v4 = (unsigned __int16 *)v14;
v12 = v8;
}
result = v13;
dst[i] = v13;
}
return result;
}