original_code:
int
B1convTest(GENmodel *inModel, CKTcircuit *ckt)
{
    B1model *model = (B1model*)inModel;
    B1instance *here;
    double cbd;
    double cbhat;
    double cbs;
    double cd;
    double cdhat;
    double delvbd;
    double delvbs;
    double delvds;
    double delvgd;
    double delvgs;
    double tol;
    double vbd;
    double vbs;
    double vds;
    double vgd;
    double vgdo;
    double vgs;
    for( ; model != ((void *)0); model = model->B1nextModel ) {
        for (here = model->B1instances; here != ((void *)0) ;
                here=here->B1nextInstance) {
     if (here->B1owner != ARCHme) continue;
            vbs = model->B1type * (
                *(ckt->CKTrhsOld+here->B1bNode) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vgs = model->B1type * (
                *(ckt->CKTrhsOld+here->B1gNode) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vds = model->B1type * (
                *(ckt->CKTrhsOld+here->B1dNodePrime) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vbd=vbs-vds;
            vgd=vgs-vds;
            vgdo = *(ckt->CKTstates[0] + here->B1states+ 2) -
                *(ckt->CKTstates[0] + here->B1states+ 3);
            delvbs = vbs - *(ckt->CKTstates[0] + here->B1states+ 1);
            delvbd = vbd - *(ckt->CKTstates[0] + here->B1states+ 0);
            delvgs = vgs - *(ckt->CKTstates[0] + here->B1states+ 2);
            delvds = vds - *(ckt->CKTstates[0] + here->B1states+ 3);
            delvgd = vgd-vgdo;
            if (here->B1mode >= 0) {
                cdhat=
                    *(ckt->CKTstates[0] + here->B1states+ 4) -
                    *(ckt->CKTstates[0] + here->B1states+ 10) * delvbd +
                    *(ckt->CKTstates[0] + here->B1states+ 9) * delvbs +
                    *(ckt->CKTstates[0] + here->B1states+ 7) * delvgs +
                    *(ckt->CKTstates[0] + here->B1states+ 8) * delvds ;
            } else {
                cdhat=
                    *(ckt->CKTstates[0] + here->B1states+ 4) -
                    ( *(ckt->CKTstates[0] + here->B1states+ 10) -
                      *(ckt->CKTstates[0] + here->B1states+ 9)) * delvbd -
                    *(ckt->CKTstates[0] + here->B1states+ 7) * delvgd +
                    *(ckt->CKTstates[0] + here->B1states+ 8) * delvds;
            }
            cbhat=
                *(ckt->CKTstates[0] + here->B1states+ 5) +
                *(ckt->CKTstates[0] + here->B1states+ 6) +
                *(ckt->CKTstates[0] + here->B1states+ 10) * delvbd +
                *(ckt->CKTstates[0] + here->B1states+ 11) * delvbs ;
            cd = *(ckt->CKTstates[0] + here->B1states+ 4);
            cbs = *(ckt->CKTstates[0] + here->B1states+ 5);
            cbd = *(ckt->CKTstates[0] + here->B1states+ 6);
            if ( (here->B1off == 0) || (!(ckt->CKTmode & 0x400)) ){
                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);
                }
                tol=ckt->CKTreltol*((fabs(cbhat)) > (fabs(cbs+cbd)) ? (fabs(cbhat)) : (fabs(cbs+cbd)))+
                    ckt->CKTabstol;
                if (fabs(cbhat-(cbs+cbd)) > tol) {
                    ckt->CKTnoncon++;
      ckt->CKTtroubleElt = (GENinstance *) here;
                    return(0);
                }
            }
        }
    }
    return(0);
}

canonical_original_code:
int B1convTest(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sBSIM1model *model = (B1model*)inModel;
    struct sBSIM1instance *here;
    double cbd;
    double cbhat;
    double cbs;
    double cd;
    double cdhat;
    double delvbd;
    double delvbs;
    double delvds;
    double delvgd;
    double delvgs;
    double tol;
    double vbd;
    double vbs;
    double vds;
    double vgd;
    double vgdo;
    double vgs;
    for( ; model != ((void *)0); model = model->B1nextModel ) {
        for (here = model->B1instances; here != ((void *)0) ;
                here=here->B1nextInstance) {
     if (here->B1owner != ARCHme) continue;
            vbs = model->B1type * (
                *(ckt->CKTrhsOld+here->B1bNode) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vgs = model->B1type * (
                *(ckt->CKTrhsOld+here->B1gNode) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vds = model->B1type * (
                *(ckt->CKTrhsOld+here->B1dNodePrime) -
                *(ckt->CKTrhsOld+here->B1sNodePrime));
            vbd=vbs-vds;
            vgd=vgs-vds;
            vgdo = *(ckt->CKTstates[0] + here->B1states+ 2) -
                *(ckt->CKTstates[0] + here->B1states+ 3);
            delvbs = vbs - *(ckt->CKTstates[0] + here->B1states+ 1);
            delvbd = vbd - *(ckt->CKTstates[0] + here->B1states+ 0);
            delvgs = vgs - *(ckt->CKTstates[0] + here->B1states+ 2);
            delvds = vds - *(ckt->CKTstates[0] + here->B1states+ 3);
            delvgd = vgd-vgdo;
            if (here->B1mode >= 0) {
                cdhat=
                    *(ckt->CKTstates[0] + here->B1states+ 4) -
                    *(ckt->CKTstates[0] + here->B1states+ 10) * delvbd +
                    *(ckt->CKTstates[0] + here->B1states+ 9) * delvbs +
                    *(ckt->CKTstates[0] + here->B1states+ 7) * delvgs +
                    *(ckt->CKTstates[0] + here->B1states+ 8) * delvds ;
            } else {
                cdhat=
                    *(ckt->CKTstates[0] + here->B1states+ 4) -
                    ( *(ckt->CKTstates[0] + here->B1states+ 10) -
                      *(ckt->CKTstates[0] + here->B1states+ 9)) * delvbd -
                    *(ckt->CKTstates[0] + here->B1states+ 7) * delvgd +
                    *(ckt->CKTstates[0] + here->B1states+ 8) * delvds;
            }
            cbhat=
                *(ckt->CKTstates[0] + here->B1states+ 5) +
                *(ckt->CKTstates[0] + here->B1states+ 6) +
                *(ckt->CKTstates[0] + here->B1states+ 10) * delvbd +
                *(ckt->CKTstates[0] + here->B1states+ 11) * delvbs ;
            cd = *(ckt->CKTstates[0] + here->B1states+ 4);
            cbs = *(ckt->CKTstates[0] + here->B1states+ 5);
            cbd = *(ckt->CKTstates[0] + here->B1states+ 6);
            if ( (here->B1off == 0) || (!(ckt->CKTmode & 0x400)) ){
                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);
                }
                tol=ckt->CKTreltol*((fabs(cbhat)) > (fabs(cbs+cbd)) ? (fabs(cbhat)) : (fabs(cbs+cbd)))+
                    ckt->CKTabstol;
                if (fabs(cbhat-(cbs+cbd)) > tol) {
                    ckt->CKTnoncon++;
      ckt->CKTtroubleElt = (struct sGENinstance *) here;
                    return(0);
                }
            }
        }
    }
    return(0);
}

variable_types: struct sBSIM1model { int B1modType; struct sBSIM1model *B1nextModel; struct sBSIM1instance { struct sBSIM1model *B1modPtr; struct sBSIM1instance *B1nextInstance; char *B1name; int B1owner; int B1states; int B1dNode; int B1gNode; int B1sNode; int B1bNode; int B1dNodePrime; int B1sNodePrime; double B1l; double B1w; double B1m; double B1drainArea; double B1sourceArea; double B1drainSquares; double B1sourceSquares; double B1drainPerimeter; double B1sourcePerimeter; double B1sourceConductance; double B1drainConductance; double B1icVBS; double B1icVDS; double B1icVGS; double B1von; double B1vdsat; int B1off; int B1mode; double B1vfb; double B1phi; double B1K1; double B1K2; double B1eta; double B1etaB; double B1etaD; double B1betaZero; double B1betaZeroB; double B1betaVdd; double B1betaVddB; double B1betaVddD; double B1ugs; double B1ugsB; double B1uds; double B1udsB; double B1udsD; double B1subthSlope; double B1subthSlopeB; double B1subthSlopeD; double B1GDoverlapCap; double B1GSoverlapCap; double B1GBoverlapCap; double B1vt0; double B1vdd; double B1temp; double B1oxideThickness; unsigned int B1channelChargePartitionFlag; unsigned int B1lGiven; unsigned int B1wGiven; unsigned int B1mGiven; unsigned int B1drainAreaGiven; unsigned int B1sourceAreaGiven; unsigned int B1drainSquaresGiven; unsigned int B1sourceSquaresGiven; unsigned int B1drainPerimeterGiven; unsigned int B1sourcePerimeterGiven; unsigned int B1dNodePrimeSet; unsigned int B1sNodePrimeSet; unsigned int B1icVBSGiven; unsigned int B1icVDSGiven; unsigned int B1icVGSGiven; unsigned int B1vonGiven; unsigned int B1vdsatGiven; double *B1DdPtr; double *B1GgPtr; double *B1SsPtr; double *B1BbPtr; double *B1DPdpPtr; double *B1SPspPtr; double *B1DdpPtr; double *B1GbPtr; double *B1GdpPtr; double *B1GspPtr; double *B1SspPtr; double *B1BdpPtr; double *B1BspPtr; double *B1DPspPtr; double *B1DPdPtr; double *B1BgPtr; double *B1DPgPtr; double *B1SPgPtr; double *B1SPsPtr; double *B1DPbPtr; double *B1SPbPtr; double *B1SPdpPtr; double B1dCoeffs[82]; double B1nVar[3][5]; } *B1instances; char *B1modName; int B1type; double B1vfb0; double B1vfbL; double B1vfbW; double B1phi0; double B1phiL; double B1phiW; double B1K10; double B1K1L; double B1K1W; double B1K20; double B1K2L; double B1K2W; double B1eta0; double B1etaL; double B1etaW; double B1etaB0; double B1etaBl; double B1etaBw; double B1etaD0; double B1etaDl; double B1etaDw; double B1deltaL; double B1deltaW; double B1mobZero; double B1mobZeroB0; double B1mobZeroBl; double B1mobZeroBw; double B1mobVdd0; double B1mobVddl; double B1mobVddw; double B1mobVddB0; double B1mobVddBl; double B1mobVddBw; double B1mobVddD0; double B1mobVddDl; double B1mobVddDw; double B1ugs0; double B1ugsL; double B1ugsW; double B1ugsB0; double B1ugsBL; double B1ugsBW; double B1uds0; double B1udsL; double B1udsW; double B1udsB0; double B1udsBL; double B1udsBW; double B1udsD0; double B1udsDL; double B1udsDW; double B1subthSlope0; double B1subthSlopeL; double B1subthSlopeW; double B1subthSlopeB0; double B1subthSlopeBL; double B1subthSlopeBW; double B1subthSlopeD0; double B1subthSlopeDL; double B1subthSlopeDW; double B1oxideThickness; double B1Cox; double B1temp; double B1vdd; double B1gateSourceOverlapCap; double B1gateDrainOverlapCap; double B1gateBulkOverlapCap; double B1channelChargePartitionFlag; double B1sheetResistance; double B1jctSatCurDensity; double B1bulkJctPotential; double B1bulkJctBotGradingCoeff; double B1bulkJctSideGradingCoeff; double B1sidewallJctPotential; double B1unitAreaJctCap; double B1unitLengthSidewallJctCap; double B1defaultWidth; double B1deltaLength; double B1fNcoef; double B1fNexp; unsigned int B1vfb0Given; unsigned int B1vfbLGiven; unsigned int B1vfbWGiven; unsigned int B1phi0Given; unsigned int B1phiLGiven; unsigned int B1phiWGiven; unsigned int B1K10Given; unsigned int B1K1LGiven; unsigned int B1K1WGiven; unsigned int B1K20Given; unsigned int B1K2LGiven; unsigned int B1K2WGiven; unsigned int B1eta0Given; unsigned int B1etaLGiven; unsigned int B1etaWGiven; unsigned int B1etaB0Given; unsigned int B1etaBlGiven; unsigned int B1etaBwGiven; unsigned int B1etaD0Given; unsigned int B1etaDlGiven; unsigned int B1etaDwGiven; unsigned int B1deltaLGiven; unsigned int B1deltaWGiven; unsigned int B1mobZeroGiven; unsigned int B1mobZeroB0Given; unsigned int B1mobZeroBlGiven; unsigned int B1mobZeroBwGiven; unsigned int B1mobVdd0Given; unsigned int B1mobVddlGiven; unsigned int B1mobVddwGiven; unsigned int B1mobVddB0Given; unsigned int B1mobVddBlGiven; unsigned int B1mobVddBwGiven; unsigned int B1mobVddD0Given; unsigned int B1mobVddDlGiven; unsigned int B1mobVddDwGiven; unsigned int B1ugs0Given; unsigned int B1ugsLGiven; unsigned int B1ugsWGiven; unsigned int B1ugsB0Given; unsigned int B1ugsBLGiven; unsigned int B1ugsBWGiven; unsigned int B1uds0Given; unsigned int B1udsLGiven; unsigned int B1udsWGiven; unsigned int B1udsB0Given; unsigned int B1udsBLGiven; unsigned int B1udsBWGiven; unsigned int B1udsD0Given; unsigned int B1udsDLGiven; unsigned int B1udsDWGiven; unsigned int B1subthSlope0Given; unsigned int B1subthSlopeLGiven; unsigned int B1subthSlopeWGiven; unsigned int B1subthSlopeB0Given; unsigned int B1subthSlopeBLGiven; unsigned int B1subthSlopeBWGiven; unsigned int B1subthSlopeD0Given; unsigned int B1subthSlopeDLGiven; unsigned int B1subthSlopeDWGiven; unsigned int B1oxideThicknessGiven; unsigned int B1tempGiven; unsigned int B1vddGiven; unsigned int B1gateSourceOverlapCapGiven; unsigned int B1gateDrainOverlapCapGiven; unsigned int B1gateBulkOverlapCapGiven; unsigned int B1channelChargePartitionFlagGiven; unsigned int B1sheetResistanceGiven; unsigned int B1jctSatCurDensityGiven; unsigned int B1bulkJctPotentialGiven; unsigned int B1bulkJctBotGradingCoeffGiven; unsigned int B1sidewallJctPotentialGiven; unsigned int B1bulkJctSideGradingCoeffGiven; unsigned int B1unitAreaJctCapGiven; unsigned int B1unitLengthSidewallJctCapGiven; unsigned int B1defaultWidthGiven; unsigned int B1deltaLengthGiven; unsigned int B1fNcoefGiven; unsigned int B1fNexpGiven; unsigned int B1typeGiven; } *

variable_types: struct sBSIM1instance { struct sBSIM1model { int B1modType; struct sBSIM1model *B1nextModel; struct sBSIM1instance *B1instances; char *B1modName; int B1type; double B1vfb0; double B1vfbL; double B1vfbW; double B1phi0; double B1phiL; double B1phiW; double B1K10; double B1K1L; double B1K1W; double B1K20; double B1K2L; double B1K2W; double B1eta0; double B1etaL; double B1etaW; double B1etaB0; double B1etaBl; double B1etaBw; double B1etaD0; double B1etaDl; double B1etaDw; double B1deltaL; double B1deltaW; double B1mobZero; double B1mobZeroB0; double B1mobZeroBl; double B1mobZeroBw; double B1mobVdd0; double B1mobVddl; double B1mobVddw; double B1mobVddB0; double B1mobVddBl; double B1mobVddBw; double B1mobVddD0; double B1mobVddDl; double B1mobVddDw; double B1ugs0; double B1ugsL; double B1ugsW; double B1ugsB0; double B1ugsBL; double B1ugsBW; double B1uds0; double B1udsL; double B1udsW; double B1udsB0; double B1udsBL; double B1udsBW; double B1udsD0; double B1udsDL; double B1udsDW; double B1subthSlope0; double B1subthSlopeL; double B1subthSlopeW; double B1subthSlopeB0; double B1subthSlopeBL; double B1subthSlopeBW; double B1subthSlopeD0; double B1subthSlopeDL; double B1subthSlopeDW; double B1oxideThickness; double B1Cox; double B1temp; double B1vdd; double B1gateSourceOverlapCap; double B1gateDrainOverlapCap; double B1gateBulkOverlapCap; double B1channelChargePartitionFlag; double B1sheetResistance; double B1jctSatCurDensity; double B1bulkJctPotential; double B1bulkJctBotGradingCoeff; double B1bulkJctSideGradingCoeff; double B1sidewallJctPotential; double B1unitAreaJctCap; double B1unitLengthSidewallJctCap; double B1defaultWidth; double B1deltaLength; double B1fNcoef; double B1fNexp; unsigned int B1vfb0Given; unsigned int B1vfbLGiven; unsigned int B1vfbWGiven; unsigned int B1phi0Given; unsigned int B1phiLGiven; unsigned int B1phiWGiven; unsigned int B1K10Given; unsigned int B1K1LGiven; unsigned int B1K1WGiven; unsigned int B1K20Given; unsigned int B1K2LGiven; unsigned int B1K2WGiven; unsigned int B1eta0Given; unsigned int B1etaLGiven; unsigned int B1etaWGiven; unsigned int B1etaB0Given; unsigned int B1etaBlGiven; unsigned int B1etaBwGiven; unsigned int B1etaD0Given; unsigned int B1etaDlGiven; unsigned int B1etaDwGiven; unsigned int B1deltaLGiven; unsigned int B1deltaWGiven; unsigned int B1mobZeroGiven; unsigned int B1mobZeroB0Given; unsigned int B1mobZeroBlGiven; unsigned int B1mobZeroBwGiven; unsigned int B1mobVdd0Given; unsigned int B1mobVddlGiven; unsigned int B1mobVddwGiven; unsigned int B1mobVddB0Given; unsigned int B1mobVddBlGiven; unsigned int B1mobVddBwGiven; unsigned int B1mobVddD0Given; unsigned int B1mobVddDlGiven; unsigned int B1mobVddDwGiven; unsigned int B1ugs0Given; unsigned int B1ugsLGiven; unsigned int B1ugsWGiven; unsigned int B1ugsB0Given; unsigned int B1ugsBLGiven; unsigned int B1ugsBWGiven; unsigned int B1uds0Given; unsigned int B1udsLGiven; unsigned int B1udsWGiven; unsigned int B1udsB0Given; unsigned int B1udsBLGiven; unsigned int B1udsBWGiven; unsigned int B1udsD0Given; unsigned int B1udsDLGiven; unsigned int B1udsDWGiven; unsigned int B1subthSlope0Given; unsigned int B1subthSlopeLGiven; unsigned int B1subthSlopeWGiven; unsigned int B1subthSlopeB0Given; unsigned int B1subthSlopeBLGiven; unsigned int B1subthSlopeBWGiven; unsigned int B1subthSlopeD0Given; unsigned int B1subthSlopeDLGiven; unsigned int B1subthSlopeDWGiven; unsigned int B1oxideThicknessGiven; unsigned int B1tempGiven; unsigned int B1vddGiven; unsigned int B1gateSourceOverlapCapGiven; unsigned int B1gateDrainOverlapCapGiven; unsigned int B1gateBulkOverlapCapGiven; unsigned int B1channelChargePartitionFlagGiven; unsigned int B1sheetResistanceGiven; unsigned int B1jctSatCurDensityGiven; unsigned int B1bulkJctPotentialGiven; unsigned int B1bulkJctBotGradingCoeffGiven; unsigned int B1sidewallJctPotentialGiven; unsigned int B1bulkJctSideGradingCoeffGiven; unsigned int B1unitAreaJctCapGiven; unsigned int B1unitLengthSidewallJctCapGiven; unsigned int B1defaultWidthGiven; unsigned int B1deltaLengthGiven; unsigned int B1fNcoefGiven; unsigned int B1fNexpGiven; unsigned int B1typeGiven; } *B1modPtr; struct sBSIM1instance *B1nextInstance; char *B1name; int B1owner; int B1states; int B1dNode; int B1gNode; int B1sNode; int B1bNode; int B1dNodePrime; int B1sNodePrime; double B1l; double B1w; double B1m; double B1drainArea; double B1sourceArea; double B1drainSquares; double B1sourceSquares; double B1drainPerimeter; double B1sourcePerimeter; double B1sourceConductance; double B1drainConductance; double B1icVBS; double B1icVDS; double B1icVGS; double B1von; double B1vdsat; int B1off; int B1mode; double B1vfb; double B1phi; double B1K1; double B1K2; double B1eta; double B1etaB; double B1etaD; double B1betaZero; double B1betaZeroB; double B1betaVdd; double B1betaVddB; double B1betaVddD; double B1ugs; double B1ugsB; double B1uds; double B1udsB; double B1udsD; double B1subthSlope; double B1subthSlopeB; double B1subthSlopeD; double B1GDoverlapCap; double B1GSoverlapCap; double B1GBoverlapCap; double B1vt0; double B1vdd; double B1temp; double B1oxideThickness; unsigned int B1channelChargePartitionFlag; unsigned int B1lGiven; unsigned int B1wGiven; unsigned int B1mGiven; unsigned int B1drainAreaGiven; unsigned int B1sourceAreaGiven; unsigned int B1drainSquaresGiven; unsigned int B1sourceSquaresGiven; unsigned int B1drainPerimeterGiven; unsigned int B1sourcePerimeterGiven; unsigned int B1dNodePrimeSet; unsigned int B1sNodePrimeSet; unsigned int B1icVBSGiven; unsigned int B1icVDSGiven; unsigned int B1icVGSGiven; unsigned int B1vonGiven; unsigned int B1vdsatGiven; double *B1DdPtr; double *B1GgPtr; double *B1SsPtr; double *B1BbPtr; double *B1DPdpPtr; double *B1SPspPtr; double *B1DdpPtr; double *B1GbPtr; double *B1GdpPtr; double *B1GspPtr; double *B1SspPtr; double *B1BdpPtr; double *B1BspPtr; double *B1DPspPtr; double *B1DPdPtr; double *B1BgPtr; double *B1DPgPtr; double *B1SPgPtr; double *B1SPsPtr; double *B1DPbPtr; double *B1SPbPtr; double *B1SPdpPtr; double B1dCoeffs[82]; double B1nVar[3][5]; } *

variable_types: cbd double

variable_types: cbhat double

variable_types: cbs double

variable_types: cd double

variable_types: cdhat double

variable_types: delvbd double

variable_types: delvbs double

variable_types: delvds double

variable_types: delvgd double

variable_types: delvgs double

variable_types: tol double

variable_types: vbd double

variable_types: vbs double

variable_types: vds double

variable_types: vgd double

variable_types: vgdo double

variable_types: vgs double