ExeEqu

decompiled_code:
__int64 ExeEqu()
{
_BYTE *v0; // rax
_BYTE *v1; // rax

if ( EStTop == EStBot )
{
ErrMsg(21LL);
return 0xFFFFFFFFLL;
}
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
if ( *(_BYTE *)(CBfPtr + 1LL) == 61 )
{
if ( (unsigned int)IncCBP() != -1 )
{
if ( *(_BYTE *)(CBfPtr + 1LL) != 61 )
{
MakDBf(NArgmt, 8LL);
goto LABEL_5;
}
if ( (unsigned int)IncCBP() != -1 )
{
MakDBf(NArgmt, 16LL);
goto LABEL_5;
}
}
return 0xFFFFFFFFLL;
}
MakDBf(NArgmt, 10LL);
LABEL_5:
if ( (CmdMod & 2) != 0 )
{
CmdMod &= 0xFDu;
}
else
{
v0 = (_BYTE *)DBfPtr++;
*v0 = 13;
v1 = (_BYTE *)DBfPtr++;
*v1 = 10;
}
ZDspBf(DBfBeg, DBfPtr - DBfBeg);
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
_BYTE *v0; // rax
_BYTE *v1; // rax

if ( EStTop == EStBot )
{
ErrMsg(21LL);
return 0xFFFFFFFFLL;
}
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
if ( *(_BYTE *)(CBfPtr + 1LL) == 61 )
{
if ( (unsigned int)IncCBP() != -1 )
{
if ( *(_BYTE *)(CBfPtr + 1LL) != 61 )
{
MakDBf(NArgmt, 8LL);
goto LABEL_5;
}
if ( (unsigned int)IncCBP() != -1 )
{
MakDBf(NArgmt, 16LL);
goto LABEL_5;
}
}
return 0xFFFFFFFFLL;
}
MakDBf(NArgmt, 10LL);
LABEL_5:
if ( (CmdMod & 2) != 0 )
{
CmdMod &= 0xFDu;
}
else
{
v0 = (_BYTE *)DBfPtr++;
*v0 = 13;
v1 = (_BYTE *)DBfPtr++;
*v1 = 10;
}
ZDspBf(DBfBeg, DBfPtr - DBfBeg);
return 0LL;
}

original_code:
DEFAULT ExeEqu()
{
 ;
 if (EStTop == EStBot) {
  ErrMsg(21);
  ;
  return (-1);
 }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 if (*(CBfPtr+1) != '=') {
  MakDBf(NArgmt, 10);
 } else {
  if (IncCBP() == (-1)) {
   ;
   return (-1);
  }
  if (*(CBfPtr+1) != '=') {
   MakDBf(NArgmt, 8);
  } else {
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   MakDBf(NArgmt, 16);
  }
 }
 if (CmdMod & '\2') {
  CmdMod &= ~'\2';
 } else {
  *DBfPtr++ = '\015';
  *DBfPtr++ = '\012';
 }
 ZDspBf(DBfBeg, DBfPtr-DBfBeg);
 ;
 return 0;
}

canonical_original_code:
int ExeEqu()
{
 ;
 if (EStTop == EStBot) {
  ErrMsg(21);
  ;
  return (-1);
 }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 if (*(CBfPtr+1) != '=') {
  MakDBf(NArgmt, 10);
 } else {
  if (IncCBP() == (-1)) {
   ;
   return (-1);
  }
  if (*(CBfPtr+1) != '=') {
   MakDBf(NArgmt, 8);
  } else {
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   MakDBf(NArgmt, 16);
  }
 }
 if (CmdMod & '\2') {
  CmdMod &= ~'\2';
 } else {
  *DBfPtr++ = '\015';
  *DBfPtr++ = '\012';
 }
 ZDspBf(DBfBeg, DBfPtr-DBfBeg);
 ;
 return 0;
}


ExeFB

repo: rmblair/tecoc

decompiled_code:
__int64 ExeFB()
{
__int64 result; // rax

if ( (CmdMod & 4) != 0 )
{
ErrStr(8LL, "::FB");
result = 0xFFFFFFFFLL;
}
else
{
SrcTyp = 2;
result = Search(0LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

if ( (CmdMod & 4) != 0 )
{
ErrStr(8LL, "::FB");
result = 0xFFFFFFFFLL;
}
else
{
SrcTyp = 2;
result = Search(0LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

original_code:
DEFAULT ExeFB()
{
 ;
 if (CmdMod & '\4') {
  ErrStr(8, "::FB");
  ;
  return (-1);
 }
 SrcTyp = 2;
 if (Search(0) == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 ;
 return 0;
}

canonical_original_code:
int ExeFB()
{
 ;
 if (CmdMod & '\4') {
  ErrStr(8, "::FB");
  ;
  return (-1);
 }
 SrcTyp = 2;
 if (Search(0) == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 ;
 return 0;
}

return_type: int


ExeCtQ

decompiled_code:
__int64 ExeCtQ()
{
__int64 v0; // rax

CmdMod = 0;
if ( EStTop == EStBot )
return PushEx(0LL, 0LL);
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
v0 = Ln2Chr(NArgmt);
return PushEx(v0, 0LL);
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rax

CmdMod = 0;
if ( EStTop == EStBot )
return PushEx(0LL, 0LL);
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
v0 = Ln2Chr(NArgmt);
return PushEx(v0, 0LL);
}

original_code:
DEFAULT ExeCtQ()
{
 ;
 CmdMod = '\0';
 if (EStTop == EStBot) {
  ;
  return PushEx(0L, 0);
  }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 ;
 return PushEx(Ln2Chr(NArgmt), 0);
}

canonical_original_code:
int ExeCtQ()
{
 ;
 CmdMod = '\0';
 if (EStTop == EStBot) {
  ;
  return PushEx(0L, 0);
  }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 ;
 return PushEx(Ln2Chr(NArgmt), 0);
}


ExeU

decompiled_code:
__int64 ExeU()
{
__int64 result; // rax

if ( EStTop == EStBot )
{
ErrMsg(25LL);
result = 0xFFFFFFFFLL;
}
else if ( (unsigned int)GetNmA() == -1 || (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
{
result = 0xFFFFFFFFLL;
}
else
{
*(_QWORD *)(QR + 16LL) = NArgmt;
if ( (CmdMod & 8) != 0 )
{
result = PushEx(MArgmt, 0LL);
}
else
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

if ( EStTop == EStBot )
{
ErrMsg(25LL);
result = 0xFFFFFFFFLL;
}
else if ( (unsigned int)GetNmA() == -1 || (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
{
result = 0xFFFFFFFFLL;
}
else
{
*(_QWORD *)(QR + 16LL) = NArgmt;
if ( (CmdMod & 8) != 0 )
{
result = PushEx(MArgmt, 0LL);
}
else
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

original_code:
DEFAULT ExeU()
{
 ;
 if (EStTop == EStBot) {
  ErrMsg(25);
  ;
  return (-1);
 }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 QR->Number = NArgmt;
 if (CmdMod & '\10') {
  ;
  return PushEx(MArgmt, 0);
 }
 CmdMod = '\0';
 ;
 return 0;
}

canonical_original_code:
int ExeU()
{
 ;
 if (EStTop == EStBot) {
  ErrMsg(25);
  ;
  return (-1);
 }
 if (GetNmA() == (-1)) {
  ;
  return (-1);
 }
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 QR->Number = NArgmt;
 if (CmdMod & '\10') {
  ;
  return PushEx(MArgmt, 0);
 }
 CmdMod = '\0';
 ;
 return 0;
}


ExeRBr

decompiled_code:
__int64 ExeRBr()
{
char v0; // r12
char v1; // r12
__int64 v2; // rbx
__int64 v3; // rbp
_QWORD *v4; // rax
__int64 result; // rax

v0 = CmdMod;
CmdMod &= 0xFDu;
v1 = v0 & 2;
if ( (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
return 0xFFFFFFFFLL;
v2 = QStTop;
if ( QStTop < 0 )
{
if ( v1 )
return PushEx(0LL, 0LL);
ErrMsg(33LL);
return 0xFFFFFFFFLL;
}
v3 = QStack[3 * QStTop + 1] - QStack[3 * QStTop];
if ( LODWORD(QStack[3 * QStTop + 1]) == LODWORD(QStack[3 * QStTop]) )
{
v4 = (_QWORD *)QR;
if ( *QR )
{
ZFree();
v4 = (_QWORD *)QR;
*(_QWORD *)(QR + 8LL) = 0LL;
*v4 = 0LL;
}
goto LABEL_7;
}
if ( (unsigned int)MakRom((unsigned int)v3) == -1 )
return 0xFFFFFFFFLL;
ZCpyBl(*QR, QStack[3 * v2], (unsigned int)v3);
v4 = (_QWORD *)QR;
*(_QWORD *)(QR + 8LL) = *QR + (int)v3;
LABEL_7:
v4[2] = QStack[3 * v2 + 2];
if ( QStack[3 * v2] )
{
ZFree();
QStack[3 * v2 + 1] = 0LL;
QStack[3 * v2] = 0LL;
}
--QStTop;
QStack[3 * v2 + 2] = 0LL;
result = 0LL;
if ( v1 )
result = PushEx(-1LL, 0LL);
return result;
}

canonical_decompiled_code:
__int64 func0()
{
char v0; // r12
char v1; // r12
__int64 v2; // rbx
__int64 v3; // rbp
_QWORD *v4; // rax
__int64 result; // rax

v0 = CmdMod;
CmdMod &= 0xFDu;
v1 = v0 & 2;
if ( (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
return 0xFFFFFFFFLL;
v2 = QStTop;
if ( QStTop < 0 )
{
if ( v1 )
return PushEx(0LL, 0LL);
ErrMsg(33LL);
return 0xFFFFFFFFLL;
}
v3 = QStack[3 * QStTop + 1] - QStack[3 * QStTop];
if ( LODWORD(QStack[3 * QStTop + 1]) == LODWORD(QStack[3 * QStTop]) )
{
v4 = (_QWORD *)QR;
if ( *QR )
{
ZFree();
v4 = (_QWORD *)QR;
*(_QWORD *)(QR + 8LL) = 0LL;
*v4 = 0LL;
}
goto LABEL_7;
}
if ( (unsigned int)MakRom((unsigned int)v3) == -1 )
return 0xFFFFFFFFLL;
ZCpyBl(*QR, QStack[3 * v2], (unsigned int)v3);
v4 = (_QWORD *)QR;
*(_QWORD *)(QR + 8LL) = *QR + (int)v3;
LABEL_7:
v4[2] = QStack[3 * v2 + 2];
if ( QStack[3 * v2] )
{
ZFree();
QStack[3 * v2 + 1] = 0LL;
QStack[3 * v2] = 0LL;
}
--QStTop;
QStack[3 * v2 + 2] = 0LL;
result = 0LL;
if ( v1 )
result = PushEx(-1LL, 0LL);
return result;
}

original_code:
DEFAULT ExeRBr()
{
 QRptr TmpQRp;
 int TmpSiz;
 BOOLEAN ColonMod;
 ColonMod = (CmdMod & '\2');
 CmdMod &= ~'\2';
 if (IncCBP() == (-1)) {
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 if (QStTop < 0) {
  if (ColonMod) {
   ;
   return PushEx(0L, 0);
  } else {
   ErrMsg(33);
   ;
   return (-1);
  }
 }
 TmpQRp = &QStack[QStTop];
 TmpSiz = TmpQRp->End_P1 - TmpQRp->Start;
 if (TmpSiz == 0) {
  if (QR->Start != (void *)0) {
   ZFree((voidptr)QR->Start);
   QR->Start = QR->End_P1 = (void *)0;
  }
 } else {
  if (MakRom((SIZE_T)TmpSiz) == (-1)) {
   ;
   return (-1);
  }
  ZCpyBl((QR->Start),(TmpQRp->Start),((SIZE_T)TmpSiz));
  QR->End_P1 = QR->Start + TmpSiz;
 }
 QR->Number = TmpQRp->Number;
 if (TmpQRp->Start != (void *)0) {
  ZFree((voidptr)TmpQRp->Start);
  TmpQRp->Start = TmpQRp->End_P1 = (void *)0;
 }
 TmpQRp->Number = 0;
 --QStTop;
 ;
 return (ColonMod) ? PushEx(-1L, 0) : 0;
}

canonical_original_code:
int ExeRBr()
{
 struct QReg *TmpQRp;
 int TmpSiz;
 int ColonMod;
 ColonMod = (CmdMod & '\2');
 CmdMod &= ~'\2';
 if (IncCBP() == (-1)) {
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 if (QStTop < 0) {
  if (ColonMod) {
   ;
   return PushEx(0L, 0);
  } else {
   ErrMsg(33);
   ;
   return (-1);
  }
 }
 TmpQRp = &QStack[QStTop];
 TmpSiz = TmpQRp->End_P1 - TmpQRp->Start;
 if (TmpSiz == 0) {
  if (QR->Start != (void *)0) {
   ZFree((unsigned char *)QR->Start);
   QR->Start = QR->End_P1 = (void *)0;
  }
 } else {
  if (MakRom((unsigned int)TmpSiz) == (-1)) {
   ;
   return (-1);
  }
  ZCpyBl((QR->Start),(TmpQRp->Start),((unsigned int)TmpSiz));
  QR->End_P1 = QR->Start + TmpSiz;
 }
 QR->Number = TmpQRp->Number;
 if (TmpQRp->Start != (void *)0) {
  ZFree((unsigned char *)TmpQRp->Start);
  TmpQRp->Start = TmpQRp->End_P1 = (void *)0;
 }
 TmpQRp->Number = 0;
 --QStTop;
 ;
 return (ColonMod) ? PushEx(-1L, 0) : 0;
}

variable_types: struct QReg { unsigned char *Start; unsigned char *End_P1; long Number; } *

variable_types: TmpSiz int

variable_types: ColonMod int


ExeB

decompiled_code:
__int64 ExeB()
{
return PushEx(0LL, 0LL);
}

canonical_decompiled_code:
__int64 func0()
{
return PushEx(0LL, 0LL);
}

original_code:
DEFAULT ExeB()
{
 ;
 ;
 return PushEx(0L, 0);
}

canonical_original_code:
int ExeB()
{
 ;
 ;
 return PushEx(0L, 0);
}


ExeUnd

decompiled_code:
__int64 ExeUnd()
{
__int64 result; // rax

if ( (CmdMod & 8) != 0 )
{
ErrStr(8LL, "m,n_");
result = 0xFFFFFFFFLL;
}
else if ( (CmdMod & 4) != 0 )
{
ErrStr(8LL, "::_");
result = 0xFFFFFFFFLL;
}
else
{
SrcTyp = 6;
result = Search(0LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

if ( (CmdMod & 8) != 0 )
{
ErrStr(8LL, "m,n_");
result = 0xFFFFFFFFLL;
}
else if ( (CmdMod & 4) != 0 )
{
ErrStr(8LL, "::_");
result = 0xFFFFFFFFLL;
}
else
{
SrcTyp = 6;
result = Search(0LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
result = 0LL;
}
}
return result;
}

original_code:
DEFAULT ExeUnd()
{
 ;
 if (CmdMod & '\10') {
  ErrStr(8, "m,n_");
  ;
  return (-1);
 }
 if (CmdMod & '\4') {
  ErrStr(8, "::_");
  ;
  return (-1);
 }
 SrcTyp = 6;
 if (Search(0) == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 ;
 return 0;
}


ExeCtX

decompiled_code:
__int64 ExeCtX()
{
return DoFlag(&SMFlag);
}

canonical_decompiled_code:
__int64 func0()
{
return DoFlag(&SMFlag);
}

original_code:
DEFAULT ExeCtX()
{
 ;
 ;
 return DoFlag(&SMFlag);
}

canonical_original_code:
int ExeCtX()
{
 ;
 ;
 return DoFlag(&SMFlag);
}


UMinus

decompiled_code:
__int64 UMinus()
{
__int64 result; // rax

result = EStTop;
if ( EStTop == EStBot + 1 )
{
result = 16LL * EStTop;
if ( *(_DWORD *)((char *)&EStack[1] + result) == 1 && EStack[2 * EStTop] == 45LL )
{
EStack[2 * EStTop] = -1LL;
*(_DWORD *)((char *)&EStack[1] + result) = 0;
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = EStTop;
if ( EStTop == EStBot + 1 )
{
result = 16LL * EStTop;
if ( *(_DWORD *)((char *)&EStack[1] + result) == 1 && EStack[2 * EStTop] == 45LL )
{
EStack[2 * EStTop] = -1LL;
*(_DWORD *)((char *)&EStack[1] + result) = 0;
}
}
return result;
}

original_code:
void UMinus()
{
 ESptr ESp;
 if (EStTop == (EStBot + 1)) {
  ESp = &(EStack[EStTop]);
  if (ESp->ElType == 1 &&
      ESp->Elemnt == '-') {
   ESp->Elemnt = -1L;
   ESp->ElType = 0;
  }
 }
}

canonical_original_code:
void UMinus()
{
 struct EStck *ESp;
 if (EStTop == (EStBot + 1)) {
  ESp = &(EStack[EStTop]);
  if (ESp->ElType == 1 &&
      ESp->Elemnt == '-') {
   ESp->Elemnt = -1L;
   ESp->ElType = 0;
  }
 }
}

variable_types: struct EStck { long Elemnt; int ElType; } *

return_type: void


ExeCtZ

decompiled_code:
__int64 ExeCtZ()
{
_QWORD *v0; // rax
__int64 v1; // rdi
__int64 v2; // rdx

v0 = &QRgstr;
v1 = CStEnd - CStBeg + 1LL;
do
{
v2 = v0[1];
v0 += 3;
v1 += v2 - *(v0 - 3);
}
while ( (_QWORD *)(unsigned int)((_DWORD)&QRgstr + 864) != v0 );
return PushEx(v1, 0LL);
}

canonical_decompiled_code:
__int64 func0()
{
_QWORD *v0; // rax
__int64 v1; // rdi
__int64 v2; // rdx

v0 = &QRgstr;
v1 = CStEnd - CStBeg + 1LL;
do
{
v2 = v0[1];
v0 += 3;
v1 += v2 - *(v0 - 3);
}
while ( (_QWORD *)(unsigned int)((_DWORD)&QRgstr + 864) != v0 );
return PushEx(v1, 0LL);
}

original_code:
DEFAULT ExeCtZ()
{
 LONG TmpLng;
 WORD TmpWrd;
 ;
 TmpLng = (CStEnd - CStBeg) + 1;
 for (TmpWrd = 0; TmpWrd < 36; ++TmpWrd) {
  TmpLng += QRgstr[TmpWrd].End_P1 - QRgstr[TmpWrd].Start;
 }
 return PushEx(TmpLng,0);
}

canonical_original_code:
int ExeCtZ()
{
 long TmpLng;
 short TmpWrd;
 ;
 TmpLng = (CStEnd - CStBeg) + 1;
 for (TmpWrd = 0; TmpWrd < 36; ++TmpWrd) {
  TmpLng += QRgstr[TmpWrd].End_P1 - QRgstr[TmpWrd].Start;
 }
 return PushEx(TmpLng,0);
}

variable_types: TmpLng long

variable_types: TmpWrd short


ExeCtI

decompiled_code:
__int64 ExeCtI()
{
if ( (unsigned int)FindES(27LL) == -1 || (unsigned int)InsStr(ArgPtr - 1LL, CBfPtr - ArgPtr + 1LL) == -1 )
return 0xFFFFFFFFLL;
CmdMod = 0;
EStTop = EStBot;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
if ( (unsigned int)FindES(27LL) == -1 || (unsigned int)InsStr(ArgPtr - 1LL, CBfPtr - ArgPtr + 1LL) == -1 )
return 0xFFFFFFFFLL;
CmdMod = 0;
EStTop = EStBot;
return 0LL;
}

original_code:
DEFAULT ExeCtI()
{
 ;
 if (FindES('\033') == (-1)) {
  ;
  return (-1);
 }
 if (InsStr(ArgPtr-1, (CBfPtr-ArgPtr)+1) == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}

canonical_original_code:
int ExeCtI()
{
 ;
 if (FindES('\033') == (-1)) {
  ;
  return (-1);
 }
 if (InsStr(ArgPtr-1, (CBfPtr-ArgPtr)+1) == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}


Replac

decompiled_code:
__int64 Replac()
{
__int64 result; // rax

result = Search(1LL);
if ( (_DWORD)result != -1 )
{
result = Matchd;
if ( Matchd )
{
GapBeg += RefLen;
result = (unsigned int)-((unsigned int)InsStr(ArgPtr, CBfPtr - ArgPtr) == -1);
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = Search(1LL);
if ( (_DWORD)result != -1 )
{
result = Matchd;
if ( Matchd )
{
GapBeg += RefLen;
result = (unsigned int)-((unsigned int)InsStr(ArgPtr, CBfPtr - ArgPtr) == -1);
}
}
return result;
}

original_code:
DEFAULT Replac()
{
 ;
 if (Search(1) == (-1)) {
  ;
  return (-1);
 }
 if (Matchd) {
  GapBeg += RefLen;
  if (InsStr(ArgPtr, CBfPtr-ArgPtr) == (-1)) {
   ;
   return (-1);
  }
 }
 ;
 return 0;
}

canonical_original_code:
int Replac()
{
 ;
 if (Search(1) == (-1)) {
  ;
  return (-1);
 }
 if (Matchd) {
  GapBeg += RefLen;
  if (InsStr(ArgPtr, CBfPtr-ArgPtr) == (-1)) {
   ;
   return (-1);
  }
 }
 ;
 return 0;
}


ExeM

decompiled_code:
__int64 ExeM()
{
char v0; // bl
unsigned int v1; // er12
__int64 v3; // rax
__int64 v4; // rdx

if ( (unsigned int)IncCBP() == -1 )
goto LABEL_14;
v0 = *CBfPtr;
if ( (unsigned int)FindQR() == -1 )
goto LABEL_14;
v1 = 0;
if ( *QR )
{
if ( (unsigned int)PshMac(*QR, *(_QWORD *)(QR + 8LL)) == -1 )
goto LABEL_14;
if ( (CmdMod & 2) != 0 || v0 == 46 )
{
CmdMod &= 0xFDu;
}
else
{
v3 = ZAlloc(864LL);
if ( !v3 )
{
v1 = -1;
ErrMsg(18LL);
return v1;
}
MStack[5 * MStTop + 4] = v3;
v4 = v3 + 864;
do
{
*(_QWORD *)(v3 + 8) = 0LL;
v3 += 24LL;
*(_QWORD *)(v3 - 24) = 0LL;
*(_QWORD *)(v3 - 8) = 0LL;
}
while ( v3 != v4 );
}
v1 = ExeCSt();
if ( (unsigned int)PopMac() == -1 )
LABEL_14:
v1 = -1;
}
return v1;
}

canonical_decompiled_code:
__int64 func0()
{
char v0; // bl
unsigned int v1; // er12
__int64 v3; // rax
__int64 v4; // rdx

if ( (unsigned int)IncCBP() == -1 )
goto LABEL_14;
v0 = *CBfPtr;
if ( (unsigned int)FindQR() == -1 )
goto LABEL_14;
v1 = 0;
if ( *QR )
{
if ( (unsigned int)PshMac(*QR, *(_QWORD *)(QR + 8LL)) == -1 )
goto LABEL_14;
if ( (CmdMod & 2) != 0 || v0 == 46 )
{
CmdMod &= 0xFDu;
}
else
{
v3 = ZAlloc(864LL);
if ( !v3 )
{
v1 = -1;
ErrMsg(18LL);
return v1;
}
MStack[5 * MStTop + 4] = v3;
v4 = v3 + 864;
do
{
*(_QWORD *)(v3 + 8) = 0LL;
v3 += 24LL;
*(_QWORD *)(v3 - 24) = 0LL;
*(_QWORD *)(v3 - 8) = 0LL;
}
while ( v3 != v4 );
}
v1 = ExeCSt();
if ( (unsigned int)PopMac() == -1 )
LABEL_14:
v1 = -1;
}
return v1;
}

original_code:
DEFAULT ExeM()
{
    DEFAULT status;
 BOOLEAN islocal;
    ;
    if (IncCBP() == (-1)) {
 ;
 return (-1);
    }
 islocal = (*CBfPtr=='.');
    if (FindQR() == (-1)) {
 ;
 return (-1);
    }
    if (QR->Start == (void *)0) {
 ;
 return 0;
    }
    if (PshMac(QR->Start, QR->End_P1) == (-1)) {
        ;
 return (-1);
    }
    if ((CmdMod & '\2') == 0&&!islocal) {
 QRptr QRp;
 WORD i;
 QRp = (QRptr)ZAlloc(36 * sizeof(struct QReg));
 if (QRp == (void *)0) {
     ErrMsg(18);
     ;
     return (-1);
 }
 MStack[MStTop].QRgstr = QRp;
 for (i = 0; i < 36; ++i, ++QRp) {
     QRp->Start = QRp->End_P1 = (void *)0;
     QRp->Number = 0;
 }
    }
    else CmdMod &= ~'\2';
    status = ExeCSt();
    if (PopMac() == (-1)) {
        ;
 return (-1);
    }
    ;
    return status;
}

canonical_original_code:
int ExeM()
{
    int status;
 int islocal;
    ;
    if (IncCBP() == (-1)) {
 ;
 return (-1);
    }
 islocal = (*CBfPtr=='.');
    if (FindQR() == (-1)) {
 ;
 return (-1);
    }
    if (QR->Start == (void *)0) {
 ;
 return 0;
    }
    if (PshMac(QR->Start, QR->End_P1) == (-1)) {
        ;
 return (-1);
    }
    if ((CmdMod & '\2') == 0&&!islocal) {
 struct QReg *QRp;
 short i;
 QRp = (struct QReg *)ZAlloc(36 * sizeof(struct QReg));
 if (QRp == (void *)0) {
     ErrMsg(18);
     ;
     return (-1);
 }
 MStack[MStTop].QRgstr = QRp;
 for (i = 0; i < 36; ++i, ++QRp) {
     QRp->Start = QRp->End_P1 = (void *)0;
     QRp->Number = 0;
 }
    }
    else CmdMod &= ~'\2';
    status = ExeCSt();
    if (PopMac() == (-1)) {
        ;
 return (-1);
    }
    ;
    return status;
}

variable_types: status int

variable_types: islocal int

variable_types: i short

user_defined_types: struct QReg { unsigned char *Start; unsigned char *End_P1; long Number; }


ExeCtD

decompiled_code:
__int64 ExeCtD()
{
__int64 result; // rax

Radix = 10;
result = 0LL;
CmdMod = 0;
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

Radix = 10;
result = 0LL;
CmdMod = 0;
return result;
}

original_code:
DEFAULT ExeCtD()
{
 ;
 Radix = 10;
 CmdMod = '\0';
 ;
 return 0;
}

canonical_original_code:
int ExeCtD()
{
 ;
 Radix = 10;
 CmdMod = '\0';
 ;
 return 0;
}


ExeBSl

decompiled_code:
__int64 ExeBSl()
{
unsigned int v0; // er12
__int64 v1; // rax
__int64 v2; // rdi
int v3; // ebx
__int64 v4; // rbp
char v5; // al
__int64 v6; // rcx
_BYTE *v7; // rax
__int64 v8; // rax
char v9; // dl
char v10; // si
_BYTE *v12; // rdx
_BYTE *v13; // rdx

if ( EStTop == EStBot || (v0 = EStack[4 * EStTop + 2]) != 0 )
{
v1 = GapEnd;
RefLen = 0LL;
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
if ( (_BYTE)v2 == 45 )
{
RefLen = -1LL;
++GapEnd;
v13 = (_BYTE *)GapBeg++;
*v13 = *(_BYTE *)(v1 + 1);
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
v3 = 1;
LABEL_6:
v4 = 0LL;
while ( (unsigned int)IsRadx(v2) )
{
v6 = GapEnd;
--RefLen;
++GapEnd;
v7 = (_BYTE *)GapBeg++;
*v7 = *(_BYTE *)(v6 + 1);
v8 = (char)*GapEnd;
v9 = *((_BYTE *)&ChrMsk + v8);
if ( (v9 & 0x10) != 0 )
{
v5 = v8 - 48;
}
else
{
v10 = v8 - 55;
v5 = v8 - 87;
if ( (v9 & 0x80) != 0 )
v5 = v10;
}
v4 = v5 + v4 * Radix;
if ( GapEnd == EBfEnd )
break;
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
}
if ( v3 )
v4 = -v4;
goto LABEL_21;
}
}
else
{
v3 = 0;
if ( (_BYTE)v2 != 43 )
goto LABEL_6;
RefLen = -1LL;
++GapEnd;
v12 = (_BYTE *)GapBeg++;
*v12 = *(_BYTE *)(v1 + 1);
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
goto LABEL_6;
}
}
}
v4 = 0LL;
LABEL_21:
CmdMod = 0;
return PushEx(v4, 0LL);
}
if ( (unsigned int)GetNmA() == -1 )
return (unsigned int)-1;
MakDBf(NArgmt, Radix);
if ( (unsigned int)InsStr(DBfBeg, DBfPtr - DBfBeg) == -1 )
return (unsigned int)-1;
CmdMod = 0;
EStTop = EStBot;
return v0;
}

canonical_decompiled_code:
__int64 func0()
{
unsigned int v0; // er12
__int64 v1; // rax
__int64 v2; // rdi
int v3; // ebx
__int64 v4; // rbp
char v5; // al
__int64 v6; // rcx
_BYTE *v7; // rax
__int64 v8; // rax
char v9; // dl
char v10; // si
_BYTE *v12; // rdx
_BYTE *v13; // rdx

if ( EStTop == EStBot || (v0 = EStack[4 * EStTop + 2]) != 0 )
{
v1 = GapEnd;
RefLen = 0LL;
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
if ( (_BYTE)v2 == 45 )
{
RefLen = -1LL;
++GapEnd;
v13 = (_BYTE *)GapBeg++;
*v13 = *(_BYTE *)(v1 + 1);
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
v3 = 1;
LABEL_6:
v4 = 0LL;
while ( (unsigned int)IsRadx(v2) )
{
v6 = GapEnd;
--RefLen;
++GapEnd;
v7 = (_BYTE *)GapBeg++;
*v7 = *(_BYTE *)(v6 + 1);
v8 = (char)*GapEnd;
v9 = *((_BYTE *)&ChrMsk + v8);
if ( (v9 & 0x10) != 0 )
{
v5 = v8 - 48;
}
else
{
v10 = v8 - 55;
v5 = v8 - 87;
if ( (v9 & 0x80) != 0 )
v5 = v10;
}
v4 = v5 + v4 * Radix;
if ( GapEnd == EBfEnd )
break;
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
}
if ( v3 )
v4 = -v4;
goto LABEL_21;
}
}
else
{
v3 = 0;
if ( (_BYTE)v2 != 43 )
goto LABEL_6;
RefLen = -1LL;
++GapEnd;
v12 = (_BYTE *)GapBeg++;
*v12 = *(_BYTE *)(v1 + 1);
if ( GapEnd != EBfEnd )
{
v2 = *(unsigned __int8 *)(GapEnd + 1LL);
goto LABEL_6;
}
}
}
v4 = 0LL;
LABEL_21:
CmdMod = 0;
return PushEx(v4, 0LL);
}
if ( (unsigned int)GetNmA() == -1 )
return (unsigned int)-1;
MakDBf(NArgmt, Radix);
if ( (unsigned int)InsStr(DBfBeg, DBfPtr - DBfBeg) == -1 )
return (unsigned int)-1;
CmdMod = 0;
EStTop = EStBot;
return v0;
}

original_code:
DEFAULT ExeBSl()
{
    ;
    if ((EStTop == EStBot) ||
 (EStack[EStTop].ElType != 0)) {
 LONG StrVal = 0;
 RefLen=0;
 if (GapEnd != EBfEnd) {
     BOOLEAN negative = 0;
     char NxtChr;
     if (*(GapEnd+1) == '-') {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
  negative = 1;
     } else if (*(GapEnd+1) == '+') {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
     }
     while ((GapEnd != EBfEnd) && (IsRadx(*(GapEnd+1)))) {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
  NxtChr = *GapEnd;
  if ((ChrMsk[(NxtChr)] & '\20'))
      NxtChr -= '0';
  else if ((ChrMsk[(NxtChr)] & '\200'))
      NxtChr -= '\67';
  else
      NxtChr -= '\127';
  StrVal = (StrVal * Radix) + NxtChr;
     }
     if (negative)
  StrVal = -StrVal;
 }
 CmdMod = '\0';
 return PushEx(StrVal,0);
    }
    if (GetNmA() == (-1)) {
 ;
 return (-1);
    }
    MakDBf(NArgmt, Radix);
    if (InsStr(DBfBeg, DBfPtr-DBfBeg) == (-1)) {
 ;
 return (-1);
    }
    CmdMod = '\0';
    EStTop = EStBot;
    ;
    return 0;
}

canonical_original_code:
int ExeBSl()
{
    ;
    if ((EStTop == EStBot) ||
 (EStack[EStTop].ElType != 0)) {
 long StrVal = 0;
 RefLen=0;
 if (GapEnd != EBfEnd) {
     int negative = 0;
     char NxtChr;
     if (*(GapEnd+1) == '-') {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
  negative = 1;
     } else if (*(GapEnd+1) == '+') {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
     }
     while ((GapEnd != EBfEnd) && (IsRadx(*(GapEnd+1)))) {
  RefLen--;
  GapEnd++;
  *GapBeg++ = *GapEnd;
  NxtChr = *GapEnd;
  if ((ChrMsk[(NxtChr)] & '\20'))
      NxtChr -= '0';
  else if ((ChrMsk[(NxtChr)] & '\200'))
      NxtChr -= '\67';
  else
      NxtChr -= '\127';
  StrVal = (StrVal * Radix) + NxtChr;
     }
     if (negative)
  StrVal = -StrVal;
 }
 CmdMod = '\0';
 return PushEx(StrVal,0);
    }
    if (GetNmA() == (-1)) {
 ;
 return (-1);
    }
    MakDBf(NArgmt, Radix);
    if (InsStr(DBfBeg, DBfPtr-DBfBeg) == (-1)) {
 ;
 return (-1);
    }
    CmdMod = '\0';
    EStTop = EStBot;
    ;
    return 0;
}

variable_types: StrVal long

variable_types: negative int

variable_types: NxtChr char


ExeUsc

decompiled_code:
__int64 ExeUsc()
{
return PushEx(31LL, 1LL);
}

canonical_decompiled_code:
__int64 func0()
{
return PushEx(31LL, 1LL);
}

original_code:
DEFAULT ExeUsc()
{
 ;
 ;
 return PushEx((LONG)'\037', 1);
}

canonical_original_code:
int ExeUsc()
{
 ;
 ;
 return PushEx((long)'\037', 1);
}


ExeNul

decompiled_code:
__int64 ExeNul()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
DEFAULT ExeNul()
{
 return 0;
}

canonical_original_code:
int ExeNul()
{
 return 0;
}


ExeIll

decompiled_code:
__int64 ExeIll()
{
ErrChr(8LL, (unsigned __int8)*CBfPtr);
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
ErrChr(8LL, (unsigned __int8)*CBfPtr);
return 0xFFFFFFFFLL;
}

original_code:
DEFAULT ExeIll()
{
 ErrChr(8, *CBfPtr);
 return (-1);
}

canonical_original_code:
int ExeIll()
{
 ErrChr(8, *CBfPtr);
 return (-1);
}


ExeCtE

decompiled_code:
__int64 ExeCtE()
{
__int64 result; // rax

if ( EStTop <= EStBot )
{
CmdMod = 0;
result = PushEx(FFPage, 0LL);
}
else
{
result = GetNmA();
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
FFPage = -(__int64)(NArgmt == -1LL);
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

if ( EStTop <= EStBot )
{
CmdMod = 0;
result = PushEx(FFPage, 0LL);
}
else
{
result = GetNmA();
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
FFPage = -(__int64)(NArgmt == -1LL);
result = 0LL;
}
}
return result;
}

original_code:
DEFAULT ExeCtE()
{
    ;
   if (EStTop > EStBot) {
 if (GetNmA() == (-1)) {
     ;
     return (-1);
 }
 FFPage = (NArgmt == -1) ? -1 : 0;
 CmdMod = '\0';
 ;
 return 0;
    }
    CmdMod = '\0';
    ;
    return PushEx(FFPage, 0);
}

canonical_original_code:
int ExeCtE()
{
    ;
   if (EStTop > EStBot) {
 if (GetNmA() == (-1)) {
     ;
     return (-1);
 }
 FFPage = (NArgmt == -1) ? -1 : 0;
 CmdMod = '\0';
 ;
 return 0;
    }
    CmdMod = '\0';
    ;
    return PushEx(FFPage, 0);
}


DoFBFC

decompiled_code:
__int64 DoFBFC()
{
__int64 v0; // rdi
__int64 v1; // rax
__int64 v2; // rsi
__int64 v3; // rdx
__int64 v4; // rbx
unsigned int v5; // er12
__int64 result; // rax
__int64 v7; // rbx
__int64 v8; // rbx
__int64 v9; // rax
int v10; // ebx
int v12; // edx
__int64 v13; // rbx
int v14; // er12

v0 = NArgmt;
if ( (CmdMod & 8) != 0 )
{
SIncrm = 2LL * (MArgmt < NArgmt) - 1;
if ( (unsigned int)GetAra() == -1 )
return (unsigned int)-1;
v1 = AraBeg;
v2 = GapBeg;
v3 = AraEnd;
if ( AraBeg < GapBeg && (v0 = GapEnd, GapEnd < AraEnd) )
{
v14 = AraEnd - GapEnd;
v4 = AraEnd - GapEnd;
v2 = GapBeg - v4;
GapEnd -= v4;
v0 = GapEnd + 1LL;
GapBeg -= v4;
ZCpyBl(GapEnd + 1LL);
if ( SIncrm != 1LL )
{
EBPtr1 = AraEnd;
if ( v14 )
{
v1 = GapEnd + 1LL;
goto LABEL_8;
}
v1 = AraBeg;
LABEL_7:
v4 = 0LL;
LABEL_8:
EndSAr = v1;
goto LABEL_9;
}
v3 = AraEnd;
v1 = GapEnd + 1LL;
if ( v14 )
{
LABEL_29:
EBPtr1 = v1;
EndSAr = v3;
LABEL_9:
RhtSid = EBfEnd;
if ( (unsigned int)SSerch(v0, v2, v3) != -1 )
{
v5 = Matchd;
if ( !Matchd )
{
if ( (_DWORD)v4 )
{
ZCpyBl(GapBeg);
GapBeg += v4;
result = v5;
GapEnd += v4;
return result;
}
return 0;
}
goto LABEL_17;
}
return (unsigned int)-1;
}
v1 = AraBeg;
}
else if ( SIncrm != 1LL )
{
EBPtr1 = AraEnd;
goto LABEL_7;
}
v4 = 0LL;
goto LABEL_29;
}
if ( NArgmt <= 0 )
{
v13 = GapBeg;
SIncrm = -1LL;
EBPtr1 = GapBeg - 1LL;
EndSAr = Ln2Chr(NArgmt) + v13;
v9 = GapBeg - 1LL;
}
else
{
v7 = GapEnd;
SIncrm = 1LL;
EBPtr1 = GapEnd + 1LL;
v8 = Ln2Chr(NArgmt) + v7;
v9 = EBfEnd;
EndSAr = v8;
}
RhtSid = v9;
if ( (unsigned int)((__int64 (*)(void))SSerch)() == -1 )
return (unsigned int)-1;
if ( !Matchd )
return 0;
LABEL_17:
if ( EBPtr2 >= GapEnd )
{
v10 = EBPtr2 - GapEnd;
ZCpyBl(GapBeg);
GapBeg += v10;
GapEnd += v10;
return 0;
}
v12 = GapBeg - 1 - EBPtr2;
GapEnd -= v12;
GapBeg -= v12;
ZCpyBl(GapEnd + 1LL);
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rdi
__int64 v1; // rax
__int64 v2; // rsi
__int64 v3; // rdx
__int64 v4; // rbx
unsigned int v5; // er12
__int64 result; // rax
__int64 v7; // rbx
__int64 v8; // rbx
__int64 v9; // rax
int v10; // ebx
int v12; // edx
__int64 v13; // rbx
int v14; // er12

v0 = NArgmt;
if ( (CmdMod & 8) != 0 )
{
SIncrm = 2LL * (MArgmt < NArgmt) - 1;
if ( (unsigned int)GetAra() == -1 )
return (unsigned int)-1;
v1 = AraBeg;
v2 = GapBeg;
v3 = AraEnd;
if ( AraBeg < GapBeg && (v0 = GapEnd, GapEnd < AraEnd) )
{
v14 = AraEnd - GapEnd;
v4 = AraEnd - GapEnd;
v2 = GapBeg - v4;
GapEnd -= v4;
v0 = GapEnd + 1LL;
GapBeg -= v4;
ZCpyBl(GapEnd + 1LL);
if ( SIncrm != 1LL )
{
EBPtr1 = AraEnd;
if ( v14 )
{
v1 = GapEnd + 1LL;
goto LABEL_8;
}
v1 = AraBeg;
LABEL_7:
v4 = 0LL;
LABEL_8:
EndSAr = v1;
goto LABEL_9;
}
v3 = AraEnd;
v1 = GapEnd + 1LL;
if ( v14 )
{
LABEL_29:
EBPtr1 = v1;
EndSAr = v3;
LABEL_9:
RhtSid = EBfEnd;
if ( (unsigned int)SSerch(v0, v2, v3) != -1 )
{
v5 = Matchd;
if ( !Matchd )
{
if ( (_DWORD)v4 )
{
ZCpyBl(GapBeg);
GapBeg += v4;
result = v5;
GapEnd += v4;
return result;
}
return 0;
}
goto LABEL_17;
}
return (unsigned int)-1;
}
v1 = AraBeg;
}
else if ( SIncrm != 1LL )
{
EBPtr1 = AraEnd;
goto LABEL_7;
}
v4 = 0LL;
goto LABEL_29;
}
if ( NArgmt <= 0 )
{
v13 = GapBeg;
SIncrm = -1LL;
EBPtr1 = GapBeg - 1LL;
EndSAr = Ln2Chr(NArgmt) + v13;
v9 = GapBeg - 1LL;
}
else
{
v7 = GapEnd;
SIncrm = 1LL;
EBPtr1 = GapEnd + 1LL;
v8 = Ln2Chr(NArgmt) + v7;
v9 = EBfEnd;
EndSAr = v8;
}
RhtSid = v9;
if ( (unsigned int)((__int64 (*)(void))SSerch)() == -1 )
return (unsigned int)-1;
if ( !Matchd )
return 0;
LABEL_17:
if ( EBPtr2 >= GapEnd )
{
v10 = EBPtr2 - GapEnd;
ZCpyBl(GapBeg);
GapBeg += v10;
GapEnd += v10;
return 0;
}
v12 = GapBeg - 1 - EBPtr2;
GapEnd -= v12;
GapBeg -= v12;
ZCpyBl(GapEnd + 1LL);
return 0LL;
}

original_code:
static DEFAULT DoFBFC()
{
    int HowFar;
    int Shuffl;
    Shuffl = 0;
    if (CmdMod & '\10') {
 SIncrm = (MArgmt < NArgmt) ? 1 : -1;
 if (GetAra() == (-1)) {
     ;
     return (-1);
 }
 if ((AraBeg < GapBeg) && (AraEnd > GapEnd)) {
     Shuffl = AraEnd - GapEnd;
     GapBeg -= Shuffl;
     GapEnd -= Shuffl;
     ZCpyBl((GapEnd+1),(GapBeg),((SIZE_T)Shuffl));
 }
 if (SIncrm == 1) {
     EBPtr1 = (Shuffl!=0 ? GapEnd + 1 : AraBeg);
     EndSAr = AraEnd;
 } else {
     EBPtr1 = AraEnd;
     EndSAr = (Shuffl!=0 ? GapEnd + 1 : AraBeg);
 }
 RhtSid = EBfEnd;
    } else {
 if (NArgmt > 0) {
     SIncrm = 1;
     EBPtr1 = GapEnd + 1;
     EndSAr = GapEnd + Ln2Chr(NArgmt);
     RhtSid = EBfEnd;
 } else {
     SIncrm = -1;
     EBPtr1 = GapBeg - 1;
     EndSAr = GapBeg + Ln2Chr(NArgmt);
     RhtSid = GapBeg - 1;
 }
    }
    if (SSerch() == (-1)) {
 ;
 return (-1);
    }
    if (Matchd) {
 if (EBPtr2 >= GapEnd) {
     HowFar = EBPtr2 - GapEnd;
     ZCpyBl((GapBeg),(GapEnd+1),((SIZE_T)HowFar));
     GapBeg += HowFar;
     GapEnd += HowFar;
 } else {
     HowFar = (GapBeg-1) - EBPtr2;
     GapBeg -= HowFar;
     GapEnd -= HowFar;
     ZCpyBl((GapEnd+1),(GapBeg),((SIZE_T)HowFar));
 }
    } else {
 if (Shuffl != 0) {
     ZCpyBl((GapBeg),(GapEnd+1),((SIZE_T)Shuffl));
     GapBeg += Shuffl;
     GapEnd += Shuffl;
 }
    }
    return 0;
}

canonical_original_code:
static int DoFBFC()
{
    int HowFar;
    int Shuffl;
    Shuffl = 0;
    if (CmdMod & '\10') {
 SIncrm = (MArgmt < NArgmt) ? 1 : -1;
 if (GetAra() == (-1)) {
     ;
     return (-1);
 }
 if ((AraBeg < GapBeg) && (AraEnd > GapEnd)) {
     Shuffl = AraEnd - GapEnd;
     GapBeg -= Shuffl;
     GapEnd -= Shuffl;
     ZCpyBl((GapEnd+1),(GapBeg),((unsigned int)Shuffl));
 }
 if (SIncrm == 1) {
     EBPtr1 = (Shuffl!=0 ? GapEnd + 1 : AraBeg);
     EndSAr = AraEnd;
 } else {
     EBPtr1 = AraEnd;
     EndSAr = (Shuffl!=0 ? GapEnd + 1 : AraBeg);
 }
 RhtSid = EBfEnd;
    } else {
 if (NArgmt > 0) {
     SIncrm = 1;
     EBPtr1 = GapEnd + 1;
     EndSAr = GapEnd + Ln2Chr(NArgmt);
     RhtSid = EBfEnd;
 } else {
     SIncrm = -1;
     EBPtr1 = GapBeg - 1;
     EndSAr = GapBeg + Ln2Chr(NArgmt);
     RhtSid = GapBeg - 1;
 }
    }
    if (SSerch() == (-1)) {
 ;
 return (-1);
    }
    if (Matchd) {
 if (EBPtr2 >= GapEnd) {
     HowFar = EBPtr2 - GapEnd;
     ZCpyBl((GapBeg),(GapEnd+1),((unsigned int)HowFar));
     GapBeg += HowFar;
     GapEnd += HowFar;
 } else {
     HowFar = (GapBeg-1) - EBPtr2;
     GapBeg -= HowFar;
     GapEnd -= HowFar;
     ZCpyBl((GapEnd+1),(GapBeg),((unsigned int)HowFar));
 }
    } else {
 if (Shuffl != 0) {
     ZCpyBl((GapBeg),(GapEnd+1),((unsigned int)Shuffl));
     GapBeg += Shuffl;
     GapEnd += Shuffl;
 }
    }
    return 0;
}

variable_types: HowFar int

variable_types: Shuffl int


SrcLop

decompiled_code:
__int64 __fastcall SrcLop(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rdx
__int64 result; // rax
int v8; // eax
int v9; // ebx
__int64 v10; // rdx
__int64 v11; // rax
__int64 v12; // rcx
int v13; // edx

if ( SrcTyp == 2 )
return DoFBFC();
if ( NArgmt <= 0 )
{
v10 = EBfBeg;
SIncrm = -1LL;
v11 = GapBeg - 1LL;
EndSAr = EBfBeg;
RhtSid = GapBeg - 1LL;
while ( 1 )
{
EBPtr1 = v11;
if ( (unsigned int)SSerch(a1, a2, v10) == -1 )
return 0xFFFFFFFFLL;
if ( !Matchd )
break;
++NArgmt;
if ( NArgmt >= 0 )
goto LABEL_27;
v11 = EBPtr1 - 1LL;
}
if ( ((SrcTyp - 3) & 0xFFFD) != 0 )
return ExeNYI();
goto LABEL_15;
}
v2 = EBfEnd;
v3 = GapEnd;
SIncrm = 1LL;
RhtSid = EBfEnd;
EndSAr = EBfEnd;
while ( 2 )
{
EBPtr1 = v3 + 1;
if ( (unsigned int)SSerch(a1, a2, v2) == -1 )
return 0xFFFFFFFFLL;
a1 = Matchd;
if ( Matchd )
{
v4 = --NArgmt;
if ( (EdFlag & 0x40) == 0 )
{
v2 = EBPtr2;
EBPtr1 = EBPtr2;
}
goto LABEL_6;
}
switch ( SrcTyp )
{
case 1:
v5 = EBfBeg;
goto LABEL_12;
case 3:
case 5:
goto LABEL_14;
case 4:
a2 = *((unsigned int *)&IsEofI + CurInp);
if ( !(_DWORD)a2 )
{
if ( (unsigned int)SinglP() == -1 )
return 0xFFFFFFFFLL;
LABEL_32:
EBPtr1 = GapEnd + 1LL;
RhtSid = EBfEnd;
EndSAr = EBfEnd;
LABEL_33:
v4 = NArgmt;
LABEL_6:
if ( v4 <= 0 )
{
v8 = Matchd;
LABEL_26:
if ( v8 )
{
LABEL_27:
if ( SrcTyp != 3 )
{
if ( SIncrm == 1LL || GapEnd < EBPtr2 )
{
v9 = EBPtr2 - GapEnd;
ZCpyBl(GapBeg);
GapBeg += v9;
GapEnd += v9;
result = 0LL;
}
else
{
v13 = GapBeg - 1 - EBPtr2;
GapBeg -= v13;
GapEnd -= v13;
ZCpyBl(GapEnd + 1LL);
result = 0LL;
}
return result;
}
if ( SIncrm == 1LL || (GapBeg = EBPtr1, GapEnd < EBPtr2) )
{
GapEnd = EBPtr2;
return 0LL;
}
return 0LL;
}
LABEL_15:
if ( (EdFlag & 0x10) == 0 )
{
v12 = GapBeg - EBfBeg;
GapEnd -= v12;
GapBeg -= v12;
ZCpyBl(GapEnd + 1LL);
return 0LL;
}
return 0LL;
}
v3 = EBPtr1;
continue;
}
if ( (unsigned int)WrPage(CurOut, EBfBeg, EBfEnd, FFPage) != -1 )
{
NArgmt = 0LL;
GapBeg = EBfBeg;
GapEnd = EBfEnd;
v8 = Matchd;
goto LABEL_26;
}
return 0xFFFFFFFFLL;
case 6:
v5 = EBfBeg;
if ( (EdFlag & 2) != 0 || !*((_DWORD *)&IsOpnO + CurOut) )
{
LABEL_12:
v6 = EBfEnd;
}
else if ( GapBeg != EBfBeg || (v6 = EBfEnd, GapEnd != EBfEnd) )
{
ErrMsg(42LL);
return 0xFFFFFFFFLL;
}
GapBeg = v5;
GapEnd = v6;
if ( *((_DWORD *)&IsEofI + CurInp) )
{
LABEL_14:
NArgmt = 0LL;
goto LABEL_15;
}
if ( (unsigned int)RdPage() == -1 )
return 0xFFFFFFFFLL;
goto LABEL_32;
default:
goto LABEL_33;
}
}
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rdx
__int64 result; // rax
int v8; // eax
int v9; // ebx
__int64 v10; // rdx
__int64 v11; // rax
__int64 v12; // rcx
int v13; // edx

if ( SrcTyp == 2 )
return func0();
if ( NArgmt <= 0 )
{
v10 = EBfBeg;
SIncrm = -1LL;
v11 = GapBeg - 1LL;
EndSAr = EBfBeg;
RhtSid = GapBeg - 1LL;
while ( 1 )
{
EBPtr1 = v11;
if ( (unsigned int)SSerch(a1, a2, v10) == -1 )
return 0xFFFFFFFFLL;
if ( !Matchd )
break;
++NArgmt;
if ( NArgmt >= 0 )
goto LABEL_27;
v11 = EBPtr1 - 1LL;
}
if ( ((SrcTyp - 3) & 0xFFFD) != 0 )
return ExeNYI();
goto LABEL_15;
}
v2 = EBfEnd;
v3 = GapEnd;
SIncrm = 1LL;
RhtSid = EBfEnd;
EndSAr = EBfEnd;
while ( 2 )
{
EBPtr1 = v3 + 1;
if ( (unsigned int)SSerch(a1, a2, v2) == -1 )
return 0xFFFFFFFFLL;
a1 = Matchd;
if ( Matchd )
{
v4 = --NArgmt;
if ( (EdFlag & 0x40) == 0 )
{
v2 = EBPtr2;
EBPtr1 = EBPtr2;
}
goto LABEL_6;
}
switch ( SrcTyp )
{
case 1:
v5 = EBfBeg;
goto LABEL_12;
case 3:
case 5:
goto LABEL_14;
case 4:
a2 = *((unsigned int *)&IsEofI + CurInp);
if ( !(_DWORD)a2 )
{
if ( (unsigned int)SinglP() == -1 )
return 0xFFFFFFFFLL;
LABEL_32:
EBPtr1 = GapEnd + 1LL;
RhtSid = EBfEnd;
EndSAr = EBfEnd;
LABEL_33:
v4 = NArgmt;
LABEL_6:
if ( v4 <= 0 )
{
v8 = Matchd;
LABEL_26:
if ( v8 )
{
LABEL_27:
if ( SrcTyp != 3 )
{
if ( SIncrm == 1LL || GapEnd < EBPtr2 )
{
v9 = EBPtr2 - GapEnd;
ZCpyBl(GapBeg);
GapBeg += v9;
GapEnd += v9;
result = 0LL;
}
else
{
v13 = GapBeg - 1 - EBPtr2;
GapBeg -= v13;
GapEnd -= v13;
ZCpyBl(GapEnd + 1LL);
result = 0LL;
}
return result;
}
if ( SIncrm == 1LL || (GapBeg = EBPtr1, GapEnd < EBPtr2) )
{
GapEnd = EBPtr2;
return 0LL;
}
return 0LL;
}
LABEL_15:
if ( (EdFlag & 0x10) == 0 )
{
v12 = GapBeg - EBfBeg;
GapEnd -= v12;
GapBeg -= v12;
ZCpyBl(GapEnd + 1LL);
return 0LL;
}
return 0LL;
}
v3 = EBPtr1;
continue;
}
if ( (unsigned int)WrPage(CurOut, EBfBeg, EBfEnd, FFPage) != -1 )
{
NArgmt = 0LL;
GapBeg = EBfBeg;
GapEnd = EBfEnd;
v8 = Matchd;
goto LABEL_26;
}
return 0xFFFFFFFFLL;
case 6:
v5 = EBfBeg;
if ( (EdFlag & 2) != 0 || !*((_DWORD *)&IsOpnO + CurOut) )
{
LABEL_12:
v6 = EBfEnd;
}
else if ( GapBeg != EBfBeg || (v6 = EBfEnd, GapEnd != EBfEnd) )
{
ErrMsg(42LL);
return 0xFFFFFFFFLL;
}
GapBeg = v5;
GapEnd = v6;
if ( *((_DWORD *)&IsEofI + CurInp) )
{
LABEL_14:
NArgmt = 0LL;
goto LABEL_15;
}
if ( (unsigned int)RdPage() == -1 )
return 0xFFFFFFFFLL;
goto LABEL_32;
default:
goto LABEL_33;
}
}
}

original_code:
DEFAULT SrcLop()
{
    int HowFar;
    if (SrcTyp == 2) {
 ;
 return DoFBFC();
    }
    if (NArgmt > 0) {
 SIncrm = 1;
 EBPtr1 = GapEnd;
 EndSAr = RhtSid = EBfEnd;
 do {
     EBPtr1++;
     if (SSerch() == (-1)) {
  ;
  return (-1);
     }
     if (Matchd) {
  --NArgmt;
  if ((EdFlag & 64) == 0)
      EBPtr1 = EBPtr2;
     } else {
  switch (SrcTyp) {
      case 5:
      case 3:
   NArgmt = 0;
   break;
      case 4:
   if (IsEofI[CurInp]) {
       if (WrPage(CurOut,EBfBeg,
     EBfEnd,FFPage) == (-1)) {
    ;
    return (-1);
       }
       GapBeg = EBfBeg;
       GapEnd = EBfEnd;
       NArgmt = 0;
   } else {
       if (SinglP() == (-1)) {
    ;
    return (-1);
       }
       EBPtr1 = GapEnd + 1;
       EndSAr = RhtSid = EBfEnd;
   }
   break;
      case 6:
   if (((EdFlag & 2) == 0) &&
       (IsOpnO[CurOut]) &&
       ((GapBeg != EBfBeg) || (GapEnd != EBfEnd))) {
    ErrMsg(42);
    ;
    return (-1);
   }
      case 1:
   GapBeg = EBfBeg;
   GapEnd = EBfEnd;
   if (IsEofI[CurInp]) {
       NArgmt = 0;
   } else {
      if (RdPage() == (-1)) {
    ;
    return (-1);
       }
       EBPtr1 = GapEnd + 1;
       EndSAr = RhtSid = EBfEnd;
   }
  }
     }
 } while (NArgmt > 0);
    } else {
 SIncrm = -1;
 EBPtr1 = RhtSid = GapBeg;
 RhtSid--;
 EndSAr = EBfBeg;
 do {
     EBPtr1--;
     if (SSerch() == (-1)) {
  ;
  return (-1);
     }
     if (Matchd) {
  ++NArgmt;
     } else {
  if ((SrcTyp==5) || (SrcTyp==3)) {
      break;
  } else {
      ;
      return ExeNYI();
  }
     }
 } while (NArgmt < 0);
    }
    if (Matchd) {
 if (SrcTyp == 3) {
     if (SIncrm == 1) {
  GapEnd = EBPtr2;
     } else {
  GapBeg = EBPtr1;
  if (EBPtr2 > GapEnd)
      GapEnd = EBPtr2;
     }
 } else {
     if ((SIncrm == 1) || (EBPtr2 > GapEnd)) {
  HowFar = EBPtr2 - GapEnd;
  ZCpyBl((GapBeg),(GapEnd+1),((SIZE_T)HowFar));
  GapBeg += HowFar;
  GapEnd += HowFar;
     } else {
  HowFar = (GapBeg-1) - EBPtr2;
  GapBeg -= HowFar;
  GapEnd -= HowFar;
  ZCpyBl((GapEnd+1),(GapBeg),((SIZE_T)HowFar));
     }
 }
    } else {
 if ((EdFlag & 16) == 0) {
     HowFar = GapBeg - EBfBeg;
     GapBeg -= HowFar;
     GapEnd -= HowFar;
     ZCpyBl((GapEnd+1),(GapBeg),((SIZE_T)HowFar));
 }
    }
    return 0;
}

canonical_original_code:
int SrcLop()
{
    int HowFar;
    if (SrcTyp == 2) {
 ;
 return DoFBFC();
    }
    if (NArgmt > 0) {
 SIncrm = 1;
 EBPtr1 = GapEnd;
 EndSAr = RhtSid = EBfEnd;
 do {
     EBPtr1++;
     if (SSerch() == (-1)) {
  ;
  return (-1);
     }
     if (Matchd) {
  --NArgmt;
  if ((EdFlag & 64) == 0)
      EBPtr1 = EBPtr2;
     } else {
  switch (SrcTyp) {
      case 5:
      case 3:
   NArgmt = 0;
   break;
      case 4:
   if (IsEofI[CurInp]) {
       if (WrPage(CurOut,EBfBeg,
     EBfEnd,FFPage) == (-1)) {
    ;
    return (-1);
       }
       GapBeg = EBfBeg;
       GapEnd = EBfEnd;
       NArgmt = 0;
   } else {
       if (SinglP() == (-1)) {
    ;
    return (-1);
       }
       EBPtr1 = GapEnd + 1;
       EndSAr = RhtSid = EBfEnd;
   }
   break;
      case 6:
   if (((EdFlag & 2) == 0) &&
       (IsOpnO[CurOut]) &&
       ((GapBeg != EBfBeg) || (GapEnd != EBfEnd))) {
    ErrMsg(42);
    ;
    return (-1);
   }
      case 1:
   GapBeg = EBfBeg;
   GapEnd = EBfEnd;
   if (IsEofI[CurInp]) {
       NArgmt = 0;
   } else {
      if (RdPage() == (-1)) {
    ;
    return (-1);
       }
       EBPtr1 = GapEnd + 1;
       EndSAr = RhtSid = EBfEnd;
   }
  }
     }
 } while (NArgmt > 0);
    } else {
 SIncrm = -1;
 EBPtr1 = RhtSid = GapBeg;
 RhtSid--;
 EndSAr = EBfBeg;
 do {
     EBPtr1--;
     if (SSerch() == (-1)) {
  ;
  return (-1);
     }
     if (Matchd) {
  ++NArgmt;
     } else {
  if ((SrcTyp==5) || (SrcTyp==3)) {
      break;
  } else {
      ;
      return ExeNYI();
  }
     }
 } while (NArgmt < 0);
    }
    if (Matchd) {
 if (SrcTyp == 3) {
     if (SIncrm == 1) {
  GapEnd = EBPtr2;
     } else {
  GapBeg = EBPtr1;
  if (EBPtr2 > GapEnd)
      GapEnd = EBPtr2;
     }
 } else {
     if ((SIncrm == 1) || (EBPtr2 > GapEnd)) {
  HowFar = EBPtr2 - GapEnd;
  ZCpyBl((GapBeg),(GapEnd+1),((unsigned int)HowFar));
  GapBeg += HowFar;
  GapEnd += HowFar;
     } else {
  HowFar = (GapBeg-1) - EBPtr2;
  GapBeg -= HowFar;
  GapEnd -= HowFar;
  ZCpyBl((GapEnd+1),(GapBeg),((unsigned int)HowFar));
     }
 }
    } else {
 if ((EdFlag & 16) == 0) {
     HowFar = GapBeg - EBfBeg;
     GapBeg -= HowFar;
     GapEnd -= HowFar;
     ZCpyBl((GapEnd+1),(GapBeg),((unsigned int)HowFar));
 }
    }
    return 0;
}


ExeLst

decompiled_code:
__int64 ExeLst()
{
__int16 v0; // ax
__int64 v1; // rdx
__int64 v2; // rax
__int64 result; // rax

v0 = LStTop + 1;
LStTop = v0;
if ( v0 > 31 )
{
ErrMsg(32LL);
result = 0xFFFFFFFFLL;
}
else
{
if ( EStTop == EStBot )
{
NArgmt = -1LL;
v1 = -1LL;
LABEL_4:
v2 = 16LL * v0;
*(_QWORD *)((char *)&LStack + v2) = v1;
*(_QWORD *)((char *)&LStack + v2 + 8) = CBfPtr;
LABEL_5:
CmdMod = 0;
return 0LL;
}
if ( (unsigned int)GetNmA() != -1 )
{
v1 = NArgmt;
v0 = LStTop;
if ( NArgmt > 0 )
goto LABEL_4;
if ( (unsigned int)FlowEL() != -1 )
goto LABEL_5;
}
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int16 v0; // ax
__int64 v1; // rdx
__int64 v2; // rax
__int64 result; // rax

v0 = LStTop + 1;
LStTop = v0;
if ( v0 > 31 )
{
ErrMsg(32LL);
result = 0xFFFFFFFFLL;
}
else
{
if ( EStTop == EStBot )
{
NArgmt = -1LL;
v1 = -1LL;
LABEL_4:
v2 = 16LL * v0;
*(_QWORD *)((char *)&LStack + v2) = v1;
*(_QWORD *)((char *)&LStack + v2 + 8) = CBfPtr;
LABEL_5:
CmdMod = 0;
return 0LL;
}
if ( (unsigned int)GetNmA() != -1 )
{
v1 = NArgmt;
v0 = LStTop;
if ( NArgmt > 0 )
goto LABEL_4;
if ( (unsigned int)FlowEL() != -1 )
goto LABEL_5;
}
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
DEFAULT ExeLst()
{
 ;
 if (++LStTop >= 32) {
  ErrMsg(32);
  ;
  return (-1);
 }
 if (EStTop == EStBot) {
  NArgmt = -1L;
 } else {
  if (GetNmA() == (-1)) {
   ;
   return (-1);
  }
  if (NArgmt <= 0) {
   if (FlowEL()== (-1)) {
    ;
    return (-1);
   }
   CmdMod = '\0';
   ;
   return 0;
  }
 }
 LStack[LStTop].LIndex = NArgmt;
 LStack[LStTop].LAddr = CBfPtr;
 CmdMod = '\0';
 ;
 return 0;
}

canonical_original_code:
int ExeLst()
{
 ;
 if (++LStTop >= 32) {
  ErrMsg(32);
  ;
  return (-1);
 }
 if (EStTop == EStBot) {
  NArgmt = -1L;
 } else {
  if (GetNmA() == (-1)) {
   ;
   return (-1);
  }
  if (NArgmt <= 0) {
   if (FlowEL()== (-1)) {
    ;
    return (-1);
   }
   CmdMod = '\0';
   ;
   return 0;
  }
 }
 LStack[LStTop].LIndex = NArgmt;
 LStack[LStTop].LAddr = CBfPtr;
 CmdMod = '\0';
 ;
 return 0;
}


SSerch

decompiled_code:
__int64 SSerch()
{
__int64 v0; // rax
__int64 v1; // rdx
unsigned __int64 v2; // rax
int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = SBfBeg;
if ( SBfPtr == SBfBeg )
{
LABEL_18:
Matchd = 0;
return 0LL;
}
v1 = SIncrm;
while ( 2 )
{
SStPtr = v0;
if ( v1 == 1 )
{
if ( (unsigned int)ZFrSrc() != -1 )
{
if ( EBPtr1 <= EndSAr )
{
do
{
LABEL_13:
if ( ++SStPtr == SBfPtr )
{
RefLen = EBPtr1 + ~EBPtr2;
if ( SIncrm == -1LL && GapEnd <= EBPtr2 )
RefLen = EBPtr1 + ~EBPtr2 + GapEnd - GapBeg + 1LL;
Matchd = 1;
return 0LL;
}
v2 = EBPtr2 + 1LL;
EBPtr2 = v2;
if ( v2 > RhtSid )
{
if ( SIncrm != -1LL )
goto LABEL_18;
if ( v2 < GapEnd )
EBPtr2 = GapEnd + 1LL;
}
if ( (unsigned int)CMatch(v4) == -1 )
return 0xFFFFFFFFLL;
}
while ( v4[0] );
v1 = SIncrm;
if ( SIncrm != 1LL )
{
if ( --EBPtr1 < EndSAr )
goto LABEL_18;
goto LABEL_22;
}
if ( ++EBPtr1 <= EndSAr )
{
LABEL_22:
v0 = SBfBeg;
continue;
}
}
goto LABEL_18;
}
}
else if ( (unsigned int)BakSrc() != -1 )
{
if ( EBPtr1 >= EndSAr )
goto LABEL_13;
goto LABEL_18;
}
return 0xFFFFFFFFLL;
}
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rax
__int64 v1; // rdx
unsigned __int64 v2; // rax
int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = SBfBeg;
if ( SBfPtr == SBfBeg )
{
LABEL_18:
Matchd = 0;
return 0LL;
}
v1 = SIncrm;
while ( 2 )
{
SStPtr = v0;
if ( v1 == 1 )
{
if ( (unsigned int)ZFrSrc() != -1 )
{
if ( EBPtr1 <= EndSAr )
{
do
{
LABEL_13:
if ( ++SStPtr == SBfPtr )
{
RefLen = EBPtr1 + ~EBPtr2;
if ( SIncrm == -1LL && GapEnd <= EBPtr2 )
RefLen = EBPtr1 + ~EBPtr2 + GapEnd - GapBeg + 1LL;
Matchd = 1;
return 0LL;
}
v2 = EBPtr2 + 1LL;
EBPtr2 = v2;
if ( v2 > RhtSid )
{
if ( SIncrm != -1LL )
goto LABEL_18;
if ( v2 < GapEnd )
EBPtr2 = GapEnd + 1LL;
}
if ( (unsigned int)CMatch(v4) == -1 )
return 0xFFFFFFFFLL;
}
while ( v4[0] );
v1 = SIncrm;
if ( SIncrm != 1LL )
{
if ( --EBPtr1 < EndSAr )
goto LABEL_18;
goto LABEL_22;
}
if ( ++EBPtr1 <= EndSAr )
{
LABEL_22:
v0 = SBfBeg;
continue;
}
}
goto LABEL_18;
}
}
else if ( (unsigned int)BakSrc() != -1 )
{
if ( EBPtr1 >= EndSAr )
goto LABEL_13;
goto LABEL_18;
}
return 0xFFFFFFFFLL;
}
}

original_code:
DEFAULT SSerch()
{
 BOOLEAN SamChr;
 if (SBfPtr == SBfBeg) {
  Matchd = 0;
  ;
  return 0;
 }
 for(;;) {
  SStPtr = SBfBeg;
  if (SIncrm == 1) {
   if (ZFrSrc() == (-1)) {
    ;
    return (-1);
   }
   if (EBPtr1 > EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  } else {
   if (BakSrc() == (-1)) {
    ;
    return (-1);
   }
   if (EBPtr1 < EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  }
  do {
   if (++SStPtr == SBfPtr) {
    RefLen = (EBPtr1 - EBPtr2) - 1;
    if ((SIncrm == -1) && (EBPtr2 >= GapEnd)) {
     RefLen += GapEnd-GapBeg+1;
    }
    Matchd = 1;
    ;
    return 0;
   }
   if (++EBPtr2 > RhtSid) {
       if (SIncrm == -1) {
    if (EBPtr2 < GapEnd) EBPtr2 = GapEnd+1;
       } else {
    Matchd = 0;
    ;
    return 0;
       }
   }
   if (CMatch(&SamChr) == (-1)) {
    ;
    return (-1);
   }
  } while (SamChr);
  if (SIncrm == 1) {
   if (++EBPtr1 > EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  } else {
   if (--EBPtr1 < EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  }
 }
}

canonical_original_code:
int SSerch()
{
 int SamChr;
 if (SBfPtr == SBfBeg) {
  Matchd = 0;
  ;
  return 0;
 }
 for(;;) {
  SStPtr = SBfBeg;
  if (SIncrm == 1) {
   if (ZFrSrc() == (-1)) {
    ;
    return (-1);
   }
   if (EBPtr1 > EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  } else {
   if (BakSrc() == (-1)) {
    ;
    return (-1);
   }
   if (EBPtr1 < EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  }
  do {
   if (++SStPtr == SBfPtr) {
    RefLen = (EBPtr1 - EBPtr2) - 1;
    if ((SIncrm == -1) && (EBPtr2 >= GapEnd)) {
     RefLen += GapEnd-GapBeg+1;
    }
    Matchd = 1;
    ;
    return 0;
   }
   if (++EBPtr2 > RhtSid) {
       if (SIncrm == -1) {
    if (EBPtr2 < GapEnd) EBPtr2 = GapEnd+1;
       } else {
    Matchd = 0;
    ;
    return 0;
       }
   }
   if (CMatch(&SamChr) == (-1)) {
    ;
    return (-1);
   }
  } while (SamChr);
  if (SIncrm == 1) {
   if (++EBPtr1 > EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  } else {
   if (--EBPtr1 < EndSAr) {
    Matchd = 0;
    ;
    return 0;
   }
  }
 }
}

variable_types: SamChr int


ExeY

decompiled_code:
__int64 ExeY()
{
if ( EStTop > EStBot )
{
ErrMsg(29LL);
}
else
{
if ( (EdFlag & 2) != 0 || !*((_DWORD *)&IsOpnO + CurOut) || GapBeg == EBfBeg && GapEnd == EBfEnd )
return ExeEY();
ErrMsg(42LL);
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
if ( EStTop > EStBot )
{
ErrMsg(29LL);
}
else
{
if ( (EdFlag & 2) != 0 || !*((_DWORD *)&IsOpnO + CurOut) || GapBeg == EBfBeg && GapEnd == EBfEnd )
return ExeEY();
ErrMsg(42LL);
}
return 0xFFFFFFFFLL;
}

original_code:
DEFAULT ExeY()
{
 ;
 if (EStTop > EStBot) {
  ErrMsg(29);
  ;
  return (-1);
 }
 if ((EdFlag & 2) == 0) {
  if (IsOpnO[CurOut] &&
      ((GapBeg != EBfBeg) || (GapEnd != EBfEnd))) {
   ErrMsg(42);
   ;
   return (-1);
  }
 }
 ;
 return ExeEY();
}

canonical_original_code:
int ExeY()
{
 ;
 if (EStTop > EStBot) {
  ErrMsg(29);
  ;
  return (-1);
 }
 if ((EdFlag & 2) == 0) {
  if (IsOpnO[CurOut] &&
      ((GapBeg != EBfBeg) || (GapEnd != EBfEnd))) {
   ErrMsg(42);
   ;
   return (-1);
  }
 }
 ;
 return ExeEY();
}


ExeH

decompiled_code:
__int64 ExeH()
{
CmdMod |= 8u;
MArgmt = 0LL;
return ExeZ();
}

canonical_decompiled_code:
__int64 func0()
{
CmdMod |= 8u;
MArgmt = 0LL;
return ExeZ();
}

original_code:
DEFAULT ExeH()
{
 ;
 MArgmt = 0;
 CmdMod |= '\10';
 ;
 return ExeZ();
}

canonical_original_code:
int ExeH()
{
 ;
 MArgmt = 0;
 CmdMod |= '\10';
 ;
 return ExeZ();
}


ExeG

decompiled_code:
__int64 ExeG()
{
__int64 v0; // rdi
__int64 v1; // rsi

if ( (unsigned int)IncCBP() != -1 )
{
v0 = FBfBeg;
v1 = FBfPtr;
if ( *CBfPtr == 42 )
goto LABEL_5;
if ( *CBfPtr == 95 )
{
v0 = SBfBeg;
v1 = SBfPtr;
LABEL_5:
if ( (CmdMod & 2) == 0 )
{
LABEL_6:
if ( (unsigned int)InsStr(v0, v1 - v0) != -1 )
{
LABEL_7:
CmdMod = 0;
EStTop = EStBot;
return 0LL;
}
return 0xFFFFFFFFLL;
}
LABEL_8:
TypBuf(v0, v1);
goto LABEL_7;
}
if ( (unsigned int)FindQR(FBfBeg, FBfPtr) != -1 )
{
v0 = *QR;
if ( !*QR )
{
CmdMod = 0;
RefLen = 0LL;
EStTop = EStBot;
return 0LL;
}
v1 = *(_QWORD *)(QR + 8LL);
if ( (CmdMod & 2) == 0 )
goto LABEL_6;
goto LABEL_8;
}
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rdi
__int64 v1; // rsi

if ( (unsigned int)IncCBP() != -1 )
{
v0 = FBfBeg;
v1 = FBfPtr;
if ( *CBfPtr == 42 )
goto LABEL_5;
if ( *CBfPtr == 95 )
{
v0 = SBfBeg;
v1 = SBfPtr;
LABEL_5:
if ( (CmdMod & 2) == 0 )
{
LABEL_6:
if ( (unsigned int)InsStr(v0, v1 - v0) != -1 )
{
LABEL_7:
CmdMod = 0;
EStTop = EStBot;
return 0LL;
}
return 0xFFFFFFFFLL;
}
LABEL_8:
TypBuf(v0, v1);
goto LABEL_7;
}
if ( (unsigned int)FindQR(FBfBeg, FBfPtr) != -1 )
{
v0 = *QR;
if ( !*QR )
{
CmdMod = 0;
RefLen = 0LL;
EStTop = EStBot;
return 0LL;
}
v1 = *(_QWORD *)(QR + 8LL);
if ( (CmdMod & 2) == 0 )
goto LABEL_6;
goto LABEL_8;
}
}
return 0xFFFFFFFFLL;
}

original_code:
DEFAULT ExeG()
{
 charptr TxtBeg;
 charptr TxtEnd;
 ;
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (*CBfPtr == '*') {
  TxtBeg = FBfBeg;
  TxtEnd = FBfPtr;
 } else if (*CBfPtr == '_') {
  TxtBeg = SBfBeg;
  TxtEnd = SBfPtr;
 } else {
  if (FindQR() == (-1)) {
   return (-1);
  }
  if (QR->Start == (void *)0) {
   RefLen = 0;
   CmdMod = '\0';
   EStTop = EStBot;
   ;
   return 0;
  }
  TxtBeg = QR->Start;
  TxtEnd = QR->End_P1;
 }
 if (CmdMod & '\2') {
  TypBuf(TxtBeg, TxtEnd);
 } else {
  if (InsStr(TxtBeg, TxtEnd-TxtBeg) == (-1)) {
   ;
   return (-1);
  }
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}

canonical_original_code:
int ExeG()
{
 unsigned char *TxtBeg;
 unsigned char *TxtEnd;
 ;
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (*CBfPtr == '*') {
  TxtBeg = FBfBeg;
  TxtEnd = FBfPtr;
 } else if (*CBfPtr == '_') {
  TxtBeg = SBfBeg;
  TxtEnd = SBfPtr;
 } else {
  if (FindQR() == (-1)) {
   return (-1);
  }
  if (QR->Start == (void *)0) {
   RefLen = 0;
   CmdMod = '\0';
   EStTop = EStBot;
   ;
   return 0;
  }
  TxtBeg = QR->Start;
  TxtEnd = QR->End_P1;
 }
 if (CmdMod & '\2') {
  TypBuf(TxtBeg, TxtEnd);
 } else {
  if (InsStr(TxtBeg, TxtEnd-TxtBeg) == (-1)) {
   ;
   return (-1);
  }
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}

variable_types:
TxtBeg
unsigned char *

variable_types:
TxtEnd
unsigned char *


ExeExc

decompiled_code:
__int64 ExeExc()
{
__int64 result; // rax

result = FindES(33LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
EStTop = EStBot;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = FindES(33LL);
if ( (_DWORD)result != -1 )
{
CmdMod = 0;
EStTop = EStBot;
result = 0LL;
}
return result;
}

original_code:
DEFAULT ExeExc()
{
 ;
 if (FindES('!') == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}

canonical_original_code:
int ExeExc()
{
 ;
 if (FindES('!') == (-1)) {
  ;
  return (-1);
 }
 CmdMod = '\0';
 EStTop = EStBot;
 ;
 return 0;
}


ExeI

decompiled_code:
__int64 ExeI()
{
char v1[9]; // [rsp+Fh] [rbp-9h] BYREF

if ( EStTop <= EStBot )
{
if ( (unsigned int)FindES(27LL) != -1 && (unsigned int)InsStr(ArgPtr, CBfPtr - ArgPtr) != -1 )
goto LABEL_7;
return 0xFFFFFFFFLL;
}
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
if ( (CmdMod & 1) != 0 )
{
if ( (unsigned int)IncCBP() != -1 && (unsigned int)IncCBP() != -1 )
{
if ( *CBfPtr == *(_BYTE *)(CBfPtr - 1LL) )
{
LABEL_6:
v1[0] = NArgmt;
if ( (unsigned int)InsStr(v1, 1LL) != -1 )
{
LABEL_7:
CmdMod = 0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
goto LABEL_14;
}
return 0xFFFFFFFFLL;
}
if ( CStEnd != CBfPtr + 1LL )
{
if ( *(_BYTE *)(CBfPtr + 1LL) == 27 )
goto LABEL_6;
LABEL_14:
ErrMsg(7LL);
return 0xFFFFFFFFLL;
}
if ( MStTop < 0 )
{
ErrUTC();
return 0xFFFFFFFFLL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
char v1[9]; // [rsp+Fh] [rbp-9h] BYREF

if ( EStTop <= EStBot )
{
if ( (unsigned int)FindES(27LL) != -1 && (unsigned int)InsStr(ArgPtr, CBfPtr - ArgPtr) != -1 )
goto LABEL_7;
return 0xFFFFFFFFLL;
}
if ( (unsigned int)GetNmA() == -1 )
return 0xFFFFFFFFLL;
if ( (CmdMod & 1) != 0 )
{
if ( (unsigned int)IncCBP() != -1 && (unsigned int)IncCBP() != -1 )
{
if ( *CBfPtr == *(_BYTE *)(CBfPtr - 1LL) )
{
LABEL_6:
v1[0] = NArgmt;
if ( (unsigned int)InsStr(v1, 1LL) != -1 )
{
LABEL_7:
CmdMod = 0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
goto LABEL_14;
}
return 0xFFFFFFFFLL;
}
if ( CStEnd != CBfPtr + 1LL )
{
if ( *(_BYTE *)(CBfPtr + 1LL) == 27 )
goto LABEL_6;
LABEL_14:
ErrMsg(7LL);
return 0xFFFFFFFFLL;
}
if ( MStTop < 0 )
{
ErrUTC();
return 0xFFFFFFFFLL;
}
return 0LL;
}

original_code:
DEFAULT ExeI()
{
 unsigned char InChar;
 ;
 if (EStTop > EStBot) {
  if (GetNmA() == (-1)) {
   ;
   return (-1);
  }
  if (CmdMod & '\1') {
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   if (*CBfPtr != *(CBfPtr-1)) {
    ErrMsg(7);
    ;
    return (-1);
   }
  } else {
   if ((CBfPtr+1) == CStEnd) {
    if (MStTop < 0) {
     ErrUTC();
     ;
     return (-1);
    } else {
     ;
     return 0;
    }
   }
   if (*(CBfPtr+1) != '\033') {
    ErrMsg(7);
    ;
    return (-1);
   }
  }
  InChar = (char)NArgmt;
  if (InsStr(&InChar, (int)1) == (-1)) {
   ;
   return (-1);
  }
 } else {
  if (FindES('\033') == (-1)) {
   ;
   return (-1);
  }
  if (InsStr(ArgPtr, CBfPtr-ArgPtr) == (-1)) {
   ;
   return (-1);
  }
 }
 CmdMod = '\0';
 ;
 return 0;
}

canonical_original_code:
int ExeI()
{
 unsigned char InChar;
 ;
 if (EStTop > EStBot) {
  if (GetNmA() == (-1)) {
   ;
   return (-1);
  }
  if (CmdMod & '\1') {
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   if (IncCBP() == (-1)) {
    ;
    return (-1);
   }
   if (*CBfPtr != *(CBfPtr-1)) {
    ErrMsg(7);
    ;
    return (-1);
   }
  } else {
   if ((CBfPtr+1) == CStEnd) {
    if (MStTop < 0) {
     ErrUTC();
     ;
     return (-1);
    } else {
     ;
     return 0;
    }
   }
   if (*(CBfPtr+1) != '\033') {
    ErrMsg(7);
    ;
    return (-1);
   }
  }
  InChar = (char)NArgmt;
  if (InsStr(&InChar, (int)1) == (-1)) {
   ;
   return (-1);
  }
 } else {
  if (FindES('\033') == (-1)) {
   ;
   return (-1);
  }
  if (InsStr(ArgPtr, CBfPtr-ArgPtr) == (-1)) {
   ;
   return (-1);
  }
 }
 CmdMod = '\0';
 ;
 return 0;
}

variable_types:
InChar
unsigned char


PopMac

decompiled_code:
__int64 __fastcall PopMac(__int64 a1, __int64 a2)
{
__int16 v2; // r14
__int16 v3; // r13
__int64 v4; // r12
__int64 v5; // rdx
__int64 v6; // rax
_QWORD *v7; // rbx
_QWORD *v8; // rbp
__int64 result; // rax

v2 = EStTop;
v3 = EStBot;
if ( EStTop <= EStBot || (result = GetNmA(), (_DWORD)result != -1) )
{
v4 = MStTop;
v5 = MStTop;
v6 = 40LL * MStTop;
v7 = *(_QWORD **)((char *)&MStack + v6 + 32);
CStBeg = *(_QWORD *)((char *)&MStack + v6);
v8 = v7 + 108;
CBfPtr = *(_QWORD *)((char *)&MStack + v6 + 8);
CStEnd = *(_QWORD *)((char *)&MStack + v6 + 16);
EStBot = *(_WORD *)((char *)&MStack + v6 + 24);
EStTop = *(_WORD *)((char *)&MStack + v6 + 26);
LStBot = *(_WORD *)((char *)&MStack + v6 + 28);
LStTop = *(_WORD *)((char *)&MStack + v6 + 30);
if ( v7 )
{
do
{
if ( *v7 )
ZFree(*v7, a2, v5);
v7 += 3;
}
while ( v7 != v8 );
ZFree(*((_QWORD *)&MStack + 5 * v4 + 4), a2, v5);
LOWORD(v5) = MStTop;
}
result = 0LL;
MStTop = v5 - 1;
if ( v2 > v3 )
result = PushEx(NArgmt, 0LL);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int16 v2; // r14
__int16 v3; // r13
__int64 v4; // r12
__int64 v5; // rdx
__int64 v6; // rax
_QWORD *v7; // rbx
_QWORD *v8; // rbp
__int64 result; // rax

v2 = EStTop;
v3 = EStBot;
if ( EStTop <= EStBot || (result = GetNmA(), (_DWORD)result != -1) )
{
v4 = MStTop;
v5 = MStTop;
v6 = 40LL * MStTop;
v7 = *(_QWORD **)((char *)&MStack + v6 + 32);
CStBeg = *(_QWORD *)((char *)&MStack + v6);
v8 = v7 + 108;
CBfPtr = *(_QWORD *)((char *)&MStack + v6 + 8);
CStEnd = *(_QWORD *)((char *)&MStack + v6 + 16);
EStBot = *(_WORD *)((char *)&MStack + v6 + 24);
EStTop = *(_WORD *)((char *)&MStack + v6 + 26);
LStBot = *(_WORD *)((char *)&MStack + v6 + 28);
LStTop = *(_WORD *)((char *)&MStack + v6 + 30);
if ( v7 )
{
do
{
if ( *v7 )
ZFree(*v7, a2, v5);
v7 += 3;
}
while ( v7 != v8 );
ZFree(*((_QWORD *)&MStack + 5 * v4 + 4), a2, v5);
LOWORD(v5) = MStTop;
}
result = 0LL;
MStTop = v5 - 1;
if ( v2 > v3 )
result = PushEx(NArgmt, 0LL);
}
return result;
}

original_code:
DEFAULT PopMac()
{
    WORD i;
    MSptr MSp;
    QRptr QRp;
    BOOLEAN RetVal;
    ;
    RetVal = (EStTop > EStBot);
    if (RetVal) {
        if (GetNmA() == (-1)) {
     ;
     return (-1);
 }
    }
    MSp = &MStack[MStTop];
    CStBeg = MSp->CStBeg;
    CBfPtr = MSp->CBfPtr;
    CStEnd = MSp->CStEnd;
    EStBot = MSp->EStBot;
    EStTop = MSp->EStTop;
    LStBot = MSp->LStBot;
    LStTop = MSp->LStTop;
    if (MSp->QRgstr != (void *)0) {
        for (QRp = MSp->QRgstr, i = 0; i < 36; ++i, ++QRp) {
     if (QRp->Start != (void *)0) {
  ZFree((voidptr)QRp->Start);
     }
 }
 ZFree(MSp->QRgstr);
    }
    --MStTop;
    return ((RetVal) ? PushEx(NArgmt, 0) : 0);
}

canonical_original_code:
int PopMac()
{
    short i;
    struct MStck *MSp;
    struct QReg *QRp;
    int RetVal;
    ;
    RetVal = (EStTop > EStBot);
    if (RetVal) {
        if (GetNmA() == (-1)) {
     ;
     return (-1);
 }
    }
    MSp = &MStack[MStTop];
    CStBeg = MSp->CStBeg;
    CBfPtr = MSp->CBfPtr;
    CStEnd = MSp->CStEnd;
    EStBot = MSp->EStBot;
    EStTop = MSp->EStTop;
    LStBot = MSp->LStBot;
    LStTop = MSp->LStTop;
    if (MSp->QRgstr != (void *)0) {
        for (QRp = MSp->QRgstr, i = 0; i < 36; ++i, ++QRp) {
     if (QRp->Start != (void *)0) {
  ZFree((unsigned char *)QRp->Start);
     }
 }
 ZFree(MSp->QRgstr);
    }
    --MStTop;
    return ((RetVal) ? PushEx(NArgmt, 0) : 0);
}

variable_types: struct MStck { unsigned char *CStBeg; unsigned char *CBfPtr; unsigned char *CStEnd; short EStBot; short EStTop; short LStBot; short LStTop; struct QReg { unsigned char *Start; unsigned char *End_P1; long Number; } *QRgstr; } *

variable_types: RetVal int

user_defined_types: struct MStck { unsigned char *CStBeg; unsigned char *CBfPtr; unsigned char *CStEnd; short EStBot; short EStTop; short LStBot; short LStTop; struct QReg *QRgstr; }


ExeLBr

decompiled_code:
__int64 ExeLBr()
{
__int16 v0; // ax
_QWORD *v1; // rbp
char *v2; // rax
__int64 v3; // rbx
__int64 v4; // rdx
__int64 result; // rax

if ( (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
return 0xFFFFFFFFLL;
v0 = QStTop + 1;
QStTop = v0;
if ( v0 > 31 )
{
ErrMsg(32LL);
return 0xFFFFFFFFLL;
}
v1 = (_QWORD *)QR;
v2 = (char *)&QStack + 24 * v0;
v3 = *(_QWORD *)(QR + 8LL) - *QR;
QR = v2;
if ( (int)v3 <= 0 )
{
LABEL_5:
v4 = v1[2];
QR = v1;
*((_QWORD *)v2 + 2) = v4;
return 0LL;
}
result = MakRom((unsigned int)v3);
if ( (_DWORD)result != -1 )
{
ZCpyBl(*QR, *v1, (unsigned int)v3);
v2 = (char *)QR;
*(_QWORD *)(QR + 8LL) = *QR + (int)v3;
goto LABEL_5;
}
--QStTop;
QR = v1;
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int16 v0; // ax
_QWORD *v1; // rbp
char *v2; // rax
__int64 v3; // rbx
__int64 v4; // rdx
__int64 result; // rax

if ( (unsigned int)IncCBP() == -1 || (unsigned int)FindQR() == -1 )
return 0xFFFFFFFFLL;
v0 = QStTop + 1;
QStTop = v0;
if ( v0 > 31 )
{
ErrMsg(32LL);
return 0xFFFFFFFFLL;
}
v1 = (_QWORD *)QR;
v2 = (char *)&QStack + 24 * v0;
v3 = *(_QWORD *)(QR + 8LL) - *QR;
QR = v2;
if ( (int)v3 <= 0 )
{
LABEL_5:
v4 = v1[2];
QR = v1;
*((_QWORD *)v2 + 2) = v4;
return 0LL;
}
result = MakRom((unsigned int)v3);
if ( (_DWORD)result != -1 )
{
ZCpyBl(*QR, *v1, (unsigned int)v3);
v2 = (char *)QR;
*(_QWORD *)(QR + 8LL) = *QR + (int)v3;
goto LABEL_5;
}
--QStTop;
QR = v1;
return result;
}

original_code:
DEFAULT ExeLBr()
{
 QRptr TmpQRp;
 int TmpSiz;
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 if (++QStTop >= 32) {
  ErrMsg(32);
  ;
  return (-1);
 }
 TmpQRp = QR;
 QR = &QStack[QStTop];
 TmpSiz = TmpQRp->End_P1 - TmpQRp->Start;
 if (TmpSiz > 0) {
  if (MakRom((SIZE_T)TmpSiz) == (-1)) {
   QR = TmpQRp;
   --QStTop;
   ;
   return (-1);
  }
  ZCpyBl((QR->Start),(TmpQRp->Start),((SIZE_T) TmpSiz));
  QR->End_P1 = QR->Start + TmpSiz;
 }
 QR->Number = TmpQRp->Number;
 QR = TmpQRp;
 ;
 return 0;
}

canonical_original_code:
int ExeLBr()
{
 struct QReg *TmpQRp;
 int TmpSiz;
 if (IncCBP() == (-1)) {
  ;
  return (-1);
 }
 if (FindQR() == (-1)) {
  ;
  return (-1);
 }
 if (++QStTop >= 32) {
  ErrMsg(32);
  ;
  return (-1);
 }
 TmpQRp = QR;
 QR = &QStack[QStTop];
 TmpSiz = TmpQRp->End_P1 - TmpQRp->Start;
 if (TmpSiz > 0) {
  if (MakRom((unsigned int)TmpSiz) == (-1)) {
   QR = TmpQRp;
   --QStTop;
   ;
   return (-1);
  }
  ZCpyBl((QR->Start),(TmpQRp->Start),((unsigned int) TmpSiz));
  QR->End_P1 = QR->Start + TmpSiz;
 }
 QR->Number = TmpQRp->Number;
 QR = TmpQRp;
 ;
 return 0;
}

variable_types: struct QReg { unsigned char *Start; unsigned char *End_P1; long Number; } *

variable_types: TmpSiz int


ExeCtP

decompiled_code:
__int64 ExeCtP()
{
return ExeIll();
}

canonical_decompiled_code:
__int64 func0()
{
return ExeIll();
}

original_code:
DEFAULT ExeCtP()
{
 return (ExeIll ());
}

canonical_original_code:
int ExeCtP()
{
 return (ExeIll ());
}


TypESt

decompiled_code:
__int64 TypESt()
{
TypBuf(CStBeg, CBfPtr);
return ZDspBf(&unk_30, 3LL);
}

canonical_decompiled_code:
__int64 func0()
{
TypBuf(CStBeg, CBfPtr);
return ZDspBf(&unk_30, 3LL);
}

original_code:
void TypESt()
{
 TypBuf(CStBeg,CBfPtr);
 ZDspBf("?\r\n", 3);
}


ClenUp

decompiled_code:
__int64 ClenUp()
{
char *v0; // rbx
char *v1; // rbx

ZIClos(0LL);
ZIClos(1LL);
ZOClDe(0LL);
ZOClDe(1LL);
if ( CBfBeg )
ZFree();
if ( DBfBeg )
ZFree();
if ( EBfBeg )
ZFree();
if ( FBfBeg )
ZFree();
if ( SBfBeg )
ZFree();
v0 = (char *)&QRgstr;
do
{
if ( *(_QWORD *)v0 )
ZFree();
v0 += 24;
}
while ( v0 != (char *)&QRgstr + 1728 );
v1 = (char *)&QStack;
do
{
if ( *(_QWORD *)v1 )
ZFree();
v1 += 24;
}
while ( v1 != (char *)&QStack + 768 );
return ZClnUp();
}

canonical_decompiled_code:
__int64 func0()
{
char *v0; // rbx
char *v1; // rbx

ZIClos(0LL);
ZIClos(1LL);
ZOClDe(0LL);
ZOClDe(1LL);
if ( CBfBeg )
ZFree();
if ( DBfBeg )
ZFree();
if ( EBfBeg )
ZFree();
if ( FBfBeg )
ZFree();
if ( SBfBeg )
ZFree();
v0 = (char *)&QRgstr;
do
{
if ( *(_QWORD *)v0 )
ZFree();
v0 += 24;
}
while ( v0 != (char *)&QRgstr + 1728 );
v1 = (char *)&QStack;
do
{
if ( *(_QWORD *)v1 )
ZFree();
v1 += 24;
}
while ( v1 != (char *)&QStack + 768 );
return ZClnUp();
}

original_code:
void ClenUp (void)
{
 QRptr QRp;
 int i;
 ZIClos(0);
 ZIClos(1);
 ZOClDe(0);
 ZOClDe(1);
 if (CBfBeg) ZFree((voidptr)CBfBeg);
 if (DBfBeg) ZFree((voidptr)DBfBeg);
 if (EBfBeg) ZFree((voidptr)EBfBeg);
 if (FBfBeg) ZFree((voidptr)FBfBeg);
 if (SBfBeg) ZFree((voidptr)SBfBeg);
 for (QRp = QRgstr, i = 0; i < 72; ++i, ++QRp) {
  if (QRp->Start != (void *)0) {
   ZFree((voidptr)QRp->Start);
  }
 }
 for (QRp = QStack, i = 0; i < 32; ++i, ++QRp) {
  if (QRp->Start != (void *)0) {
   ZFree((voidptr)QRp->Start);
  }
 }
 ZClnUp();
}

canonical_original_code:
void ClenUp()
{
 struct QReg *QRp;
 int i;
 ZIClos(0);
 ZIClos(1);
 ZOClDe(0);
 ZOClDe(1);
 if (CBfBeg) ZFree((unsigned char *)CBfBeg);
 if (DBfBeg) ZFree((unsigned char *)DBfBeg);
 if (EBfBeg) ZFree((unsigned char *)EBfBeg);
 if (FBfBeg) ZFree((unsigned char *)FBfBeg);
 if (SBfBeg) ZFree((unsigned char *)SBfBeg);
 for (QRp = QRgstr, i = 0; i < 72; ++i, ++QRp) {
  if (QRp->Start != (void *)0) {
   ZFree((unsigned char *)QRp->Start);
  }
 }
 for (QRp = QStack, i = 0; i < 32; ++i, ++QRp) {
  if (QRp->Start != (void *)0) {
   ZFree((unsigned char *)QRp->Start);
  }
 }
 ZClnUp();
}

variable_types: i int


repo: rnakano/Suzuka

decompiled_code:
char *__fastcall sk_http_parse_header(char *a1)
{
signed int v1; // eax
signed int v2; // ebx
signed int v3; // eax
const char *v4; // rdx
bool v5; // cf
bool v6; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
char v10; // al
bool v11; // cf
bool v12; // zf
const char *v13; // rdi
__int64 v14; // rcx
char *v15; // rax
char *save_ptr[2]; // [rsp+8h] [rbp-10h] BYREF

v1 = (unsigned int)strtok_r(a1, " \r\n", save_ptr);
if ( !v1 )
return 0LL;
if ( strcmp((const char *)v1, "GET") )
return 0LL;
v2 = (unsigned int)strtok_r(0LL, " \r\n", save_ptr);
if ( !v2 )
return 0LL;
v3 = (unsigned int)strtok_r(0LL, " \r\n", save_ptr);
v4 = (const char *)v3;
v5 = 0;
v6 = v3 == 0;
if ( !v3 )
return 0LL;
v7 = "HTTP/1.1";
v8 = 9LL;
v9 = (const char *)v3;
do
{
if ( !v8 )
break;
v5 = *v9 < (unsigned int)*v7;
v6 = *v9++ == *v7++;
--v8;
}
while ( v6 );
v10 = (!v5 && !v6) - v5;
v11 = 0;
v12 = v10 == 0;
if ( v10 )
{
v13 = "HTTP/1.0";
v14 = 9LL;
v9 = v4;
do
{
if ( !v14 )
break;
v11 = *v9 < (unsigned int)*v13;
v12 = *v9++ == *v13++;
--v14;
}
while ( v12 );
if ( (!v11 && !v12) != v11 )
return 0LL;
}
v15 = (char *)sk_malloc(256LL, v9, v4);
return strncpy(v15, (const char *)v2, 0x100uLL);
}

canonical_decompiled_code:
char *__fastcall func0(char *a1)
{
signed int v1; // eax
signed int v2; // ebx
signed int v3; // eax
const char *v4; // rdx
bool v5; // cf
bool v6; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
char v10; // al
bool v11; // cf
bool v12; // zf
const char *v13; // rdi
__int64 v14; // rcx
char *v15; // rax
char *save_ptr[2]; // [rsp+8h] [rbp-10h] BYREF

v1 = (unsigned int)strtok_r(a1, " \r\n", save_ptr);
if ( !v1 )
return 0LL;
if ( strcmp((const char *)v1, "GET") )
return 0LL;
v2 = (unsigned int)strtok_r(0LL, " \r\n", save_ptr);
if ( !v2 )
return 0LL;
v3 = (unsigned int)strtok_r(0LL, " \r\n", save_ptr);
v4 = (const char *)v3;
v5 = 0;
v6 = v3 == 0;
if ( !v3 )
return 0LL;
v7 = "HTTP/1.1";
v8 = 9LL;
v9 = (const char *)v3;
do
{
if ( !v8 )
break;
v5 = *v9 < (unsigned int)*v7;
v6 = *v9++ == *v7++;
--v8;
}
while ( v6 );
v10 = (!v5 && !v6) - v5;
v11 = 0;
v12 = v10 == 0;
if ( v10 )
{
v13 = "HTTP/1.0";
v14 = 9LL;
v9 = v4;
do
{
if ( !v14 )
break;
v11 = *v9 < (unsigned int)*v13;
v12 = *v9++ == *v13++;
--v14;
}
while ( v12 );
if ( (!v11 && !v12) != v11 )
return 0LL;
}
v15 = (char *)sk_malloc(256LL, v9, v4);
return strncpy(v15, (const char *)v2, 0x100uLL);
}

original_code:
sk_http_header* sk_http_parse_header(char* str)
{
  char *type, *path, *version;
  char* saveptr;
  type = strtok_r(str, " \r\n", &saveptr);
  if(type == ((void *)0)) return ((void *)0);
  if(strcmp(type, "GET") != 0) return ((void *)0);
  path = strtok_r(((void *)0), " \r\n", &saveptr);
  if(path == ((void *)0)) return ((void *)0);
  version = strtok_r(((void *)0), " \r\n", &saveptr);
  if(version == ((void *)0)) return ((void *)0);
  if(strcmp(version, "HTTP/1.1") != 0 && strcmp(version, "HTTP/1.0") != 0) return ((void *)0);
  sk_http_header *header = sk_malloc(sizeof(sk_http_header));
  strncpy(header->path, path, 256);
  return header;
}

canonical_original_code:
struct sk_http_header *sk_http_parse_header(char *str)
{
  char *type; char *path; char *version;
  char *saveptr;
  type = strtok_r(str, " \r\n", &saveptr);
  if(type == ((void *)0)) return ((void *)0);
  if(strcmp(type, "GET") != 0) return ((void *)0);
  path = strtok_r(((void *)0), " \r\n", &saveptr);
  if(path == ((void *)0)) return ((void *)0);
  version = strtok_r(((void *)0), " \r\n", &saveptr);
  if(version == ((void *)0)) return ((void *)0);
  if(strcmp(version, "HTTP/1.1") != 0 && strcmp(version, "HTTP/1.0") != 0) return ((void *)0);
  struct sk_http_header *header = sk_malloc(sizeof(sk_http_header));
  strncpy(header->path, path, 256);
  return header;
}

variable_types:
str
char *

variable_types:
type
char *

variable_types:
path
char *

variable_types:
version
char *

variable_types:
saveptr
char *

variable_types: struct sk_http_header { char path[256]; } *


decompiled_code:
// attributes: thunk
__int64 sk_http_header_free()
{
return sk_free();
}

canonical_decompiled_code:
__int64 func1()
{
return sk_free();
}

original_code:
void sk_http_header_free(sk_http_header* header)
{
  sk_free(header);
}

canonical_original_code:
void sk_http_header_free(struct sk_http_header *header)
{
  sk_free(header);
}

user_defined_types: struct sk_http_header { char path[256]; }


decompiled_code:
int __fastcall sk_http_write_response_header(const char **a1, char *a2, size_t a3)
{
return snprintf(
a2,
a3,
"HTTP/1.1 %d OK\r\nContent-Type: %s\r\nContent-Length: %lld\r\nConnection: close\r\nServer: suzuka\r\n\r\n",
*(unsigned __int16 *)a1,
a1[1],
a1[2]);
}

canonical_decompiled_code:
int __fastcall func2(const char **a1, char *a2, size_t a3)
{
return snprintf(
a2,
a3,
"HTTP/1.1 %d OK\r\nContent-Type: %s\r\nContent-Length: %lld\r\nConnection: close\r\nServer: suzuka\r\n\r\n",
*(unsigned __int16 *)a1,
a1[1],
a1[2]);
}

original_code:
void sk_http_write_response_header(sk_http_response* response, char* buff, size_t buflen)
{
  snprintf(buff,
           buflen,
          "HTTP/1.1 %d OK" "\r\n"
          "Content-Type: %s" "\r\n"
          "Content-Length: %lld" "\r\n"
          "Connection: close" "\r\n"
          "Server: suzuka" "\r\n" "\r\n",
          response->status_code,
          response->content_type,
          response->content_length);
}

canonical_original_code:
void sk_http_write_response_header(struct sk_http_response *response, char *buff, unsigned long buflen)
{
  snprintf(buff,
           buflen,
          "HTTP/1.1 %d OK" "\r\n"
          "Content-Type: %s" "\r\n"
          "Content-Length: %lld" "\r\n"
          "Connection: close" "\r\n"
          "Server: suzuka" "\r\n" "\r\n",
          response->status_code,
          response->content_type,
          response->content_length);
}

variable_types: struct sk_http_response { unsigned short status_code; char *content_type; unsigned long content_length; } *

variable_types:
buff
char *

variable_types:
buflen
unsigned long


decompiled_code:
char __fastcall sk_image_parse_term(char *a1, int *a2)
{
int v2; // eax
int v3; // edx
bool v4; // zf
int v6; // [rsp+4h] [rbp-14h] BYREF
char *save_ptr; // [rsp+8h] [rbp-10h] BYREF

v2 = (unsigned int)strtok_r(a1, "=", &save_ptr);
if ( v2 )
{
v3 = *(unsigned __int8 *)v2;
if ( v3 != 119 || *((_BYTE *)&loc_1 + v2) )
{
if ( v3 == 104 && !*((_BYTE *)&loc_1 + v2) )
{
v4 = strcmp(save_ptr, "auto") == 0;
LOBYTE(v2) = !v4;
if ( v4 )
{
a2[2] |= 4u;
}
else
{
v2 = _isoc99_sscanf(save_ptr, "%ud", &v6);
if ( v2 > 0 )
{
v2 = v6;
a2[2] &= 0xFFFFFFFB;
a2[1] = v2;
}
}
}
}
else
{
v4 = strcmp(save_ptr, "auto") == 0;
LOBYTE(v2) = !v4;
if ( v4 )
{
a2[2] |= 2u;
}
else
{
v2 = _isoc99_sscanf(save_ptr, "%ud", &v6);
if ( v2 > 0 )
{
v2 = v6;
a2[2] &= 0xFFFFFFFD;
*a2 = v2;
}
}
}
}
return v2;
}

canonical_decompiled_code:
char __fastcall func0(char *a1, int *a2)
{
int v2; // eax
int v3; // edx
bool v4; // zf
int v6; // [rsp+4h] [rbp-14h] BYREF
char *save_ptr; // [rsp+8h] [rbp-10h] BYREF

v2 = (unsigned int)strtok_r(a1, "=", &save_ptr);
if ( v2 )
{
v3 = *(unsigned __int8 *)v2;
if ( v3 != 119 || *((_BYTE *)&loc_1 + v2) )
{
if ( v3 == 104 && !*((_BYTE *)&loc_1 + v2) )
{
v4 = strcmp(save_ptr, "auto") == 0;
LOBYTE(v2) = !v4;
if ( v4 )
{
a2[2] |= 4u;
}
else
{
v2 = _isoc99_sscanf(save_ptr, "%ud", &v6);
if ( v2 > 0 )
{
v2 = v6;
a2[2] &= 0xFFFFFFFB;
a2[1] = v2;
}
}
}
}
else
{
v4 = strcmp(save_ptr, "auto") == 0;
LOBYTE(v2) = !v4;
if ( v4 )
{
a2[2] |= 2u;
}
else
{
v2 = _isoc99_sscanf(save_ptr, "%ud", &v6);
if ( v2 > 0 )
{
v2 = v6;
a2[2] &= 0xFFFFFFFD;
*a2 = v2;
}
}
}
}
return v2;
}

original_code:
void sk_image_parse_term(char* term, sk_image_request* result)
{
  char* saveptr;
  char* name = strtok_r(term, "=", &saveptr);
  if(name == ((void *)0)) return;
  if(strcmp(name, "w") == 0) {
    if(strcmp(saveptr, "auto") == 0) {
      result->convert_flag |= 0b0010;
    } else {
      uint32_t width;
      if(sscanf(saveptr, "%ud", &width) > 0) {
        result->convert_flag &= ~0b0010;
        result->width = width;
      }
    }
  } else if(strcmp(name, "h") == 0) {
    if(strcmp(saveptr, "auto") == 0) {
      result->convert_flag |= 0b0100;
    } else {
      uint32_t height;
      if(sscanf(saveptr, "%ud", &height) > 0) {
        result->convert_flag &= ~0b0100;
        result->height = height;
      }
    }
  }
}

canonical_original_code:
void sk_image_parse_term(char *term, struct sk_image_request *result)
{
  char *saveptr;
  char *name = strtok_r(term, "=", &saveptr);
  if(name == ((void *)0)) return;
  if(strcmp(name, "w") == 0) {
    if(strcmp(saveptr, "auto") == 0) {
      result->convert_flag |= 0b0010;
    } else {
      unsigned int width;
      if(sscanf(saveptr, "%ud", &width) > 0) {
        result->convert_flag &= ~0b0010;
        result->width = width;
      }
    }
  } else if(strcmp(name, "h") == 0) {
    if(strcmp(saveptr, "auto") == 0) {
      result->convert_flag |= 0b0100;
    } else {
      unsigned int height;
      if(sscanf(saveptr, "%ud", &height) > 0) {
        result->convert_flag &= ~0b0100;
        result->height = height;
      }
    }
  }
}

variable_types:
term
char *

variable_types: struct sk_image_request { unsigned int width; unsigned int convert_flag; char *path; } *

variable_types:
name
char *

variable_types:
width
unsigned int

variable_types:
height
unsigned int


decompiled_code:
char *__fastcall sk_image_parse_request(char *a1, __int64 a2)
{
char *result; // rax
char *save_ptr[4]; // [rsp+8h] [rbp-20h] BYREF

result = strtok_r(a1, "?", save_ptr);
if ( save_ptr[0] )
{
*(_QWORD *)(a2 + 16) = (int)result;
while ( 1 )
{
result = strtok_r(0LL, "&", save_ptr);
if ( !(_DWORD)result )
break;
sk_image_parse_term((char *)(int)result, (int *)a2);
}
}
else
{
*(_QWORD *)(a2 + 16) = a1;
*(_DWORD *)(a2 + 8) |= 1u;
}
return result;
}

canonical_decompiled_code:
char *__fastcall func1(char *a1, __int64 a2)
{
char *result; // rax
char *save_ptr[4]; // [rsp+8h] [rbp-20h] BYREF

result = strtok_r(a1, "?", save_ptr);
if ( save_ptr[0] )
{
*(_QWORD *)(a2 + 16) = (int)result;
while ( 1 )
{
result = strtok_r(0LL, "&", save_ptr);
if ( !(_DWORD)result )
break;
func0((char *)(int)result, (int *)a2);
}
}
else
{
*(_QWORD *)(a2 + 16) = a1;
*(_DWORD *)(a2 + 8) |= 1u;
}
return result;
}

original_code:
void sk_image_parse_request(char* request, sk_image_request* result)
{
  char* saveptr;
  char* path = strtok_r(request, "?", &saveptr);
  if(saveptr == ((void *)0)) {
    result->path = request;
    result->convert_flag |= 0b0001;
    return;
  }
  result->path = path;
  char* term;
  while((term = strtok_r(((void *)0), "&", &saveptr)) != ((void *)0)) {
    sk_image_parse_term(term, result);
  }
}

canonical_original_code:
void sk_image_parse_request(char *request, struct sk_image_request *result)
{
  char *saveptr;
  char *path = strtok_r(request, "?", &saveptr);
  if(saveptr == ((void *)0)) {
    result->path = request;
    result->convert_flag |= 0b0001;
    return;
  }
  result->path = path;
  char *term;
  while((term = strtok_r(((void *)0), "&", &saveptr)) != ((void *)0)) {
    sk_image_parse_term(term, result);
  }
}

variable_types:
request
char *

user_defined_types: struct sk_image_request { unsigned int width; unsigned int convert_flag; char *path; }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int16 v4; // [rsp+0h] [rbp-28h] BYREF
const char *v5; // [rsp+8h] [rbp-20h]
const char *v6; // [rsp+10h] [rbp-18h]
void *v7; // [rsp+18h] [rbp-10h]

_sysv_signal(13, handler);
v5 = "127.0.0.1";
v4 = 8080;
v7 = &sk_handler_simple_send;
v6 = "../public";
sk_server_start(&v4);
return 0;
}

original_code:
int main(int argc, char *argv[])
{
  signal(13 , ((__sighandler_t) 1));
  sk_server server;
  server.port = 8080;
  server.addr = "127.0.0.1";
  server.handler = sk_handler_simple_send;
  server.document_root = "../public";
  sk_server_start(&server);
  return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
  signal(13 , ((void (*)(int)) 1));
  struct sk_server_T server;
  server.port = 8080;
  server.addr = "127.0.0.1";
  server.handler = sk_handler_simple_send;
  server.document_root = "../public";
  sk_server_start(&server);
  return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct sk_server_T { unsigned short port; char *addr; char *document_root; void (*handler)(struct sk_server_T *, int); }


decompiled_code:
int __fastcall sk_log_error(const char *a1)
{
return fprintf(stderr, "%s\n", a1);
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
return fprintf(stderr, "%s\n", a1);
}

original_code:
void sk_log_error(char* str)
{
  fprintf(stderr, "%s\n", str);
}

canonical_original_code:
void sk_log_error(char *str)
{
  fprintf(stderr, "%s\n", str);
}

variable_types:
str
char *


decompiled_code:
// attributes: thunk
void sk_log_perror(const char *s)
{
perror(s);
}

canonical_decompiled_code:
void func1(const char *s)
{
perror(s);
}

original_code:
void sk_log_perror(char* str)
{
  perror(str);
}

canonical_original_code:
void sk_log_perror(char *str)
{
  perror(str);
}


decompiled_code:
// attributes: thunk
int __fastcall sk_log_debug(const char *a1)
{
return sk_log_error(a1);
}

canonical_decompiled_code:
int __fastcall func2(const char *a1)
{
return func0(a1);
}

original_code:
void sk_log_debug(char* str)
{
  fprintf(stderr, "%s\n", str);
}

canonical_original_code:
void sk_log_debug(char *str)
{
  fprintf(stderr, "%s\n", str);
}


decompiled_code:
const char *__fastcall sk_file_content_type_ext(const char *a1)
{
const char *v1; // r8

v1 = "image/jpeg";
if ( strcmp(a1, "jpg") )
{
if ( strcmp(a1, "jpeg") )
{
v1 = "text/html";
if ( !strcmp(a1, "png") )
v1 = "image/png";
}
}
return v1;
}

canonical_decompiled_code:
const char *__fastcall func0(const char *a1)
{
const char *v1; // r8

v1 = "image/jpeg";
if ( strcmp(a1, "jpg") )
{
if ( strcmp(a1, "jpeg") )
{
v1 = "text/html";
if ( !strcmp(a1, "png") )
v1 = "image/png";
}
}
return v1;
}

original_code:
const char* sk_file_content_type_ext(const char* ext)
{
  if(strcmp(ext, "jpg") == 0) {
    return "image/jpeg";
  } else if(strcmp(ext, "jpeg") == 0) {
    return "image/jpeg";
  } else if(strcmp(ext, "png") == 0) {
    return "image/png";
  }
  return "text/html";
}

canonical_original_code:
char *sk_file_content_type_ext(char *ext)
{
  if(strcmp(ext, "jpg") == 0) {
    return "image/jpeg";
  } else if(strcmp(ext, "jpeg") == 0) {
    return "image/jpeg";
  } else if(strcmp(ext, "png") == 0) {
    return "image/png";
  }
  return "text/html";
}

variable_types:
ext
char *

return_type: char *


decompiled_code:
const char *__fastcall sk_file_extname(const char *a1)
{
__int64 v1; // rax

LODWORD(v1) = strlen(a1) - 1;
if ( (int)v1 < 0 )
return (const char *)&unk_17A;
v1 = (int)v1;
while ( a1[v1] != 46 )
{
if ( (int)--v1 < 0 )
return (const char *)&unk_17A;
}
return &a1[(int)v1 + 1];
}

canonical_decompiled_code:
const char *__fastcall func1(const char *a1)
{
__int64 v1; // rax

LODWORD(v1) = strlen(a1) - 1;
if ( (int)v1 < 0 )
return (const char *)&unk_17A;
v1 = (int)v1;
while ( a1[v1] != 46 )
{
if ( (int)--v1 < 0 )
return (const char *)&unk_17A;
}
return &a1[(int)v1 + 1];
}

original_code:
const char* sk_file_extname(const char* path)
{
  int n = strlen(path);
  for (int i = n-1; i >= 0; i--){
    if(path[i] == '.') {
      return &path[i+1];
    }
  }
  return "";
}

canonical_original_code:
char *sk_file_extname(char *path)
{
  int n = strlen(path);
  for (int i = n-1; i >= 0; i--){
    if(path[i] == '.') {
      return &path[i+1];
    }
  }
  return "";
}

variable_types:
path
char *

variable_types: n int

variable_types: i int


decompiled_code:
const char *__fastcall sk_file_content_type(const char *a1)
{
const char *v1; // rax

v1 = sk_file_extname(a1);
return sk_file_content_type_ext(v1);
}

canonical_decompiled_code:
const char *__fastcall func2(const char *a1)
{
const char *v1; // rax

v1 = func1(a1);
return func0(v1);
}

original_code:
const char* sk_file_content_type(const char* path)
{
  const char* ext = sk_file_extname(path);
  return sk_file_content_type_ext(ext);
}

canonical_original_code:
char *sk_file_content_type(char *path)
{
  char *ext = sk_file_extname(path);
  return sk_file_content_type_ext(ext);
}


decompiled_code:
__int64 __fastcall sk_file_validate_path(char *a1)
{
__int64 result; // rax
char v2; // bp
int v3; // eax
char *v4; // rax
char v5; // dl

result = 0LL;
v2 = *a1;
if ( *a1 == 47 )
{
v3 = strlen(a1);
if ( v3 <= 0 )
{
LABEL_13:
result = 1LL;
}
else
{
v4 = &a1[v3 - 1];
while ( 1 )
{
if ( v2 == 47 )
{
v5 = a1[1];
if ( v5 == 47 || v5 && a1[2] == 46 && v5 == 46 )
break;
}
if ( a1 == v4 )
goto LABEL_13;
v2 = *++a1;
}
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *a1)
{
__int64 result; // rax
char v2; // bp
int v3; // eax
char *v4; // rax
char v5; // dl

result = 0LL;
v2 = *a1;
if ( *a1 == 47 )
{
v3 = strlen(a1);
if ( v3 <= 0 )
{
LABEL_13:
result = 1LL;
}
else
{
v4 = &a1[v3 - 1];
while ( 1 )
{
if ( v2 == 47 )
{
v5 = a1[1];
if ( v5 == 47 || v5 && a1[2] == 46 && v5 == 46 )
break;
}
if ( a1 == v4 )
goto LABEL_13;
v2 = *++a1;
}
result = 0LL;
}
}
return result;
}

original_code:
_Bool sk_file_validate_path(const char* path)
{
  if(path[0] != '/') {
    return 0;
  }
  int n = strlen(path);
  for (int i = 0; i < n; i++){
    if(path[i] == '/') {
      if(path[i+1] && path[i+1] == '/') {
        return 0;
      }
      if(path[i+1] && path[i+2] && path[i+1] == '.' && path[i+2] == '.') {
        return 0;
      }
    }
  }
  return 1;
}

canonical_original_code:
_Bool sk_file_validate_path(char *path)
{
  if(path[0] != '/') {
    return 0;
  }
  int n = strlen(path);
  for (int i = 0; i < n; i++){
    if(path[i] == '/') {
      if(path[i+1] && path[i+1] == '/') {
        return 0;
      }
      if(path[i+1] && path[i+2] && path[i+1] == '.' && path[i+2] == '.') {
        return 0;
      }
    }
  }
  return 1;
}


decompiled_code:
void *__fastcall sk_malloc(size_t a1)
{
void *result; // rax

result = malloc(a1);
if ( !result )
{
sk_log_error("Cannot allocate memory.");
exit(1);
}
return result;
}

canonical_decompiled_code:
void *__fastcall func0(size_t a1)
{
void *result; // rax

result = malloc(a1);
if ( !result )
{
sk_log_error("Cannot allocate memory.");
exit(1);
}
return result;
}

original_code:
void* sk_malloc(size_t size) {
  void* ptr = malloc(size);
  if(ptr == ((void *)0)) {
    sk_log_error("Cannot allocate memory.");
    exit(1);
  }
  return ptr;
}

canonical_original_code:
void *sk_malloc(unsigned long size) {
  void *ptr = malloc(size);
  if(ptr == ((void *)0)) {
    sk_log_error("Cannot allocate memory.");
    exit(1);
  }
  return ptr;
}

variable_types:
size
unsigned long

variable_types:
ptr
void *

return_type: void *


decompiled_code:
// attributes: thunk
void sk_free(void *ptr)
{
free(ptr);
}

canonical_decompiled_code:
void func1(void *ptr)
{
free(ptr);
}

original_code:
void sk_free(void* ptr) {
  free(ptr);
}

canonical_original_code:
void sk_free(void *ptr) {
  free(ptr);
}


decompiled_code:
void __fastcall __noreturn sk_server_start(__int64 a1)
{
int v2; // eax
__int16 v3; // di
int v4; // er12
int v5; // edx
const void *v6; // rcx
socklen_t v7; // er8
int v8; // ebp
socklen_t addr_len; // [rsp+Ch] [rbp-3Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-38h] BYREF
struct sockaddr v11; // [rsp+20h] [rbp-28h] BYREF

v2 = socket(2, 1, 0);
if ( v2 >= 0 )
{
v3 = *(_WORD *)a1;
v4 = v2;
addr_len = 16;
addr.sa_family = 2;
*(_WORD *)addr.sa_data = _bswap_16(v3);
*(_DWORD *)&addr.sa_data[2] = 0;
setsockopt(v4, 1, v5, v6, v7);
if ( bind(v4, &addr, 0x10u) >= 0 )
{
if ( listen(v4, 128) >= 0 )
{
while ( 1 )
{
v8 = accept(v4, &v11, &addr_len);
if ( v8 < 0 )
sk_log_perror("cannot accept");
(*(void (__fastcall **)(__int64, _QWORD))(a1 + 24))(a1, (unsigned int)v8);
}
}
sk_log_perror("cannot listen");
exit(1);
}
sk_log_perror("cannot bind");
exit(1);
}
sk_log_perror("cannot open server socket");
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func1(__int64 a1)
{
int v2; // eax
__int16 v3; // di
int v4; // er12
int v5; // edx
const void *v6; // rcx
socklen_t v7; // er8
int v8; // ebp
socklen_t addr_len; // [rsp+Ch] [rbp-3Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-38h] BYREF
struct sockaddr v11; // [rsp+20h] [rbp-28h] BYREF

v2 = socket(2, 1, 0);
if ( v2 >= 0 )
{
v3 = *(_WORD *)a1;
v4 = v2;
addr_len = 16;
addr.sa_family = 2;
*(_WORD *)addr.sa_data = func0(v3);
*(_DWORD *)&addr.sa_data[2] = 0;
setsockopt(v4, 1, v5, v6, v7);
if ( bind(v4, &addr, 0x10u) >= 0 )
{
if ( listen(v4, 128) >= 0 )
{
while ( 1 )
{
v8 = accept(v4, &v11, &addr_len);
if ( v8 < 0 )
sk_log_perror("cannot accept");
(*(void (__fastcall **)(__int64, _QWORD))(a1 + 24))(a1, (unsigned int)v8);
}
}
sk_log_perror("cannot listen");
exit(1);
}
sk_log_perror("cannot bind");
exit(1);
}
sk_log_perror("cannot open server socket");
exit(1);
}

original_code:
void sk_server_start(sk_server* server)
{
  int server_sock;
  if((server_sock = socket(2, SOCK_STREAM, 0)) < 0){
    sk_log_perror("cannot open server socket");
    exit(1);
  }
  socklen_t sin_siz = sizeof(struct sockaddr_in);
  struct sockaddr_in serv, clt;
  serv.sin_family = 2;
  serv.sin_port = htons(server->port);
  serv.sin_addr.s_addr = ((in_addr_t) 0x00000000);
  char yes = 1;
  setsockopt(server_sock, 1, 2, (const char*)&yes, sizeof(yes));
  if(bind(server_sock, (struct sockaddr*)&serv, sizeof(serv)) < 0){
    sk_log_perror("cannot bind");
    exit(1);
  }
  if(listen(server_sock, 128) < 0){
    sk_log_perror("cannot listen");
    exit(1);
  }
  int client_sock;
  while(1) {
    if((client_sock = accept(server_sock, (struct sockaddr*)&clt, &sin_siz)) < 0){
      sk_log_perror("cannot accept");
    }
    server->handler(server, client_sock);
  }
}

canonical_original_code:
void sk_server_start(struct sk_server_T *server)
{
  int server_sock;
  if((server_sock = socket(2, SOCK_STREAM, 0)) < 0){
    sk_log_perror("cannot open server socket");
    exit(1);
  }
  unsigned int sin_siz = sizeof(struct sockaddr_in);
  struct sockaddr_in serv; struct sockaddr_in clt;
  serv.sin_family = 2;
  serv.sin_port = htons(server->port);
  serv.sin_addr.s_addr = ((unsigned int) 0x00000000);
  char yes = 1;
  setsockopt(server_sock, 1, 2, (char *)&yes, sizeof(yes));
  if(bind(server_sock, (struct sockaddr *)&serv, sizeof(serv)) < 0){
    sk_log_perror("cannot bind");
    exit(1);
  }
  if(listen(server_sock, 128) < 0){
    sk_log_perror("cannot listen");
    exit(1);
  }
  int client_sock;
  while(1) {
    if((client_sock = accept(server_sock, (struct sockaddr *)&clt, &sin_siz)) < 0){
      sk_log_perror("cannot accept");
    }
    server->handler(server, client_sock);
  }
}

variable_types: struct sk_server_T { unsigned short port; char *addr; char *document_root; void (*handler)(struct sk_server_T *, int); } *

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }

variable_types: yes char

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


repo: rnakano/amitahash

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
__int64 v4; // rbp
int v5; // eax
__int64 v6; // rax
int v7; // er12
__int64 v8; // rbx
const char *v9; // rax
char v11[32]; // [rsp+0h] [rbp-A8h] BYREF
char s[136]; // [rsp+20h] [rbp-88h] BYREF

v3 = 0LL;
v4 = ah_table_create(2000LL, argv, envp);
do
{
v5 = rand();
gen_random_key(v11, (unsigned int)v3, (unsigned int)(v5 % 12 + 8));
sprintf(s, "%d", (unsigned int)v3);
v6 = 5 * v3++;
strcpy(&data[4 * v6], v11);
ah_table_set(v4, v11, s);
}
while ( v3 != 1000 );
v7 = 10;
do
{
v8 = 0LL;
while ( 1 )
{
v9 = (const char *)ah_table_get(v4, &data[20 * v8]);
if ( atoi(v9) != (_DWORD)v8 )
break;
if ( ++v8 == 1000 )
goto LABEL_8;
}
puts("value is changed!!");
LABEL_8:
--v7;
}
while ( v7 );
ah_table_delete(v4);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
__int64 v4; // rbp
int v5; // eax
__int64 v6; // rax
int v7; // er12
__int64 v8; // rbx
const char *v9; // rax
char v11[32]; // [rsp+0h] [rbp-A8h] BYREF
char s[136]; // [rsp+20h] [rbp-88h] BYREF

v3 = 0LL;
v4 = ah_table_create(2000LL, argv, envp);
do
{
v5 = rand();
func26(v11, (unsigned int)v3, (unsigned int)(v5 % 12 + 8));
sprintf(s, "%d", (unsigned int)v3);
v6 = 5 * v3++;
strcpy(&data[4 * v6], v11);
func8(v4, v11, s);
}
while ( v3 != 1000 );
v7 = 10;
do
{
v8 = 0LL;
while ( 1 )
{
v9 = (const char *)func9(v4, &data[20 * v8]);
if ( atoi(v9) != (_DWORD)v8 )
break;
if ( ++v8 == 1000 )
goto LABEL_8;
}
puts("value is changed!!");
LABEL_8:
--v7;
}
while ( v7 );
func11(v4);
return 0;
}

original_code:
int main(int argc, char *argv[])
{
  ah_table* table = ah_table_create(2000);
  char keybuff[20], valuebuff[100];
  for(uint i = 0; i < 1000; i++) {
    uint len = rand() % (20 - 8) + 8;
    gen_random_key(keybuff, i, len);
    sprintf(valuebuff, "%d", i);
    strcpy(data[i], keybuff);
    ah_table_set(table, keybuff, valuebuff);
  }
  for(uint k = 0; k < 10; k++) {
    for(uint i = 0; i < 1000; i++) {
      char* value = ah_table_get(table, data[i]);
      if(atoi(value) != i) {
        printf("value is changed!!\n");
        break;
      }
    }
  }
  ah_table_delete(table);
  return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
  struct ah_t_table *table = ah_table_create(2000);
  char keybuff[20]; char valuebuff[100];
  for(unsigned int i = 0; i < 1000; i++) {
    unsigned int len = rand() % (20 - 8) + 8;
    gen_random_key(keybuff, i, len);
    sprintf(valuebuff, "%d", i);
    strcpy(data[i], keybuff);
    ah_table_set(table, keybuff, valuebuff);
  }
  for(unsigned int k = 0; k < 10; k++) {
    for(unsigned int i = 0; i < 1000; i++) {
      char *value = ah_table_get(table, data[i]);
      if(atoi(value) != i) {
        printf("value is changed!!\n");
        break;
      }
    }
  }
  ah_table_delete(table);
  return 0;
}

variable_types: struct ah_t_table { struct ah_t_bucket { char *key; char *value; struct ah_t_bucket *next; } **data; unsigned long current; unsigned long size; } *

variable_types:
keybuff
char [20]

variable_types:
valuebuff
char [100]

variable_types:
i
unsigned int

variable_types:
len
unsigned int

variable_types:
k
unsigned int

variable_types:
value
char *

user_defined_types: struct ah_t_table { struct ah_t_bucket **data; unsigned long current; unsigned long size; }


decompiled_code:
__int64 __fastcall ah_table_hash(const char *a1, unsigned __int64 a2)
{
return (unsigned int)(a2 * *a1 * a1[strlen(a1) >> 1] % a2);
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, unsigned __int64 a2)
{
return (unsigned int)(a2 * *a1 * a1[strlen(a1) >> 1] % a2);
}

original_code:
hash_code ah_table_hash(char* key, ulong size)
{
  ulong l = strlen(key);
  return (key[0] * key[l/2] * size) % size;
}

canonical_original_code:
unsigned int ah_table_hash(char *key, unsigned long size)
{
  unsigned long l = strlen(key);
  return (key[0] * key[l/2] * size) % size;
}

variable_types:
key
char *

variable_types:
l
unsigned long

return_type: unsigned int


decompiled_code:
__int64 __fastcall ah_table_set(_QWORD *a1, const char *a2, __int64 a3)
{
__int64 v4; // r13
signed int v5; // eax

v4 = *a1 + 8LL * (unsigned int)ah_table_hash(a2, a1[2]);
v5 = (unsigned int)strdup(a2);
return ah_bucket_insert(v4, v5, a3);
}

canonical_decompiled_code:
__int64 __fastcall func8(_QWORD *a1, const char *a2, __int64 a3)
{
__int64 v4; // r13
signed int v5; // eax

v4 = *a1 + 8LL * (unsigned int)func7(a2, a1[2]);
v5 = (unsigned int)strdup(a2);
return func14(v4, v5, a3);
}

original_code:
void ah_table_set(ah_table* table, char* key, char* value)
{
  hash_code hash = ah_table_hash(key, table->size);
  ah_bucket** bucket = & (table->data[hash]);
  ah_bucket_insert(bucket, strdup(key), value);
}

canonical_original_code:
void ah_table_set(struct ah_t_table *table, char *key, char *value)
{
  unsigned int hash = ah_table_hash(key, table->size);
  struct ah_t_bucket **bucket = & (table->data[hash]);
  ah_bucket_insert(bucket, strdup(key), value);
}

variable_types:
hash
unsigned int

variable_types: struct ah_t_bucket { char *key; char *value; struct ah_t_bucket *next; } **


decompiled_code:
__int64 __fastcall ah_table_get(_QWORD *a1, const char *a2)
{
unsigned int v2; // eax
__int64 result; // rax

v2 = ah_table_hash(a2, a1[2]);
result = ah_bucket_search(*(_QWORD *)(*a1 + 8LL * v2), a2);
if ( result )
result = *(_QWORD *)(result + 8);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(_QWORD *a1, const char *a2)
{
unsigned int v2; // eax
__int64 result; // rax

v2 = func7(a2, a1[2]);
result = func15(*(_QWORD *)(*a1 + 8LL * v2), a2);
if ( result )
result = *(_QWORD *)(result + 8);
return result;
}

original_code:
char* ah_table_get(ah_table* table, char* key)
{
  hash_code hash = ah_table_hash(key, table->size);
  ah_bucket* bucket = (table->data[hash]);
  ah_bucket* find = ah_bucket_search(bucket, key);
  if(find) {
    return find->value;
  } else {
    return ((void *)0);
  }
}

canonical_original_code:
char *ah_table_get(struct ah_t_table *table, char *key)
{
  unsigned int hash = ah_table_hash(key, table->size);
  struct ah_t_bucket *bucket = (table->data[hash]);
  struct ah_t_bucket *find = ah_bucket_search(bucket, key);
  if(find) {
    return find->value;
  } else {
    return ((void *)0);
  }
}

variable_types: struct ah_t_bucket { char *key; char *value; struct ah_t_bucket *next; } *


decompiled_code:
__int64 __fastcall ah_table_remove(_QWORD *a1, const char *a2)
{
unsigned int v2; // eax

v2 = ah_table_hash(a2, a1[2]);
return ah_bucket_remove(*a1 + 8LL * v2, a2);
}

canonical_decompiled_code:
__int64 __fastcall func10(_QWORD *a1, const char *a2)
{
unsigned int v2; // eax

v2 = func7(a2, a1[2]);
return func22(*a1 + 8LL * v2, a2);
}

original_code:
void ah_table_remove(ah_table* table, char* key)
{
  hash_code hash = ah_table_hash(key, table->size);
  ah_bucket** bucket = & (table->data[hash]);
  ah_bucket_remove(bucket, key);
}

canonical_original_code:
void ah_table_remove(struct ah_t_table *table, char *key)
{
  unsigned int hash = ah_table_hash(key, table->size);
  struct ah_t_bucket **bucket = & (table->data[hash]);
  ah_bucket_remove(bucket, key);
}

user_defined_types: struct ah_t_bucket { char *key; char *value; struct ah_t_bucket *next; }


decompiled_code:
__int64 __fastcall ah_table_delete(__int64 *a1)
{
bool v2; // zf
__int64 v3; // rdi
unsigned int v4; // ebp
__int64 v5; // rbx

v2 = a1[2] == 0;
v3 = *a1;
if ( !v2 )
{
v4 = 0;
v5 = 0LL;
do
{
ah_bucket_delete(*(_QWORD *)(v3 + 8 * v5));
v3 = *a1;
*(_QWORD *)(*a1 + 8 * v5) = 0LL;
v5 = ++v4;
}
while ( v4 < (unsigned __int64)a1[2] );
}
ah_free(v3);
return ah_free(a1);
}

original_code:
void ah_table_delete(ah_table* table)
{
  for(uint i = 0; i < table->size; i++)
  {
    ah_bucket_delete(table->data[i]);
    table->data[i] = ((void *)0);
  }
  ah_free(table->data);
  ah_free(table);
}

canonical_original_code:
void ah_table_delete(struct ah_t_table *table)
{
  for(unsigned int i = 0; i < table->size; i++)
  {
    ah_bucket_delete(table->data[i]);
    table->data[i] = ((void *)0);
  }
  ah_free(table->data);
  ah_free(table);
}


decompiled_code:
__int64 ah_bucket_create_empty()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func12()
{
return 0LL;
}

original_code:
ah_bucket* ah_bucket_create_empty()
{
  return ((void *)0);
}

canonical_original_code:
struct ah_t_bucket *ah_bucket_create_empty()
{
  return ((void *)0);
}

return_type: struct ah_t_bucket { char *key; char *value; struct ah_t_bucket *next; } *


decompiled_code:
__int64 ah_bucket_create()
{
__int64 result; // rax

result = ah_malloc(24LL);
*(_QWORD *)(result + 16) = 0LL;
return result;
}

canonical_decompiled_code:
__int64 func13()
{
__int64 result; // rax

result = func24(24LL);
*(_QWORD *)(result + 16) = 0LL;
return result;
}

original_code:
ah_bucket* ah_bucket_create()
{
  ah_bucket* bucket = (ah_bucket*) ah_malloc(sizeof(ah_bucket));
  bucket->next = ((void *)0);
  return bucket;
}

canonical_original_code:
struct ah_t_bucket *ah_bucket_create()
{
  struct ah_t_bucket *bucket = (ah_bucket*) ah_malloc(sizeof(ah_bucket));
  bucket->next = ((void *)0);
  return bucket;
}


decompiled_code:
__int64 __fastcall ah_bucket_search(__int64 a1, const char *a2)
{
__int64 v2; // rbx

if ( !a1 )
return 0LL;
v2 = a1;
do
{
if ( !strcmp(*(const char **)v2, a2) )
return v2;
v2 = *(_QWORD *)(v2 + 16);
}
while ( v2 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, const char *a2)
{
__int64 v2; // rbx

if ( !a1 )
return 0LL;
v2 = a1;
do
{
if ( !strcmp(*(const char **)v2, a2) )
return v2;
v2 = *(_QWORD *)(v2 + 16);
}
while ( v2 );
return 0LL;
}

original_code:
ah_bucket* ah_bucket_search(ah_bucket* bucket, char* key)
{
  if(((void *)0) == bucket) {
    return ((void *)0);
  }
  if(strcmp(bucket->key, key) == 0) {
    return bucket;
  } else {
    return ah_bucket_search(bucket->next, key);
  }
}

canonical_original_code:
struct ah_t_bucket *ah_bucket_search(struct ah_t_bucket *bucket, char *key)
{
  if(((void *)0) == bucket) {
    return ((void *)0);
  }
  if(strcmp(bucket->key, key) == 0) {
    return bucket;
  } else {
    return ah_bucket_search(bucket->next, key);
  }
}

variable_types:
bucket
struct ah_t_bucket *