LTRAmParam

repo: gserdyuk/gnucap-a

decompiled_code:
__int64 __fastcall LTRAmParam(int a1, _QWORD *a2, __int64 a3)
{
__int64 result; // rax

switch ( a1 )
{
case 'd':
result = 0LL;
break;
case 'e':
*(_QWORD *)(a3 + 120) = *a2;
*(_BYTE *)(a3 + 328) |= 1u;
result = 0LL;
break;
case 'f':
*(_QWORD *)(a3 + 128) = *a2;
*(_BYTE *)(a3 + 328) |= 4u;
result = 0LL;
break;
case 'g':
*(_QWORD *)(a3 + 112) = *a2;
*(_BYTE *)(a3 + 328) |= 2u;
result = 0LL;
break;
case 'h':
*(_QWORD *)(a3 + 136) = *a2;
*(_BYTE *)(a3 + 328) |= 8u;
result = 0LL;
break;
case 'i':
*(_QWORD *)(a3 + 144) = *a2;
*(_BYTE *)(a3 + 328) |= 0x10u;
result = 0LL;
break;
case 'j':
*(_QWORD *)(a3 + 360) = *a2;
*(_BYTE *)(a3 + 304) |= 1u;
result = 0LL;
break;
case 'k':
*(_QWORD *)(a3 + 352) = *a2;
*(_BYTE *)(a3 + 304) |= 2u;
result = 0LL;
break;
case 'l':
*(_DWORD *)(a3 + 332) = 108;
result = 0LL;
break;
case 'm':
*(_DWORD *)(a3 + 332) = 109;
result = 0LL;
break;
case 'n':
*(_DWORD *)(a3 + 332) = 110;
result = 0LL;
break;
case 'o':
*(_DWORD *)(a3 + 340) = 111;
result = 0LL;
break;
case 'p':
*(_DWORD *)(a3 + 340) = 112;
result = 0LL;
break;
case 'q':
*(_DWORD *)(a3 + 336) = 113;
result = 0LL;
break;
case 'r':
*(_DWORD *)(a3 + 336) = 114;
result = 0LL;
break;
case 's':
*(_DWORD *)(a3 + 336) = 115;
result = 0LL;
break;
case 't':
*(_DWORD *)(a3 + 308) = 1;
result = 0LL;
break;
case 'u':
*(_DWORD *)(a3 + 312) = 1;
result = 0LL;
break;
case 'v':
*(_QWORD *)(a3 + 272) = *a2;
result = 0LL;
break;
case 'w':
*(_QWORD *)(a3 + 288) = *a2;
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, _QWORD *a2, __int64 a3)
{
__int64 result; // rax

switch ( a1 )
{
case 'd':
result = 0LL;
break;
case 'e':
*(_QWORD *)(a3 + 120) = *a2;
*(_BYTE *)(a3 + 328) |= 1u;
result = 0LL;
break;
case 'f':
*(_QWORD *)(a3 + 128) = *a2;
*(_BYTE *)(a3 + 328) |= 4u;
result = 0LL;
break;
case 'g':
*(_QWORD *)(a3 + 112) = *a2;
*(_BYTE *)(a3 + 328) |= 2u;
result = 0LL;
break;
case 'h':
*(_QWORD *)(a3 + 136) = *a2;
*(_BYTE *)(a3 + 328) |= 8u;
result = 0LL;
break;
case 'i':
*(_QWORD *)(a3 + 144) = *a2;
*(_BYTE *)(a3 + 328) |= 0x10u;
result = 0LL;
break;
case 'j':
*(_QWORD *)(a3 + 360) = *a2;
*(_BYTE *)(a3 + 304) |= 1u;
result = 0LL;
break;
case 'k':
*(_QWORD *)(a3 + 352) = *a2;
*(_BYTE *)(a3 + 304) |= 2u;
result = 0LL;
break;
case 'l':
*(_DWORD *)(a3 + 332) = 108;
result = 0LL;
break;
case 'm':
*(_DWORD *)(a3 + 332) = 109;
result = 0LL;
break;
case 'n':
*(_DWORD *)(a3 + 332) = 110;
result = 0LL;
break;
case 'o':
*(_DWORD *)(a3 + 340) = 111;
result = 0LL;
break;
case 'p':
*(_DWORD *)(a3 + 340) = 112;
result = 0LL;
break;
case 'q':
*(_DWORD *)(a3 + 336) = 113;
result = 0LL;
break;
case 'r':
*(_DWORD *)(a3 + 336) = 114;
result = 0LL;
break;
case 's':
*(_DWORD *)(a3 + 336) = 115;
result = 0LL;
break;
case 't':
*(_DWORD *)(a3 + 308) = 1;
result = 0LL;
break;
case 'u':
*(_DWORD *)(a3 + 312) = 1;
result = 0LL;
break;
case 'v':
*(_QWORD *)(a3 + 272) = *a2;
result = 0LL;
break;
case 'w':
*(_QWORD *)(a3 + 288) = *a2;
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

original_code:
int
LTRAmParam(int param, IFvalue *value, GENmodel *inModel)
{
  LTRAmodel *mods = (LTRAmodel *) inModel;
  switch (param) {
  case 0:
    break;
  case 11:
    mods->LTRAreltol = value->rValue;
    mods->LTRAreltolGiven = 1;
    break;
  case 12:
    mods->LTRAabstol = value->rValue;
    mods->LTRAabstolGiven = 1;
    break;
  case 42:
    mods->LTRAstLineReltol = value->rValue;
    break;
  case 43:
    mods->LTRAstLineAbstol = value->rValue;
    break;
  case 44:
    mods->LTRAchopReltol = value->rValue;
    break;
  case 45:
    mods->LTRAchopAbstol = value->rValue;
    break;
  case 46:
    mods->LTRAtruncNR = 1;
    break;
  case 47:
    mods->LTRAtruncDontCut = 1;
    break;
  case 1:
    mods->LTRAresist = value->rValue;
    mods->LTRAresistGiven = 1;
    break;
  case 2:
    mods->LTRAinduct = value->rValue;
    mods->LTRAinductGiven = 1;
    break;
  case 3:
    mods->LTRAconduct = value->rValue;
    mods->LTRAconductGiven = 1;
    break;
  case 4:
    mods->LTRAcapac = value->rValue;
    mods->LTRAcapacGiven = 1;
    break;
  case 5:
    mods->LTRAlength = value->rValue;
    mods->LTRAlengthGiven = 1;
    break;
  case 22:
    mods->LTRAnl = value->rValue;
    mods->LTRAnlGiven = 1;
    break;
  case 23:
    mods->LTRAf = value->rValue;
    mods->LTRAfGiven = 1;
    break;
  case 26:
    mods->LTRAlteConType = 26;
    break;
  case 27:
    mods->LTRAlteConType = 27;
    break;
  case 28:
    mods->LTRAlteConType = 28;
    break;
  case 29:
    mods->LTRAprintFlag = 1;
    break;
  case 30:
    mods->LTRAprintFlag = 0;
    break;
  case 32:
    mods->LTRAstepLimit = 32;
    break;
  case 33:
    mods->LTRAstepLimit = 33;
    break;
  case 34:
    mods->LTRAhowToInterp = 34;
    break;
  case 35:
    mods->LTRAhowToInterp = 35;
    break;
  case 36:
    mods->LTRAhowToInterp = 36;
    break;
  default:
    return (7);
  }
  return (0);
}

canonical_original_code:
int LTRAmParam(int param, union uIFvalue *value, struct sGENmodel *inModel)
{
  struct sLTRAmodel *mods = (LTRAmodel *) inModel;
  switch (param) {
  case 0:
    break;
  case 11:
    mods->LTRAreltol = value->rValue;
    mods->LTRAreltolGiven = 1;
    break;
  case 12:
    mods->LTRAabstol = value->rValue;
    mods->LTRAabstolGiven = 1;
    break;
  case 42:
    mods->LTRAstLineReltol = value->rValue;
    break;
  case 43:
    mods->LTRAstLineAbstol = value->rValue;
    break;
  case 44:
    mods->LTRAchopReltol = value->rValue;
    break;
  case 45:
    mods->LTRAchopAbstol = value->rValue;
    break;
  case 46:
    mods->LTRAtruncNR = 1;
    break;
  case 47:
    mods->LTRAtruncDontCut = 1;
    break;
  case 1:
    mods->LTRAresist = value->rValue;
    mods->LTRAresistGiven = 1;
    break;
  case 2:
    mods->LTRAinduct = value->rValue;
    mods->LTRAinductGiven = 1;
    break;
  case 3:
    mods->LTRAconduct = value->rValue;
    mods->LTRAconductGiven = 1;
    break;
  case 4:
    mods->LTRAcapac = value->rValue;
    mods->LTRAcapacGiven = 1;
    break;
  case 5:
    mods->LTRAlength = value->rValue;
    mods->LTRAlengthGiven = 1;
    break;
  case 22:
    mods->LTRAnl = value->rValue;
    mods->LTRAnlGiven = 1;
    break;
  case 23:
    mods->LTRAf = value->rValue;
    mods->LTRAfGiven = 1;
    break;
  case 26:
    mods->LTRAlteConType = 26;
    break;
  case 27:
    mods->LTRAlteConType = 27;
    break;
  case 28:
    mods->LTRAlteConType = 28;
    break;
  case 29:
    mods->LTRAprintFlag = 1;
    break;
  case 30:
    mods->LTRAprintFlag = 0;
    break;
  case 32:
    mods->LTRAstepLimit = 32;
    break;
  case 33:
    mods->LTRAstepLimit = 33;
    break;
  case 34:
    mods->LTRAhowToInterp = 34;
    break;
  case 35:
    mods->LTRAhowToInterp = 35;
    break;
  case 36:
    mods->LTRAhowToInterp = 36;
    break;
  default:
    return (7);
  }
  return (0);
}

variable_types: param int

variable_types: union uIFvalue { int iValue; double rValue; struct sIFcomplex { double real; double imag; } cValue; char *sValue; char *uValue; void *nValue; struct sIFparseTree { int numVars; int *varTypes; union uIFvalue *vars; int (*IFeval)(struct sIFparseTree *, double, double *, double *, double *); } *tValue; struct { int numValue; union { int *iVec; double *rVec; struct sIFcomplex *cVec; char **sVec; char **uVec; void **nVec; } vec; } v; } *

variable_types: struct sGENmodel { int GENmodType; struct sGENmodel *GENnextModel; struct sGENinstance { struct sGENmodel *GENmodPtr; struct sGENinstance *GENnextInstance; char *GENname; int GENowner; int GENstate; int GENnode1; int GENnode2; int GENnode3; int GENnode4; int GENnode5; int GENnode6; int GENnode7; } *GENinstances; char *GENmodName; } *

variable_types: struct sLTRAmodel { int LTRAmodType; struct sLTRAmodel *LTRAnextModel; struct sLTRAinstance { struct sLTRAmodel *LTRAmodPtr; struct sLTRAinstance *LTRAnextInstance; char *LTRAname; int LTRAowner; int LTRAstate; int LTRAposNode1; int LTRAnegNode1; int LTRAposNode2; int LTRAnegNode2; int LTRAbrEq1; int LTRAbrEq2; double LTRAinput1; double LTRAinput2; double LTRAinitVolt1; double LTRAinitCur1; double LTRAinitVolt2; double LTRAinitCur2; double *LTRAv1; double *LTRAi1; double *LTRAv2; double *LTRAi2; int LTRAinstListSize; double *LTRAibr1Ibr1Ptr; double *LTRAibr1Ibr2Ptr; double *LTRAibr1Pos1Ptr; double *LTRAibr1Neg1Ptr; double *LTRAibr1Pos2Ptr; double *LTRAibr1Neg2Ptr; double *LTRAibr2Ibr1Ptr; double *LTRAibr2Ibr2Ptr; double *LTRAibr2Pos1Ptr; double *LTRAibr2Neg1Ptr; double *LTRAibr2Pos2Ptr; double *LTRAibr2Neg2Ptr; double *LTRAneg1Ibr1Ptr; double *LTRAneg2Ibr2Ptr; double *LTRApos1Ibr1Ptr; double *LTRApos2Ibr2Ptr; double *LTRApos1Pos1Ptr; double *LTRAneg1Neg1Ptr; double *LTRApos2Pos2Ptr; double *LTRAneg2Neg2Ptr; unsigned int LTRAicV1Given; unsigned int LTRAicC1Given; unsigned int LTRAicV2Given; unsigned int LTRAicC2Given; } *LTRAinstances; char *LTRAmodName; double LTRAh1dashFirstVal; double LTRAh2FirstVal; double LTRAh3dashFirstVal; double LTRAh1dashFirstCoeff; double LTRAh2FirstCoeff; double LTRAh3dashFirstCoeff; double *LTRAh1dashCoeffs; double *LTRAh2Coeffs; double *LTRAh3dashCoeffs; int LTRAmodelListSize; double LTRAconduct; double LTRAresist; double LTRAinduct; double LTRAcapac; double LTRAlength; double LTRAtd; double LTRAimped; double LTRAadmit; double LTRAalpha; double LTRAbeta; double LTRAattenuation; double LTRAcByR; double LTRArclsqr; double LTRAintH1dash; double LTRAintH2; double LTRAintH3dash; double LTRAnl; double LTRAf; double LTRAcoshlrootGR; double LTRArRsLrGRorG; double LTRArGsLrGRorR; int LTRAauxIndex; double LTRAstLineReltol; double LTRAchopReltol; double LTRAstLineAbstol; double LTRAchopAbstol; unsigned int LTRAreltolGiven; unsigned int LTRAabstolGiven; unsigned int LTRAtruncNR; unsigned int LTRAtruncDontCut; double LTRAmaxSafeStep; unsigned int LTRAresistGiven; unsigned int LTRAconductGiven; unsigned int LTRAinductGiven; unsigned int LTRAcapacGiven; unsigned int LTRAlengthGiven; unsigned int LTRAnlGiven; int LTRAlteConType; int LTRAhowToInterp; unsigned int LTRAprintFlag; int LTRAstepLimit; unsigned int LTRAfGiven; double LTRAabstol; double LTRAreltol; int LTRAspecialCase; } *

return_type: int

user_defined_types: union uIFvalue { int iValue; double rValue; struct sIFcomplex cValue; char *sValue; char *uValue; void *nValue; struct sIFparseTree *tValue; struct { int numValue; union { int *iVec; double *rVec; struct sIFcomplex *cVec; char **sVec; char **uVec; void **nVec; } vec; } v; }

user_defined_types: struct sGENmodel { int GENmodType; struct sGENmodel *GENnextModel; struct sGENinstance *GENinstances; char *GENmodName; }

user_defined_types: struct sLTRAmodel { int LTRAmodType; struct sLTRAmodel *LTRAnextModel; struct sLTRAinstance *LTRAinstances; char *LTRAmodName; double LTRAh1dashFirstVal; double LTRAh2FirstVal; double LTRAh3dashFirstVal; double LTRAh1dashFirstCoeff; double LTRAh2FirstCoeff; double LTRAh3dashFirstCoeff; double *LTRAh1dashCoeffs; double *LTRAh2Coeffs; double *LTRAh3dashCoeffs; int LTRAmodelListSize; double LTRAconduct; double LTRAresist; double LTRAinduct; double LTRAcapac; double LTRAlength; double LTRAtd; double LTRAimped; double LTRAadmit; double LTRAalpha; double LTRAbeta; double LTRAattenuation; double LTRAcByR; double LTRArclsqr; double LTRAintH1dash; double LTRAintH2; double LTRAintH3dash; double LTRAnl; double LTRAf; double LTRAcoshlrootGR; double LTRArRsLrGRorG; double LTRArGsLrGRorR; int LTRAauxIndex; double LTRAstLineReltol; double LTRAchopReltol; double LTRAstLineAbstol; double LTRAchopAbstol; unsigned int LTRAreltolGiven; unsigned int LTRAabstolGiven; unsigned int LTRAtruncNR; unsigned int LTRAtruncDontCut; double LTRAmaxSafeStep; unsigned int LTRAresistGiven; unsigned int LTRAconductGiven; unsigned int LTRAinductGiven; unsigned int LTRAcapacGiven; unsigned int LTRAlengthGiven; unsigned int LTRAnlGiven; int LTRAlteConType; int LTRAhowToInterp; unsigned int LTRAprintFlag; int LTRAstepLimit; unsigned int LTRAfGiven; double LTRAabstol; double LTRAreltol; int LTRAspecialCase; }


LTRAparam

original_code:
int
LTRAparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
  LTRAinstance *here = (LTRAinstance *) inst;
  switch (param) {
  case 6:
    here->LTRAinitVolt1 = value->rValue;
    here->LTRAicV1Given = 1;
    break;
  case 7:
    here->LTRAinitCur1 = value->rValue;
    here->LTRAicC1Given = 1;
    break;
  case 8:
    here->LTRAinitVolt2 = value->rValue;
    here->LTRAicV2Given = 1;
    break;
  case 9:
    here->LTRAinitCur2 = value->rValue;
    here->LTRAicC2Given = 1;
    break;
  case 10:
    switch (value->v.numValue) {
    case 4:
      here->LTRAinitCur2 = *(value->v.vec.rVec + 3);
      break;
    case 3:
      here->LTRAinitVolt2 = *(value->v.vec.rVec + 2);
      break;
    case 2:
      here->LTRAinitCur1 = *(value->v.vec.rVec + 1);
      break;
    case 1:
      here->LTRAinitVolt1 = *(value->v.vec.rVec);
      break;
    default:
      return (7);
    }
    break;
  default:
    return (7);
  }
  return (0);
}

canonical_original_code:
int LTRAparam(int param, union uIFvalue *value, struct sGENinstance *inst, union uIFvalue *select)
{
  struct sLTRAinstance *here = (LTRAinstance *) inst;
  switch (param) {
  case 6:
    here->LTRAinitVolt1 = value->rValue;
    here->LTRAicV1Given = 1;
    break;
  case 7:
    here->LTRAinitCur1 = value->rValue;
    here->LTRAicC1Given = 1;
    break;
  case 8:
    here->LTRAinitVolt2 = value->rValue;
    here->LTRAicV2Given = 1;
    break;
  case 9:
    here->LTRAinitCur2 = value->rValue;
    here->LTRAicC2Given = 1;
    break;
  case 10:
    switch (value->v.numValue) {
    case 4:
      here->LTRAinitCur2 = *(value->v.vec.rVec + 3);
      break;
    case 3:
      here->LTRAinitVolt2 = *(value->v.vec.rVec + 2);
      break;
    case 2:
      here->LTRAinitCur1 = *(value->v.vec.rVec + 1);
      break;
    case 1:
      here->LTRAinitVolt1 = *(value->v.vec.rVec);
      break;
    default:
      return (7);
    }
    break;
  default:
    return (7);
  }
  return (0);
}

variable_types: struct sGENinstance { struct sGENmodel { int GENmodType; struct sGENmodel *GENnextModel; struct sGENinstance *GENinstances; char *GENmodName; } *GENmodPtr; struct sGENinstance *GENnextInstance; char *GENname; int GENowner; int GENstate; int GENnode1; int GENnode2; int GENnode3; int GENnode4; int GENnode5; int GENnode6; int GENnode7; } *

variable_types:
select
union uIFvalue *

variable_types: struct sLTRAinstance { struct sLTRAmodel { int LTRAmodType; struct sLTRAmodel *LTRAnextModel; struct sLTRAinstance *LTRAinstances; char *LTRAmodName; double LTRAh1dashFirstVal; double LTRAh2FirstVal; double LTRAh3dashFirstVal; double LTRAh1dashFirstCoeff; double LTRAh2FirstCoeff; double LTRAh3dashFirstCoeff; double *LTRAh1dashCoeffs; double *LTRAh2Coeffs; double *LTRAh3dashCoeffs; int LTRAmodelListSize; double LTRAconduct; double LTRAresist; double LTRAinduct; double LTRAcapac; double LTRAlength; double LTRAtd; double LTRAimped; double LTRAadmit; double LTRAalpha; double LTRAbeta; double LTRAattenuation; double LTRAcByR; double LTRArclsqr; double LTRAintH1dash; double LTRAintH2; double LTRAintH3dash; double LTRAnl; double LTRAf; double LTRAcoshlrootGR; double LTRArRsLrGRorG; double LTRArGsLrGRorR; int LTRAauxIndex; double LTRAstLineReltol; double LTRAchopReltol; double LTRAstLineAbstol; double LTRAchopAbstol; unsigned int LTRAreltolGiven; unsigned int LTRAabstolGiven; unsigned int LTRAtruncNR; unsigned int LTRAtruncDontCut; double LTRAmaxSafeStep; unsigned int LTRAresistGiven; unsigned int LTRAconductGiven; unsigned int LTRAinductGiven; unsigned int LTRAcapacGiven; unsigned int LTRAlengthGiven; unsigned int LTRAnlGiven; int LTRAlteConType; int LTRAhowToInterp; unsigned int LTRAprintFlag; int LTRAstepLimit; unsigned int LTRAfGiven; double LTRAabstol; double LTRAreltol; int LTRAspecialCase; } *LTRAmodPtr; struct sLTRAinstance *LTRAnextInstance; char *LTRAname; int LTRAowner; int LTRAstate; int LTRAposNode1; int LTRAnegNode1; int LTRAposNode2; int LTRAnegNode2; int LTRAbrEq1; int LTRAbrEq2; double LTRAinput1; double LTRAinput2; double LTRAinitVolt1; double LTRAinitCur1; double LTRAinitVolt2; double LTRAinitCur2; double *LTRAv1; double *LTRAi1; double *LTRAv2; double *LTRAi2; int LTRAinstListSize; double *LTRAibr1Ibr1Ptr; double *LTRAibr1Ibr2Ptr; double *LTRAibr1Pos1Ptr; double *LTRAibr1Neg1Ptr; double *LTRAibr1Pos2Ptr; double *LTRAibr1Neg2Ptr; double *LTRAibr2Ibr1Ptr; double *LTRAibr2Ibr2Ptr; double *LTRAibr2Pos1Ptr; double *LTRAibr2Neg1Ptr; double *LTRAibr2Pos2Ptr; double *LTRAibr2Neg2Ptr; double *LTRAneg1Ibr1Ptr; double *LTRAneg2Ibr2Ptr; double *LTRApos1Ibr1Ptr; double *LTRApos2Ibr2Ptr; double *LTRApos1Pos1Ptr; double *LTRAneg1Neg1Ptr; double *LTRApos2Pos2Ptr; double *LTRAneg2Neg2Ptr; unsigned int LTRAicV1Given; unsigned int LTRAicC1Given; unsigned int LTRAicV2Given; unsigned int LTRAicC2Given; } *

user_defined_types: struct sGENinstance { struct sGENmodel *GENmodPtr; struct sGENinstance *GENnextInstance; char *GENname; int GENowner; int GENstate; int GENnode1; int GENnode2; int GENnode3; int GENnode4; int GENnode5; int GENnode6; int GENnode7; }

user_defined_types: struct sLTRAinstance { struct sLTRAmodel *LTRAmodPtr; struct sLTRAinstance *LTRAnextInstance; char *LTRAname; int LTRAowner; int LTRAstate; int LTRAposNode1; int LTRAnegNode1; int LTRAposNode2; int LTRAnegNode2; int LTRAbrEq1; int LTRAbrEq2; double LTRAinput1; double LTRAinput2; double LTRAinitVolt1; double LTRAinitCur1; double LTRAinitVolt2; double LTRAinitCur2; double *LTRAv1; double *LTRAi1; double *LTRAv2; double *LTRAi2; int LTRAinstListSize; double *LTRAibr1Ibr1Ptr; double *LTRAibr1Ibr2Ptr; double *LTRAibr1Pos1Ptr; double *LTRAibr1Neg1Ptr; double *LTRAibr1Pos2Ptr; double *LTRAibr1Neg2Ptr; double *LTRAibr2Ibr1Ptr; double *LTRAibr2Ibr2Ptr; double *LTRAibr2Pos1Ptr; double *LTRAibr2Neg1Ptr; double *LTRAibr2Pos2Ptr; double *LTRAibr2Neg2Ptr; double *LTRAneg1Ibr1Ptr; double *LTRAneg2Ibr2Ptr; double *LTRApos1Ibr1Ptr; double *LTRApos2Ibr2Ptr; double *LTRApos1Pos1Ptr; double *LTRAneg1Neg1Ptr; double *LTRApos2Pos2Ptr; double *LTRAneg2Neg2Ptr; unsigned int LTRAicV1Given; unsigned int LTRAicC1Given; unsigned int LTRAicV2Given; unsigned int LTRAicC2Given; }

user_defined_types: struct sIFcomplex { double real; double imag; }

user_defined_types: struct sIFparseTree { int numVars; int *varTypes; union uIFvalue *vars; int (*IFeval)(struct sIFparseTree *, double, double *, double *, double *); }


CAPparam

original_code:
int
CAPparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
    CAPinstance *here = (CAPinstance*)inst;
    switch(param) {
        case 1:
            here->CAPcapac = value->rValue;
     if (!here->CAPmGiven)
         here->CAPm = 1.0;
            here->CAPcapGiven = 1;
            break;
        case 2:
            here->CAPinitCond = value->rValue;
            here->CAPicGiven = 1;
            break;
        case 8:
            here->CAPtemp = value->rValue + (273.15);
            here->CAPtempGiven = 1;
            break;
        case 9:
            here->CAPdtemp = value->rValue;
            here->CAPdtempGiven = 1;
            break;
        case 3:
            here->CAPwidth = value->rValue;
            here->CAPwidthGiven = 1;
            break;
        case 4:
            here->CAPlength = value->rValue;
            here->CAPlengthGiven = 1;
            break;
        case 11:
            here->CAPm = value->rValue;
            here->CAPmGiven = 1;
            break;
        case 10:
            here->CAPscale = value->rValue;
            here->CAPscaleGiven = 1;
            break;
        case 5:
            here->CAPsenParmNo = value->iValue;
            break;
        default:
            return(7);
    }
    return(0);
}

canonical_original_code:
int CAPparam(int param, union uIFvalue *value, struct sGENinstance *inst, union uIFvalue *select)
{
    struct sCAPinstance *here = (CAPinstance*)inst;
    switch(param) {
        case 1:
            here->CAPcapac = value->rValue;
     if (!here->CAPmGiven)
         here->CAPm = 1.0;
            here->CAPcapGiven = 1;
            break;
        case 2:
            here->CAPinitCond = value->rValue;
            here->CAPicGiven = 1;
            break;
        case 8:
            here->CAPtemp = value->rValue + (273.15);
            here->CAPtempGiven = 1;
            break;
        case 9:
            here->CAPdtemp = value->rValue;
            here->CAPdtempGiven = 1;
            break;
        case 3:
            here->CAPwidth = value->rValue;
            here->CAPwidthGiven = 1;
            break;
        case 4:
            here->CAPlength = value->rValue;
            here->CAPlengthGiven = 1;
            break;
        case 11:
            here->CAPm = value->rValue;
            here->CAPmGiven = 1;
            break;
        case 10:
            here->CAPscale = value->rValue;
            here->CAPscaleGiven = 1;
            break;
        case 5:
            here->CAPsenParmNo = value->iValue;
            break;
        default:
            return(7);
    }
    return(0);
}

variable_types: struct sCAPinstance { struct sCAPmodel { int CAPmodType; struct sCAPmodel *CAPnextModel; struct sCAPinstance *CAPinstances; char *CAPmodName; double CAPtnom; double CAPtempCoeff1; double CAPtempCoeff2; double CAPmCap; double CAPcj; double CAPcjsw; double CAPdefWidth; double CAPdefLength; double CAPnarrow; double CAPshort; double CAPdi; double CAPthick; unsigned int CAPmCapGiven; unsigned int CAPcjGiven; unsigned int CAPcjswGiven; unsigned int CAPdefWidthGiven; unsigned int CAPdefLengthGiven; unsigned int CAPnarrowGiven; unsigned int CAPshortGiven; unsigned int CAPtnomGiven; unsigned int CAPtc1Given; unsigned int CAPtc2Given; unsigned int CAPdiGiven; unsigned int CAPthickGiven; } *CAPmodPtr; struct sCAPinstance *CAPnextInstance; char *CAPname; int CAPowner; int CAPstate; int CAPposNode; int CAPnegNode; double CAPtemp; double CAPdtemp; double CAPcapac; double CAPinitCond; double CAPwidth; double CAPlength; double CAPscale; double CAPm; double *CAPposPosptr; double *CAPnegNegptr; double *CAPposNegptr; double *CAPnegPosptr; unsigned int CAPcapGiven; unsigned int CAPicGiven; unsigned int CAPwidthGiven; unsigned int CAPlengthGiven; unsigned int CAPtempGiven; unsigned int CAPdtempGiven; unsigned int CAPscaleGiven; unsigned int CAPmGiven; int CAPsenParmNo; } *

user_defined_types: struct sCAPinstance { struct sCAPmodel *CAPmodPtr; struct sCAPinstance *CAPnextInstance; char *CAPname; int CAPowner; int CAPstate; int CAPposNode; int CAPnegNode; double CAPtemp; double CAPdtemp; double CAPcapac; double CAPinitCond; double CAPwidth; double CAPlength; double CAPscale; double CAPm; double *CAPposPosptr; double *CAPnegNegptr; double *CAPposNegptr; double *CAPnegPosptr; unsigned int CAPcapGiven; unsigned int CAPicGiven; unsigned int CAPwidthGiven; unsigned int CAPlengthGiven; unsigned int CAPtempGiven; unsigned int CAPdtempGiven; unsigned int CAPscaleGiven; unsigned int CAPmGiven; int CAPsenParmNo; }


TRAparam

original_code:
int
TRAparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
    TRAinstance *here = (TRAinstance *)inst;
    switch(param) {
        case 10:
            here->TRAreltol = value->rValue;
            here->TRAreltolGiven = 1;
            break;
        case 11:
            here->TRAabstol = value->rValue;
            here->TRAabstolGiven = 1;
            break;
        case 1:
            here->TRAimped = value->rValue;
            here->TRAimpedGiven = 1;
            break;
        case 2:
            here->TRAtd = value->rValue;
            here->TRAtdGiven = 1;
            break;
        case 3:
            here->TRAnl= value->rValue;
            here->TRAnlGiven = 1;
            break;
        case 4:
            here->TRAf= value->rValue;
            here->TRAfGiven = 1;
            break;
        case 5:
            here->TRAinitVolt1 = value->rValue;
            here->TRAicV1Given = 1;
            break;
        case 6:
            here->TRAinitCur1 = value->rValue;
            here->TRAicC1Given = 1;
            break;
        case 7:
            here->TRAinitVolt2 = value->rValue;
            here->TRAicV2Given = 1;
            break;
        case 8:
            here->TRAinitCur2 = value->rValue;
            here->TRAicC2Given = 1;
            break;
        case 9:
            switch(value->v.numValue){
                case 4:
                    here->TRAinitCur2 = *(value->v.vec.rVec+3);
                    break;
                case 3:
                    here->TRAinitVolt2 = *(value->v.vec.rVec+2);
                    break;
                case 2:
                    here->TRAinitCur1 = *(value->v.vec.rVec+1);
                    break;
                case 1:
                    here->TRAinitVolt1 = *(value->v.vec.rVec);
                    break;
                default:
                    return(7);
            }
            break;
        default:
            return(7);
    }
    return(0);
}

canonical_original_code:
int TRAparam(int param, union uIFvalue *value, struct sGENinstance *inst, union uIFvalue *select)
{
    struct sTRAinstance *here = (TRAinstance *)inst;
    switch(param) {
        case 10:
            here->TRAreltol = value->rValue;
            here->TRAreltolGiven = 1;
            break;
        case 11:
            here->TRAabstol = value->rValue;
            here->TRAabstolGiven = 1;
            break;
        case 1:
            here->TRAimped = value->rValue;
            here->TRAimpedGiven = 1;
            break;
        case 2:
            here->TRAtd = value->rValue;
            here->TRAtdGiven = 1;
            break;
        case 3:
            here->TRAnl= value->rValue;
            here->TRAnlGiven = 1;
            break;
        case 4:
            here->TRAf= value->rValue;
            here->TRAfGiven = 1;
            break;
        case 5:
            here->TRAinitVolt1 = value->rValue;
            here->TRAicV1Given = 1;
            break;
        case 6:
            here->TRAinitCur1 = value->rValue;
            here->TRAicC1Given = 1;
            break;
        case 7:
            here->TRAinitVolt2 = value->rValue;
            here->TRAicV2Given = 1;
            break;
        case 8:
            here->TRAinitCur2 = value->rValue;
            here->TRAicC2Given = 1;
            break;
        case 9:
            switch(value->v.numValue){
                case 4:
                    here->TRAinitCur2 = *(value->v.vec.rVec+3);
                    break;
                case 3:
                    here->TRAinitVolt2 = *(value->v.vec.rVec+2);
                    break;
                case 2:
                    here->TRAinitCur1 = *(value->v.vec.rVec+1);
                    break;
                case 1:
                    here->TRAinitVolt1 = *(value->v.vec.rVec);
                    break;
                default:
                    return(7);
            }
            break;
        default:
            return(7);
    }
    return(0);
}

variable_types: struct sTRAinstance { struct sTRAmodel { int TRAmodType; struct sTRAmodel *TRAnextModel; struct sTRAinstance *TRAinstances; char *TRAmodName; } *TRAmodPtr; struct sTRAinstance *TRAnextInstance; char *TRAname; int TRAowner; int TRAstate; int TRAposNode1; int TRAnegNode1; int TRAposNode2; int TRAnegNode2; int TRAintNode1; int TRAintNode2; double TRAimped; double TRAconduct; double TRAtd; double TRAnl; double TRAf; double TRAinput1; double TRAinput2; double TRAinitVolt1; double TRAinitCur1; double TRAinitVolt2; double TRAinitCur2; double TRAreltol; double TRAabstol; double *TRAdelays; int TRAsizeDelay; int TRAallocDelay; int TRAbrEq1; int TRAbrEq2; double *TRAibr1Ibr2Ptr; double *TRAibr1Int1Ptr; double *TRAibr1Neg1Ptr; double *TRAibr1Neg2Ptr; double *TRAibr1Pos2Ptr; double *TRAibr2Ibr1Ptr; double *TRAibr2Int2Ptr; double *TRAibr2Neg1Ptr; double *TRAibr2Neg2Ptr; double *TRAibr2Pos1Ptr; double *TRAint1Ibr1Ptr; double *TRAint1Int1Ptr; double *TRAint1Pos1Ptr; double *TRAint2Ibr2Ptr; double *TRAint2Int2Ptr; double *TRAint2Pos2Ptr; double *TRAneg1Ibr1Ptr; double *TRAneg2Ibr2Ptr; double *TRApos1Int1Ptr; double *TRApos1Pos1Ptr; double *TRApos2Int2Ptr; double *TRApos2Pos2Ptr; unsigned int TRAimpedGiven; unsigned int TRAtdGiven; unsigned int TRAnlGiven; unsigned int TRAfGiven; unsigned int TRAicV1Given; unsigned int TRAicC1Given; unsigned int TRAicV2Given; unsigned int TRAicC2Given; unsigned int TRAreltolGiven; unsigned int TRAabstolGiven; } *

user_defined_types: struct sTRAinstance { struct sTRAmodel *TRAmodPtr; struct sTRAinstance *TRAnextInstance; char *TRAname; int TRAowner; int TRAstate; int TRAposNode1; int TRAnegNode1; int TRAposNode2; int TRAnegNode2; int TRAintNode1; int TRAintNode2; double TRAimped; double TRAconduct; double TRAtd; double TRAnl; double TRAf; double TRAinput1; double TRAinput2; double TRAinitVolt1; double TRAinitCur1; double TRAinitVolt2; double TRAinitCur2; double TRAreltol; double TRAabstol; double *TRAdelays; int TRAsizeDelay; int TRAallocDelay; int TRAbrEq1; int TRAbrEq2; double *TRAibr1Ibr2Ptr; double *TRAibr1Int1Ptr; double *TRAibr1Neg1Ptr; double *TRAibr1Neg2Ptr; double *TRAibr1Pos2Ptr; double *TRAibr2Ibr1Ptr; double *TRAibr2Int2Ptr; double *TRAibr2Neg1Ptr; double *TRAibr2Neg2Ptr; double *TRAibr2Pos1Ptr; double *TRAint1Ibr1Ptr; double *TRAint1Int1Ptr; double *TRAint1Pos1Ptr; double *TRAint2Ibr2Ptr; double *TRAint2Int2Ptr; double *TRAint2Pos2Ptr; double *TRAneg1Ibr1Ptr; double *TRAneg2Ibr2Ptr; double *TRApos1Int1Ptr; double *TRApos1Pos1Ptr; double *TRApos2Int2Ptr; double *TRApos2Pos2Ptr; unsigned int TRAimpedGiven; unsigned int TRAtdGiven; unsigned int TRAnlGiven; unsigned int TRAfGiven; unsigned int TRAicV1Given; unsigned int TRAicC1Given; unsigned int TRAicV2Given; unsigned int TRAicC2Given; unsigned int TRAreltolGiven; unsigned int TRAabstolGiven; }


JFETdSetup

decompiled_code:
__int64 __fastcall JFETdSetup(__int64 a1, __int64 a2)
{
__int64 v2; // r14
double v3; // xmm1_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // r12
double v7; // xmm0_8
double v8; // xmm1_8
double v9; // xmm2_8
double v10; // xmm4_8
double v11; // xmm5_8
double v12; // rbx
double v13; // xmm0_8
double v14; // rbp
double v15; // rbx
double v16; // xmm6_8
double v17; // xmm2_8
double v18; // xmm0_8
__int64 i; // r13
double v20; // rbp
double v21; // rbx
double v22; // xmm1_8
__int64 v23; // rax
double v24; // xmm2_8
double v25; // xmm0_8
double v26; // xmm5_8
int v27; // eax
double v28; // xmm0_8
double v29; // xmm1_8
double v30; // xmm0_8
double v31; // xmm3_8
double v32; // xmm2_8
double v33; // xmm0_8
double v34; // xmm0_8
double v35; // xmm1_8
double v36; // xmm1_8
double v38; // [rsp+0h] [rbp-C8h]
double v39; // [rsp+0h] [rbp-C8h]
double v40; // [rsp+8h] [rbp-C0h]
double v41; // [rsp+10h] [rbp-B8h]
double v42; // [rsp+10h] [rbp-B8h]
double v43; // [rsp+18h] [rbp-B0h]
double v44; // [rsp+20h] [rbp-A8h]
double v45; // [rsp+28h] [rbp-A0h]
double v46; // [rsp+28h] [rbp-A0h]
double v47; // [rsp+30h] [rbp-98h]
double v48; // [rsp+38h] [rbp-90h]
double v49; // [rsp+40h] [rbp-88h]
double v50; // [rsp+48h] [rbp-80h]
double v51; // [rsp+50h] [rbp-78h]
double v52; // [rsp+58h] [rbp-70h]
double v53; // [rsp+60h] [rbp-68h]
double v54; // [rsp+68h] [rbp-60h]
double v55; // [rsp+70h] [rbp-58h]
double v56; // [rsp+78h] [rbp-50h]
double v57; // [rsp+80h] [rbp-48h]
double v58; // [rsp+88h] [rbp-40h]

if ( !a1 )
return 0LL;
v2 = a1;
do
{
for ( i = *(_QWORD *)(v2 + 16); i; i = *(_QWORD *)(i + 8) )
{
v20 = *(double *)(v2 + 48);
v21 = *(double *)(i + 472);
v42 = v21 * *(double *)(i + 504);
v22 = (double)*(int *)(v2 + 32);
v23 = *(_QWORD *)(a2 + 536);
v24 = *(double *)(v23 + 8LL * *(int *)(i + 32)) - *(double *)(v23 + 8LL * *(int *)(i + 44));
v39 = v24 * v22;
v25 = *(double *)(v23 + 8LL * *(int *)(i + 32)) - *(double *)(v23 + 8LL * *(int *)(i + 40));
v40 = v25 * v22;
v26 = v24 * v22 - v25 * v22;
v46 = v26;
v27 = 1;
if ( v26 < 0.0 )
{
*(_QWORD *)&v46 = *(_QWORD *)&v26 ^ LC1;
v40 = v24 * v22;
v39 = v25 * v22;
v27 = -1;
}
*(_DWORD *)(i + 168) = v27;
if ( *(double *)(i + 496) * -5.0 * CONSTKoverQ < v39 )
{
v3 = exp(v39 / (CONSTKoverQ * *(double *)(i + 496)));
v4 = *(double *)(i + 496) * CONSTKoverQ;
v5 = *(double *)(a2 + 824);
v51 = v3 * v42 / v4 + v5;
v43 = (v51 - v5) / (v4 + v4);
v6 = v43 / (v4 * 3.0);
}
else
{
v51 = COERCE_DOUBLE(*(_QWORD *)&v42 ^ LC1) / v39 + *(double *)(a2 + 824);
v6 = *(double *)&LC0;
v43 = *(double *)&LC0;
}
v28 = *(double *)(i + 496) * CONSTKoverQ;
if ( v28 * -5.0 < v40 )
{
v7 = exp(v40 / v28);
v8 = *(double *)(i + 496) * CONSTKoverQ;
v9 = *(double *)(a2 + 824);
v49 = v7 * v42 / v8 + v9;
v41 = (v49 - v9) / (v8 + v8);
v50 = v41 / (v8 * 3.0);
}
else
{
v49 = COERCE_DOUBLE(*(_QWORD *)&v42 ^ LC1) / v40 + *(double *)(a2 + 824);
v50 = 0.0;
v41 = 0.0;
}
v29 = v39 - *(double *)(v2 + 40);
if ( v29 <= 0.0 )
{
v58 = 0.0;
v57 = 0.0;
v56 = 0.0;
v44 = 0.0;
v55 = 0.0;
v54 = 0.0;
v53 = 0.0;
v52 = 0.0;
}
else
{
v30 = v20 * v21;
v31 = *(double *)(v2 + 56);
v32 = (v46 * v31 + 1.0) * (v20 * v21);
v44 = v32 + v32;
if ( v46 < v29 )
{
v55 = v44 * v46;
v56 = (v46 * (v31 + v31) + 1.0) * (v30 + v30);
v10 = v31 * 3.0 * v46;
v53 = ((v31 + v31) * v29 - 1.0 - v10) * (v30 + v30);
v52 = (v29 - v46 + v29 - v46 + v29 * 4.0 * v46 * v31 - v10 * v46) * v30;
v58 = 4.0 * v30 * v31;
v54 = v30 * -6.0 * v31;
v44 = 0.0;
v57 = 0.0;
}
else
{
v55 = (v32 + v32) * v29;
v52 = v31 * v30 * v29 * v29;
v57 = (v31 + v31) * v30;
v56 = v29 * v57;
v58 = 0.0;
v54 = 0.0;
v53 = 0.0;
}
}
v11 = *(double *)(i + 472) * *(double *)(i + 520);
v12 = v11;
v47 = *(double *)(i + 472) * *(double *)(i + 528);
v13 = *(double *)(i + 512);
v45 = v13 + v13;
v14 = *(double *)(v2 + 152);
if ( *(double *)(i + 536) > v39 )
{
v33 = 1.0 - v39 / v13;
if ( v33 < 0.0 )
v34 = sqrt(v33);
else
v34 = sqrt(v33);
v48 = v12 / v34;
v38 = v12 / v34 / (*(double *)(i + 512) * 4.0 * v34 * v34);
v15 = v38 / (v34 * ((*(double *)(i + 512) + *(double *)(i + 512)) * v34));
}
else
{
v48 = (v39 / v45 + *(double *)(v2 + 160)) * (v11 / v14);
v38 = v11 / v14 / v45 * 0.5;
v15 = *(double *)&LC0;
}
if ( *(double *)(i + 536) > v40 )
{
v35 = 1.0 - v40 / *(double *)(i + 512);
if ( v35 < 0.0 )
v36 = sqrt(v35);
else
v36 = sqrt(v35);
v16 = v47 / v36;
v17 = v47 / v36 / (*(double *)(i + 512) * 4.0 * v36 * v36);
v18 = v17 / (v36 * ((*(double *)(i + 512) + *(double *)(i + 512)) * v36));
}
else
{
v16 = (v40 / v45 + *(double *)(v2 + 160)) * (v47 / v14);
v17 = v47 / v14 / v45 * 0.5;
v18 = 0.0;
}
if ( *(_DWORD *)(i + 168) == 1 )
{
*(double *)(i + 176) = v55;
*(double *)(i + 184) = v52;
*(double *)(i + 192) = v44;
*(double *)(i + 200) = v53;
*(double *)(i + 208) = v56;
*(_QWORD *)(i + 216) = 0LL;
*(double *)(i + 224) = v54;
*(double *)(i + 232) = v57;
*(double *)(i + 240) = v58;
*(double *)(i + 248) = v51;
*(double *)(i + 256) = v49;
*(double *)(i + 264) = v43;
*(double *)(i + 272) = v41;
*(double *)(i + 280) = v6;
*(double *)(i + 288) = v50;
*(double *)(i + 296) = v48;
*(double *)(i + 304) = v16;
*(double *)(i + 312) = v38;
*(double *)(i + 320) = v17;
*(double *)(i + 328) = v15;
*(double *)(i + 336) = v18;
}
else
{
*(_QWORD *)(i + 176) = *(_QWORD *)&v55 ^ LC1;
*(double *)(i + 184) = v52 + v55;
*(_QWORD *)(i + 192) = *(_QWORD *)&v44 ^ LC1;
*(_QWORD *)(i + 200) = COERCE_UNSIGNED_INT64(v53 + v44 + v56 + v56) ^ LC1;
*(double *)(i + 208) = v44 + v56;
*(_QWORD *)(i + 216) = LC8;
*(double *)(i + 224) = (v57 + v58) * 3.0 + v54 + 0.0;
*(double *)(i + 232) = v57 + 0.0;
*(_QWORD *)(i + 240) = COERCE_UNSIGNED_INT64(v57 + v57 + 0.0 + v58) ^ LC1;
*(double *)(i + 248) = v49;
*(double *)(i + 256) = v51;
*(double *)(i + 264) = v41;
*(double *)(i + 272) = v43;
*(double *)(i + 280) = v50;
*(double *)(i + 288) = v6;
*(double *)(i + 296) = v16;
*(double *)(i + 304) = v48;
*(double *)(i + 312) = v17;
*(double *)(i + 320) = v38;
*(double *)(i + 328) = v18;
*(double *)(i + 336) = v15;
}
*(double *)(i + 192) = (double)*(int *)(v2 + 32) * 0.5 * *(double *)(i + 192);
*(double *)(i + 200) = (double)*(int *)(v2 + 32) * 0.5 * *(double *)(i + 200);
*(double *)(i + 208) = (double)*(int *)(v2 + 32) * *(double *)(i + 208);
*(double *)(i + 216) = *(double *)(i + 216) / 6.0;
*(double *)(i + 224) = *(double *)(i + 224) / 6.0;
*(double *)(i + 232) = 0.5 * *(double *)(i + 232);
*(double *)(i + 240) = 0.5 * *(double *)(i + 240);
*(double *)(i + 264) = (double)*(int *)(v2 + 32) * v43;
*(double *)(i + 272) = (double)*(int *)(v2 + 32) * v41;
*(double *)(i + 312) = (double)*(int *)(v2 + 32) * v38;
*(double *)(i + 320) = v17 * (double)*(int *)(v2 + 32);
}
v2 = *(_QWORD *)(v2 + 8);
}
while ( v2 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 v2; // r14
double v3; // xmm1_8
double v4; // xmm0_8
double v5; // xmm2_8
double v6; // r12
double v7; // xmm0_8
double v8; // xmm1_8
double v9; // xmm2_8
double v10; // xmm4_8
double v11; // xmm5_8
double v12; // rbx
double v13; // xmm0_8
double v14; // rbp
double v15; // rbx
double v16; // xmm6_8
double v17; // xmm2_8
double v18; // xmm0_8
__int64 i; // r13
double v20; // rbp
double v21; // rbx
double v22; // xmm1_8
__int64 v23; // rax
double v24; // xmm2_8
double v25; // xmm0_8
double v26; // xmm5_8
int v27; // eax
double v28; // xmm0_8
double v29; // xmm1_8
double v30; // xmm0_8
double v31; // xmm3_8
double v32; // xmm2_8
double v33; // xmm0_8
double v34; // xmm0_8
double v35; // xmm1_8
double v36; // xmm1_8
double v38; // [rsp+0h] [rbp-C8h]
double v39; // [rsp+0h] [rbp-C8h]
double v40; // [rsp+8h] [rbp-C0h]
double v41; // [rsp+10h] [rbp-B8h]
double v42; // [rsp+10h] [rbp-B8h]
double v43; // [rsp+18h] [rbp-B0h]
double v44; // [rsp+20h] [rbp-A8h]
double v45; // [rsp+28h] [rbp-A0h]
double v46; // [rsp+28h] [rbp-A0h]
double v47; // [rsp+30h] [rbp-98h]
double v48; // [rsp+38h] [rbp-90h]
double v49; // [rsp+40h] [rbp-88h]
double v50; // [rsp+48h] [rbp-80h]
double v51; // [rsp+50h] [rbp-78h]
double v52; // [rsp+58h] [rbp-70h]
double v53; // [rsp+60h] [rbp-68h]
double v54; // [rsp+68h] [rbp-60h]
double v55; // [rsp+70h] [rbp-58h]
double v56; // [rsp+78h] [rbp-50h]
double v57; // [rsp+80h] [rbp-48h]
double v58; // [rsp+88h] [rbp-40h]

if ( !a1 )
return 0LL;
v2 = a1;
do
{
for ( i = *(_QWORD *)(v2 + 16); i; i = *(_QWORD *)(i + 8) )
{
v20 = *(double *)(v2 + 48);
v21 = *(double *)(i + 472);
v42 = v21 * *(double *)(i + 504);
v22 = (double)*(int *)(v2 + 32);
v23 = *(_QWORD *)(a2 + 536);
v24 = *(double *)(v23 + 8LL * *(int *)(i + 32)) - *(double *)(v23 + 8LL * *(int *)(i + 44));
v39 = v24 * v22;
v25 = *(double *)(v23 + 8LL * *(int *)(i + 32)) - *(double *)(v23 + 8LL * *(int *)(i + 40));
v40 = v25 * v22;
v26 = v24 * v22 - v25 * v22;
v46 = v26;
v27 = 1;
if ( v26 < 0.0 )
{
*(_QWORD *)&v46 = *(_QWORD *)&v26 ^ LC1;
v40 = v24 * v22;
v39 = v25 * v22;
v27 = -1;
}
*(_DWORD *)(i + 168) = v27;
if ( *(double *)(i + 496) * -5.0 * CONSTKoverQ < v39 )
{
v3 = exp(v39 / (CONSTKoverQ * *(double *)(i + 496)));
v4 = *(double *)(i + 496) * CONSTKoverQ;
v5 = *(double *)(a2 + 824);
v51 = v3 * v42 / v4 + v5;
v43 = (v51 - v5) / (v4 + v4);
v6 = v43 / (v4 * 3.0);
}
else
{
v51 = COERCE_DOUBLE(*(_QWORD *)&v42 ^ LC1) / v39 + *(double *)(a2 + 824);
v6 = *(double *)&LC0;
v43 = *(double *)&LC0;
}
v28 = *(double *)(i + 496) * CONSTKoverQ;
if ( v28 * -5.0 < v40 )
{
v7 = exp(v40 / v28);
v8 = *(double *)(i + 496) * CONSTKoverQ;
v9 = *(double *)(a2 + 824);
v49 = v7 * v42 / v8 + v9;
v41 = (v49 - v9) / (v8 + v8);
v50 = v41 / (v8 * 3.0);
}
else
{
v49 = COERCE_DOUBLE(*(_QWORD *)&v42 ^ LC1) / v40 + *(double *)(a2 + 824);
v50 = 0.0;
v41 = 0.0;
}
v29 = v39 - *(double *)(v2 + 40);
if ( v29 <= 0.0 )
{
v58 = 0.0;
v57 = 0.0;
v56 = 0.0;
v44 = 0.0;
v55 = 0.0;
v54 = 0.0;
v53 = 0.0;
v52 = 0.0;
}
else
{
v30 = v20 * v21;
v31 = *(double *)(v2 + 56);
v32 = (v46 * v31 + 1.0) * (v20 * v21);
v44 = v32 + v32;
if ( v46 < v29 )
{
v55 = v44 * v46;
v56 = (v46 * (v31 + v31) + 1.0) * (v30 + v30);
v10 = v31 * 3.0 * v46;
v53 = ((v31 + v31) * v29 - 1.0 - v10) * (v30 + v30);
v52 = (v29 - v46 + v29 - v46 + v29 * 4.0 * v46 * v31 - v10 * v46) * v30;
v58 = 4.0 * v30 * v31;
v54 = v30 * -6.0 * v31;
v44 = 0.0;
v57 = 0.0;
}
else
{
v55 = (v32 + v32) * v29;
v52 = v31 * v30 * v29 * v29;
v57 = (v31 + v31) * v30;
v56 = v29 * v57;
v58 = 0.0;
v54 = 0.0;
v53 = 0.0;
}
}
v11 = *(double *)(i + 472) * *(double *)(i + 520);
v12 = v11;
v47 = *(double *)(i + 472) * *(double *)(i + 528);
v13 = *(double *)(i + 512);
v45 = v13 + v13;
v14 = *(double *)(v2 + 152);
if ( *(double *)(i + 536) > v39 )
{
v33 = 1.0 - v39 / v13;
if ( v33 < 0.0 )
v34 = sqrt(v33);
else
v34 = sqrt(v33);
v48 = v12 / v34;
v38 = v12 / v34 / (*(double *)(i + 512) * 4.0 * v34 * v34);
v15 = v38 / (v34 * ((*(double *)(i + 512) + *(double *)(i + 512)) * v34));
}
else
{
v48 = (v39 / v45 + *(double *)(v2 + 160)) * (v11 / v14);
v38 = v11 / v14 / v45 * 0.5;
v15 = *(double *)&LC0;
}
if ( *(double *)(i + 536) > v40 )
{
v35 = 1.0 - v40 / *(double *)(i + 512);
if ( v35 < 0.0 )
v36 = sqrt(v35);
else
v36 = sqrt(v35);
v16 = v47 / v36;
v17 = v47 / v36 / (*(double *)(i + 512) * 4.0 * v36 * v36);
v18 = v17 / (v36 * ((*(double *)(i + 512) + *(double *)(i + 512)) * v36));
}
else
{
v16 = (v40 / v45 + *(double *)(v2 + 160)) * (v47 / v14);
v17 = v47 / v14 / v45 * 0.5;
v18 = 0.0;
}
if ( *(_DWORD *)(i + 168) == 1 )
{
*(double *)(i + 176) = v55;
*(double *)(i + 184) = v52;
*(double *)(i + 192) = v44;
*(double *)(i + 200) = v53;
*(double *)(i + 208) = v56;
*(_QWORD *)(i + 216) = 0LL;
*(double *)(i + 224) = v54;
*(double *)(i + 232) = v57;
*(double *)(i + 240) = v58;
*(double *)(i + 248) = v51;
*(double *)(i + 256) = v49;
*(double *)(i + 264) = v43;
*(double *)(i + 272) = v41;
*(double *)(i + 280) = v6;
*(double *)(i + 288) = v50;
*(double *)(i + 296) = v48;
*(double *)(i + 304) = v16;
*(double *)(i + 312) = v38;
*(double *)(i + 320) = v17;
*(double *)(i + 328) = v15;
*(double *)(i + 336) = v18;
}
else
{
*(_QWORD *)(i + 176) = *(_QWORD *)&v55 ^ LC1;
*(double *)(i + 184) = v52 + v55;
*(_QWORD *)(i + 192) = *(_QWORD *)&v44 ^ LC1;
*(_QWORD *)(i + 200) = COERCE_UNSIGNED_INT64(v53 + v44 + v56 + v56) ^ LC1;
*(double *)(i + 208) = v44 + v56;
*(_QWORD *)(i + 216) = LC8;
*(double *)(i + 224) = (v57 + v58) * 3.0 + v54 + 0.0;
*(double *)(i + 232) = v57 + 0.0;
*(_QWORD *)(i + 240) = COERCE_UNSIGNED_INT64(v57 + v57 + 0.0 + v58) ^ LC1;
*(double *)(i + 248) = v49;
*(double *)(i + 256) = v51;
*(double *)(i + 264) = v41;
*(double *)(i + 272) = v43;
*(double *)(i + 280) = v50;
*(double *)(i + 288) = v6;
*(double *)(i + 296) = v16;
*(double *)(i + 304) = v48;
*(double *)(i + 312) = v17;
*(double *)(i + 320) = v38;
*(double *)(i + 328) = v18;
*(double *)(i + 336) = v15;
}
*(double *)(i + 192) = (double)*(int *)(v2 + 32) * 0.5 * *(double *)(i + 192);
*(double *)(i + 200) = (double)*(int *)(v2 + 32) * 0.5 * *(double *)(i + 200);
*(double *)(i + 208) = (double)*(int *)(v2 + 32) * *(double *)(i + 208);
*(double *)(i + 216) = *(double *)(i + 216) / 6.0;
*(double *)(i + 224) = *(double *)(i + 224) / 6.0;
*(double *)(i + 232) = 0.5 * *(double *)(i + 232);
*(double *)(i + 240) = 0.5 * *(double *)(i + 240);
*(double *)(i + 264) = (double)*(int *)(v2 + 32) * v43;
*(double *)(i + 272) = (double)*(int *)(v2 + 32) * v41;
*(double *)(i + 312) = (double)*(int *)(v2 + 32) * v38;
*(double *)(i + 320) = v17 * (double)*(int *)(v2 + 32);
}
v2 = *(_QWORD *)(v2 + 8);
}
while ( v2 );
return 0LL;
}

original_code:
int
JFETdSetup(GENmodel *inModel, CKTcircuit *ckt)
{
    JFETmodel *model = (JFETmodel*)inModel;
    JFETinstance *here;
    double beta;
    double betap;
    double lcapgd1;
    double lcapgd2;
    double lcapgd3;
    double lcapgs2;
    double lcapgs3;
    double lcapgs1;
    double cd;
    double cdrain;
    double temp;
    double cg;
    double cgd;
    double csat;
    double czgd;
    double czgdf2;
    double czgs;
    double czgsf2;
    double evgd;
    double evgs;
    double fcpb2;
    double gdpr;
    double gds1;
    double gds2;
    double gds3;
    double lggd1;
    double lggd2;
    double lggd3;
    double lggs1;
    double lggs2;
    double lggs3;
    double gm1;
    double gm2;
    double gm3;
    double gmds;
    double gm2ds;
    double gmds2;
    double gspr;
    double sarg;
    double twob;
    double twop;
    double vds;
    double vgd;
    double vgs;
    double vgst;
    for( ; model != ((void *)0); model = model->JFETnextModel ) {
        for (here = model->JFETinstances; here != ((void *)0) ;
                here=here->JFETnextInstance) {
     if (here->JFETowner != ARCHme) continue;
            beta = model->JFETbeta * here->JFETarea * here->JFETm;
            gdpr=model->JFETdrainConduct*here->JFETarea * here->JFETm;
            gspr=model->JFETsourceConduct*here->JFETarea * here-> JFETm;
            csat=here->JFETtSatCur*here->JFETarea * here-> JFETm;
                vgs= model->JFETtype*(*(ckt->CKTrhsOld + here->JFETgateNode)
   - *(ckt->CKTrhsOld + here->JFETsourcePrimeNode));
                vgd= model->JFETtype*(*(ckt->CKTrhsOld + here->JFETgateNode)
   - *(ckt->CKTrhsOld + here->JFETdrainPrimeNode));
            vds=vgs-vgd;
     if (vds < 0.0) {
  vds = -vds;
  temp = vgs;
  vgs = vgd;
  vgd = temp;
  here->JFETmode = -1;
  } else {
  here->JFETmode = 1;
  }
            if (vgs <= -5*here->JFETtemp*CONSTKoverQ) {
                lggs1 = -csat/vgs+ckt->CKTgmin;
  lggs2=lggs3=0;
                cg = lggs1*vgs;
            } else {
                evgs = exp(vgs/(here->JFETtemp*CONSTKoverQ));
                lggs1 = csat*evgs/(here->JFETtemp*CONSTKoverQ)+ckt->CKTgmin;
  lggs2 = (lggs1-ckt->CKTgmin)/((here->JFETtemp*CONSTKoverQ)*2);
  lggs3 = lggs2/(3*(here->JFETtemp*CONSTKoverQ));
                cg = csat*(evgs-1)+ckt->CKTgmin*vgs;
            }
            if (vgd <= -5*(here->JFETtemp*CONSTKoverQ)) {
                lggd1 = -csat/vgd+ckt->CKTgmin;
  lggd2=lggd3=0;
                cgd = lggd1*vgd;
            } else {
                evgd = exp(vgd/(here->JFETtemp*CONSTKoverQ));
                lggd1 = csat*evgd/(here->JFETtemp*CONSTKoverQ)+ckt->CKTgmin;
  lggd2 = (lggd1-ckt->CKTgmin)/((here->JFETtemp*CONSTKoverQ)*2);
  lggd3 = lggd2/(3*(here->JFETtemp*CONSTKoverQ));
                cgd = csat*(evgd-1)+ckt->CKTgmin*vgd;
            }
            cg = cg+cgd;
                vgst=vgs-model->JFETthreshold;
                if (vgst <= 0) {
                    cdrain=0;
                    gm1=gm2=gm3=0;
                    gds1=gds2=gds3=0;
      gmds=gm2ds=gmds2=0;
                } else {
                    betap=beta*(1+model->JFETlModulation*vds);
                    twob=betap+betap;
                    if (vgst <= vds) {
                        cdrain=betap*vgst*vgst;
                        gm1=twob*vgst;
   gm2=twob;
   gm3=0;
                        gds1=model->JFETlModulation*beta*vgst*vgst;
   gds2=gds3=gmds2=0;
   gm2ds=2*model->JFETlModulation*beta;
   gmds=gm2ds*vgst;
                    } else {
                        cdrain=betap*vds*(vgst+vgst-vds);
                        gm1=twob*vds;
   gm2=0;
   gm3=0;
   gmds=(beta+beta)*(1+2*model->JFETlModulation*vds);
   gm2ds=0;
   gds2=2*beta*(2*model->JFETlModulation*vgst - 1 -
    3*model->JFETlModulation*vds);
                        gds1=beta*(2*(vgst-vds) + 4*vgst*vds*
  model->JFETlModulation - 3*model->JFETlModulation*vds*vds);
   gmds2=4*beta*model->JFETlModulation;
   gds3= -6*beta*model->JFETlModulation;
                    }
                }
            cd=cdrain-cgd;
                czgs=here->JFETtCGS*here->JFETarea * here->JFETm;
                czgd=here->JFETtCGD*here->JFETarea * here->JFETm;
                twop=here->JFETtGatePot+here->JFETtGatePot;
                fcpb2=here->JFETcorDepCap*here->JFETcorDepCap;
                czgsf2=czgs/model->JFETf2;
                czgdf2=czgd/model->JFETf2;
                if (vgs < here->JFETcorDepCap) {
                    sarg=sqrt(1-vgs/here->JFETtGatePot);
                    lcapgs1=czgs/sarg;
      lcapgs2=lcapgs1/(here->JFETtGatePot*4*sarg*sarg);
      lcapgs3=lcapgs2/(here->JFETtGatePot*2*sarg*sarg);
                } else {
                    lcapgs1=czgsf2*(model->JFETf3+vgs/twop);
      lcapgs2=czgsf2/twop*0.5;
      lcapgs3=0;
                }
                if (vgd < here->JFETcorDepCap) {
                    sarg=sqrt(1-vgd/here->JFETtGatePot);
                    lcapgd1=czgd/sarg;
      lcapgd2=lcapgd1/(here->JFETtGatePot*4*sarg*sarg);
      lcapgd3=lcapgd2/(here->JFETtGatePot*2*sarg*sarg);
                } else {
                    lcapgd1=czgdf2*(model->JFETf3+vgd/twop);
      lcapgd2=czgdf2/twop*0.5;
      lcapgd3=0;
                }
 if (here->JFETmode == 1)
  {
here->JFETdCoeffs[0] = gm1;
here->JFETdCoeffs[1] = gds1;
here->JFETdCoeffs[2] = gm2;
here->JFETdCoeffs[3] = gds2;
here->JFETdCoeffs[4] = gmds;
here->JFETdCoeffs[5] = gm3;
here->JFETdCoeffs[6] = gds3;
here->JFETdCoeffs[7] = gm2ds;
here->JFETdCoeffs[8] = gmds2;
here->JFETdCoeffs[9] = lggs1;
here->JFETdCoeffs[10] = lggd1;
here->JFETdCoeffs[11] = lggs2;
here->JFETdCoeffs[12] = lggd2;
here->JFETdCoeffs[13] = lggs3;
here->JFETdCoeffs[14] = lggd3;
here->JFETdCoeffs[15] = lcapgs1;
here->JFETdCoeffs[16] = lcapgd1;
here->JFETdCoeffs[17] = lcapgs2;
here->JFETdCoeffs[18] = lcapgd2;
here->JFETdCoeffs[19] = lcapgs3;
here->JFETdCoeffs[20] = lcapgd3;
} else {
here->JFETdCoeffs[0] = -gm1;
here->JFETdCoeffs[1] = gm1 + gds1;
here->JFETdCoeffs[2] = -gm2;
here->JFETdCoeffs[3] = -(gm2 + gds2 + 2*gmds);
here->JFETdCoeffs[4] = gm2 + gmds;
here->JFETdCoeffs[5] = -gm3;
here->JFETdCoeffs[6] = gm3 + gds3 + 3*(gm2ds + gmds2 ) ;
here->JFETdCoeffs[7] = gm3 + gm2ds;
here->JFETdCoeffs[8] = -(gm3 + 2*gm2ds + gmds2);
here->JFETdCoeffs[9] = lggd1;
here->JFETdCoeffs[10] = lggs1;
here->JFETdCoeffs[11] = lggd2;
here->JFETdCoeffs[12] = lggs2;
here->JFETdCoeffs[13] = lggd3;
here->JFETdCoeffs[14] = lggs3;
here->JFETdCoeffs[15] = lcapgd1;
here->JFETdCoeffs[16] = lcapgs1;
here->JFETdCoeffs[17] = lcapgd2;
here->JFETdCoeffs[18] = lcapgs2;
here->JFETdCoeffs[19] = lcapgd3;
here->JFETdCoeffs[20] = lcapgs3;
}
here->JFETdCoeffs[2] = 0.5*model->JFETtype*here->JFETdCoeffs[2];
here->JFETdCoeffs[3] = 0.5*model->JFETtype*here->JFETdCoeffs[3];
here->JFETdCoeffs[4] = model->JFETtype*here->JFETdCoeffs[4];
here->JFETdCoeffs[5] = here->JFETdCoeffs[5]/6.;
here->JFETdCoeffs[6] = here->JFETdCoeffs[6]/6.;
here->JFETdCoeffs[7] = 0.5*here->JFETdCoeffs[7];
here->JFETdCoeffs[8] = 0.5*here->JFETdCoeffs[8];
here->JFETdCoeffs[11] = model->JFETtype*lggs2;
here->JFETdCoeffs[12] = model->JFETtype*lggd2;
here->JFETdCoeffs[17] = model->JFETtype*lcapgs2;
here->JFETdCoeffs[18] = model->JFETtype*lcapgd2;
   }
   }
   return(0);
   }

canonical_original_code:
int JFETdSetup(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sJFETmodel *model = (JFETmodel*)inModel;
    struct sJFETinstance *here;
    double beta;
    double betap;
    double lcapgd1;
    double lcapgd2;
    double lcapgd3;
    double lcapgs2;
    double lcapgs3;
    double lcapgs1;
    double cd;
    double cdrain;
    double temp;
    double cg;
    double cgd;
    double csat;
    double czgd;
    double czgdf2;
    double czgs;
    double czgsf2;
    double evgd;
    double evgs;
    double fcpb2;
    double gdpr;
    double gds1;
    double gds2;
    double gds3;
    double lggd1;
    double lggd2;
    double lggd3;
    double lggs1;
    double lggs2;
    double lggs3;
    double gm1;
    double gm2;
    double gm3;
    double gmds;
    double gm2ds;
    double gmds2;
    double gspr;
    double sarg;
    double twob;
    double twop;
    double vds;
    double vgd;
    double vgs;
    double vgst;
    for( ; model != ((void *)0); model = model->JFETnextModel ) {
        for (here = model->JFETinstances; here != ((void *)0) ;
                here=here->JFETnextInstance) {
     if (here->JFETowner != ARCHme) continue;
            beta = model->JFETbeta * here->JFETarea * here->JFETm;
            gdpr=model->JFETdrainConduct*here->JFETarea * here->JFETm;
            gspr=model->JFETsourceConduct*here->JFETarea * here-> JFETm;
            csat=here->JFETtSatCur*here->JFETarea * here-> JFETm;
                vgs= model->JFETtype*(*(ckt->CKTrhsOld + here->JFETgateNode)
   - *(ckt->CKTrhsOld + here->JFETsourcePrimeNode));
                vgd= model->JFETtype*(*(ckt->CKTrhsOld + here->JFETgateNode)
   - *(ckt->CKTrhsOld + here->JFETdrainPrimeNode));
            vds=vgs-vgd;
     if (vds < 0.0) {
  vds = -vds;
  temp = vgs;
  vgs = vgd;
  vgd = temp;
  here->JFETmode = -1;
  } else {
  here->JFETmode = 1;
  }
            if (vgs <= -5*here->JFETtemp*CONSTKoverQ) {
                lggs1 = -csat/vgs+ckt->CKTgmin;
  lggs2=lggs3=0;
                cg = lggs1*vgs;
            } else {
                evgs = exp(vgs/(here->JFETtemp*CONSTKoverQ));
                lggs1 = csat*evgs/(here->JFETtemp*CONSTKoverQ)+ckt->CKTgmin;
  lggs2 = (lggs1-ckt->CKTgmin)/((here->JFETtemp*CONSTKoverQ)*2);
  lggs3 = lggs2/(3*(here->JFETtemp*CONSTKoverQ));
                cg = csat*(evgs-1)+ckt->CKTgmin*vgs;
            }
            if (vgd <= -5*(here->JFETtemp*CONSTKoverQ)) {
                lggd1 = -csat/vgd+ckt->CKTgmin;
  lggd2=lggd3=0;
                cgd = lggd1*vgd;
            } else {
                evgd = exp(vgd/(here->JFETtemp*CONSTKoverQ));
                lggd1 = csat*evgd/(here->JFETtemp*CONSTKoverQ)+ckt->CKTgmin;
  lggd2 = (lggd1-ckt->CKTgmin)/((here->JFETtemp*CONSTKoverQ)*2);
  lggd3 = lggd2/(3*(here->JFETtemp*CONSTKoverQ));
                cgd = csat*(evgd-1)+ckt->CKTgmin*vgd;
            }
            cg = cg+cgd;
                vgst=vgs-model->JFETthreshold;
                if (vgst <= 0) {
                    cdrain=0;
                    gm1=gm2=gm3=0;
                    gds1=gds2=gds3=0;
      gmds=gm2ds=gmds2=0;
                } else {
                    betap=beta*(1+model->JFETlModulation*vds);
                    twob=betap+betap;
                    if (vgst <= vds) {
                        cdrain=betap*vgst*vgst;
                        gm1=twob*vgst;
   gm2=twob;
   gm3=0;
                        gds1=model->JFETlModulation*beta*vgst*vgst;
   gds2=gds3=gmds2=0;
   gm2ds=2*model->JFETlModulation*beta;
   gmds=gm2ds*vgst;
                    } else {
                        cdrain=betap*vds*(vgst+vgst-vds);
                        gm1=twob*vds;
   gm2=0;
   gm3=0;
   gmds=(beta+beta)*(1+2*model->JFETlModulation*vds);
   gm2ds=0;
   gds2=2*beta*(2*model->JFETlModulation*vgst - 1 -
    3*model->JFETlModulation*vds);
                        gds1=beta*(2*(vgst-vds) + 4*vgst*vds*
  model->JFETlModulation - 3*model->JFETlModulation*vds*vds);
   gmds2=4*beta*model->JFETlModulation;
   gds3= -6*beta*model->JFETlModulation;
                    }
                }
            cd=cdrain-cgd;
                czgs=here->JFETtCGS*here->JFETarea * here->JFETm;
                czgd=here->JFETtCGD*here->JFETarea * here->JFETm;
                twop=here->JFETtGatePot+here->JFETtGatePot;
                fcpb2=here->JFETcorDepCap*here->JFETcorDepCap;
                czgsf2=czgs/model->JFETf2;
                czgdf2=czgd/model->JFETf2;
                if (vgs < here->JFETcorDepCap) {
                    sarg=sqrt(1-vgs/here->JFETtGatePot);
                    lcapgs1=czgs/sarg;
      lcapgs2=lcapgs1/(here->JFETtGatePot*4*sarg*sarg);
      lcapgs3=lcapgs2/(here->JFETtGatePot*2*sarg*sarg);
                } else {
                    lcapgs1=czgsf2*(model->JFETf3+vgs/twop);
      lcapgs2=czgsf2/twop*0.5;
      lcapgs3=0;
                }
                if (vgd < here->JFETcorDepCap) {
                    sarg=sqrt(1-vgd/here->JFETtGatePot);
                    lcapgd1=czgd/sarg;
      lcapgd2=lcapgd1/(here->JFETtGatePot*4*sarg*sarg);
      lcapgd3=lcapgd2/(here->JFETtGatePot*2*sarg*sarg);
                } else {
                    lcapgd1=czgdf2*(model->JFETf3+vgd/twop);
      lcapgd2=czgdf2/twop*0.5;
      lcapgd3=0;
                }
 if (here->JFETmode == 1)
  {
here->JFETdCoeffs[0] = gm1;
here->JFETdCoeffs[1] = gds1;
here->JFETdCoeffs[2] = gm2;
here->JFETdCoeffs[3] = gds2;
here->JFETdCoeffs[4] = gmds;
here->JFETdCoeffs[5] = gm3;
here->JFETdCoeffs[6] = gds3;
here->JFETdCoeffs[7] = gm2ds;
here->JFETdCoeffs[8] = gmds2;
here->JFETdCoeffs[9] = lggs1;
here->JFETdCoeffs[10] = lggd1;
here->JFETdCoeffs[11] = lggs2;
here->JFETdCoeffs[12] = lggd2;
here->JFETdCoeffs[13] = lggs3;
here->JFETdCoeffs[14] = lggd3;
here->JFETdCoeffs[15] = lcapgs1;
here->JFETdCoeffs[16] = lcapgd1;
here->JFETdCoeffs[17] = lcapgs2;
here->JFETdCoeffs[18] = lcapgd2;
here->JFETdCoeffs[19] = lcapgs3;
here->JFETdCoeffs[20] = lcapgd3;
} else {
here->JFETdCoeffs[0] = -gm1;
here->JFETdCoeffs[1] = gm1 + gds1;
here->JFETdCoeffs[2] = -gm2;
here->JFETdCoeffs[3] = -(gm2 + gds2 + 2*gmds);
here->JFETdCoeffs[4] = gm2 + gmds;
here->JFETdCoeffs[5] = -gm3;
here->JFETdCoeffs[6] = gm3 + gds3 + 3*(gm2ds + gmds2 ) ;
here->JFETdCoeffs[7] = gm3 + gm2ds;
here->JFETdCoeffs[8] = -(gm3 + 2*gm2ds + gmds2);
here->JFETdCoeffs[9] = lggd1;
here->JFETdCoeffs[10] = lggs1;
here->JFETdCoeffs[11] = lggd2;
here->JFETdCoeffs[12] = lggs2;
here->JFETdCoeffs[13] = lggd3;
here->JFETdCoeffs[14] = lggs3;
here->JFETdCoeffs[15] = lcapgd1;
here->JFETdCoeffs[16] = lcapgs1;
here->JFETdCoeffs[17] = lcapgd2;
here->JFETdCoeffs[18] = lcapgs2;
here->JFETdCoeffs[19] = lcapgd3;
here->JFETdCoeffs[20] = lcapgs3;
}
here->JFETdCoeffs[2] = 0.5*model->JFETtype*here->JFETdCoeffs[2];
here->JFETdCoeffs[3] = 0.5*model->JFETtype*here->JFETdCoeffs[3];
here->JFETdCoeffs[4] = model->JFETtype*here->JFETdCoeffs[4];
here->JFETdCoeffs[5] = here->JFETdCoeffs[5]/6.;
here->JFETdCoeffs[6] = here->JFETdCoeffs[6]/6.;
here->JFETdCoeffs[7] = 0.5*here->JFETdCoeffs[7];
here->JFETdCoeffs[8] = 0.5*here->JFETdCoeffs[8];
here->JFETdCoeffs[11] = model->JFETtype*lggs2;
here->JFETdCoeffs[12] = model->JFETtype*lggd2;
here->JFETdCoeffs[17] = model->JFETtype*lcapgs2;
here->JFETdCoeffs[18] = model->JFETtype*lcapgd2;
   }
   }
   return(0);
   }

variable_types: struct CKTcircuit { struct sGENmodel **CKThead; struct STATistics { int STATnumIter; int STATtranIter; int STAToldIter; int STATtimePts; int STATaccepted; int STATrejected; double STATtotAnalTime; double STATloadTime; double STATdecompTime; double STATsolveTime; double STATreorderTime; double STATcombineTime; double STATsyncTime; double STATtranTime; double STATtranDecompTime; double STATtranSolveTime; double STATtranLoadTime; double STATtranTruncTime; double STATtranCombTime; double STATtranSyncTime; double STATacTime; double STATacDecompTime; double STATacSolveTime; double STATacLoadTime; double STATacCombTime; double STATacSyncTime; } *CKTstat; double *CKTstates[8]; double CKTtime; double CKTdelta; double CKTdeltaOld[7]; double CKTtemp; double CKTnomTemp; double CKTvt; double CKTag[7]; double CKTagp[7]; int CKTorder; int CKTmaxOrder; int CKTintegrateMethod; void *CKTmatrix; int CKTniState; double *CKTrhs; double *CKTrhsOld; double *CKTrhsSpare; double *CKTirhs; double *CKTirhsOld; double *CKTirhsSpare; double *CKTpred; double *CKTsols[8]; double *CKTrhsOp; double *CKTsenRhs; double *CKTseniRhs; int CKTmaxEqNum; int CKTcurrentAnalysis; struct sCKTnode { char *name; int type; int number; double ic; double nodeset; double *ptr; struct sCKTnode *next; unsigned int icGiven; unsigned int nsGiven; } *CKTnodes; struct sCKTnode *CKTlastNode; int CKTnumStates; long CKTmode; int CKTbypass; int CKTdcMaxIter; int CKTdcTrcvMaxIter; int CKTtranMaxIter; int CKTbreakSize; int CKTbreak; double CKTsaveDelta; double CKTminBreak; double *CKTbreaks; double CKTabstol; double CKTpivotAbsTol; double CKTpivotRelTol; double CKTreltol; double CKTchgtol; double CKTvoltTol; double CKTgmin; double CKTgshunt; double CKTdelmin; double CKTtrtol; double CKTfinalTime; double CKTstep; double CKTmaxStep; double CKTinitTime; double CKTomega; double CKTsrcFact; double CKTdiagGmin; int CKTnumSrcSteps; int CKTnumGminSteps; double CKTgminFactor; int CKTnoncon; double CKTdefaultMosM; double CKTdefaultMosL; double CKTdefaultMosW; double CKTdefaultMosAD; double CKTdefaultMosAS; unsigned int CKThadNodeset; unsigned int CKTfixLimit; unsigned int CKTnoOpIter; unsigned int CKTisSetup; struct sJOB { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; } *CKTcurJob; struct SENstruct { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; int SENnumVal; char **SENdevices; char **SENparmNames; unsigned int SENinitflag; unsigned int SENicflag; unsigned int SENstatus; unsigned int SENacpertflag; int SENmode; int SENparms; double SENpertfac; double **SEN_Sap; double **SEN_RHS; double **SEN_iRHS; int SENsize; void *SEN_Jacmat; double *SEN_parmVal; char **SEN_parmName; } *CKTsenInfo; double *CKTtimePoints; double *CKTdeltaList; int CKTtimeListSize; int CKTtimeIndex; int CKTsizeIncr; unsigned int CKTtryToCompact; unsigned int CKTbadMos3; unsigned int CKTkeepOpInfo; unsigned int CKTcopyNodesets; unsigned int CKTnodeDamping; double CKTabsDv; double CKTrelDv; int CKTtroubleNode; struct sGENinstance *CKTtroubleElt; } *

variable_types: struct sJFETmodel { int JFETmodType; struct sJFETmodel *JFETnextModel; struct sJFETinstance { struct sJFETmodel *JFETmodPtr; struct sJFETinstance *JFETnextInstance; char *JFETname; int JFETowner; int JFETstate; int JFETdrainNode; int JFETgateNode; int JFETsourceNode; int JFETdrainPrimeNode; int JFETsourcePrimeNode; double *JFETdrainDrainPrimePtr; double *JFETgateDrainPrimePtr; double *JFETgateSourcePrimePtr; double *JFETsourceSourcePrimePtr; double *JFETdrainPrimeDrainPtr; double *JFETdrainPrimeGatePtr; double *JFETdrainPrimeSourcePrimePtr; double *JFETsourcePrimeGatePtr; double *JFETsourcePrimeSourcePtr; double *JFETsourcePrimeDrainPrimePtr; double *JFETdrainDrainPtr; double *JFETgateGatePtr; double *JFETsourceSourcePtr; double *JFETdrainPrimeDrainPrimePtr; double *JFETsourcePrimeSourcePrimePtr; int JFETmode; double JFETdCoeffs[21]; double JFETnVar[3][5]; unsigned int JFEToff; unsigned int JFETareaGiven; unsigned int JFETmGiven; unsigned int JFETicVDSGiven; unsigned int JFETicVGSGiven; unsigned int JFETtempGiven; unsigned int JFETdtempGiven; double JFETarea; double JFETm; double JFETicVDS; double JFETicVGS; double JFETtemp; double JFETdtemp; double JFETtSatCur; double JFETtGatePot; double JFETtCGS; double JFETtCGD; double JFETcorDepCap; double JFETvcrit; double JFETf1; } *JFETinstances; char *JFETmodName; int JFETtype; double JFETthreshold; double JFETbeta; double JFETlModulation; double JFETdrainResist; double JFETsourceResist; double JFETcapGS; double JFETcapGD; double JFETgatePotential; double JFETgateSatCurrent; double JFETdepletionCapCoeff; double JFETfNcoef; double JFETfNexp; double JFETdrainConduct; double JFETsourceConduct; double JFETf2; double JFETf3; double JFETb; double JFETbFac; double JFETtnom; unsigned int JFETthresholdGiven; unsigned int JFETbetaGiven; unsigned int JFETlModulationGiven; unsigned int JFETdrainResistGiven; unsigned int JFETsourceResistGiven; unsigned int JFETcapGSGiven; unsigned int JFETcapGDGiven; unsigned int JFETgatePotentialGiven; unsigned int JFETgateSatCurrentGiven; unsigned int JFETdepletionCapCoeffGiven; unsigned int JFETbGiven; unsigned int JFETtnomGiven; unsigned int JFETfNcoefGiven; unsigned int JFETfNexpGiven; } *

variable_types: struct sJFETinstance { struct sJFETmodel { int JFETmodType; struct sJFETmodel *JFETnextModel; struct sJFETinstance *JFETinstances; char *JFETmodName; int JFETtype; double JFETthreshold; double JFETbeta; double JFETlModulation; double JFETdrainResist; double JFETsourceResist; double JFETcapGS; double JFETcapGD; double JFETgatePotential; double JFETgateSatCurrent; double JFETdepletionCapCoeff; double JFETfNcoef; double JFETfNexp; double JFETdrainConduct; double JFETsourceConduct; double JFETf2; double JFETf3; double JFETb; double JFETbFac; double JFETtnom; unsigned int JFETthresholdGiven; unsigned int JFETbetaGiven; unsigned int JFETlModulationGiven; unsigned int JFETdrainResistGiven; unsigned int JFETsourceResistGiven; unsigned int JFETcapGSGiven; unsigned int JFETcapGDGiven; unsigned int JFETgatePotentialGiven; unsigned int JFETgateSatCurrentGiven; unsigned int JFETdepletionCapCoeffGiven; unsigned int JFETbGiven; unsigned int JFETtnomGiven; unsigned int JFETfNcoefGiven; unsigned int JFETfNexpGiven; } *JFETmodPtr; struct sJFETinstance *JFETnextInstance; char *JFETname; int JFETowner; int JFETstate; int JFETdrainNode; int JFETgateNode; int JFETsourceNode; int JFETdrainPrimeNode; int JFETsourcePrimeNode; double *JFETdrainDrainPrimePtr; double *JFETgateDrainPrimePtr; double *JFETgateSourcePrimePtr; double *JFETsourceSourcePrimePtr; double *JFETdrainPrimeDrainPtr; double *JFETdrainPrimeGatePtr; double *JFETdrainPrimeSourcePrimePtr; double *JFETsourcePrimeGatePtr; double *JFETsourcePrimeSourcePtr; double *JFETsourcePrimeDrainPrimePtr; double *JFETdrainDrainPtr; double *JFETgateGatePtr; double *JFETsourceSourcePtr; double *JFETdrainPrimeDrainPrimePtr; double *JFETsourcePrimeSourcePrimePtr; int JFETmode; double JFETdCoeffs[21]; double JFETnVar[3][5]; unsigned int JFEToff; unsigned int JFETareaGiven; unsigned int JFETmGiven; unsigned int JFETicVDSGiven; unsigned int JFETicVGSGiven; unsigned int JFETtempGiven; unsigned int JFETdtempGiven; double JFETarea; double JFETm; double JFETicVDS; double JFETicVGS; double JFETtemp; double JFETdtemp; double JFETtSatCur; double JFETtGatePot; double JFETtCGS; double JFETtCGD; double JFETcorDepCap; double JFETvcrit; double JFETf1; } *

variable_types: beta double

variable_types: betap double

variable_types: cd double

variable_types: cdrain double

variable_types: temp double

variable_types: cg double

variable_types: cgd double

variable_types: csat double

variable_types: czgd double

variable_types: czgs double

variable_types: evgd double

variable_types: evgs double

variable_types: gdpr double

variable_types: gmds double

variable_types: gspr double

variable_types: sarg double

variable_types: twob double

variable_types: twop double

variable_types: vds double

variable_types: vgd double

variable_types: vgs double

variable_types: vgst double

user_defined_types: struct CKTcircuit { struct sGENmodel **CKThead; struct STATistics *CKTstat; double *CKTstates[8]; double CKTtime; double CKTdelta; double CKTdeltaOld[7]; double CKTtemp; double CKTnomTemp; double CKTvt; double CKTag[7]; double CKTagp[7]; int CKTorder; int CKTmaxOrder; int CKTintegrateMethod; void *CKTmatrix; int CKTniState; double *CKTrhs; double *CKTrhsOld; double *CKTrhsSpare; double *CKTirhs; double *CKTirhsOld; double *CKTirhsSpare; double *CKTpred; double *CKTsols[8]; double *CKTrhsOp; double *CKTsenRhs; double *CKTseniRhs; int CKTmaxEqNum; int CKTcurrentAnalysis; struct sCKTnode *CKTnodes; struct sCKTnode *CKTlastNode; int CKTnumStates; long CKTmode; int CKTbypass; int CKTdcMaxIter; int CKTdcTrcvMaxIter; int CKTtranMaxIter; int CKTbreakSize; int CKTbreak; double CKTsaveDelta; double CKTminBreak; double *CKTbreaks; double CKTabstol; double CKTpivotAbsTol; double CKTpivotRelTol; double CKTreltol; double CKTchgtol; double CKTvoltTol; double CKTgmin; double CKTgshunt; double CKTdelmin; double CKTtrtol; double CKTfinalTime; double CKTstep; double CKTmaxStep; double CKTinitTime; double CKTomega; double CKTsrcFact; double CKTdiagGmin; int CKTnumSrcSteps; int CKTnumGminSteps; double CKTgminFactor; int CKTnoncon; double CKTdefaultMosM; double CKTdefaultMosL; double CKTdefaultMosW; double CKTdefaultMosAD; double CKTdefaultMosAS; unsigned int CKThadNodeset; unsigned int CKTfixLimit; unsigned int CKTnoOpIter; unsigned int CKTisSetup; struct sJOB *CKTcurJob; struct SENstruct *CKTsenInfo; double *CKTtimePoints; double *CKTdeltaList; int CKTtimeListSize; int CKTtimeIndex; int CKTsizeIncr; unsigned int CKTtryToCompact; unsigned int CKTbadMos3; unsigned int CKTkeepOpInfo; unsigned int CKTcopyNodesets; unsigned int CKTnodeDamping; double CKTabsDv; double CKTrelDv; int CKTtroubleNode; struct sGENinstance *CKTtroubleElt; }


INDload

original_code:
int
INDload(GENmodel *inModel, CKTcircuit *ckt)
{
    INDmodel *model = (INDmodel*)inModel;
    INDinstance *here;
    double veq;
    double req;
    int error;
    MUTinstance *muthere;
    MUTmodel *mutmodel;
    int ktype;
    int itype;
    for( ; model != ((void *)0); model = model->INDnextModel ) {
        for (here = model->INDinstances; here != ((void *)0) ;
                here=here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            if(!(ckt->CKTmode & (0x70|0x2000))) {
                if(ckt->CKTmode & 0x10000l && ckt->CKTmode & 0x1000) {
                    *(ckt->CKTstates[0] + here->INDstate) = here->INDinduct *
                            here->INDinitCond;
                } else {
                    *(ckt->CKTstates[0] + here->INDstate) = here->INDinduct *
                            *(ckt->CKTrhsOld + here->INDbrEq);
                }
            }
        }
    }
    ktype = CKTtypelook("mutual");
    mutmodel = (MUTmodel *)(ckt->CKThead[ktype]);
    for( ; mutmodel != ((void *)0); mutmodel = mutmodel->MUTnextModel ) {
        for (muthere = mutmodel->MUTinstances; muthere != ((void *)0) ;
                muthere=muthere->MUTnextInstance) {
     if (muthere->MUTowner != ARCHme) continue;
            if(!(ckt->CKTmode& (0x70|0x2000))) {
                *(ckt->CKTstates[0] + muthere->MUTind1->INDstate) +=
                    muthere->MUTfactor * *(ckt->CKTrhsOld +
                    muthere->MUTind2->INDbrEq);
                *(ckt->CKTstates[0] + muthere->MUTind2->INDstate) +=
                    muthere->MUTfactor * *(ckt->CKTrhsOld +
                    muthere->MUTind1->INDbrEq);
            }
            *(muthere->MUTbr1br2) -= muthere->MUTfactor*ckt->CKTag[0];
            *(muthere->MUTbr2br1) -= muthere->MUTfactor*ckt->CKTag[0];
        }
    }
    itype = CKTtypelook("Inductor");
    model = (INDmodel *)(ckt->CKThead[itype]);
    for( ; model != ((void *)0); model = model->INDnextModel ) {
        for (here = model->INDinstances; here != ((void *)0) ;
                here=here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            if(ckt->CKTmode & 0x70) {
                req = 0.0;
                veq = 0.0;
            } else {
                    if (ckt->CKTmode & 0x1000) {
                        *(ckt->CKTstates[1] + here->INDstate) =
                                *(ckt->CKTstates[0] + here->INDstate);
                    }
                error=NIintegrate(ckt,&req,&veq,here->INDinduct,here->INDstate);
                if(error) return(error);
            }
            *(ckt->CKTrhs+here->INDbrEq) += veq;
     if(ckt->CKTmode & 0x1000) {
                *(ckt->CKTstates[1]+here->INDstate+1) =
                    *(ckt->CKTstates[0]+here->INDstate+1);
            }
            *(here->INDposIbrptr) += 1;
            *(here->INDnegIbrptr) -= 1;
            *(here->INDibrPosptr) += 1;
            *(here->INDibrNegptr) -= 1;
            *(here->INDibrIbrptr) -= req;
        }
    }
    return(0);
}

canonical_original_code:
int INDload(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sINDmodel *model = (INDmodel*)inModel;
    struct sINDinstance *here;
    double veq;
    double req;
    int error;
    struct sMUTinstance *muthere;
    struct sMUTmodel *mutmodel;
    int ktype;
    int itype;
    for( ; model != ((void *)0); model = model->INDnextModel ) {
        for (here = model->INDinstances; here != ((void *)0) ;
                here=here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            if(!(ckt->CKTmode & (0x70|0x2000))) {
                if(ckt->CKTmode & 0x10000l && ckt->CKTmode & 0x1000) {
                    *(ckt->CKTstates[0] + here->INDstate) = here->INDinduct *
                            here->INDinitCond;
                } else {
                    *(ckt->CKTstates[0] + here->INDstate) = here->INDinduct *
                            *(ckt->CKTrhsOld + here->INDbrEq);
                }
            }
        }
    }
    ktype = CKTtypelook("mutual");
    mutmodel = (struct sMUTmodel *)(ckt->CKThead[ktype]);
    for( ; mutmodel != ((void *)0); mutmodel = mutmodel->MUTnextModel ) {
        for (muthere = mutmodel->MUTinstances; muthere != ((void *)0) ;
                muthere=muthere->MUTnextInstance) {
     if (muthere->MUTowner != ARCHme) continue;
            if(!(ckt->CKTmode& (0x70|0x2000))) {
                *(ckt->CKTstates[0] + muthere->MUTind1->INDstate) +=
                    muthere->MUTfactor * *(ckt->CKTrhsOld +
                    muthere->MUTind2->INDbrEq);
                *(ckt->CKTstates[0] + muthere->MUTind2->INDstate) +=
                    muthere->MUTfactor * *(ckt->CKTrhsOld +
                    muthere->MUTind1->INDbrEq);
            }
            *(muthere->MUTbr1br2) -= muthere->MUTfactor*ckt->CKTag[0];
            *(muthere->MUTbr2br1) -= muthere->MUTfactor*ckt->CKTag[0];
        }
    }
    itype = CKTtypelook("Inductor");
    model = (struct sINDmodel *)(ckt->CKThead[itype]);
    for( ; model != ((void *)0); model = model->INDnextModel ) {
        for (here = model->INDinstances; here != ((void *)0) ;
                here=here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            if(ckt->CKTmode & 0x70) {
                req = 0.0;
                veq = 0.0;
            } else {
                    if (ckt->CKTmode & 0x1000) {
                        *(ckt->CKTstates[1] + here->INDstate) =
                                *(ckt->CKTstates[0] + here->INDstate);
                    }
                error=NIintegrate(ckt,&req,&veq,here->INDinduct,here->INDstate);
                if(error) return(error);
            }
            *(ckt->CKTrhs+here->INDbrEq) += veq;
     if(ckt->CKTmode & 0x1000) {
                *(ckt->CKTstates[1]+here->INDstate+1) =
                    *(ckt->CKTstates[0]+here->INDstate+1);
            }
            *(here->INDposIbrptr) += 1;
            *(here->INDnegIbrptr) -= 1;
            *(here->INDibrPosptr) += 1;
            *(here->INDibrNegptr) -= 1;
            *(here->INDibrIbrptr) -= req;
        }
    }
    return(0);
}

variable_types: struct sGENmodel { int GENmodType; struct sGENmodel *GENnextModel; struct sGENinstance { struct sGENmodel *GENmodPtr; struct sGENinstance *GENnextInstance; char *GENname; int GENowner; int GENstate; int GENnode1; int GENnode2; int GENnode3; int GENnode4; int GENnode5; int GENnode6; int GENnode7; } *GENinstances; char *GENmodName; } *

variable_types: struct CKTcircuit { struct sGENmodel **CKThead; struct STATistics { int STATnumIter; int STATtranIter; int STAToldIter; int STATtimePts; int STATaccepted; int STATrejected; double STATtotAnalTime; double STATloadTime; double STATdecompTime; double STATsolveTime; double STATreorderTime; double STATcombineTime; double STATsyncTime; double STATtranTime; double STATtranDecompTime; double STATtranSolveTime; double STATtranLoadTime; double STATtranTruncTime; double STATtranCombTime; double STATtranSyncTime; double STATacTime; double STATacDecompTime; double STATacSolveTime; double STATacLoadTime; double STATacCombTime; double STATacSyncTime; } *CKTstat; double *CKTstates[8]; double CKTtime; double CKTdelta; double CKTdeltaOld[7]; double CKTtemp; double CKTnomTemp; double CKTvt; double CKTag[7]; double CKTagp[7]; int CKTorder; int CKTmaxOrder; int CKTintegrateMethod; void *CKTmatrix; int CKTniState; double *CKTrhs; double *CKTrhsOld; double *CKTrhsSpare; double *CKTirhs; double *CKTirhsOld; double *CKTirhsSpare; double *CKTpred; double *CKTsols[8]; double *CKTrhsOp; double *CKTsenRhs; double *CKTseniRhs; int CKTmaxEqNum; int CKTcurrentAnalysis; struct sCKTnode { char *name; int type; int number; double ic; double nodeset; double *ptr; struct sCKTnode *next; unsigned int icGiven; unsigned int nsGiven; } *CKTnodes; struct sCKTnode *CKTlastNode; int CKTnumStates; long CKTmode; int CKTbypass; int CKTdcMaxIter; int CKTdcTrcvMaxIter; int CKTtranMaxIter; int CKTbreakSize; int CKTbreak; double CKTsaveDelta; double CKTminBreak; double *CKTbreaks; double CKTabstol; double CKTpivotAbsTol; double CKTpivotRelTol; double CKTreltol; double CKTchgtol; double CKTvoltTol; double CKTgmin; double CKTgshunt; double CKTdelmin; double CKTtrtol; double CKTfinalTime; double CKTstep; double CKTmaxStep; double CKTinitTime; double CKTomega; double CKTsrcFact; double CKTdiagGmin; int CKTnumSrcSteps; int CKTnumGminSteps; double CKTgminFactor; int CKTnoncon; double CKTdefaultMosM; double CKTdefaultMosL; double CKTdefaultMosW; double CKTdefaultMosAD; double CKTdefaultMosAS; unsigned int CKThadNodeset; unsigned int CKTfixLimit; unsigned int CKTnoOpIter; unsigned int CKTisSetup; struct sJOB { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; } *CKTcurJob; struct SENstruct { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; int SENnumVal; char **SENdevices; char **SENparmNames; unsigned int SENinitflag; unsigned int SENicflag; unsigned int SENstatus; unsigned int SENacpertflag; int SENmode; int SENparms; double SENpertfac; double **SEN_Sap; double **SEN_RHS; double **SEN_iRHS; int SENsize; void *SEN_Jacmat; double *SEN_parmVal; char **SEN_parmName; } *CKTsenInfo; double *CKTtimePoints; double *CKTdeltaList; int CKTtimeListSize; int CKTtimeIndex; int CKTsizeIncr; unsigned int CKTtryToCompact; unsigned int CKTbadMos3; unsigned int CKTkeepOpInfo; unsigned int CKTcopyNodesets; unsigned int CKTnodeDamping; double CKTabsDv; double CKTrelDv; int CKTtroubleNode; struct sGENinstance *CKTtroubleElt; } *

variable_types: struct sINDmodel { int INDmodType; struct sINDmodel *INDnextModel; struct sINDinstance { struct sINDmodel *INDmodPtr; struct sINDinstance *INDnextInstance; char *INDname; int INDowner; int INDstate; int INDposNode; int INDnegNode; int INDbrEq; double INDinduct; double INDm; double INDtemp; double INDdtemp; double INDscale; double INDnt; double INDinitCond; double *INDposIbrptr; double *INDnegIbrptr; double *INDibrNegptr; double *INDibrPosptr; double *INDibrIbrptr; unsigned int INDindGiven; unsigned int INDicGiven; unsigned int INDmGiven; unsigned int INDtempGiven; unsigned int INDdtempGiven; unsigned int INDscaleGiven; unsigned int INDntGiven; int INDsenParmNo; } *INDinstances; char *INDmodName; double INDmInd; double INDtnom; double INDtempCoeff1; double INDtempCoeff2; double INDcsect; double INDlength; double INDmodNt; double INDmu; unsigned int INDtnomGiven; unsigned int INDtc1Given; unsigned int INDtc2Given; unsigned int INDcsectGiven; unsigned int INDlengthGiven; unsigned int INDmodNtGiven; unsigned int INDmuGiven; unsigned int INDmIndGiven; double INDspecInd; } *

variable_types: veq double

variable_types: req double

variable_types: error int

variable_types: struct sMUTinstance { struct sMUTmodel { int MUTmodType; struct sMUTmodel *MUTnextModel; struct sMUTinstance *MUTinstances; char *MUTmodName; } *MUTmodPtr; struct sMUTinstance *MUTnextInstance; char *MUTname; int MUTowner; double MUTcoupling; double MUTfactor; char *MUTindName1; char *MUTindName2; struct sINDinstance { struct sINDmodel { int INDmodType; struct sINDmodel *INDnextModel; struct sINDinstance *INDinstances; char *INDmodName; double INDmInd; double INDtnom; double INDtempCoeff1; double INDtempCoeff2; double INDcsect; double INDlength; double INDmodNt; double INDmu; unsigned int INDtnomGiven; unsigned int INDtc1Given; unsigned int INDtc2Given; unsigned int INDcsectGiven; unsigned int INDlengthGiven; unsigned int INDmodNtGiven; unsigned int INDmuGiven; unsigned int INDmIndGiven; double INDspecInd; } *INDmodPtr; struct sINDinstance *INDnextInstance; char *INDname; int INDowner; int INDstate; int INDposNode; int INDnegNode; int INDbrEq; double INDinduct; double INDm; double INDtemp; double INDdtemp; double INDscale; double INDnt; double INDinitCond; double *INDposIbrptr; double *INDnegIbrptr; double *INDibrNegptr; double *INDibrPosptr; double *INDibrIbrptr; unsigned int INDindGiven; unsigned int INDicGiven; unsigned int INDmGiven; unsigned int INDtempGiven; unsigned int INDdtempGiven; unsigned int INDscaleGiven; unsigned int INDntGiven; int INDsenParmNo; } *MUTind1; struct sINDinstance *MUTind2; double *MUTbr1br2; double *MUTbr2br1; unsigned int MUTindGiven; int MUTsenParmNo; } *

variable_types: struct sMUTmodel { int MUTmodType; struct sMUTmodel *MUTnextModel; struct sMUTinstance { struct sMUTmodel *MUTmodPtr; struct sMUTinstance *MUTnextInstance; char *MUTname; int MUTowner; double MUTcoupling; double MUTfactor; char *MUTindName1; char *MUTindName2; struct sINDinstance { struct sINDmodel { int INDmodType; struct sINDmodel *INDnextModel; struct sINDinstance *INDinstances; char *INDmodName; double INDmInd; double INDtnom; double INDtempCoeff1; double INDtempCoeff2; double INDcsect; double INDlength; double INDmodNt; double INDmu; unsigned int INDtnomGiven; unsigned int INDtc1Given; unsigned int INDtc2Given; unsigned int INDcsectGiven; unsigned int INDlengthGiven; unsigned int INDmodNtGiven; unsigned int INDmuGiven; unsigned int INDmIndGiven; double INDspecInd; } *INDmodPtr; struct sINDinstance *INDnextInstance; char *INDname; int INDowner; int INDstate; int INDposNode; int INDnegNode; int INDbrEq; double INDinduct; double INDm; double INDtemp; double INDdtemp; double INDscale; double INDnt; double INDinitCond; double *INDposIbrptr; double *INDnegIbrptr; double *INDibrNegptr; double *INDibrPosptr; double *INDibrIbrptr; unsigned int INDindGiven; unsigned int INDicGiven; unsigned int INDmGiven; unsigned int INDtempGiven; unsigned int INDdtempGiven; unsigned int INDscaleGiven; unsigned int INDntGiven; int INDsenParmNo; } *MUTind1; struct sINDinstance *MUTind2; double *MUTbr1br2; double *MUTbr2br1; unsigned int MUTindGiven; int MUTsenParmNo; } *MUTinstances; char *MUTmodName; } *

variable_types: ktype int

variable_types: itype int

user_defined_types: struct sMUTinstance { struct sMUTmodel *MUTmodPtr; struct sMUTinstance *MUTnextInstance; char *MUTname; int MUTowner; double MUTcoupling; double MUTfactor; char *MUTindName1; char *MUTindName2; struct sINDinstance *MUTind1; struct sINDinstance *MUTind2; double *MUTbr1br2; double *MUTbr2br1; unsigned int MUTindGiven; int MUTsenParmNo; }


DIOconvTest

original_code:
int
DIOconvTest(GENmodel *inModel, CKTcircuit *ckt)
{
    DIOmodel *model = (DIOmodel*)inModel;
    DIOinstance *here;
    double delvd,vd,cdhat,cd;
    double tol;
    for( ; model != ((void *)0); model = model->DIOnextModel ) {
        for (here = model->DIOinstances; here != ((void *)0) ;
                here=here->DIOnextInstance) {
     if (here->DIOowner != ARCHme) continue;
            vd = *(ckt->CKTrhsOld+here->DIOposPrimeNode)-
                    *(ckt->CKTrhsOld + here->DIOnegNode);
            delvd=vd- *(ckt->CKTstates[0] + here->DIOstate);
            cdhat= *(ckt->CKTstates[0] + here->DIOstate+1) +
                    *(ckt->CKTstates[0] + here->DIOstate+2) * delvd;
            cd= *(ckt->CKTstates[0] + here->DIOstate+1);
            tol=ckt->CKTreltol*
                    ((fabs(cdhat)) > (fabs(cd)) ? (fabs(cdhat)) : (fabs(cd)))+ckt->CKTabstol;
            if (fabs(cdhat-cd) > tol) {
                ckt->CKTnoncon++;
  ckt->CKTtroubleElt = (GENinstance *) here;
                return(0);
            }
        }
    }
    return(0);
}

canonical_original_code:
int DIOconvTest(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sDIOmodel *model = (DIOmodel*)inModel;
    struct sDIOinstance *here;
    double delvd; double vd; double cdhat; double cd;
    double tol;
    for( ; model != ((void *)0); model = model->DIOnextModel ) {
        for (here = model->DIOinstances; here != ((void *)0) ;
                here=here->DIOnextInstance) {
     if (here->DIOowner != ARCHme) continue;
            vd = *(ckt->CKTrhsOld+here->DIOposPrimeNode)-
                    *(ckt->CKTrhsOld + here->DIOnegNode);
            delvd=vd- *(ckt->CKTstates[0] + here->DIOstate);
            cdhat= *(ckt->CKTstates[0] + here->DIOstate+1) +
                    *(ckt->CKTstates[0] + here->DIOstate+2) * delvd;
            cd= *(ckt->CKTstates[0] + here->DIOstate+1);
            tol=ckt->CKTreltol*
                    ((fabs(cdhat)) > (fabs(cd)) ? (fabs(cdhat)) : (fabs(cd)))+ckt->CKTabstol;
            if (fabs(cdhat-cd) > tol) {
                ckt->CKTnoncon++;
  ckt->CKTtroubleElt = (struct sGENinstance *) here;
                return(0);
            }
        }
    }
    return(0);
}

variable_types: struct sDIOmodel { int DIOmodType; struct sDIOmodel *DIOnextModel; struct sDIOinstance { struct sDIOmodel *DIOmodPtr; struct sDIOinstance *DIOnextInstance; char *DIOname; int DIOowner; int DIOstate; int DIOposNode; int DIOnegNode; int DIOposPrimeNode; double *DIOposPosPrimePtr; double *DIOnegPosPrimePtr; double *DIOposPrimePosPtr; double *DIOposPrimeNegPtr; double *DIOposPosPtr; double *DIOnegNegPtr; double *DIOposPrimePosPrimePtr; double DIOcap; double *DIOsens; int DIOsenParmNo; unsigned int DIOoff; unsigned int DIOareaGiven; unsigned int DIOpjGiven; unsigned int DIOmGiven; unsigned int DIOinitCondGiven; unsigned int DIOsenPertFlag; unsigned int DIOtempGiven; unsigned int DIOdtempGiven; double DIOarea; double DIOpj; double DIOm; double DIOinitCond; double DIOtemp; double DIOdtemp; double DIOtJctPot; double DIOtJctCap; double DIOtJctSWPot; double DIOtJctSWCap; double DIOtTransitTime; double DIOtGradingCoeff; double DIOtConductance; double DIOtDepCap; double DIOtSatCur; double DIOtSatSWCur; double DIOtVcrit; double DIOtF1; double DIOtBrkdwnV; double DIOtF2; double DIOtF3; double DIOtF2SW; double DIOtF3SW; double DIOdCoeffs[6]; double DIOnVar[3][4]; } *DIOinstances; char *DIOmodName; unsigned int DIOsatCurGiven; unsigned int DIOsatSWCurGiven; unsigned int DIOresistGiven; unsigned int DIOresistTemp1Given; unsigned int DIOresistTemp2Given; unsigned int DIOemissionCoeffGiven; unsigned int DIOtransitTimeGiven; unsigned int DIOtranTimeTemp1Given; unsigned int DIOtranTimeTemp2Given; unsigned int DIOjunctionCapGiven; unsigned int DIOjunctionPotGiven; unsigned int DIOgradingCoeffGiven; unsigned int DIOgradCoeffTemp1Given; unsigned int DIOgradCoeffTemp2Given; unsigned int DIOjunctionSWCapGiven; unsigned int DIOjunctionSWPotGiven; unsigned int DIOgradingSWCoeffGiven; unsigned int DIOforwardKneeCurrentGiven; unsigned int DIOreverseKneeCurrentGiven; unsigned int DIOactivationEnergyGiven; unsigned int DIOsaturationCurrentExpGiven; unsigned int DIOdepletionCapCoeffGiven; unsigned int DIOdepletionSWcapCoeffGiven; unsigned int DIObreakdownVoltageGiven; unsigned int DIObreakdownCurrentGiven; unsigned int DIOnomTempGiven; unsigned int DIOfNcoefGiven; unsigned int DIOfNexpGiven; double DIOsatCur; double DIOsatSWCur; double DIOresist; double DIOresistTemp1; double DIOresistTemp2; double DIOconductance; double DIOemissionCoeff; double DIOtransitTime; double DIOtranTimeTemp1; double DIOtranTimeTemp2; double DIOjunctionCap; double DIOjunctionPot; double DIOgradingCoeff; double DIOgradCoeffTemp1; double DIOgradCoeffTemp2; double DIOjunctionSWCap; double DIOjunctionSWPot; double DIOgradingSWCoeff; double DIOforwardKneeCurrent; double DIOreverseKneeCurrent; double DIOactivationEnergy; double DIOsaturationCurrentExp; double DIOdepletionCapCoeff; double DIOdepletionSWcapCoeff; double DIObreakdownVoltage; double DIObreakdownCurrent; double DIOnomTemp; double DIOfNcoef; double DIOfNexp; } *

variable_types: struct sDIOinstance { struct sDIOmodel { int DIOmodType; struct sDIOmodel *DIOnextModel; struct sDIOinstance *DIOinstances; char *DIOmodName; unsigned int DIOsatCurGiven; unsigned int DIOsatSWCurGiven; unsigned int DIOresistGiven; unsigned int DIOresistTemp1Given; unsigned int DIOresistTemp2Given; unsigned int DIOemissionCoeffGiven; unsigned int DIOtransitTimeGiven; unsigned int DIOtranTimeTemp1Given; unsigned int DIOtranTimeTemp2Given; unsigned int DIOjunctionCapGiven; unsigned int DIOjunctionPotGiven; unsigned int DIOgradingCoeffGiven; unsigned int DIOgradCoeffTemp1Given; unsigned int DIOgradCoeffTemp2Given; unsigned int DIOjunctionSWCapGiven; unsigned int DIOjunctionSWPotGiven; unsigned int DIOgradingSWCoeffGiven; unsigned int DIOforwardKneeCurrentGiven; unsigned int DIOreverseKneeCurrentGiven; unsigned int DIOactivationEnergyGiven; unsigned int DIOsaturationCurrentExpGiven; unsigned int DIOdepletionCapCoeffGiven; unsigned int DIOdepletionSWcapCoeffGiven; unsigned int DIObreakdownVoltageGiven; unsigned int DIObreakdownCurrentGiven; unsigned int DIOnomTempGiven; unsigned int DIOfNcoefGiven; unsigned int DIOfNexpGiven; double DIOsatCur; double DIOsatSWCur; double DIOresist; double DIOresistTemp1; double DIOresistTemp2; double DIOconductance; double DIOemissionCoeff; double DIOtransitTime; double DIOtranTimeTemp1; double DIOtranTimeTemp2; double DIOjunctionCap; double DIOjunctionPot; double DIOgradingCoeff; double DIOgradCoeffTemp1; double DIOgradCoeffTemp2; double DIOjunctionSWCap; double DIOjunctionSWPot; double DIOgradingSWCoeff; double DIOforwardKneeCurrent; double DIOreverseKneeCurrent; double DIOactivationEnergy; double DIOsaturationCurrentExp; double DIOdepletionCapCoeff; double DIOdepletionSWcapCoeff; double DIObreakdownVoltage; double DIObreakdownCurrent; double DIOnomTemp; double DIOfNcoef; double DIOfNexp; } *DIOmodPtr; struct sDIOinstance *DIOnextInstance; char *DIOname; int DIOowner; int DIOstate; int DIOposNode; int DIOnegNode; int DIOposPrimeNode; double *DIOposPosPrimePtr; double *DIOnegPosPrimePtr; double *DIOposPrimePosPtr; double *DIOposPrimeNegPtr; double *DIOposPosPtr; double *DIOnegNegPtr; double *DIOposPrimePosPrimePtr; double DIOcap; double *DIOsens; int DIOsenParmNo; unsigned int DIOoff; unsigned int DIOareaGiven; unsigned int DIOpjGiven; unsigned int DIOmGiven; unsigned int DIOinitCondGiven; unsigned int DIOsenPertFlag; unsigned int DIOtempGiven; unsigned int DIOdtempGiven; double DIOarea; double DIOpj; double DIOm; double DIOinitCond; double DIOtemp; double DIOdtemp; double DIOtJctPot; double DIOtJctCap; double DIOtJctSWPot; double DIOtJctSWCap; double DIOtTransitTime; double DIOtGradingCoeff; double DIOtConductance; double DIOtDepCap; double DIOtSatCur; double DIOtSatSWCur; double DIOtVcrit; double DIOtF1; double DIOtBrkdwnV; double DIOtF2; double DIOtF3; double DIOtF2SW; double DIOtF3SW; double DIOdCoeffs[6]; double DIOnVar[3][4]; } *

variable_types: delvd double

variable_types: vd double

variable_types: cdhat double

variable_types: cd double

variable_types: tol double

user_defined_types: struct STATistics { int STATnumIter; int STATtranIter; int STAToldIter; int STATtimePts; int STATaccepted; int STATrejected; double STATtotAnalTime; double STATloadTime; double STATdecompTime; double STATsolveTime; double STATreorderTime; double STATcombineTime; double STATsyncTime; double STATtranTime; double STATtranDecompTime; double STATtranSolveTime; double STATtranLoadTime; double STATtranTruncTime; double STATtranCombTime; double STATtranSyncTime; double STATacTime; double STATacDecompTime; double STATacSolveTime; double STATacLoadTime; double STATacCombTime; double STATacSyncTime; }

user_defined_types: struct sCKTnode { char *name; int type; int number; double ic; double nodeset; double *ptr; struct sCKTnode *next; unsigned int icGiven; unsigned int nsGiven; }

user_defined_types: struct sJOB { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; }

user_defined_types: struct SENstruct { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; int SENnumVal; char **SENdevices; char **SENparmNames; unsigned int SENinitflag; unsigned int SENicflag; unsigned int SENstatus; unsigned int SENacpertflag; int SENmode; int SENparms; double SENpertfac; double **SEN_Sap; double **SEN_RHS; double **SEN_iRHS; int SENsize; void *SEN_Jacmat; double *SEN_parmVal; char **SEN_parmName; }


MUTparam

original_code:
int
MUTparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
    MUTinstance *here = (MUTinstance*)inst;
    switch(param) {
        case 401:
            here->MUTcoupling = value->rValue;
            here->MUTindGiven = 1;
            break;
        case 402:
            here->MUTindName1 = value->uValue;
            break;
        case 403:
            here->MUTindName2 = value->uValue;
            break;
        case 404:
        here->MUTsenParmNo = value->iValue;
        break;
        default:
            return(7);
    }
    return(0);
}

canonical_original_code:
int MUTparam(int param, union uIFvalue *value, struct sGENinstance *inst, union uIFvalue *select)
{
    struct sMUTinstance *here = (MUTinstance*)inst;
    switch(param) {
        case 401:
            here->MUTcoupling = value->rValue;
            here->MUTindGiven = 1;
            break;
        case 402:
            here->MUTindName1 = value->uValue;
            break;
        case 403:
            here->MUTindName2 = value->uValue;
            break;
        case 404:
        here->MUTsenParmNo = value->iValue;
        break;
        default:
            return(7);
    }
    return(0);
}

variable_types: param int

variable_types: union uIFvalue { int iValue; double rValue; struct sIFcomplex { double real; double imag; } cValue; char *sValue; char *uValue; void *nValue; struct sIFparseTree { int numVars; int *varTypes; union uIFvalue *vars; int (*IFeval)(struct sIFparseTree *, double, double *, double *, double *); } *tValue; struct { int numValue; union { int *iVec; double *rVec; struct sIFcomplex *cVec; char **sVec; char **uVec; void **nVec; } vec; } v; } *

variable_types: struct sGENinstance { struct sGENmodel { int GENmodType; struct sGENmodel *GENnextModel; struct sGENinstance *GENinstances; char *GENmodName; } *GENmodPtr; struct sGENinstance *GENnextInstance; char *GENname; int GENowner; int GENstate; int GENnode1; int GENnode2; int GENnode3; int GENnode4; int GENnode5; int GENnode6; int GENnode7; } *

variable_types:
select
union uIFvalue *

user_defined_types: struct sMUTmodel { int MUTmodType; struct sMUTmodel *MUTnextModel; struct sMUTinstance *MUTinstances; char *MUTmodName; }

user_defined_types: struct sINDinstance { struct sINDmodel *INDmodPtr; struct sINDinstance *INDnextInstance; char *INDname; int INDowner; int INDstate; int INDposNode; int INDnegNode; int INDbrEq; double INDinduct; double INDm; double INDtemp; double INDdtemp; double INDscale; double INDnt; double INDinitCond; double *INDposIbrptr; double *INDnegIbrptr; double *INDibrNegptr; double *INDibrPosptr; double *INDibrIbrptr; unsigned int INDindGiven; unsigned int INDicGiven; unsigned int INDmGiven; unsigned int INDtempGiven; unsigned int INDdtempGiven; unsigned int INDscaleGiven; unsigned int INDntGiven; int INDsenParmNo; }

user_defined_types: struct sINDmodel { int INDmodType; struct sINDmodel *INDnextModel; struct sINDinstance *INDinstances; char *INDmodName; double INDmInd; double INDtnom; double INDtempCoeff1; double INDtempCoeff2; double INDcsect; double INDlength; double INDmodNt; double INDmu; unsigned int INDtnomGiven; unsigned int INDtc1Given; unsigned int INDtc2Given; unsigned int INDcsectGiven; unsigned int INDlengthGiven; unsigned int INDmodNtGiven; unsigned int INDmuGiven; unsigned int INDmIndGiven; double INDspecInd; }