DIOnoise

decompiled_code:
__int64 __fastcall DIOnoise(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, double *a6)
{
__int64 result; // rax
__int64 v9; // r13
__int64 v10; // r13
void **v11; // rbp
__int64 v12; // rax
void (__fastcall *v13)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v14; // edx
const char **v15; // r12
const char *v16; // r15
__int64 v17; // rax
void (__fastcall *v18)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v19; // edx
__int64 v20; // rax
void (__fastcall *v21)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v22; // edx
double v23; // xmm0_8
double v24; // xmm0_8
double v25; // xmm0_8
double v26; // xmm0_8
double v27; // xmm0_8
double v28; // xmm0_8
__int64 i; // rbp
double v30; // r13
double v31; // r12
double *v32; // r12
double *v33; // r13
double *v34; // r15
double v35; // xmm0_8
char *v36; // rdx
__int64 v37; // rcx
int v38; // eax
_QWORD *j; // rdi
_QWORD *v40; // rax
__int64 v41; // rcx
int v42; // edx
__int64 v43; // rcx
int v44; // edx
double v45; // [rsp+0h] [rbp-D8h]
__int64 v46; // [rsp+8h] [rbp-D0h]
char s[64]; // [rsp+20h] [rbp-B8h] BYREF
__int64 v49; // [rsp+60h] [rbp-78h] BYREF
__int64 v50; // [rsp+68h] [rbp-70h] BYREF
double v51; // [rsp+70h] [rbp-68h]
double v52; // [rsp+78h] [rbp-60h]
double v53; // [rsp+80h] [rbp-58h] BYREF
double v54; // [rsp+88h] [rbp-50h] BYREF
double v55; // [rsp+90h] [rbp-48h] BYREF
double v56; // [rsp+98h] [rbp-40h]
char v57; // [rsp+A0h] [rbp-38h] BYREF

v46 = a3;
if ( a2 == 1 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a1 == 1 )
{
if ( a3 )
{
while ( 1 )
{
v10 = *(_QWORD *)(v46 + 16);
if ( v10 )
break;
LABEL_13:
result = *(_QWORD *)(v46 + 8);
v46 = result;
if ( !result )
return result;
}
LABEL_16:
v11 = (void **)DIOnNames;
while ( 1 )
{
sprintf(s, "onoise.%s%s", *(const char **)(v10 + 16), (const char *)*v11);
v12 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v12;
if ( !v12 )
break;
v13 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v14 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v14 + 1;
v13(a4, v12 + 8LL * v14, 0LL, s, 32LL, 0LL);
if ( ++v11 == &off_7D8 + 1 )
{
v10 = *(_QWORD *)(v10 + 8);
if ( !v10 )
goto LABEL_13;
goto LABEL_16;
}
}
result = 8LL;
}
else
{
result = 0LL;
}
}
else
{
result = 0LL;
if ( a1 == 2 )
{
if ( a3 )
{
while ( 1 )
{
v9 = *(_QWORD *)(v46 + 16);
if ( v9 )
break;
LABEL_9:
result = *(_QWORD *)(v46 + 8);
v46 = result;
if ( !result )
return result;
}
LABEL_21:
v15 = (const char **)DIOnNames;
while ( 1 )
{
v16 = *v15;
sprintf(s, "onoise_total.%s%s", *(const char **)(v9 + 16), *v15);
v17 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v17;
if ( !v17 )
return 8LL;
v18 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v19 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v19 + 1;
v18(a4, v17 + 8LL * v19, 0LL, s, 32LL, 0LL);
sprintf(s, "inoise_total.%s%s", *(const char **)(v9 + 16), v16);
v20 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v20;
if ( !v20 )
break;
v21 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v22 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v22 + 1;
v21(a4, v20 + 8LL * v22, 0LL, s, 32LL, 0LL);
if ( ++v15 == (const char **)(&off_7D8 + 1) )
{
v9 = *(_QWORD *)(v9 + 8);
if ( !v9 )
goto LABEL_9;
goto LABEL_21;
}
}
result = 8LL;
}
else
{
result = 0LL;
}
}
}
}
}
else
{
result = 0LL;
if ( a2 == 2 )
{
if ( a1 == 1 )
{
if ( a3 )
{
do
{
for ( i = *(_QWORD *)(v46 + 16); i; i = *(_QWORD *)(i + 8) )
{
NevalSrc(
&v53,
&v49,
a4,
2LL,
*(unsigned int *)(i + 36),
*(unsigned int *)(i + 28),
*(double *)(v46 + 56) * *(double *)(i + 104));
NevalSrc(&v54, &v50, a4, 1LL, *(unsigned int *)(i + 36), *(unsigned int *)(i + 32), *(double *)(i + 192));
NevalSrc(&v55, 0LL, a4, 3LL, *(unsigned int *)(i + 36), *(unsigned int *)(i + 32), 0.0);
v30 = *(double *)(v46 + 168);
v31 = *(double *)(v46 + 176);
v23 = *(double *)(i + 192);
if ( v23 < 0.0 )
{
if ( v23 < -1.0e-38 )
*(_QWORD *)&v23 ^= LC6;
else
v23 = LC0;
}
else if ( v23 <= 1.0e-38 )
{
v23 = LC0;
}
v24 = log(v23);
v25 = exp(v31 * v24);
v26 = v30 * v25 / *(double *)a5 * v55;
v55 = v26;
if ( v26 <= 1.0e-38 )
v26 = LC0;
v51 = log(v26);
v27 = v53 + v54 + v55;
v56 = v27;
if ( v27 <= 1.0e-38 )
v27 = LC0;
v28 = log(v27);
v52 = v28;
*a6 = *a6 + v56;
if ( *(double *)(a5 + 16) == 0.0 )
{
*(_QWORD *)(i + 272) = v49;
*(_QWORD *)(i + 280) = v50;
*(double *)(i + 288) = v51;
*(double *)(i + 296) = v28;
if ( *(double *)a5 == *(double *)(*(_QWORD *)(a4 + 968) + 96LL) )
{
*(_QWORD *)(i + 304) = 0LL;
*(_QWORD *)(i + 336) = 0LL;
*(_QWORD *)(i + 312) = 0LL;
*(_QWORD *)(i + 344) = 0LL;
*(_QWORD *)(i + 320) = 0LL;
*(_QWORD *)(i + 352) = 0LL;
*(_QWORD *)(i + 328) = 0LL;
*(_QWORD *)(i + 360) = 0LL;
}
}
else
{
v32 = (double *)(i + 272);
v33 = (double *)&v49;
v34 = &v53;
do
{
v45 = Nintegrate(a5, *v34, *v33, *v32);
v35 = Nintegrate(
a5,
*v34 * *(double *)(a5 + 40),
*(double *)(a5 + 48) + *v33,
*(double *)(a5 + 48) + *v32);
*v32 = *v33;
*(double *)(a5 + 24) = v45 + *(double *)(a5 + 24);
*(double *)(a5 + 32) = v35 + *(double *)(a5 + 32);
if ( *(_DWORD *)(*(_QWORD *)(a4 + 968) + 64LL) )
{
v32[4] = v45 + v32[4];
*(double *)(i + 328) = v45 + *(double *)(i + 328);
v32[8] = v35 + v32[8];
*(double *)(i + 360) = v35 + *(double *)(i + 360);
}
++v32;
++v33;
++v34;
}
while ( v32 != (double *)(i + 296) );
}
if ( *(_DWORD *)(a5 + 88) )
{
v36 = (char *)&v53;
do
{
v37 = *(_QWORD *)(a5 + 96);
v38 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v38 + 1;
*(_QWORD *)(v37 + 8LL * v38) = *(_QWORD *)v36;
v36 += 8;
}
while ( v36 != &v57 );
}
}
result = *(_QWORD *)(v46 + 8);
v46 = result;
}
while ( result );
}
else
{
result = 0LL;
}
}
else
{
result = 0LL;
if ( a1 == 2 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a3 )
{
do
{
for ( j = *(_QWORD **)(v46 + 16); j; j = (_QWORD *)j[1] )
{
v40 = j + 38;
do
{
v41 = *(_QWORD *)(a5 + 96);
v42 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v42 + 1;
*(_QWORD *)(v41 + 8LL * v42) = *v40;
v43 = *(_QWORD *)(a5 + 96);
v44 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v44 + 1;
*(_QWORD *)(v43 + 8LL * v44) = v40[4];
++v40;
}
while ( j + 42 != v40 );
}
result = *(_QWORD *)(v46 + 8);
v46 = result;
}
while ( result );
}
else
{
result = 0LL;
}
}
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, double *a6)
{
__int64 result; // rax
__int64 v9; // r13
__int64 v10; // r13
void **v11; // rbp
__int64 v12; // rax
void (__fastcall *v13)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v14; // edx
const char **v15; // r12
const char *v16; // r15
__int64 v17; // rax
void (__fastcall *v18)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v19; // edx
__int64 v20; // rax
void (__fastcall *v21)(__int64, __int64, _QWORD, char *, __int64, _QWORD); // r10
int v22; // edx
double v23; // xmm0_8
double v24; // xmm0_8
double v25; // xmm0_8
double v26; // xmm0_8
double v27; // xmm0_8
double v28; // xmm0_8
__int64 i; // rbp
double v30; // r13
double v31; // r12
double *v32; // r12
double *v33; // r13
double *v34; // r15
double v35; // xmm0_8
char *v36; // rdx
__int64 v37; // rcx
int v38; // eax
_QWORD *j; // rdi
_QWORD *v40; // rax
__int64 v41; // rcx
int v42; // edx
__int64 v43; // rcx
int v44; // edx
double v45; // [rsp+0h] [rbp-D8h]
__int64 v46; // [rsp+8h] [rbp-D0h]
char s[64]; // [rsp+20h] [rbp-B8h] BYREF
__int64 v49; // [rsp+60h] [rbp-78h] BYREF
__int64 v50; // [rsp+68h] [rbp-70h] BYREF
double v51; // [rsp+70h] [rbp-68h]
double v52; // [rsp+78h] [rbp-60h]
double v53; // [rsp+80h] [rbp-58h] BYREF
double v54; // [rsp+88h] [rbp-50h] BYREF
double v55; // [rsp+90h] [rbp-48h] BYREF
double v56; // [rsp+98h] [rbp-40h]
char v57; // [rsp+A0h] [rbp-38h] BYREF

v46 = a3;
if ( a2 == 1 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a1 == 1 )
{
if ( a3 )
{
while ( 1 )
{
v10 = *(_QWORD *)(v46 + 16);
if ( v10 )
break;
LABEL_13:
result = *(_QWORD *)(v46 + 8);
v46 = result;
if ( !result )
return result;
}
LABEL_16:
v11 = (void **)DIOnNames;
while ( 1 )
{
sprintf(s, "onoise.%s%s", *(const char **)(v10 + 16), (const char *)*v11);
v12 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v12;
if ( !v12 )
break;
v13 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v14 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v14 + 1;
v13(a4, v12 + 8LL * v14, 0LL, s, 32LL, 0LL);
if ( ++v11 == &off_7D8 + 1 )
{
v10 = *(_QWORD *)(v10 + 8);
if ( !v10 )
goto LABEL_13;
goto LABEL_16;
}
}
result = 8LL;
}
else
{
result = 0LL;
}
}
else
{
result = 0LL;
if ( a1 == 2 )
{
if ( a3 )
{
while ( 1 )
{
v9 = *(_QWORD *)(v46 + 16);
if ( v9 )
break;
LABEL_9:
result = *(_QWORD *)(v46 + 8);
v46 = result;
if ( !result )
return result;
}
LABEL_21:
v15 = (const char **)DIOnNames;
while ( 1 )
{
v16 = *v15;
sprintf(s, "onoise_total.%s%s", *(const char **)(v9 + 16), *v15);
v17 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v17;
if ( !v17 )
return 8LL;
v18 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v19 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v19 + 1;
v18(a4, v17 + 8LL * v19, 0LL, s, 32LL, 0LL);
sprintf(s, "inoise_total.%s%s", *(const char **)(v9 + 16), v16);
v20 = trealloc(*(_QWORD *)(a5 + 112), 8LL * (*(_DWORD *)(a5 + 84) + 1));
*(_QWORD *)(a5 + 112) = v20;
if ( !v20 )
break;
v21 = (void (__fastcall *)(__int64, __int64, _QWORD, char *, __int64, _QWORD))*SPfrontEnd;
v22 = *(_DWORD *)(a5 + 84);
*(_DWORD *)(a5 + 84) = v22 + 1;
v21(a4, v20 + 8LL * v22, 0LL, s, 32LL, 0LL);
if ( ++v15 == (const char **)(&off_7D8 + 1) )
{
v9 = *(_QWORD *)(v9 + 8);
if ( !v9 )
goto LABEL_9;
goto LABEL_21;
}
}
result = 8LL;
}
else
{
result = 0LL;
}
}
}
}
}
else
{
result = 0LL;
if ( a2 == 2 )
{
if ( a1 == 1 )
{
if ( a3 )
{
do
{
for ( i = *(_QWORD *)(v46 + 16); i; i = *(_QWORD *)(i + 8) )
{
NevalSrc(
&v53,
&v49,
a4,
2LL,
*(unsigned int *)(i + 36),
*(unsigned int *)(i + 28),
*(double *)(v46 + 56) * *(double *)(i + 104));
NevalSrc(&v54, &v50, a4, 1LL, *(unsigned int *)(i + 36), *(unsigned int *)(i + 32), *(double *)(i + 192));
NevalSrc(&v55, 0LL, a4, 3LL, *(unsigned int *)(i + 36), *(unsigned int *)(i + 32), 0.0);
v30 = *(double *)(v46 + 168);
v31 = *(double *)(v46 + 176);
v23 = *(double *)(i + 192);
if ( v23 < 0.0 )
{
if ( v23 < -1.0e-38 )
*(_QWORD *)&v23 ^= LC6;
else
v23 = LC0;
}
else if ( v23 <= 1.0e-38 )
{
v23 = LC0;
}
v24 = log(v23);
v25 = exp(v31 * v24);
v26 = v30 * v25 / *(double *)a5 * v55;
v55 = v26;
if ( v26 <= 1.0e-38 )
v26 = LC0;
v51 = log(v26);
v27 = v53 + v54 + v55;
v56 = v27;
if ( v27 <= 1.0e-38 )
v27 = LC0;
v28 = log(v27);
v52 = v28;
*a6 = *a6 + v56;
if ( *(double *)(a5 + 16) == 0.0 )
{
*(_QWORD *)(i + 272) = v49;
*(_QWORD *)(i + 280) = v50;
*(double *)(i + 288) = v51;
*(double *)(i + 296) = v28;
if ( *(double *)a5 == *(double *)(*(_QWORD *)(a4 + 968) + 96LL) )
{
*(_QWORD *)(i + 304) = 0LL;
*(_QWORD *)(i + 336) = 0LL;
*(_QWORD *)(i + 312) = 0LL;
*(_QWORD *)(i + 344) = 0LL;
*(_QWORD *)(i + 320) = 0LL;
*(_QWORD *)(i + 352) = 0LL;
*(_QWORD *)(i + 328) = 0LL;
*(_QWORD *)(i + 360) = 0LL;
}
}
else
{
v32 = (double *)(i + 272);
v33 = (double *)&v49;
v34 = &v53;
do
{
v45 = Nintegrate(a5, *v34, *v33, *v32);
v35 = Nintegrate(
a5,
*v34 * *(double *)(a5 + 40),
*(double *)(a5 + 48) + *v33,
*(double *)(a5 + 48) + *v32);
*v32 = *v33;
*(double *)(a5 + 24) = v45 + *(double *)(a5 + 24);
*(double *)(a5 + 32) = v35 + *(double *)(a5 + 32);
if ( *(_DWORD *)(*(_QWORD *)(a4 + 968) + 64LL) )
{
v32[4] = v45 + v32[4];
*(double *)(i + 328) = v45 + *(double *)(i + 328);
v32[8] = v35 + v32[8];
*(double *)(i + 360) = v35 + *(double *)(i + 360);
}
++v32;
++v33;
++v34;
}
while ( v32 != (double *)(i + 296) );
}
if ( *(_DWORD *)(a5 + 88) )
{
v36 = (char *)&v53;
do
{
v37 = *(_QWORD *)(a5 + 96);
v38 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v38 + 1;
*(_QWORD *)(v37 + 8LL * v38) = *(_QWORD *)v36;
v36 += 8;
}
while ( v36 != &v57 );
}
}
result = *(_QWORD *)(v46 + 8);
v46 = result;
}
while ( result );
}
else
{
result = 0LL;
}
}
else
{
result = 0LL;
if ( a1 == 2 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a3 )
{
do
{
for ( j = *(_QWORD **)(v46 + 16); j; j = (_QWORD *)j[1] )
{
v40 = j + 38;
do
{
v41 = *(_QWORD *)(a5 + 96);
v42 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v42 + 1;
*(_QWORD *)(v41 + 8LL * v42) = *v40;
v43 = *(_QWORD *)(a5 + 96);
v44 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v44 + 1;
*(_QWORD *)(v43 + 8LL * v44) = v40[4];
++v40;
}
while ( j + 42 != v40 );
}
result = *(_QWORD *)(v46 + 8);
v46 = result;
}
while ( result );
}
else
{
result = 0LL;
}
}
}
}
}
}
return result;
}

original_code:
int
DIOnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
          Ndata *data, double *OnDens)
{
    DIOmodel *firstModel = (DIOmodel *) genmodel;
    DIOmodel *model;
    DIOinstance *inst;
    char name[64];
    double tempOnoise;
    double tempInoise;
    double noizDens[4];
    double lnNdens[4];
    int i;
    static char *DIOnNames[4] = {
 "_rs",
 "_id",
 "_1overf",
 ""
    };
    for (model=firstModel; model != ((void *)0); model=model->DIOnextModel) {
 for (inst=model->DIOinstances; inst != ((void *)0); inst=inst->DIOnextInstance) {
     if (inst->DIOowner != ARCHme) continue;
     switch (operation) {
     case 1:
  if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
      switch (mode) {
      case 1:
   for (i=0; i < 4; i++) {
       (void)sprintf(name,"onoise_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
   }
   break;
      case 2:
   for (i=0; i < 4; i++) {
       (void)sprintf(name,"onoise_total_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
       (void)sprintf(name,"inoise_total_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
   }
   break;
      }
  }
  break;
     case 2:
  switch (mode) {
  case 1:
      NevalSrc(&noizDens[0],&lnNdens[0],
     ckt,2,inst->DIOposPrimeNode,inst->DIOposNode,
     inst->DIOtConductance * inst->DIOarea * inst->DIOm);
      NevalSrc(&noizDens[1],&lnNdens[1],
            ckt,1,inst->DIOposPrimeNode, inst->DIOnegNode,
     *(ckt->CKTstates[0] + inst->DIOstate+1));
      NevalSrc(&noizDens[2],(double*)((void *)0),ckt,
     3,inst->DIOposPrimeNode, inst->DIOnegNode,
     (double)0.0);
      noizDens[2] *= model->DIOfNcoef *
     exp(model->DIOfNexp *
     log(((fabs(*(ckt->CKTstates[0] + inst->DIOstate+1)/inst->DIOm)) > (1E-38) ? (fabs(*(ckt->CKTstates[0] + inst->DIOstate+1)/inst->DIOm)) : (1E-38)))) /
     data->freq * inst->DIOm;
      lnNdens[2] =
     log(((noizDens[2]) > (1E-38) ? (noizDens[2]) : (1E-38)));
      noizDens[3] = noizDens[0] +
          noizDens[1] +
          noizDens[2];
      lnNdens[3] =
     log(((noizDens[3]) > (1E-38) ? (noizDens[3]) : (1E-38)));
      *OnDens += noizDens[3];
      if (data->delFreq == 0.0) {
   for (i=0; i < 4; i++) {
       inst->DIOnVar[0][i] = lnNdens[i];
   }
   if (data->freq == ((NOISEAN*)ckt->CKTcurJob)->NstartFreq) {
       for (i=0; i < 4; i++) {
    inst->DIOnVar[1][i] = 0.0;
    inst->DIOnVar[2][i] = 0.0;
       }
   }
      } else {
   for (i=0; i < 4; i++) {
       if (i != 3) {
    tempOnoise = Nintegrate(noizDens[i], lnNdens[i],
          inst->DIOnVar[0][i], data);
    tempInoise = Nintegrate(noizDens[i] * data->GainSqInv ,
          lnNdens[i] + data->lnGainInv,
          inst->DIOnVar[0][i] + data->lnGainInv,
          data);
    inst->DIOnVar[0][i] = lnNdens[i];
    data->outNoiz += tempOnoise;
    data->inNoise += tempInoise;
    if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
        inst->DIOnVar[1][i] += tempOnoise;
        inst->DIOnVar[1][3] += tempOnoise;
        inst->DIOnVar[2][i] += tempInoise;
        inst->DIOnVar[2][3] += tempInoise;
                                }
       }
   }
      }
      if (data->prtSummary) {
   for (i=0; i < 4; i++) {
       data->outpVector[data->outNumber++] = noizDens[i];
   }
      }
      break;
  case 2:
      if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
   for (i=0; i < 4; i++) {
       data->outpVector[data->outNumber++] = inst->DIOnVar[1][i];
       data->outpVector[data->outNumber++] = inst->DIOnVar[2][i];
   }
      }
      break;
  }
  break;
     case 3:
  return (0);
  break;
     }
 }
    }
return(0);
}

canonical_original_code:
int DIOnoise(int mode, int operation, struct sGENmodel *genmodel, struct CKTcircuit *ckt, struct Ndata *data, double *OnDens)
{
    struct sDIOmodel *firstModel = (DIOmodel *) genmodel;
    struct sDIOmodel *model;
    struct sDIOinstance *inst;
    char name[64];
    double tempOnoise;
    double tempInoise;
    double noizDens[4];
    double lnNdens[4];
    int i;
    static char *DIOnNames[4] = {
 "_rs",
 "_id",
 "_1overf",
 ""
    };
    for (model=firstModel; model != ((void *)0); model=model->DIOnextModel) {
 for (inst=model->DIOinstances; inst != ((void *)0); inst=inst->DIOnextInstance) {
     if (inst->DIOowner != ARCHme) continue;
     switch (operation) {
     case 1:
  if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
      switch (mode) {
      case 1:
   for (i=0; i < 4; i++) {
       (void)sprintf(name,"onoise_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (char **)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
   }
   break;
      case 2:
   for (i=0; i < 4; i++) {
       (void)sprintf(name,"onoise_total_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (char **)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
       (void)sprintf(name,"inoise_total_%s%s",inst->DIOname,DIOnNames[i]);
                            data->namelist = (char **)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
                            if (!data->namelist) return(8);
              (*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
                                 (IFuid)((void *)0),name,0x20,(void **)((void *)0));
   }
   break;
      }
  }
  break;
     case 2:
  switch (mode) {
  case 1:
      NevalSrc(&noizDens[0],&lnNdens[0],
     ckt,2,inst->DIOposPrimeNode,inst->DIOposNode,
     inst->DIOtConductance * inst->DIOarea * inst->DIOm);
      NevalSrc(&noizDens[1],&lnNdens[1],
            ckt,1,inst->DIOposPrimeNode, inst->DIOnegNode,
     *(ckt->CKTstates[0] + inst->DIOstate+1));
      NevalSrc(&noizDens[2],(double *)((void *)0),ckt,
     3,inst->DIOposPrimeNode, inst->DIOnegNode,
     (double)0.0);
      noizDens[2] *= model->DIOfNcoef *
     exp(model->DIOfNexp *
     log(((fabs(*(ckt->CKTstates[0] + inst->DIOstate+1)/inst->DIOm)) > (1E-38) ? (fabs(*(ckt->CKTstates[0] + inst->DIOstate+1)/inst->DIOm)) : (1E-38)))) /
     data->freq * inst->DIOm;
      lnNdens[2] =
     log(((noizDens[2]) > (1E-38) ? (noizDens[2]) : (1E-38)));
      noizDens[3] = noizDens[0] +
          noizDens[1] +
          noizDens[2];
      lnNdens[3] =
     log(((noizDens[3]) > (1E-38) ? (noizDens[3]) : (1E-38)));
      *OnDens += noizDens[3];
      if (data->delFreq == 0.0) {
   for (i=0; i < 4; i++) {
       inst->DIOnVar[0][i] = lnNdens[i];
   }
   if (data->freq == ((struct NOISEAN *)ckt->CKTcurJob)->NstartFreq) {
       for (i=0; i < 4; i++) {
    inst->DIOnVar[1][i] = 0.0;
    inst->DIOnVar[2][i] = 0.0;
       }
   }
      } else {
   for (i=0; i < 4; i++) {
       if (i != 3) {
    tempOnoise = Nintegrate(noizDens[i], lnNdens[i],
          inst->DIOnVar[0][i], data);
    tempInoise = Nintegrate(noizDens[i] * data->GainSqInv ,
          lnNdens[i] + data->lnGainInv,
          inst->DIOnVar[0][i] + data->lnGainInv,
          data);
    inst->DIOnVar[0][i] = lnNdens[i];
    data->outNoiz += tempOnoise;
    data->inNoise += tempInoise;
    if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
        inst->DIOnVar[1][i] += tempOnoise;
        inst->DIOnVar[1][3] += tempOnoise;
        inst->DIOnVar[2][i] += tempInoise;
        inst->DIOnVar[2][3] += tempInoise;
                                }
       }
   }
      }
      if (data->prtSummary) {
   for (i=0; i < 4; i++) {
       data->outpVector[data->outNumber++] = noizDens[i];
   }
      }
      break;
  case 2:
      if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
   for (i=0; i < 4; i++) {
       data->outpVector[data->outNumber++] = inst->DIOnVar[1][i];
       data->outpVector[data->outNumber++] = inst->DIOnVar[2][i];
   }
      }
      break;
  }
  break;
     case 3:
  return (0);
  break;
     }
 }
    }
return(0);
}

variable_types: mode int

variable_types: operation int

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 Ndata { double freq; double lstFreq; double delFreq; double outNoiz; double inNoise; double GainSqInv; double lnGainInv; double lnFreq; double lnLastFreq; double delLnFreq; int outNumber; int numPlots; unsigned int prtSummary; double *outpVector; void *NplotPtr; char **namelist; } *

variable_types:
OnDens
double *

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:
name
char [64]

variable_types: tempOnoise double

variable_types: tempInoise double

variable_types:
noizDens
double [4]

variable_types:
lnNdens
double [4]

variable_types: i int

variable_types:
DIOnNames
char *[4]

user_defined_types: struct NOISEAN { int JOBtype; struct sJOB *JOBnextJob; char *JOBname; void *output; void *outputRef; char *input; double NstartFreq; double NstopFreq; double NfreqDelta; double NsavFstp; double NsavOnoise; double NsavInoise; int NstpType; int NnumSteps; int NStpsSm; }


DEVlimvds

repo: gserdyuk/gnucap-a

decompiled_code:
double __fastcall DEVlimvds(double result, double a2)
{
if ( a2 < 3.5 )
{
if ( result <= a2 )
{
if ( result <= -0.5 )
result = *(double *)&LC2;
}
else if ( result >= 4.0 )
{
result = *(double *)&LC1;
}
}
else if ( result <= a2 )
{
if ( result < 3.5 && result <= 2.0 )
result = *(double *)&LC0;
}
else
{
result = fmin(result, a2 * 3.0 + 2.0);
}
return result;
}

canonical_decompiled_code:
double __fastcall func0(double result, double a2)
{
if ( a2 < 3.5 )
{
if ( result <= a2 )
{
if ( result <= -0.5 )
result = *(double *)&LC2;
}
else if ( result >= 4.0 )
{
result = *(double *)&LC1;
}
}
else if ( result <= a2 )
{
if ( result < 3.5 && result <= 2.0 )
result = *(double *)&LC0;
}
else
{
result = fmin(result, a2 * 3.0 + 2.0);
}
return result;
}

original_code:
double
DEVlimvds(double vnew, double vold)
{
    if(vold >= 3.5) {
        if(vnew > vold) {
            vnew = ((vnew) < ((3 * vold) +2) ? (vnew) : ((3 * vold) +2));
        } else {
            if (vnew < 3.5) {
                vnew = ((vnew) > (2) ? (vnew) : (2));
            }
        }
    } else {
        if(vnew > vold) {
            vnew = ((vnew) < (4) ? (vnew) : (4));
        } else {
            vnew = ((vnew) > (-.5) ? (vnew) : (-.5));
        }
    }
    return(vnew);
}

variable_types: vnew double

variable_types: vold double

return_type: double


DEVpnjlim

original_code:
double
DEVpnjlim(double vnew, double vold, double vt, double vcrit, int *icheck)
{
    double arg;
    if((vnew > vcrit) && (fabs(vnew - vold) > (vt + vt))) {
        if(vold > 0) {
            arg = (vnew - vold) / vt;
            if(arg > 0) {
                vnew = vold + vt * (2+log(arg-2));
            } else {
                vnew = vold - vt * (2+log(2-arg));
            }
        } else {
            vnew = vt *log(vnew/vt);
        }
        *icheck = 1;
    } else {
       if (vnew < 0) {
           if (vold > 0) {
               arg = -1*vold-1;
           } else {
               arg = 2*vold-1;
           }
           if (vnew < arg) {
              vnew = arg;
              *icheck = 1;
           } else {
              *icheck = 0;
           };
        } else {
           *icheck = 0;
        }
    }
    return(vnew);
}

variable_types: vt double

variable_types: vcrit double

variable_types:
icheck
int *

variable_types: arg double


DEVfetlim

original_code:
double
DEVfetlim(double vnew, double vold, double vto)
{
    double vtsthi;
    double vtstlo;
    double vtox;
    double delv;
    double vtemp;
    vtsthi = fabs(2*(vold-vto))+2;
    vtstlo = fabs(vold-vto)+1;
    vtox = vto + 3.5;
    delv = vnew-vold;
    if (vold >= vto) {
        if(vold >= vtox) {
            if(delv <= 0) {
                if(vnew >= vtox) {
                    if(-delv >vtstlo) {
                        vnew = vold - vtstlo;
                    }
                } else {
                    vnew = ((vnew) > (vto+2) ? (vnew) : (vto+2));
                }
            } else {
                if(delv >= vtsthi) {
                    vnew = vold + vtsthi;
                }
            }
        } else {
            if(delv <= 0) {
                vnew = ((vnew) > (vto-.5) ? (vnew) : (vto-.5));
            } else {
                vnew = ((vnew) < (vto+4) ? (vnew) : (vto+4));
            }
        }
    } else {
        if(delv <= 0) {
            if(-delv >vtsthi) {
                vnew = vold - vtsthi;
            }
        } else {
            vtemp = vto + .5;
            if(vnew <= vtemp) {
                if(delv >vtstlo) {
                    vnew = vold + vtstlo;
                }
            } else {
                vnew = vtemp;
            }
        }
    }
    return(vnew);
}

variable_types: vto double

variable_types: vtsthi double

variable_types: vtstlo double

variable_types: vtox double

variable_types: delv double

variable_types: vtemp double


DEVcmeyer

original_code:
void
DEVcmeyer(double vgs0,
   double vgd0,
   double vgb0,
   double von0,
   double vdsat0,
   double vgs1,
   double vgd1,
   double vgb1,
   double covlgs,
   double covlgd,
   double covlgb,
   double *cgs,
   double *cgd,
   double *cgb,
   double phi,
   double cox,
   double von,
   double vdsat)
{
    double vdb;
    double vdbsat;
    double vddif;
    double vddif1;
    double vddif2;
    double vgbt;
    *cgs = 0;
    *cgd = 0;
    *cgb = 0;
    vgbt = vgs1-von;
    if (vgbt <= -phi) {
        *cgb = cox;
    } else if (vgbt <= -phi/2) {
        *cgb = -vgbt*cox/phi;
    } else if (vgbt <= 0) {
        *cgb = -vgbt*cox/phi;
        *cgs = cox/(7.5e-1*phi)*vgbt+cox/1.5;
    } else {
        vdbsat = vdsat-(vgs1-vgb1);
        vdb = vgb1-vgd1;
        if (vdbsat <= vdb) {
            *cgs = cox/1.5;
        } else {
            vddif = 2.0*vdbsat-vdb;
            vddif1 = vdbsat-vdb-1.0e-12;
            vddif2 = vddif*vddif;
            *cgd = cox*(1.0-vdbsat*vdbsat/vddif2)/1.5;
            *cgs = cox*(1.0-vddif1*vddif1/vddif2)/1.5;
        }
    }
    vgbt = vgs0-von0;
    if (vgbt <= -phi) {
        *cgb += cox;
    } else if (vgbt <= -phi/2) {
        *cgb += -vgbt*cox/phi;
    } else if (vgbt <= 0) {
        *cgb += -vgbt*cox/phi;
        *cgs += cox/(7.5e-1*phi)*vgbt+cox/1.5;
    } else {
        vdbsat = vdsat0-(vgs0-vgb0);
        vdb = vgb0-vgd0;
        if (vdbsat <= vdb) {
            *cgs += cox/1.5;
        } else {
            vddif = 2.0*vdbsat-vdb;
            vddif1 = vdbsat-vdb-1.0e-12;
            vddif2 = vddif*vddif;
            *cgd += cox*(1.0-vdbsat*vdbsat/vddif2)/1.5;
            *cgs += cox*(1.0-vddif1*vddif1/vddif2)/1.5;
        }
    }
    *cgs = *cgs *.5 + covlgs;
    *cgd = *cgd *.5 + covlgd;
    *cgb = *cgb *.5 + covlgb;
}

variable_types: covlgs double

variable_types: covlgd double

variable_types: covlgb double

variable_types:
cgs
double *

variable_types:
cgd
double *

variable_types:
cgb
double *

variable_types: phi double

variable_types: cox double

variable_types: von double

variable_types: vdsat double

variable_types: vdb double

variable_types: vdbsat double

variable_types: vddif double

variable_types: vgbt double

return_type: void


DEVqmeyer

original_code:
void
DEVqmeyer(double vgs,
   double vgd,
   double vgb,
   double von,
   double vdsat,
   double *capgs,
   double *capgd,
   double *capgb,
   double phi,
   double cox)
{
    double vds;
    double vddif;
    double vddif1;
    double vddif2;
    double vgst;
    vgst = vgs-von;
    vdsat = ((vdsat) > (0.025) ? (vdsat) : (0.025));
    if (vgst <= -phi) {
        *capgb = cox/2;
        *capgs = 0;
        *capgd = 0;
    } else if (vgst <= -phi/2) {
        *capgb = -vgst*cox/(2*phi);
        *capgs = 0;
        *capgd = 0;
    } else if (vgst <= 0) {
        *capgb = -vgst*cox/(2*phi);
        *capgs = vgst*cox/(1.5*phi)+cox/3;
        vds = vgs-vgd;
        if (vds>=vdsat) {
           *capgd = 0;
        } else {
            vddif = 2.0*vdsat-vds;
            vddif1 = vdsat-vds ;
            vddif2 = vddif*vddif;
            *capgd = *capgs*(1.0-vdsat*vdsat/vddif2);
            *capgs = *capgs*(1.0-vddif1*vddif1/vddif2);
        }
    } else {
        vds = vgs-vgd;
        vdsat = ((vdsat) > (0.025) ? (vdsat) : (0.025));
        if (vdsat <= vds) {
            *capgs = cox/3;
            *capgd = 0;
            *capgb = 0;
        } else {
            vddif = 2.0*vdsat-vds;
            vddif1 = vdsat-vds ;
            vddif2 = vddif*vddif;
            *capgd = cox*(1.0-vdsat*vdsat/vddif2)/3;
            *capgs = cox*(1.0-vddif1*vddif1/vddif2)/3;
            *capgb = 0;
        }
    }
}

variable_types: vgs double

variable_types: vgd double

variable_types: vgb double

variable_types:
capgs
double *

variable_types:
capgd
double *

variable_types:
capgb
double *

variable_types: vds double

variable_types: vgst double


TRAtemp

original_code:
int
TRAtemp(GENmodel *inModel, CKTcircuit *ckt)
{
    TRAmodel *model = (TRAmodel *)inModel;
    TRAinstance *here;
    for( ; model != ((void *)0); model = model->TRAnextModel ) {
        for (here = model->TRAinstances; here != ((void *)0) ;
                here=here->TRAnextInstance) {
     if (here->TRAowner != ARCHme) continue;
            if(!here->TRAtdGiven) {
                here->TRAtd = here->TRAnl/here->TRAf;
            }
            here->TRAconduct = 1/here->TRAimped;
        }
    }
    return(0);
}

canonical_original_code:
int TRAtemp(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sTRAmodel *model = (TRAmodel *)inModel;
    struct sTRAinstance *here;
    for( ; model != ((void *)0); model = model->TRAnextModel ) {
        for (here = model->TRAinstances; here != ((void *)0) ;
                here=here->TRAnextInstance) {
     if (here->TRAowner != ARCHme) continue;
            if(!here->TRAtdGiven) {
                here->TRAtd = here->TRAnl/here->TRAf;
            }
            here->TRAconduct = 1/here->TRAimped;
        }
    }
    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 sTRAmodel { int TRAmodType; struct sTRAmodel *TRAnextModel; 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; } *TRAinstances; char *TRAmodName; } *

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

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


CAPgetic

original_code:
int
CAPgetic(GENmodel *inModel, CKTcircuit *ckt)
{
    CAPmodel *model = (CAPmodel*)inModel;
    CAPinstance *here;
    for( ; model ; model = model->CAPnextModel) {
        for(here = model->CAPinstances; here ; here = here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
            if(!here->CAPicGiven) {
                here->CAPinitCond =
                        *(ckt->CKTrhs + here->CAPposNode) -
                        *(ckt->CKTrhs + here->CAPnegNode);
            }
        }
    }
    return(0);
}

canonical_original_code:
int CAPgetic(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
    struct sCAPmodel *model = (CAPmodel*)inModel;
    struct sCAPinstance *here;
    for( ; model ; model = model->CAPnextModel) {
        for(here = model->CAPinstances; here ; here = here->CAPnextInstance) {
     if (here->CAPowner != ARCHme) continue;
            if(!here->CAPicGiven) {
                here->CAPinitCond =
                        *(ckt->CKTrhs + here->CAPposNode) -
                        *(ckt->CKTrhs + here->CAPnegNode);
            }
        }
    }
    return(0);
}

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

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


INDpzLoad

original_code:
int
INDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
{
    INDmodel *model = (INDmodel*)inModel;
    double val;
    INDinstance *here;
    for( ; model != ((void *)0); model = model->INDnextModel) {
        for( here = model->INDinstances;here != ((void *)0);
                here = here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            val = here->INDinduct;
            *(here->INDposIbrptr) += 1;
            *(here->INDnegIbrptr) -= 1;
            *(here->INDibrPosptr) += 1;
            *(here->INDibrNegptr) -= 1;
            *(here->INDibrIbrptr ) -= val * s->real;
            *(here->INDibrIbrptr +1) -= val * s->imag;
        }
    }
    return(0);
}

canonical_original_code:
int INDpzLoad(struct sGENmodel *inModel, struct CKTcircuit *ckt, struct SPcomplex *s)
{
    struct sINDmodel *model = (INDmodel*)inModel;
    double val;
    struct sINDinstance *here;
    for( ; model != ((void *)0); model = model->INDnextModel) {
        for( here = model->INDinstances;here != ((void *)0);
                here = here->INDnextInstance) {
     if (here->INDowner != ARCHme) continue;
            val = here->INDinduct;
            *(here->INDposIbrptr) += 1;
            *(here->INDnegIbrptr) -= 1;
            *(here->INDibrPosptr) += 1;
            *(here->INDibrNegptr) -= 1;
            *(here->INDibrIbrptr ) -= val * s->real;
            *(here->INDibrIbrptr +1) -= val * s->imag;
        }
    }
    return(0);
}

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

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

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


URCask

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

switch ( a3 )
{
case 1:
*a4 = *(_QWORD *)(a2 + 40);
result = 0LL;
break;
case 2:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 48);
result = 0LL;
break;
case 3:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 4:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 5:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

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

switch ( a3 )
{
case 1:
*a4 = *(_QWORD *)(a2 + 40);
result = 0LL;
break;
case 2:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 48);
result = 0LL;
break;
case 3:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 4:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 5:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

original_code:
int
URCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
{
    URCinstance *here = (URCinstance *)inst;
    switch(which) {
        case 3:
            value->iValue = here->URCposNode;
            return (0);
        case 4:
            value->iValue = here->URCnegNode;
            return (0);
        case 5:
            value->iValue = here->URCgndNode;
            return (0);
        case 1:
            value->rValue = here->URClength;
            return (0);
        case 2:
            value->iValue = here->URClumps;
            return (0);
        default:
            return (7);
    }
}

canonical_original_code:
int URCask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
    struct sURCinstance *here = (URCinstance *)inst;
    switch(which) {
        case 3:
            value->iValue = here->URCposNode;
            return (0);
        case 4:
            value->iValue = here->URCnegNode;
            return (0);
        case 5:
            value->iValue = here->URCgndNode;
            return (0);
        case 1:
            value->rValue = here->URClength;
            return (0);
        case 2:
            value->iValue = here->URClumps;
            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 sURCinstance { struct sURCmodel { int URCmodType; struct sURCmodel *URCnextModel; struct sURCinstance *URCinstances; char *URCmodName; double URCk; double URCfmax; double URCrPerL; double URCcPerL; double URCisPerL; double URCrsPerL; unsigned int URCkGiven; unsigned int URCfmaxGiven; unsigned int URCrPerLGiven; unsigned int URCcPerLGiven; unsigned int URCisPerLGiven; unsigned int URCrsPerLGiven; } *URCmodPtr; struct sURCinstance *URCnextInstance; char *URCname; int URCowner; int URCstate; int URCposNode; int URCnegNode; int URCgndNode; double URClength; int URClumps; unsigned int URClenGiven; unsigned int URClumpsGiven; } *

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 sURCinstance { struct sURCmodel *URCmodPtr; struct sURCinstance *URCnextInstance; char *URCname; int URCowner; int URCstate; int URCposNode; int URCnegNode; int URCgndNode; double URClength; int URClumps; unsigned int URClenGiven; unsigned int URClumpsGiven; }


DIOask

decompiled_code:
__int64 __fastcall DIOask(__int64 a1, __int64 a2, int a3, _QWORD *a4)
{
__int64 result; // rax
__int64 v5; // rdx
__int64 v6; // rdx
__int64 v7; // rdx
__int64 v8; // rdx

switch ( a3 )
{
case 1:
*a4 = *(_QWORD *)(a2 + 104);
result = 0LL;
break;
case 2:
*a4 = *(_QWORD *)(a2 + 112);
result = 0LL;
break;
case 3:
*(_DWORD *)a4 = *(_BYTE *)(a2 + 96) & 1;
result = 0LL;
break;
case 4:
result = 0LL;
if ( *(_QWORD *)(a1 + 280) )
*a4 = *(_QWORD *)(a2 + 192);
break;
case 5:
v5 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v5 )
{
*a4 = *(_QWORD *)(v5 + 8LL * *(int *)(a2 + 24));
result = 0LL;
}
break;
case 6:
v6 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v6 )
{
*a4 = *(_QWORD *)(v6 + 8LL * *(int *)(a2 + 24) + 8);
result = 0LL;
}
break;
case 7:
v7 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v7 )
{
*a4 = *(_QWORD *)(v7 + 8LL * *(int *)(a2 + 24) + 16);
result = 0LL;
}
break;
case 8:
result = 0LL;
if ( *(_QWORD *)(a1 + 280) )
*a4 = *(_QWORD *)(a2 + 200);
break;
case 9:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x30uLL);
errRtn = "DIOask";
strcpy(errMsg, "Current and power not available for ac analysis");
result = 112LL;
}
else
{
v8 = *(_QWORD *)(a1 + 280);
if ( v8 )
*(double *)a4 = *(double *)(v8 + 8LL * *(int *)(a2 + 24)) * *(double *)(a2 + 192);
}
break;
case 10:
*(double *)a4 = *(double *)(a2 + 120) - 273.15;
result = 0LL;
break;
case 11:
*a4 = *(_QWORD *)(a2 + 208);
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

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

switch ( a3 )
{
case 1:
*a4 = *(_QWORD *)(a2 + 104);
result = 0LL;
break;
case 2:
*a4 = *(_QWORD *)(a2 + 112);
result = 0LL;
break;
case 3:
*(_DWORD *)a4 = *(_BYTE *)(a2 + 96) & 1;
result = 0LL;
break;
case 4:
result = 0LL;
if ( *(_QWORD *)(a1 + 280) )
*a4 = *(_QWORD *)(a2 + 192);
break;
case 5:
v5 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v5 )
{
*a4 = *(_QWORD *)(v5 + 8LL * *(int *)(a2 + 24));
result = 0LL;
}
break;
case 6:
v6 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v6 )
{
*a4 = *(_QWORD *)(v6 + 8LL * *(int *)(a2 + 24) + 8);
result = 0LL;
}
break;
case 7:
v7 = *(_QWORD *)(a1 + 280);
result = 0LL;
if ( v7 )
{
*a4 = *(_QWORD *)(v7 + 8LL * *(int *)(a2 + 24) + 16);
result = 0LL;
}
break;
case 8:
result = 0LL;
if ( *(_QWORD *)(a1 + 280) )
*a4 = *(_QWORD *)(a2 + 200);
break;
case 9:
result = *(_DWORD *)(a1 + 684) & 4;
if ( (*(_DWORD *)(a1 + 684) & 4) != 0 )
{
errMsg = (char *)calloc(1uLL, 0x30uLL);
errRtn = "DIOask";
strcpy(errMsg, "Current and power not available for ac analysis");
result = 112LL;
}
else
{
v8 = *(_QWORD *)(a1 + 280);
if ( v8 )
*(double *)a4 = *(double *)(v8 + 8LL * *(int *)(a2 + 24)) * *(double *)(a2 + 192);
}
break;
case 10:
*(double *)a4 = *(double *)(a2 + 120) - 273.15;
result = 0LL;
break;
case 11:
*a4 = *(_QWORD *)(a2 + 208);
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

original_code:
int
DIOask (CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
        IFvalue *select)
{
    DIOinstance *here = (DIOinstance*)inst;
    double vr;
    double vi;
    double sr;
    double si;
    double vm;
    static char *msg = "Current and power not available for ac analysis";
    switch (which) {
        case 3:
            value->iValue = here->DIOoff;
            return(0);
        case 2:
            value->rValue = here->DIOinitCond;
            return(0);
        case 1:
            value->rValue = here->DIOarea;
            return(0);
        case 19:
            value->rValue = here->DIOpj;
            return(0);
        case 20:
            value->rValue = here->DIOm;
            return(0);
        case 11:
            value->rValue = here->DIOtemp-(273.15);
            return(0);
 case 21:
            value->rValue = here->DIOdtemp;
            return(0);
        case 5:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate);
            return(0);
        case 4:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+1);
            return(0);
        case 18:
            value->rValue = here->DIOcap;
            return(0);
        case 6:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+3);
            return(0);
        case 7:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+4);
            return(0);
        case 8:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+2);
            return(0);
        case 10 :
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned)(strlen(msg)+1));
                errRtn = "DIOask";
                strcpy(errMsg,msg);
                return((100 +12));
            } else {
                value->rValue = *(ckt->CKTstates[0] + here->DIOstate+1) *
                        *(ckt->CKTstates[0] + here->DIOstate);
            }
            return(0);
        case 17:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_Sap[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 12:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 13:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 14:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = sqrt(vr*vr + vi*vi);
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->rValue = (vr * sr + vi * si)/vm;
            }
            return(0);
        case 15:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = vr*vr + vi*vi;
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->rValue = (vr * si - vi * sr)/vm;
            }
            return(0);
        case 16:
            if(ckt->CKTsenInfo){
                value->cValue.real=
                        *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->cValue.imag=
                        *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
            }
            return(0);
        default:
            return(7);
        }
}

canonical_original_code:
int DIOask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
    struct sDIOinstance *here = (DIOinstance*)inst;
    double vr;
    double vi;
    double sr;
    double si;
    double vm;
    static char *msg = "Current and power not available for ac analysis";
    switch (which) {
        case 3:
            value->iValue = here->DIOoff;
            return(0);
        case 2:
            value->rValue = here->DIOinitCond;
            return(0);
        case 1:
            value->rValue = here->DIOarea;
            return(0);
        case 19:
            value->rValue = here->DIOpj;
            return(0);
        case 20:
            value->rValue = here->DIOm;
            return(0);
        case 11:
            value->rValue = here->DIOtemp-(273.15);
            return(0);
 case 21:
            value->rValue = here->DIOdtemp;
            return(0);
        case 5:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate);
            return(0);
        case 4:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+1);
            return(0);
        case 18:
            value->rValue = here->DIOcap;
            return(0);
        case 6:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+3);
            return(0);
        case 7:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+4);
            return(0);
        case 8:
            value->rValue = *(ckt->CKTstates[0]+here->DIOstate+2);
            return(0);
        case 10 :
            if (ckt->CKTcurrentAnalysis & 4) {
                errMsg = tmalloc((unsigned int)(strlen(msg)+1));
                errRtn = "DIOask";
                strcpy(errMsg,msg);
                return((100 +12));
            } else {
                value->rValue = *(ckt->CKTstates[0] + here->DIOstate+1) *
                        *(ckt->CKTstates[0] + here->DIOstate);
            }
            return(0);
        case 17:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_Sap[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 12:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 13:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                here->DIOsenParmNo);
            }
            return(0);
        case 14:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = sqrt(vr*vr + vi*vi);
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->rValue = (vr * sr + vi * si)/vm;
            }
            return(0);
        case 15:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = vr*vr + vi*vi;
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->rValue = (vr * si - vi * sr)/vm;
            }
            return(0);
        case 16:
            if(ckt->CKTsenInfo){
                value->cValue.real=
                        *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->DIOsenParmNo);
                value->cValue.imag=
                        *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->DIOsenParmNo);
            }
            return(0);
        default:
            return(7);
        }
}

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

variable_types: vi double

variable_types: sr double

variable_types: si double

variable_types: vm double

variable_types:
msg
char *

user_defined_types: 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]; }

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


MUTask

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

if ( a3 == 402 )
{
*a4 = a2[5];
result = 0LL;
}
else if ( a3 == 403 )
{
*a4 = a2[6];
result = 0LL;
}
else
{
result = 7LL;
if ( a3 == 401 )
{
*a4 = a2[4];
result = 0LL;
}
}
return result;
}

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

if ( a3 == 402 )
{
*a4 = a2[5];
result = 0LL;
}
else if ( a3 == 403 )
{
*a4 = a2[6];
result = 0LL;
}
else
{
result = 7LL;
if ( a3 == 401 )
{
*a4 = a2[4];
result = 0LL;
}
}
return result;
}

original_code:
int
MUTask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
       IFvalue *select)
{
    MUTinstance *here = (MUTinstance*)inst;
    double vr;
    double vi;
    double sr;
    double si;
    double vm;
    switch(which) {
        case 401:
            value->rValue = here->MUTfactor;
            return(0);
        case 402:
            value->uValue = here->MUTindName1;
            return(0);
        case 403:
            value->uValue = here->MUTindName2;
            return(0);
        case 606:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_Sap[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 601:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 602:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 603:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = sqrt(vr*vr + vi*vi);
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->rValue = (vr * sr + vi * si)/vm;
            }
            return(0);
        case 604:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = vr*vr + vi*vi;
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->rValue = (vr * si - vi * sr)/vm;
            }
            return(0);
        case 605:
            if(ckt->CKTsenInfo){
                value->cValue.real=
                        *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->cValue.imag=
                        *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        default:
            return(7);
    }
}

canonical_original_code:
int MUTask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
    struct sMUTinstance *here = (MUTinstance*)inst;
    double vr;
    double vi;
    double sr;
    double si;
    double vm;
    switch(which) {
        case 401:
            value->rValue = here->MUTfactor;
            return(0);
        case 402:
            value->uValue = here->MUTindName1;
            return(0);
        case 403:
            value->uValue = here->MUTindName2;
            return(0);
        case 606:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_Sap[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 601:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 602:
            if(ckt->CKTsenInfo){
                value->rValue = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        case 603:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = sqrt(vr*vr + vi*vi);
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->rValue = (vr * sr + vi * si)/vm;
            }
            return(0);
        case 604:
            if(ckt->CKTsenInfo){
                vr = *(ckt->CKTrhsOld + select->iValue + 1);
                vi = *(ckt->CKTirhsOld + select->iValue + 1);
                vm = vr*vr + vi*vi;
                if(vm == 0){
                    value->rValue = 0;
                    return(0);
                }
                sr = *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                si = *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->rValue = (vr * si - vi * sr)/vm;
            }
            return(0);
        case 605:
            if(ckt->CKTsenInfo){
                value->cValue.real=
                        *(ckt->CKTsenInfo->SEN_RHS[select->iValue + 1]+
                        here->MUTsenParmNo);
                value->cValue.imag=
                        *(ckt->CKTsenInfo->SEN_iRHS[select->iValue + 1]+
                        here->MUTsenParmNo);
            }
            return(0);
        default:
            return(7);
    }
}

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

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

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