Help me decompile. Be verbose but not too much. I will paste some pseudocode generated by a decompiler after this sentence, please re-write this code using comments, renaming variables so that it becomes more understandeable, and in proper C notation describing what it does.

char __fastcall decrypt_routine(_DWORD *a1, _BYTE *a2, _BYTE *a3, __int64 a4)
{
__int64 v4; // r10
__int64 v5; // r8
char v6; // r11
char result; // al

LODWORD(v4) = *a1;
LODWORD(v5) = a1[1];
while ( a4 )
{
v4 = (unsigned __int8)(v4 + 1);
v6 = *((_BYTE *)a1 + v4 + 8);
v5 = (unsigned __int8)(v6 + v5);
result = *((_BYTE *)a1 + v5 + 8);
*((_BYTE *)a1 + v4 + 8) = result;
*((_BYTE *)a1 + v5 + 8) = v6;
if ( a3 )
{
if ( a2 )
{
result = *a2 ^ *((_BYTE )a1 + (unsigned __int8)(((_BYTE *)a1 + v4 + 8) + v6) + 8);
*a3 = result;
++a2;
++a3;
}
}
--a4;
}
*a1 = v4;
a1[1] = v5;
return result;
}
