CAPtemp

original_code:
int
CAPtemp(GENmodel *inModel, CKTcircuit *ckt)
{
    CAPmodel *model = (CAPmodel*)inModel;
    CAPinstance *here;
    double difference;
    double factor;
    for( ; model != ((void *)0); model = model->CAPnextModel ) {
        for (here = model->CAPinstances; here != ((void *)0) ;
                here=here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
     if(!here->CAPtempGiven) {
               here->CAPtemp = ckt->CKTtemp;
               if(!here->CAPdtempGiven) here->CAPdtemp = 0.0;
             } else {
               here->CAPdtemp = 0.0;
               if (here->CAPdtempGiven)
                   ;
             }
            if (!here->CAPwidthGiven) {
                here->CAPwidth = model->CAPdefWidth;
            }
     if (!here->CAPscaleGiven) here->CAPscale = 1.0;
     if (!here->CAPmGiven) here->CAPm = 1.0;
     if (!here->CAPcapGiven) {
         if (!model->CAPmCapGiven){
      here->CAPcapac =
                        model->CAPcj *
                            (here->CAPwidth - model->CAPnarrow) *
                            (here->CAPlength - model->CAPshort) +
                        model->CAPcjsw * 2 * (
                            (here->CAPlength - model->CAPshort) +
                            (here->CAPwidth - model->CAPnarrow) );
               } else {
             here->CAPcapac = model->CAPmCap;
        }
     }
     difference = (here->CAPtemp + here->CAPdtemp) - model->CAPtnom;
     factor = 1.0 + (model->CAPtempCoeff1)*difference +
              (model->CAPtempCoeff2)*difference*difference;
     here->CAPcapac = here->CAPcapac * factor * here->CAPscale;
 }
    }
    return(0);
}

canonical_original_code:
int CAPtemp(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sCAPmodel *model = (CAPmodel*)inModel;
    struct sCAPinstance *here;
    double difference;
    double factor;
    for( ; model != ((void *)0); model = model->CAPnextModel ) {
        for (here = model->CAPinstances; here != ((void *)0) ;
                here=here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
     if(!here->CAPtempGiven) {
               here->CAPtemp = ckt->CKTtemp;
               if(!here->CAPdtempGiven) here->CAPdtemp = 0.0;
             } else {
               here->CAPdtemp = 0.0;
               if (here->CAPdtempGiven)
                   ;
             }
            if (!here->CAPwidthGiven) {
                here->CAPwidth = model->CAPdefWidth;
            }
     if (!here->CAPscaleGiven) here->CAPscale = 1.0;
     if (!here->CAPmGiven) here->CAPm = 1.0;
     if (!here->CAPcapGiven) {
         if (!model->CAPmCapGiven){
      here->CAPcapac =
                        model->CAPcj *
                            (here->CAPwidth - model->CAPnarrow) *
                            (here->CAPlength - model->CAPshort) +
                        model->CAPcjsw * 2 * (
                            (here->CAPlength - model->CAPshort) +
                            (here->CAPwidth - model->CAPnarrow) );
               } else {
             here->CAPcapac = model->CAPmCap;
        }
     }
     difference = (here->CAPtemp + here->CAPdtemp) - model->CAPtnom;
     factor = 1.0 + (model->CAPtempCoeff1)*difference +
              (model->CAPtempCoeff2)*difference*difference;
     here->CAPcapac = here->CAPcapac * factor * here->CAPscale;
 }
    }
    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 sCAPmodel { int CAPmodType; struct sCAPmodel *CAPnextModel; 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; } *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; } *

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; } *

variable_types: difference double

variable_types: factor double


BJTtrunc

repo: gserdyuk/gnucap-a

decompiled_code:
__int64 __fastcall BJTtrunc(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // r13
__int64 i; // rbx

if ( !a1 )
return 0LL;
v3 = a1;
do
{
for ( i = *(_QWORD *)(v3 + 16); i; i = *(_QWORD *)(i + 8) )
{
CKTterr((unsigned int)(*(_DWORD *)(i + 24) + 4), a2, a3);
CKTterr((unsigned int)(*(_DWORD *)(i + 24) + 6), a2, a3);
CKTterr((unsigned int)(*(_DWORD *)(i + 24) + 8), a2, a3);
}
v3 = *(_QWORD *)(v3 + 8);
}
while ( v3 );
return 0LL;
}

original_code:
int
BJTtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
{
    BJTmodel *model = (BJTmodel*)inModel;
    BJTinstance *here;
    for( ; model != ((void *)0); model = model->BJTnextModel) {
        for(here=model->BJTinstances;here!=((void *)0);here = here->BJTnextInstance){
     if (here->BJTowner != ARCHme) continue;
            CKTterr(here->BJTstate+8,ckt,timeStep);
            CKTterr(here->BJTstate+10,ckt,timeStep);
            CKTterr(here->BJTstate+12,ckt,timeStep);
        }
    }
    return(0);
}

canonical_original_code:
int BJTtrunc(struct sGENmodel *inModel, struct CKTcircuit *ckt, double *timeStep)
{
    struct sBJTmodel *model = (BJTmodel*)inModel;
    struct sBJTinstance *here;
    for( ; model != ((void *)0); model = model->BJTnextModel) {
        for(here=model->BJTinstances;here!=((void *)0);here = here->BJTnextInstance){
     if (here->BJTowner != ARCHme) continue;
            CKTterr(here->BJTstate+8,ckt,timeStep);
            CKTterr(here->BJTstate+10,ckt,timeStep);
            CKTterr(here->BJTstate+12,ckt,timeStep);
        }
    }
    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:
timeStep
double *

variable_types: struct sBJTmodel { int BJTmodType; struct sBJTmodel *BJTnextModel; struct sBJTinstance { struct sBJTmodel *BJTmodPtr; struct sBJTinstance *BJTnextInstance; char *BJTname; int BJTowner; int BJTstate; int BJTcolNode; int BJTbaseNode; int BJTemitNode; int BJTsubstNode; int BJTcolPrimeNode; int BJTbasePrimeNode; int BJTemitPrimeNode; double BJTarea; double BJTareab; double BJTareac; double BJTm; double BJTicVBE; double BJTicVCE; double BJTtemp; double BJTdtemp; double BJTtSatCur; double BJTtBetaF; double BJTtBetaR; double BJTtBEleakCur; double BJTtBCleakCur; double BJTtBEcap; double BJTtBEpot; double BJTtBCcap; double BJTtBCpot; double BJTtDepCap; double BJTtf1; double BJTtf4; double BJTtf5; double BJTtVcrit; double *BJTcolColPrimePtr; double *BJTbaseBasePrimePtr; double *BJTemitEmitPrimePtr; double *BJTcolPrimeColPtr; double *BJTcolPrimeBasePrimePtr; double *BJTcolPrimeEmitPrimePtr; double *BJTbasePrimeBasePtr; double *BJTbasePrimeColPrimePtr; double *BJTbasePrimeEmitPrimePtr; double *BJTemitPrimeEmitPtr; double *BJTemitPrimeColPrimePtr; double *BJTemitPrimeBasePrimePtr; double *BJTcolColPtr; double *BJTbaseBasePtr; double *BJTemitEmitPtr; double *BJTcolPrimeColPrimePtr; double *BJTbasePrimeBasePrimePtr; double *BJTemitPrimeEmitPrimePtr; double *BJTsubstSubstPtr; double *BJTcolPrimeSubstPtr; double *BJTsubstColPrimePtr; double *BJTbaseColPrimePtr; double *BJTcolPrimeBasePtr; unsigned int BJToff; unsigned int BJTtempGiven; unsigned int BJTdtempGiven; unsigned int BJTareaGiven; unsigned int BJTareabGiven; unsigned int BJTareacGiven; unsigned int BJTmGiven; unsigned int BJTicVBEGiven; unsigned int BJTicVCEGiven; unsigned int BJTsenPertFlag; int BJTsenParmNo; double BJTcapbe; double BJTcapbc; double BJTcapcs; double BJTcapbx; double *BJTsens; double BJTdCoeffs[65]; double BJTnVar[3][7]; } *BJTinstances; char *BJTmodName; int BJTtype; double BJTtnom; double BJTsatCur; double BJTbetaF; double BJTemissionCoeffF; double BJTearlyVoltF; double BJTrollOffF; double BJTleakBEcurrent; double BJTc2; double BJTleakBEemissionCoeff; double BJTbetaR; double BJTemissionCoeffR; double BJTearlyVoltR; double BJTrollOffR; double BJTleakBCcurrent; double BJTc4; double BJTleakBCemissionCoeff; double BJTbaseResist; double BJTbaseCurrentHalfResist; double BJTminBaseResist; double BJTemitterResist; double BJTcollectorResist; double BJTdepletionCapBE; double BJTpotentialBE; double BJTjunctionExpBE; double BJTtransitTimeF; double BJTtransitTimeBiasCoeffF; double BJTtransitTimeFVBC; double BJTtransitTimeHighCurrentF; double BJTexcessPhase; double BJTdepletionCapBC; double BJTpotentialBC; double BJTjunctionExpBC; double BJTbaseFractionBCcap; double BJTtransitTimeR; double BJTcapCS; double BJTpotentialSubstrate; double BJTexponentialSubstrate; double BJTbetaExp; double BJTenergyGap; double BJTtempExpIS; double BJTdepletionCapCoeff; double BJTfNcoef; double BJTfNexp; double BJTinvEarlyVoltF; double BJTinvEarlyVoltR; double BJTinvRollOffF; double BJTinvRollOffR; double BJTcollectorConduct; double BJTemitterConduct; double BJTtransitTimeVBCFactor; double BJTexcessPhaseFactor; double BJTf2; double BJTf3; double BJTf6; double BJTf7; unsigned int BJTtnomGiven; unsigned int BJTsatCurGiven; unsigned int BJTbetaFGiven; unsigned int BJTemissionCoeffFGiven; unsigned int BJTearlyVoltFGiven; unsigned int BJTrollOffFGiven; unsigned int BJTleakBEcurrentGiven; unsigned int BJTc2Given; unsigned int BJTleakBEemissionCoeffGiven; unsigned int BJTbetaRGiven; unsigned int BJTemissionCoeffRGiven; unsigned int BJTearlyVoltRGiven; unsigned int BJTrollOffRGiven; unsigned int BJTleakBCcurrentGiven; unsigned int BJTc4Given; unsigned int BJTleakBCemissionCoeffGiven; unsigned int BJTbaseResistGiven; unsigned int BJTbaseCurrentHalfResistGiven; unsigned int BJTminBaseResistGiven; unsigned int BJTemitterResistGiven; unsigned int BJTcollectorResistGiven; unsigned int BJTdepletionCapBEGiven; unsigned int BJTpotentialBEGiven; unsigned int BJTjunctionExpBEGiven; unsigned int BJTtransitTimeFGiven; unsigned int BJTtransitTimeBiasCoeffFGiven; unsigned int BJTtransitTimeFVBCGiven; unsigned int BJTtransitTimeHighCurrentFGiven; unsigned int BJTexcessPhaseGiven; unsigned int BJTdepletionCapBCGiven; unsigned int BJTpotentialBCGiven; unsigned int BJTjunctionExpBCGiven; unsigned int BJTbaseFractionBCcapGiven; unsigned int BJTtransitTimeRGiven; unsigned int BJTcapCSGiven; unsigned int BJTpotentialSubstrateGiven; unsigned int BJTexponentialSubstrateGiven; unsigned int BJTbetaExpGiven; unsigned int BJTenergyGapGiven; unsigned int BJTtempExpISGiven; unsigned int BJTdepletionCapCoeffGiven; unsigned int BJTfNcoefGiven; unsigned int BJTfNexpGiven; } *

variable_types: struct sBJTinstance { struct sBJTmodel { int BJTmodType; struct sBJTmodel *BJTnextModel; struct sBJTinstance *BJTinstances; char *BJTmodName; int BJTtype; double BJTtnom; double BJTsatCur; double BJTbetaF; double BJTemissionCoeffF; double BJTearlyVoltF; double BJTrollOffF; double BJTleakBEcurrent; double BJTc2; double BJTleakBEemissionCoeff; double BJTbetaR; double BJTemissionCoeffR; double BJTearlyVoltR; double BJTrollOffR; double BJTleakBCcurrent; double BJTc4; double BJTleakBCemissionCoeff; double BJTbaseResist; double BJTbaseCurrentHalfResist; double BJTminBaseResist; double BJTemitterResist; double BJTcollectorResist; double BJTdepletionCapBE; double BJTpotentialBE; double BJTjunctionExpBE; double BJTtransitTimeF; double BJTtransitTimeBiasCoeffF; double BJTtransitTimeFVBC; double BJTtransitTimeHighCurrentF; double BJTexcessPhase; double BJTdepletionCapBC; double BJTpotentialBC; double BJTjunctionExpBC; double BJTbaseFractionBCcap; double BJTtransitTimeR; double BJTcapCS; double BJTpotentialSubstrate; double BJTexponentialSubstrate; double BJTbetaExp; double BJTenergyGap; double BJTtempExpIS; double BJTdepletionCapCoeff; double BJTfNcoef; double BJTfNexp; double BJTinvEarlyVoltF; double BJTinvEarlyVoltR; double BJTinvRollOffF; double BJTinvRollOffR; double BJTcollectorConduct; double BJTemitterConduct; double BJTtransitTimeVBCFactor; double BJTexcessPhaseFactor; double BJTf2; double BJTf3; double BJTf6; double BJTf7; unsigned int BJTtnomGiven; unsigned int BJTsatCurGiven; unsigned int BJTbetaFGiven; unsigned int BJTemissionCoeffFGiven; unsigned int BJTearlyVoltFGiven; unsigned int BJTrollOffFGiven; unsigned int BJTleakBEcurrentGiven; unsigned int BJTc2Given; unsigned int BJTleakBEemissionCoeffGiven; unsigned int BJTbetaRGiven; unsigned int BJTemissionCoeffRGiven; unsigned int BJTearlyVoltRGiven; unsigned int BJTrollOffRGiven; unsigned int BJTleakBCcurrentGiven; unsigned int BJTc4Given; unsigned int BJTleakBCemissionCoeffGiven; unsigned int BJTbaseResistGiven; unsigned int BJTbaseCurrentHalfResistGiven; unsigned int BJTminBaseResistGiven; unsigned int BJTemitterResistGiven; unsigned int BJTcollectorResistGiven; unsigned int BJTdepletionCapBEGiven; unsigned int BJTpotentialBEGiven; unsigned int BJTjunctionExpBEGiven; unsigned int BJTtransitTimeFGiven; unsigned int BJTtransitTimeBiasCoeffFGiven; unsigned int BJTtransitTimeFVBCGiven; unsigned int BJTtransitTimeHighCurrentFGiven; unsigned int BJTexcessPhaseGiven; unsigned int BJTdepletionCapBCGiven; unsigned int BJTpotentialBCGiven; unsigned int BJTjunctionExpBCGiven; unsigned int BJTbaseFractionBCcapGiven; unsigned int BJTtransitTimeRGiven; unsigned int BJTcapCSGiven; unsigned int BJTpotentialSubstrateGiven; unsigned int BJTexponentialSubstrateGiven; unsigned int BJTbetaExpGiven; unsigned int BJTenergyGapGiven; unsigned int BJTtempExpISGiven; unsigned int BJTdepletionCapCoeffGiven; unsigned int BJTfNcoefGiven; unsigned int BJTfNexpGiven; } *BJTmodPtr; struct sBJTinstance *BJTnextInstance; char *BJTname; int BJTowner; int BJTstate; int BJTcolNode; int BJTbaseNode; int BJTemitNode; int BJTsubstNode; int BJTcolPrimeNode; int BJTbasePrimeNode; int BJTemitPrimeNode; double BJTarea; double BJTareab; double BJTareac; double BJTm; double BJTicVBE; double BJTicVCE; double BJTtemp; double BJTdtemp; double BJTtSatCur; double BJTtBetaF; double BJTtBetaR; double BJTtBEleakCur; double BJTtBCleakCur; double BJTtBEcap; double BJTtBEpot; double BJTtBCcap; double BJTtBCpot; double BJTtDepCap; double BJTtf1; double BJTtf4; double BJTtf5; double BJTtVcrit; double *BJTcolColPrimePtr; double *BJTbaseBasePrimePtr; double *BJTemitEmitPrimePtr; double *BJTcolPrimeColPtr; double *BJTcolPrimeBasePrimePtr; double *BJTcolPrimeEmitPrimePtr; double *BJTbasePrimeBasePtr; double *BJTbasePrimeColPrimePtr; double *BJTbasePrimeEmitPrimePtr; double *BJTemitPrimeEmitPtr; double *BJTemitPrimeColPrimePtr; double *BJTemitPrimeBasePrimePtr; double *BJTcolColPtr; double *BJTbaseBasePtr; double *BJTemitEmitPtr; double *BJTcolPrimeColPrimePtr; double *BJTbasePrimeBasePrimePtr; double *BJTemitPrimeEmitPrimePtr; double *BJTsubstSubstPtr; double *BJTcolPrimeSubstPtr; double *BJTsubstColPrimePtr; double *BJTbaseColPrimePtr; double *BJTcolPrimeBasePtr; unsigned int BJToff; unsigned int BJTtempGiven; unsigned int BJTdtempGiven; unsigned int BJTareaGiven; unsigned int BJTareabGiven; unsigned int BJTareacGiven; unsigned int BJTmGiven; unsigned int BJTicVBEGiven; unsigned int BJTicVCEGiven; unsigned int BJTsenPertFlag; int BJTsenParmNo; double BJTcapbe; double BJTcapbc; double BJTcapcs; double BJTcapbx; double *BJTsens; double BJTdCoeffs[65]; double BJTnVar[3][7]; } *

return_type: int

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

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; }

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; }


MESask

original_code:
int
MESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
{
    MESinstance *here = (MESinstance*)inst;
    static char *msg = "Current and power not available in ac analysis";
    switch(which) {
        case 1:
            value->rValue = here->MESarea;
            value->rValue *= here->MESm;
            return (0);
        case 2:
            value->rValue = here->MESicVDS;
            return (0);
        case 3:
            value->rValue = here->MESicVGS;
            return (0);
        case 5:
            value->iValue = here->MESoff;
            return (0);
        case 201:
            value->iValue = here->MESdrainNode;
            return (0);
        case 202:
            value->iValue = here->MESgateNode;
            return (0);
        case 203:
            value->iValue = here->MESsourceNode;
            return (0);
        case 204:
            value->iValue = here->MESdrainPrimeNode;
            return (0);
        case 206:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate);
            return (0);
        case 207:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+1);
            return (0);
        case 208:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+2);
            value->rValue *= here->MESm;
            return (0);
        case 209:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+3);
            value->rValue *= here->MESm;
            return (0);
        case 210:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+4);
            value->rValue *= here->MESm;
            return (0);
        case 211:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+5);
            value->rValue *= here->MESm;
            return (0);
        case 212:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+6);
            value->rValue *= here->MESm;
            return (0);
        case 213:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+7);
            value->rValue *= here->MESm;
            return (0);
        case 214:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+8);
            value->rValue *= here->MESm;
            return (0);
        case 215:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+9);
            value->rValue *= here->MESm;
            return (0);
        case 216:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+10);
            value->rValue *= here->MESm;
            return (0);
        case 217:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+11);
            value->rValue *= here->MESm;
            return (0);
        case 218:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+12);
            value->rValue *= here->MESm;
            return (0);
        case 6 :
             if (ckt->CKTcurrentAnalysis & 4) {
                 errMsg = tmalloc((unsigned)(strlen(msg)+1));
                 errRtn = "MESask";
                 strcpy(errMsg,msg);
                 return((100 +11));
             } else {
                 value->rValue = -*(ckt->CKTstates[0] + here->MESstate+3);
                 value->rValue -= *(ckt->CKTstates[0] + here->MESstate+2);
                 value->rValue *= here->MESm;
             }
             return(0);
        case 7 :
             if (ckt->CKTcurrentAnalysis & 4) {
                 errMsg = tmalloc((unsigned)(strlen(msg)+1));
                 errRtn = "MESask";
                 strcpy(errMsg,msg);
                 return((100 +12));
             } else {
                 value->rValue = *(ckt->CKTstates[0] + here->MESstate+3) *
                         *(ckt->CKTrhsOld + here->MESdrainNode);
                 value->rValue += *(ckt->CKTstates[0] + here->MESstate+2) *
                         *(ckt->CKTrhsOld + here->MESgateNode);
                 value->rValue -= (*(ckt->CKTstates[0]+here->MESstate+3) +
                         *(ckt->CKTstates[0] + here->MESstate+2)) *
                         *(ckt->CKTrhsOld + here->MESsourceNode);
                 value->rValue *= here->MESm;
             }
             return(0);
        default:
            return (7);
    }
}

canonical_original_code:
int MESask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
    struct sMESinstance *here = (MESinstance*)inst;
    static char *msg = "Current and power not available in ac analysis";
    switch(which) {
        case 1:
            value->rValue = here->MESarea;
            value->rValue *= here->MESm;
            return (0);
        case 2:
            value->rValue = here->MESicVDS;
            return (0);
        case 3:
            value->rValue = here->MESicVGS;
            return (0);
        case 5:
            value->iValue = here->MESoff;
            return (0);
        case 201:
            value->iValue = here->MESdrainNode;
            return (0);
        case 202:
            value->iValue = here->MESgateNode;
            return (0);
        case 203:
            value->iValue = here->MESsourceNode;
            return (0);
        case 204:
            value->iValue = here->MESdrainPrimeNode;
            return (0);
        case 206:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate);
            return (0);
        case 207:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+1);
            return (0);
        case 208:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+2);
            value->rValue *= here->MESm;
            return (0);
        case 209:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+3);
            value->rValue *= here->MESm;
            return (0);
        case 210:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+4);
            value->rValue *= here->MESm;
            return (0);
        case 211:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+5);
            value->rValue *= here->MESm;
            return (0);
        case 212:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+6);
            value->rValue *= here->MESm;
            return (0);
        case 213:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+7);
            value->rValue *= here->MESm;
            return (0);
        case 214:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+8);
            value->rValue *= here->MESm;
            return (0);
        case 215:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+9);
            value->rValue *= here->MESm;
            return (0);
        case 216:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+10);
            value->rValue *= here->MESm;
            return (0);
        case 217:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+11);
            value->rValue *= here->MESm;
            return (0);
        case 218:
            value->rValue = *(ckt->CKTstates[0] + here->MESstate+12);
            value->rValue *= here->MESm;
            return (0);
        case 6 :
             if (ckt->CKTcurrentAnalysis & 4) {
                 errMsg = tmalloc((unsigned int)(strlen(msg)+1));
                 errRtn = "MESask";
                 strcpy(errMsg,msg);
                 return((100 +11));
             } else {
                 value->rValue = -*(ckt->CKTstates[0] + here->MESstate+3);
                 value->rValue -= *(ckt->CKTstates[0] + here->MESstate+2);
                 value->rValue *= here->MESm;
             }
             return(0);
        case 7 :
             if (ckt->CKTcurrentAnalysis & 4) {
                 errMsg = tmalloc((unsigned int)(strlen(msg)+1));
                 errRtn = "MESask";
                 strcpy(errMsg,msg);
                 return((100 +12));
             } else {
                 value->rValue = *(ckt->CKTstates[0] + here->MESstate+3) *
                         *(ckt->CKTrhsOld + here->MESdrainNode);
                 value->rValue += *(ckt->CKTstates[0] + here->MESstate+2) *
                         *(ckt->CKTrhsOld + here->MESgateNode);
                 value->rValue -= (*(ckt->CKTstates[0]+here->MESstate+3) +
                         *(ckt->CKTstates[0] + here->MESstate+2)) *
                         *(ckt->CKTrhsOld + here->MESsourceNode);
                 value->rValue *= here->MESm;
             }
             return(0);
        default:
            return (7);
    }
}

variable_types: struct CKTcircuit { 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; } **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:
inst
struct sGENinstance *

variable_types: which 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:
select
union uIFvalue *

variable_types: struct sMESinstance { struct sMESmodel { int MESmodType; struct sMESmodel *MESnextModel; struct sMESinstance *MESinstances; char *MESmodName; int MEStype; double MESthreshold; double MESalpha; double MESbeta; double MESlModulation; double MESb; double MESdrainResist; double MESsourceResist; double MEScapGS; double MEScapGD; double MESgatePotential; double MESgateSatCurrent; double MESdepletionCapCoeff; double MESfNcoef; double MESfNexp; double MESdrainConduct; double MESsourceConduct; double MESdepletionCap; double MESf1; double MESf2; double MESf3; double MESvcrit; unsigned int MESthresholdGiven; unsigned int MESalphaGiven; unsigned int MESbetaGiven; unsigned int MESlModulationGiven; unsigned int MESbGiven; unsigned int MESdrainResistGiven; unsigned int MESsourceResistGiven; unsigned int MEScapGSGiven; unsigned int MEScapGDGiven; unsigned int MESgatePotentialGiven; unsigned int MESgateSatCurrentGiven; unsigned int MESdepletionCapCoeffGiven; unsigned int MESfNcoefGiven; unsigned int MESfNexpGiven; } *MESmodPtr; struct sMESinstance *MESnextInstance; char *MESname; int MESowner; int MESstate; int MESdrainNode; int MESgateNode; int MESsourceNode; int MESdrainPrimeNode; int MESsourcePrimeNode; double MESarea; double MESm; double MESicVDS; double MESicVGS; double *MESdrainDrainPrimePtr; double *MESgateDrainPrimePtr; double *MESgateSourcePrimePtr; double *MESsourceSourcePrimePtr; double *MESdrainPrimeDrainPtr; double *MESdrainPrimeGatePtr; double *MESdrainPrimeSourcePrimePtr; double *MESsourcePrimeGatePtr; double *MESsourcePrimeSourcePtr; double *MESsourcePrimeDrainPrimePtr; double *MESdrainDrainPtr; double *MESgateGatePtr; double *MESsourceSourcePtr; double *MESdrainPrimeDrainPrimePtr; double *MESsourcePrimeSourcePrimePtr; int MESoff; unsigned int MESareaGiven; unsigned int MESmGiven; unsigned int MESicVDSGiven; unsigned int MESicVGSGiven; int MESmode; double MESdCoeffs[27]; double MESnVar[3][5]; } *

variable_types:
msg
char *

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 sMESinstance { struct sMESmodel *MESmodPtr; struct sMESinstance *MESnextInstance; char *MESname; int MESowner; int MESstate; int MESdrainNode; int MESgateNode; int MESsourceNode; int MESdrainPrimeNode; int MESsourcePrimeNode; double MESarea; double MESm; double MESicVDS; double MESicVGS; double *MESdrainDrainPrimePtr; double *MESgateDrainPrimePtr; double *MESgateSourcePrimePtr; double *MESsourceSourcePrimePtr; double *MESdrainPrimeDrainPtr; double *MESdrainPrimeGatePtr; double *MESdrainPrimeSourcePrimePtr; double *MESsourcePrimeGatePtr; double *MESsourcePrimeSourcePtr; double *MESsourcePrimeDrainPrimePtr; double *MESdrainDrainPtr; double *MESgateGatePtr; double *MESsourceSourcePtr; double *MESdrainPrimeDrainPrimePtr; double *MESsourcePrimeSourcePrimePtr; int MESoff; unsigned int MESareaGiven; unsigned int MESmGiven; unsigned int MESicVDSGiven; unsigned int MESicVGSGiven; int MESmode; double MESdCoeffs[27]; double MESnVar[3][5]; }