DIOacLoad

repo: gserdyuk/gnucap-a

original_code:
int
DIOacLoad(GENmodel *inModel, CKTcircuit *ckt)
{
    DIOmodel *model = (DIOmodel*)inModel;
    double gspr;
    double geq;
    double xceq;
    DIOinstance *here;
    for( ; model != ((void *)0); model = model->DIOnextModel ) {
        for (here = model->DIOinstances; here != ((void *)0) ;
                here=here->DIOnextInstance) {
     if (here->DIOowner != ARCHme) continue;
            gspr=here->DIOtConductance*here->DIOarea*here->DIOm;
            geq= *(ckt->CKTstates[0] + here->DIOstate+2);
            xceq= *(ckt->CKTstates[0] + here->DIOstate+4) * ckt->CKTomega;
            *(here->DIOposPosPtr ) += gspr;
            *(here->DIOnegNegPtr ) += geq;
            *(here->DIOnegNegPtr +1 ) += xceq;
            *(here->DIOposPrimePosPrimePtr ) += geq+gspr;
            *(here->DIOposPrimePosPrimePtr +1 ) += xceq;
            *(here->DIOposPosPrimePtr ) -= gspr;
            *(here->DIOnegPosPrimePtr ) -= geq;
            *(here->DIOnegPosPrimePtr +1 ) -= xceq;
            *(here->DIOposPrimePosPtr ) -= gspr;
            *(here->DIOposPrimeNegPtr ) -= geq;
            *(here->DIOposPrimeNegPtr +1 ) -= xceq;
        }
    }
    return(0);
}

canonical_original_code:
int DIOacLoad(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sDIOmodel *model = (DIOmodel*)inModel;
    double gspr;
    double geq;
    double xceq;
    struct sDIOinstance *here;
    for( ; model != ((void *)0); model = model->DIOnextModel ) {
        for (here = model->DIOinstances; here != ((void *)0) ;
                here=here->DIOnextInstance) {
     if (here->DIOowner != ARCHme) continue;
            gspr=here->DIOtConductance*here->DIOarea*here->DIOm;
            geq= *(ckt->CKTstates[0] + here->DIOstate+2);
            xceq= *(ckt->CKTstates[0] + here->DIOstate+4) * ckt->CKTomega;
            *(here->DIOposPosPtr ) += gspr;
            *(here->DIOnegNegPtr ) += geq;
            *(here->DIOnegNegPtr +1 ) += xceq;
            *(here->DIOposPrimePosPrimePtr ) += geq+gspr;
            *(here->DIOposPrimePosPrimePtr +1 ) += xceq;
            *(here->DIOposPosPrimePtr ) -= gspr;
            *(here->DIOnegPosPrimePtr ) -= geq;
            *(here->DIOnegPosPrimePtr +1 ) -= xceq;
            *(here->DIOposPrimePosPtr ) -= gspr;
            *(here->DIOposPrimeNegPtr ) -= geq;
            *(here->DIOposPrimeNegPtr +1 ) -= xceq;
        }
    }
    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 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: gspr double

variable_types: geq double

variable_types: xceq double

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

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


SWask

decompiled_code:
__int64 __fastcall SWask(__int64 a1, __int64 a2, int a3, _DWORD *a4)
{
__int64 result; // rax
__int64 v5; // rdx
__int64 v6; // rdx
double v7; // xmm0_8

switch ( a3 )
{
case 3:
*a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 4:
*a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 5:
*a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
case 6:
*a4 = *(_DWORD *)(a2 + 40);
result = 0LL;
break;
case 7:
*(_QWORD *)a4 = *(_QWORD *)(a2 + 48);
result = 0LL;
break;
case 8:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x2FuLL);
errRtn = "SWask";
strcpy(errMsg, "Current and power not available in ac analysis");
result = 111LL;
}
else
{
v5 = *(_QWORD *)(a1 + 536);
if ( v5 )
*(double *)a4 = (*(double *)(v5 + 8LL * *(int *)(a2 + 28)) - *(double *)(v5 + 8LL * *(int *)(a2 + 32)))
* *(double *)(a2 + 88);
}
break;
case 9:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x2FuLL);
errRtn = "SWask";
strcpy(errMsg, "Current and power not available in ac analysis");
result = 112LL;
}
else
{
v6 = *(_QWORD *)(a1 + 536);
if ( v6 )
{
v7 = *(double *)(v6 + 8LL * *(int *)(a2 + 28));
*(double *)a4 = (v7 - *(double *)(v6 + 8LL * *(int *)(a2 + 32)))
* (v7 - *(double *)(v6 + 8LL * *(int *)(a2 + 32)))
* *(double *)(a2 + 88);
}
}
break;
default:
result = 7LL;
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, int a3, _DWORD *a4)
{
__int64 result; // rax
__int64 v5; // rdx
__int64 v6; // rdx
double v7; // xmm0_8

switch ( a3 )
{
case 3:
*a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 4:
*a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 5:
*a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
case 6:
*a4 = *(_DWORD *)(a2 + 40);
result = 0LL;
break;
case 7:
*(_QWORD *)a4 = *(_QWORD *)(a2 + 48);
result = 0LL;
break;
case 8:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x2FuLL);
errRtn = "SWask";
strcpy(errMsg, "Current and power not available in ac analysis");
result = 111LL;
}
else
{
v5 = *(_QWORD *)(a1 + 536);
if ( v5 )
*(double *)a4 = (*(double *)(v5 + 8LL * *(int *)(a2 + 28)) - *(double *)(v5 + 8LL * *(int *)(a2 + 32)))
* *(double *)(a2 + 88);
}
break;
case 9:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x2FuLL);
errRtn = "SWask";
strcpy(errMsg, "Current and power not available in ac analysis");
result = 112LL;
}
else
{
v6 = *(_QWORD *)(a1 + 536);
if ( v6 )
{
v7 = *(double *)(v6 + 8LL * *(int *)(a2 + 28));
*(double *)a4 = (v7 - *(double *)(v6 + 8LL * *(int *)(a2 + 32)))
* (v7 - *(double *)(v6 + 8LL * *(int *)(a2 + 32)))
* *(double *)(a2 + 88);
}
}
break;
default:
result = 7LL;
break;
}
return result;
}

original_code:
int
SWask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
{
    SWinstance *here = (SWinstance *)inst;
    static char *msg = "Current and power not available in ac analysis";
    switch(which) {
        case 3:
            value->iValue = here->SWposNode;
            return (0);
        case 4:
            value->iValue = here->SWnegNode;
            return (0);
        case 5:
            value->iValue = here->SWposCntrlNode;
            return (0);
        case 6:
            value->iValue = here->SWnegCntrlNode;
            return (0);
        case 7:
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned)(strlen(msg)+1));
                errRtn = "SWask";
                strcpy(errMsg,msg);
                return((100 +11));
            } else {
                value->rValue = (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        here->SWcond;
            }
            return(0);
        case 8:
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned)(strlen(msg)+1));
                errRtn = "SWask";
                strcpy(errMsg,msg);
                return((100 +12));
            } else {
                value->rValue = (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        here->SWcond;
            }
            return(0);
        default:
            return (7);
    }
}

canonical_original_code:
int SWask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
    struct sSWinstance *here = (SWinstance *)inst;
    static char *msg = "Current and power not available in ac analysis";
    switch(which) {
        case 3:
            value->iValue = here->SWposNode;
            return (0);
        case 4:
            value->iValue = here->SWnegNode;
            return (0);
        case 5:
            value->iValue = here->SWposCntrlNode;
            return (0);
        case 6:
            value->iValue = here->SWnegCntrlNode;
            return (0);
        case 7:
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned int)(strlen(msg)+1));
                errRtn = "SWask";
                strcpy(errMsg,msg);
                return((100 +11));
            } else {
                value->rValue = (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        here->SWcond;
            }
            return(0);
        case 8:
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned int)(strlen(msg)+1));
                errRtn = "SWask";
                strcpy(errMsg,msg);
                return((100 +12));
            } else {
                value->rValue = (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        (*(ckt->CKTrhsOld + here->SWposNode)
                        - *(ckt->CKTrhsOld + here->SWnegNode)) *
                        here->SWcond;
            }
            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 sSWinstance { struct sSWmodel { int SWmodType; struct sSWmodel *SWnextModel; struct sSWinstance *SWinstances; char *SWmodName; double SWonResistance; double SWoffResistance; double SWvThreshold; double SWvHysteresis; double SWonConduct; double SWoffConduct; unsigned int SWonGiven; unsigned int SWoffGiven; unsigned int SWthreshGiven; unsigned int SWhystGiven; } *SWmodPtr; struct sSWinstance *SWnextInstance; char *SWname; int SWowner; int SWstate; int SWposNode; int SWnegNode; int SWposCntrlNode; int SWnegCntrlNode; double *SWposPosptr; double *SWnegPosptr; double *SWposNegptr; double *SWnegNegptr; double SWcond; unsigned int SWzero_stateGiven; double SWnVar[3]; } *

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 sSWinstance { struct sSWmodel *SWmodPtr; struct sSWinstance *SWnextInstance; char *SWname; int SWowner; int SWstate; int SWposNode; int SWnegNode; int SWposCntrlNode; int SWnegCntrlNode; double *SWposPosptr; double *SWnegPosptr; double *SWposNegptr; double *SWnegNegptr; double SWcond; unsigned int SWzero_stateGiven; double SWnVar[3]; }


CAPpzLoad

original_code:
int
CAPpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
{
    CAPmodel *model = (CAPmodel*)inModel;
    double val;
    double m;
    CAPinstance *here;
    for( ; model != ((void *)0); model = model->CAPnextModel) {
        for( here = model->CAPinstances;here != ((void *)0);
                here = here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
            val = here->CAPcapac;
            m = here->CAPm;
     *(here->CAPposPosptr ) += m * val * s->real;
            *(here->CAPposPosptr +1) += m * val * s->imag;
            *(here->CAPnegNegptr ) += m * val * s->real;
            *(here->CAPnegNegptr +1) += m * val * s->imag;
            *(here->CAPposNegptr ) -= m * val * s->real;
            *(here->CAPposNegptr +1) -= m * val * s->imag;
            *(here->CAPnegPosptr ) -= m * val * s->real;
            *(here->CAPnegPosptr +1) -= m * val * s->imag;
        }
    }
    return(0);
}

canonical_original_code:
int CAPpzLoad(struct sGENmodel *inModel, struct CKTcircuit *ckt, struct SPcomplex *s)
{
    struct sCAPmodel *model = (CAPmodel*)inModel;
    double val;
    double m;
    struct sCAPinstance *here;
    for( ; model != ((void *)0); model = model->CAPnextModel) {
        for( here = model->CAPinstances;here != ((void *)0);
                here = here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
            val = here->CAPcapac;
            m = here->CAPm;
     *(here->CAPposPosptr ) += m * val * s->real;
            *(here->CAPposPosptr +1) += m * val * s->imag;
            *(here->CAPnegNegptr ) += m * val * s->real;
            *(here->CAPnegNegptr +1) += m * val * s->imag;
            *(here->CAPposNegptr ) -= m * val * s->real;
            *(here->CAPposNegptr +1) -= m * val * s->imag;
            *(here->CAPnegPosptr ) -= m * val * s->real;
            *(here->CAPnegPosptr +1) -= m * val * s->imag;
        }
    }
    return(0);
}

variable_types: struct SPcomplex { double real; double imag; } *

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: val double

variable_types: m double

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