MESnoise

decompiled_code:
__int64 __fastcall MESnoise(int a1, int a2, __int64 a3, __int64 a4, __int64 a5, double *a6)
{
__int64 result; // rax
__int64 v9; // r14
__int64 v10; // r14
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; // xmm0_8
double v31; // r14
double v32; // r12
double *v33; // r12
double *v34; // r14
double *v35; // r15
double v36; // xmm0_8
char *v37; // rdx
__int64 v38; // rcx
int v39; // eax
_QWORD *j; // r8
_QWORD *v41; // rax
__int64 v42; // rcx
int v43; // edx
__int64 v44; // rcx
int v45; // edx
double v46; // [rsp+0h] [rbp-F8h]
__int64 v47; // [rsp+8h] [rbp-F0h]
__int64 v49; // [rsp+20h] [rbp-D8h] BYREF
__int64 v50; // [rsp+28h] [rbp-D0h] BYREF
__int64 v51; // [rsp+30h] [rbp-C8h] BYREF
double v52; // [rsp+38h] [rbp-C0h]
double v53; // [rsp+40h] [rbp-B8h]
double v54; // [rsp+50h] [rbp-A8h] BYREF
double v55; // [rsp+58h] [rbp-A0h] BYREF
double v56; // [rsp+60h] [rbp-98h] BYREF
double v57; // [rsp+68h] [rbp-90h] BYREF
double v58; // [rsp+70h] [rbp-88h]
char v59; // [rsp+78h] [rbp-80h] BYREF
char s[120]; // [rsp+80h] [rbp-78h] BYREF

v47 = a3;
if ( a2 == 1 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a1 == 1 )
{
if ( a3 )
{
while ( 1 )
{
v10 = *(_QWORD *)(v47 + 16);
if ( v10 )
break;
LABEL_13:
result = *(_QWORD *)(v47 + 8);
v47 = result;
if ( !result )
return result;
}
LABEL_16:
v11 = (void **)MESnNames;
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 ( &off_860 + 1 == ++v11 )
{
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 *)(v47 + 16);
if ( v9 )
break;
LABEL_9:
result = *(_QWORD *)(v47 + 8);
v47 = result;
if ( !result )
return result;
}
LABEL_21:
v15 = (const char **)MESnNames;
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 ( &off_860 + 1 == (void **)++v15 )
{
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 *)(v47 + 16); i; i = *(_QWORD *)(i + 8) )
{
NevalSrc(
&v54,
&v49,
a4,
2LL,
*(unsigned int *)(i + 40),
*(unsigned int *)(i + 28),
*(double *)(v47 + 152) * *(double *)(i + 48));
NevalSrc(
&v55,
&v50,
a4,
2LL,
*(unsigned int *)(i + 44),
*(unsigned int *)(i + 36),
*(double *)(v47 + 160) * *(double *)(i + 48));
v30 = *(double *)(*(_QWORD *)(a4 + 280) + 8LL * *(int *)(i + 24) + 40);
if ( v30 < 0.0 )
*(_QWORD *)&v30 ^= LC5;
NevalSrc(
&v56,
&v51,
a4,
2LL,
*(unsigned int *)(i + 40),
*(unsigned int *)(i + 44),
v30 * 0.6666666666666666);
NevalSrc(&v57, 0LL, a4, 3LL, *(unsigned int *)(i + 40), *(unsigned int *)(i + 44), 0.0);
v31 = *(double *)(v47 + 136);
v32 = *(double *)(v47 + 144);
v23 = *(double *)(*(_QWORD *)(a4 + 280) + 8LL * *(int *)(i + 24) + 24);
if ( v23 < 0.0 )
{
if ( v23 < -1.0e-38 )
*(_QWORD *)&v23 ^= LC5;
else
v23 = LC0;
}
else if ( v23 <= 1.0e-38 )
{
v23 = LC0;
}
v24 = log(v23);
v25 = exp(v32 * v24);
v26 = v31 * v25 / *(double *)a5 * v57;
v57 = v26;
if ( v26 <= 1.0e-38 )
v26 = LC0;
v52 = log(v26);
v27 = v54 + v55 + v56 + v57;
v58 = v27;
if ( v27 <= 1.0e-38 )
v27 = LC0;
v28 = log(v27);
v53 = v28;
*a6 = *a6 + v58;
if ( *(double *)(a5 + 16) == 0.0 )
{
*(_QWORD *)(i + 424) = v49;
*(_QWORD *)(i + 432) = v50;
*(_QWORD *)(i + 440) = v51;
*(double *)(i + 448) = v52;
*(double *)(i + 456) = v28;
if ( *(double *)a5 == *(double *)(*(_QWORD *)(a4 + 968) + 96LL) )
{
*(_QWORD *)(i + 464) = 0LL;
*(_QWORD *)(i + 504) = 0LL;
*(_QWORD *)(i + 472) = 0LL;
*(_QWORD *)(i + 512) = 0LL;
*(_QWORD *)(i + 480) = 0LL;
*(_QWORD *)(i + 520) = 0LL;
*(_QWORD *)(i + 488) = 0LL;
*(_QWORD *)(i + 528) = 0LL;
*(_QWORD *)(i + 496) = 0LL;
*(_QWORD *)(i + 536) = 0LL;
}
}
else
{
v33 = (double *)(i + 424);
v34 = (double *)&v49;
v35 = &v54;
do
{
v46 = Nintegrate(a5, *v35, *v34, *v33);
v36 = Nintegrate(
a5,
*v35 * *(double *)(a5 + 40),
*(double *)(a5 + 48) + *v34,
*(double *)(a5 + 48) + *v33);
*v33 = *v34;
*(double *)(a5 + 24) = v46 + *(double *)(a5 + 24);
*(double *)(a5 + 32) = v36 + *(double *)(a5 + 32);
if ( *(_DWORD *)(*(_QWORD *)(a4 + 968) + 64LL) )
{
v33[5] = v46 + v33[5];
*(double *)(i + 496) = v46 + *(double *)(i + 496);
v33[10] = v36 + v33[10];
*(double *)(i + 536) = v36 + *(double *)(i + 536);
}
++v33;
++v34;
++v35;
}
while ( (double *)(i + 456) != v33 );
}
if ( *(_DWORD *)(a5 + 88) )
{
v37 = (char *)&v54;
do
{
v38 = *(_QWORD *)(a5 + 96);
v39 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v39 + 1;
*(_QWORD *)(v38 + 8LL * v39) = *(_QWORD *)v37;
v37 += 8;
}
while ( v37 != &v59 );
}
}
result = *(_QWORD *)(v47 + 8);
v47 = 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 **)(v47 + 16); j; j = (_QWORD *)j[1] )
{
v41 = j + 58;
do
{
v42 = *(_QWORD *)(a5 + 96);
v43 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v43 + 1;
*(_QWORD *)(v42 + 8LL * v43) = *v41;
v44 = *(_QWORD *)(a5 + 96);
v45 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v45 + 1;
*(_QWORD *)(v44 + 8LL * v45) = v41[5];
++v41;
}
while ( v41 != j + 63 );
}
result = *(_QWORD *)(v47 + 8);
v47 = 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; // r14
__int64 v10; // r14
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; // xmm0_8
double v31; // r14
double v32; // r12
double *v33; // r12
double *v34; // r14
double *v35; // r15
double v36; // xmm0_8
char *v37; // rdx
__int64 v38; // rcx
int v39; // eax
_QWORD *j; // r8
_QWORD *v41; // rax
__int64 v42; // rcx
int v43; // edx
__int64 v44; // rcx
int v45; // edx
double v46; // [rsp+0h] [rbp-F8h]
__int64 v47; // [rsp+8h] [rbp-F0h]
__int64 v49; // [rsp+20h] [rbp-D8h] BYREF
__int64 v50; // [rsp+28h] [rbp-D0h] BYREF
__int64 v51; // [rsp+30h] [rbp-C8h] BYREF
double v52; // [rsp+38h] [rbp-C0h]
double v53; // [rsp+40h] [rbp-B8h]
double v54; // [rsp+50h] [rbp-A8h] BYREF
double v55; // [rsp+58h] [rbp-A0h] BYREF
double v56; // [rsp+60h] [rbp-98h] BYREF
double v57; // [rsp+68h] [rbp-90h] BYREF
double v58; // [rsp+70h] [rbp-88h]
char v59; // [rsp+78h] [rbp-80h] BYREF
char s[120]; // [rsp+80h] [rbp-78h] BYREF

v47 = a3;
if ( a2 == 1 )
{
result = *(unsigned int *)(*(_QWORD *)(a4 + 968) + 64LL);
if ( (_DWORD)result )
{
if ( a1 == 1 )
{
if ( a3 )
{
while ( 1 )
{
v10 = *(_QWORD *)(v47 + 16);
if ( v10 )
break;
LABEL_13:
result = *(_QWORD *)(v47 + 8);
v47 = result;
if ( !result )
return result;
}
LABEL_16:
v11 = (void **)MESnNames;
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 ( &off_860 + 1 == ++v11 )
{
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 *)(v47 + 16);
if ( v9 )
break;
LABEL_9:
result = *(_QWORD *)(v47 + 8);
v47 = result;
if ( !result )
return result;
}
LABEL_21:
v15 = (const char **)MESnNames;
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 ( &off_860 + 1 == (void **)++v15 )
{
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 *)(v47 + 16); i; i = *(_QWORD *)(i + 8) )
{
NevalSrc(
&v54,
&v49,
a4,
2LL,
*(unsigned int *)(i + 40),
*(unsigned int *)(i + 28),
*(double *)(v47 + 152) * *(double *)(i + 48));
NevalSrc(
&v55,
&v50,
a4,
2LL,
*(unsigned int *)(i + 44),
*(unsigned int *)(i + 36),
*(double *)(v47 + 160) * *(double *)(i + 48));
v30 = *(double *)(*(_QWORD *)(a4 + 280) + 8LL * *(int *)(i + 24) + 40);
if ( v30 < 0.0 )
*(_QWORD *)&v30 ^= LC5;
NevalSrc(
&v56,
&v51,
a4,
2LL,
*(unsigned int *)(i + 40),
*(unsigned int *)(i + 44),
v30 * 0.6666666666666666);
NevalSrc(&v57, 0LL, a4, 3LL, *(unsigned int *)(i + 40), *(unsigned int *)(i + 44), 0.0);
v31 = *(double *)(v47 + 136);
v32 = *(double *)(v47 + 144);
v23 = *(double *)(*(_QWORD *)(a4 + 280) + 8LL * *(int *)(i + 24) + 24);
if ( v23 < 0.0 )
{
if ( v23 < -1.0e-38 )
*(_QWORD *)&v23 ^= LC5;
else
v23 = LC0;
}
else if ( v23 <= 1.0e-38 )
{
v23 = LC0;
}
v24 = log(v23);
v25 = exp(v32 * v24);
v26 = v31 * v25 / *(double *)a5 * v57;
v57 = v26;
if ( v26 <= 1.0e-38 )
v26 = LC0;
v52 = log(v26);
v27 = v54 + v55 + v56 + v57;
v58 = v27;
if ( v27 <= 1.0e-38 )
v27 = LC0;
v28 = log(v27);
v53 = v28;
*a6 = *a6 + v58;
if ( *(double *)(a5 + 16) == 0.0 )
{
*(_QWORD *)(i + 424) = v49;
*(_QWORD *)(i + 432) = v50;
*(_QWORD *)(i + 440) = v51;
*(double *)(i + 448) = v52;
*(double *)(i + 456) = v28;
if ( *(double *)a5 == *(double *)(*(_QWORD *)(a4 + 968) + 96LL) )
{
*(_QWORD *)(i + 464) = 0LL;
*(_QWORD *)(i + 504) = 0LL;
*(_QWORD *)(i + 472) = 0LL;
*(_QWORD *)(i + 512) = 0LL;
*(_QWORD *)(i + 480) = 0LL;
*(_QWORD *)(i + 520) = 0LL;
*(_QWORD *)(i + 488) = 0LL;
*(_QWORD *)(i + 528) = 0LL;
*(_QWORD *)(i + 496) = 0LL;
*(_QWORD *)(i + 536) = 0LL;
}
}
else
{
v33 = (double *)(i + 424);
v34 = (double *)&v49;
v35 = &v54;
do
{
v46 = Nintegrate(a5, *v35, *v34, *v33);
v36 = Nintegrate(
a5,
*v35 * *(double *)(a5 + 40),
*(double *)(a5 + 48) + *v34,
*(double *)(a5 + 48) + *v33);
*v33 = *v34;
*(double *)(a5 + 24) = v46 + *(double *)(a5 + 24);
*(double *)(a5 + 32) = v36 + *(double *)(a5 + 32);
if ( *(_DWORD *)(*(_QWORD *)(a4 + 968) + 64LL) )
{
v33[5] = v46 + v33[5];
*(double *)(i + 496) = v46 + *(double *)(i + 496);
v33[10] = v36 + v33[10];
*(double *)(i + 536) = v36 + *(double *)(i + 536);
}
++v33;
++v34;
++v35;
}
while ( (double *)(i + 456) != v33 );
}
if ( *(_DWORD *)(a5 + 88) )
{
v37 = (char *)&v54;
do
{
v38 = *(_QWORD *)(a5 + 96);
v39 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v39 + 1;
*(_QWORD *)(v38 + 8LL * v39) = *(_QWORD *)v37;
v37 += 8;
}
while ( v37 != &v59 );
}
}
result = *(_QWORD *)(v47 + 8);
v47 = 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 **)(v47 + 16); j; j = (_QWORD *)j[1] )
{
v41 = j + 58;
do
{
v42 = *(_QWORD *)(a5 + 96);
v43 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v43 + 1;
*(_QWORD *)(v42 + 8LL * v43) = *v41;
v44 = *(_QWORD *)(a5 + 96);
v45 = *(_DWORD *)(a5 + 80);
*(_DWORD *)(a5 + 80) = v45 + 1;
*(_QWORD *)(v44 + 8LL * v45) = v41[5];
++v41;
}
while ( v41 != j + 63 );
}
result = *(_QWORD *)(v47 + 8);
v47 = result;
}
while ( result );
}
else
{
result = 0LL;
}
}
}
}
}
}
return result;
}

original_code:
int
MESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *data,
          double *OnDens)
{
    MESmodel *firstModel = (MESmodel *) genmodel;
    MESmodel *model;
    MESinstance *inst;
    char name[64];
    double tempOnoise;
    double tempInoise;
    double noizDens[5];
    double lnNdens[5];
    int i;
    static char *MESnNames[5] = {
 "_rd",
 "_rs",
 "_id",
 "_1overf",
 ""
    };
    for (model=firstModel; model != ((void *)0); model=model->MESnextModel) {
 for (inst=model->MESinstances; inst != ((void *)0); inst=inst->MESnextInstance) {
     if (inst->MESowner != ARCHme) continue;
     switch (operation) {
     case 1:
  if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
      switch (mode) {
      case 1:
   for (i=0; i < 5; i++) {
       (void)sprintf(name,"onoise_%s%s",inst->MESname,MESnNames[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 < 5; i++) {
       (void)sprintf(name,"onoise_total_%s%s",inst->MESname,MESnNames[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->MESname,MESnNames[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->MESdrainPrimeNode,inst->MESdrainNode,
     model->MESdrainConduct * inst->MESarea * inst->MESm);
      NevalSrc(&noizDens[1],&lnNdens[1],
     ckt,2,inst->MESsourcePrimeNode,inst->MESsourceNode,
     model->MESsourceConduct * inst->MESarea * inst->MESm);
      NevalSrc(&noizDens[2],&lnNdens[2],
     ckt,2,inst->MESdrainPrimeNode,
     inst->MESsourcePrimeNode,
                                 (2.0/3.0 * inst->MESm * fabs(*(ckt->CKTstates[0] + inst->MESstate+5))));
      NevalSrc(&noizDens[3],(double*)((void *)0),ckt,
     3,inst->MESdrainPrimeNode, inst->MESsourcePrimeNode,
     (double)0.0);
      noizDens[3] *= inst->MESm * model->MESfNcoef *
     exp(model->MESfNexp *
     log(((fabs(*(ckt->CKTstates[0] + inst->MESstate+3))) > (1E-38) ? (fabs(*(ckt->CKTstates[0] + inst->MESstate+3))) : (1E-38)))) /
     data->freq;
      lnNdens[3] =
     log(((noizDens[3]) > (1E-38) ? (noizDens[3]) : (1E-38)));
      noizDens[4] = noizDens[0] +
          noizDens[1] +
          noizDens[2] +
          noizDens[3];
      lnNdens[4] =
     log(((noizDens[4]) > (1E-38) ? (noizDens[4]) : (1E-38)));
      *OnDens += noizDens[4];
      if (data->delFreq == 0.0) {
   for (i=0; i < 5; i++) {
       inst->MESnVar[0][i] = lnNdens[i];
   }
   if (data->freq == ((NOISEAN*)ckt->CKTcurJob)->NstartFreq) {
       for (i=0; i < 5; i++) {
    inst->MESnVar[1][i] = 0.0;
    inst->MESnVar[2][i] = 0.0;
       }
   }
      } else {
   for (i=0; i < 5; i++) {
       if (i != 4) {
    tempOnoise = Nintegrate(noizDens[i], lnNdens[i],
          inst->MESnVar[0][i], data);
    tempInoise = Nintegrate(noizDens[i] * data->GainSqInv ,
          lnNdens[i] + data->lnGainInv,
          inst->MESnVar[0][i] + data->lnGainInv,
          data);
    inst->MESnVar[0][i] = lnNdens[i];
    data->outNoiz += tempOnoise;
    data->inNoise += tempInoise;
    if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
        inst->MESnVar[1][i] += tempOnoise;
        inst->MESnVar[1][4] += tempOnoise;
        inst->MESnVar[2][i] += tempInoise;
        inst->MESnVar[2][4] += tempInoise;
                                }
       }
   }
      }
      if (data->prtSummary) {
   for (i=0; i < 5; i++) {
       data->outpVector[data->outNumber++] = noizDens[i];
   }
      }
      break;
  case 2:
      if (((NOISEAN*)ckt->CKTcurJob)->NStpsSm != 0) {
   for (i=0; i < 5; i++) {
       data->outpVector[data->outNumber++] = inst->MESnVar[1][i];
       data->outpVector[data->outNumber++] = inst->MESnVar[2][i];
   }
      }
      break;
  }
  break;
     case 3:
  return (0);
  break;
     }
 }
    }
return(0);
}

canonical_original_code:
int MESnoise(int mode, int operation, struct sGENmodel *genmodel, struct CKTcircuit *ckt, struct Ndata *data, double *OnDens)
{
    struct sMESmodel *firstModel = (MESmodel *) genmodel;
    struct sMESmodel *model;
    struct sMESinstance *inst;
    char name[64];
    double tempOnoise;
    double tempInoise;
    double noizDens[5];
    double lnNdens[5];
    int i;
    static char *MESnNames[5] = {
 "_rd",
 "_rs",
 "_id",
 "_1overf",
 ""
    };
    for (model=firstModel; model != ((void *)0); model=model->MESnextModel) {
 for (inst=model->MESinstances; inst != ((void *)0); inst=inst->MESnextInstance) {
     if (inst->MESowner != ARCHme) continue;
     switch (operation) {
     case 1:
  if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
      switch (mode) {
      case 1:
   for (i=0; i < 5; i++) {
       (void)sprintf(name,"onoise_%s%s",inst->MESname,MESnNames[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 < 5; i++) {
       (void)sprintf(name,"onoise_total_%s%s",inst->MESname,MESnNames[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->MESname,MESnNames[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->MESdrainPrimeNode,inst->MESdrainNode,
     model->MESdrainConduct * inst->MESarea * inst->MESm);
      NevalSrc(&noizDens[1],&lnNdens[1],
     ckt,2,inst->MESsourcePrimeNode,inst->MESsourceNode,
     model->MESsourceConduct * inst->MESarea * inst->MESm);
      NevalSrc(&noizDens[2],&lnNdens[2],
     ckt,2,inst->MESdrainPrimeNode,
     inst->MESsourcePrimeNode,
                                 (2.0/3.0 * inst->MESm * fabs(*(ckt->CKTstates[0] + inst->MESstate+5))));
      NevalSrc(&noizDens[3],(double *)((void *)0),ckt,
     3,inst->MESdrainPrimeNode, inst->MESsourcePrimeNode,
     (double)0.0);
      noizDens[3] *= inst->MESm * model->MESfNcoef *
     exp(model->MESfNexp *
     log(((fabs(*(ckt->CKTstates[0] + inst->MESstate+3))) > (1E-38) ? (fabs(*(ckt->CKTstates[0] + inst->MESstate+3))) : (1E-38)))) /
     data->freq;
      lnNdens[3] =
     log(((noizDens[3]) > (1E-38) ? (noizDens[3]) : (1E-38)));
      noizDens[4] = noizDens[0] +
          noizDens[1] +
          noizDens[2] +
          noizDens[3];
      lnNdens[4] =
     log(((noizDens[4]) > (1E-38) ? (noizDens[4]) : (1E-38)));
      *OnDens += noizDens[4];
      if (data->delFreq == 0.0) {
   for (i=0; i < 5; i++) {
       inst->MESnVar[0][i] = lnNdens[i];
   }
   if (data->freq == ((struct NOISEAN *)ckt->CKTcurJob)->NstartFreq) {
       for (i=0; i < 5; i++) {
    inst->MESnVar[1][i] = 0.0;
    inst->MESnVar[2][i] = 0.0;
       }
   }
      } else {
   for (i=0; i < 5; i++) {
       if (i != 4) {
    tempOnoise = Nintegrate(noizDens[i], lnNdens[i],
          inst->MESnVar[0][i], data);
    tempInoise = Nintegrate(noizDens[i] * data->GainSqInv ,
          lnNdens[i] + data->lnGainInv,
          inst->MESnVar[0][i] + data->lnGainInv,
          data);
    inst->MESnVar[0][i] = lnNdens[i];
    data->outNoiz += tempOnoise;
    data->inNoise += tempInoise;
    if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
        inst->MESnVar[1][i] += tempOnoise;
        inst->MESnVar[1][4] += tempOnoise;
        inst->MESnVar[2][i] += tempInoise;
        inst->MESnVar[2][4] += tempInoise;
                                }
       }
   }
      }
      if (data->prtSummary) {
   for (i=0; i < 5; i++) {
       data->outpVector[data->outNumber++] = noizDens[i];
   }
      }
      break;
  case 2:
      if (((struct NOISEAN *)ckt->CKTcurJob)->NStpsSm != 0) {
   for (i=0; i < 5; i++) {
       data->outpVector[data->outNumber++] = inst->MESnVar[1][i];
       data->outpVector[data->outNumber++] = inst->MESnVar[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 sMESmodel { int MESmodType; struct sMESmodel *MESnextModel; struct sMESinstance { struct sMESmodel *MESmodPtr; struct sMESinstance *MESnextInstance; char *MESname; int MESowner; int MESstate; int MESdrainNode; int MESgateNode; int MESsourceNode; int MESdrainPrimeNode; int MESsourcePrimeNode; double MESarea; double MESm; double MESicVDS; double MESicVGS; double *MESdrainDrainPrimePtr; double *MESgateDrainPrimePtr; double *MESgateSourcePrimePtr; double *MESsourceSourcePrimePtr; double *MESdrainPrimeDrainPtr; double *MESdrainPrimeGatePtr; double *MESdrainPrimeSourcePrimePtr; double *MESsourcePrimeGatePtr; double *MESsourcePrimeSourcePtr; double *MESsourcePrimeDrainPrimePtr; double *MESdrainDrainPtr; double *MESgateGatePtr; double *MESsourceSourcePtr; double *MESdrainPrimeDrainPrimePtr; double *MESsourcePrimeSourcePrimePtr; int MESoff; unsigned int MESareaGiven; unsigned int MESmGiven; unsigned int MESicVDSGiven; unsigned int MESicVGSGiven; int MESmode; double MESdCoeffs[27]; double MESnVar[3][5]; } *MESinstances; char *MESmodName; int MEStype; double MESthreshold; double MESalpha; double MESbeta; double MESlModulation; double MESb; double MESdrainResist; double MESsourceResist; double MEScapGS; double MEScapGD; double MESgatePotential; double MESgateSatCurrent; double MESdepletionCapCoeff; double MESfNcoef; double MESfNexp; double MESdrainConduct; double MESsourceConduct; double MESdepletionCap; double MESf1; double MESf2; double MESf3; double MESvcrit; unsigned int MESthresholdGiven; unsigned int MESalphaGiven; unsigned int MESbetaGiven; unsigned int MESlModulationGiven; unsigned int MESbGiven; unsigned int MESdrainResistGiven; unsigned int MESsourceResistGiven; unsigned int MEScapGSGiven; unsigned int MEScapGDGiven; unsigned int MESgatePotentialGiven; unsigned int MESgateSatCurrentGiven; unsigned int MESdepletionCapCoeffGiven; unsigned int MESfNcoefGiven; unsigned int MESfNexpGiven; } *

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

variable_types:
name
char [64]

variable_types: tempOnoise double

variable_types: tempInoise double

variable_types:
noizDens
double [5]

variable_types:
lnNdens
double [5]

variable_types:
MESnNames
char *[5]

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


LTRAask

repo: gserdyuk/gnucap-a

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

switch ( a3 )
{
case 1:
*a4 = *(_QWORD *)(a2 + 88);
result = 0LL;
break;
case 2:
*a4 = *(_QWORD *)(a2 + 96);
result = 0LL;
break;
case 3:
*a4 = *(_QWORD *)(a2 + 104);
result = 0LL;
break;
case 4:
*a4 = *(_QWORD *)(a2 + 112);
result = 0LL;
break;
case 6:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 7:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 8:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
case 9:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 40);
result = 0LL;
break;
case 10:
*(double *)a4 = (double)*(int *)(a2 + 44);
result = 0LL;
break;
case 11:
*(double *)a4 = (double)*(int *)(a2 + 48);
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 + 88);
result = 0LL;
break;
case 2:
*a4 = *(_QWORD *)(a2 + 96);
result = 0LL;
break;
case 3:
*a4 = *(_QWORD *)(a2 + 104);
result = 0LL;
break;
case 4:
*a4 = *(_QWORD *)(a2 + 112);
result = 0LL;
break;
case 6:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 28);
result = 0LL;
break;
case 7:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 32);
result = 0LL;
break;
case 8:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 36);
result = 0LL;
break;
case 9:
*(_DWORD *)a4 = *(_DWORD *)(a2 + 40);
result = 0LL;
break;
case 10:
*(double *)a4 = (double)*(int *)(a2 + 44);
result = 0LL;
break;
case 11:
*(double *)a4 = (double)*(int *)(a2 + 48);
result = 0LL;
break;
default:
result = 7LL;
break;
}
return result;
}

original_code:
int
LTRAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *select)
{
  LTRAinstance *here = (LTRAinstance *) inst;
  int temp;
  switch (which) {
  case 13:
    value->iValue = here->LTRAposNode1;
    return (0);
  case 14:
    value->iValue = here->LTRAnegNode1;
    return (0);
  case 15:
    value->iValue = here->LTRAposNode2;
    return (0);
  case 16:
    value->iValue = here->LTRAnegNode2;
    return (0);
  case 24:
    value->rValue = here->LTRAmodPtr->LTRAimped;
    return (0);
  case 25:
    value->rValue = here->LTRAmodPtr->LTRAtd;
    return (0);
  case 22:
    value->rValue = here->LTRAmodPtr->LTRAnl;
    return (0);
  case 23:
    value->rValue = here->LTRAmodPtr->LTRAf;
    return (0);
  case 6:
    value->rValue = here->LTRAinitVolt1;
    return (0);
  case 7:
    value->rValue = here->LTRAinitCur1;
    return (0);
  case 8:
    value->rValue = here->LTRAinitVolt2;
    return (0);
  case 9:
    value->rValue = here->LTRAinitCur2;
    return (0);
  case 11:
    value->rValue = here->LTRAmodPtr->LTRAreltol;
    return (0);
  case 12:
    value->rValue = here->LTRAmodPtr->LTRAabstol;
    return (0);
  case 20:
    value->rValue = here->LTRAbrEq1;
    return (0);
  case 21:
    value->rValue = here->LTRAbrEq2;
    return (0);
  case 19:
    value->v.vec.rVec = (double *) ((void *)0);
    value->v.numValue = temp = 0;
    return (0);
  default:
    return (7);
  }
}

canonical_original_code:
int LTRAask(struct CKTcircuit *ckt, struct sGENinstance *inst, int which, union uIFvalue *value, union uIFvalue *select)
{
  struct sLTRAinstance *here = (LTRAinstance *) inst;
  int temp;
  switch (which) {
  case 13:
    value->iValue = here->LTRAposNode1;
    return (0);
  case 14:
    value->iValue = here->LTRAnegNode1;
    return (0);
  case 15:
    value->iValue = here->LTRAposNode2;
    return (0);
  case 16:
    value->iValue = here->LTRAnegNode2;
    return (0);
  case 24:
    value->rValue = here->LTRAmodPtr->LTRAimped;
    return (0);
  case 25:
    value->rValue = here->LTRAmodPtr->LTRAtd;
    return (0);
  case 22:
    value->rValue = here->LTRAmodPtr->LTRAnl;
    return (0);
  case 23:
    value->rValue = here->LTRAmodPtr->LTRAf;
    return (0);
  case 6:
    value->rValue = here->LTRAinitVolt1;
    return (0);
  case 7:
    value->rValue = here->LTRAinitCur1;
    return (0);
  case 8:
    value->rValue = here->LTRAinitVolt2;
    return (0);
  case 9:
    value->rValue = here->LTRAinitCur2;
    return (0);
  case 11:
    value->rValue = here->LTRAmodPtr->LTRAreltol;
    return (0);
  case 12:
    value->rValue = here->LTRAmodPtr->LTRAabstol;
    return (0);
  case 20:
    value->rValue = here->LTRAbrEq1;
    return (0);
  case 21:
    value->rValue = here->LTRAbrEq2;
    return (0);
  case 19:
    value->v.vec.rVec = (double *) ((void *)0);
    value->v.numValue = temp = 0;
    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 sLTRAinstance { struct sLTRAmodel { int LTRAmodType; struct sLTRAmodel *LTRAnextModel; struct sLTRAinstance *LTRAinstances; char *LTRAmodName; double LTRAh1dashFirstVal; double LTRAh2FirstVal; double LTRAh3dashFirstVal; double LTRAh1dashFirstCoeff; double LTRAh2FirstCoeff; double LTRAh3dashFirstCoeff; double *LTRAh1dashCoeffs; double *LTRAh2Coeffs; double *LTRAh3dashCoeffs; int LTRAmodelListSize; double LTRAconduct; double LTRAresist; double LTRAinduct; double LTRAcapac; double LTRAlength; double LTRAtd; double LTRAimped; double LTRAadmit; double LTRAalpha; double LTRAbeta; double LTRAattenuation; double LTRAcByR; double LTRArclsqr; double LTRAintH1dash; double LTRAintH2; double LTRAintH3dash; double LTRAnl; double LTRAf; double LTRAcoshlrootGR; double LTRArRsLrGRorG; double LTRArGsLrGRorR; int LTRAauxIndex; double LTRAstLineReltol; double LTRAchopReltol; double LTRAstLineAbstol; double LTRAchopAbstol; unsigned int LTRAreltolGiven; unsigned int LTRAabstolGiven; unsigned int LTRAtruncNR; unsigned int LTRAtruncDontCut; double LTRAmaxSafeStep; unsigned int LTRAresistGiven; unsigned int LTRAconductGiven; unsigned int LTRAinductGiven; unsigned int LTRAcapacGiven; unsigned int LTRAlengthGiven; unsigned int LTRAnlGiven; int LTRAlteConType; int LTRAhowToInterp; unsigned int LTRAprintFlag; int LTRAstepLimit; unsigned int LTRAfGiven; double LTRAabstol; double LTRAreltol; int LTRAspecialCase; } *LTRAmodPtr; struct sLTRAinstance *LTRAnextInstance; char *LTRAname; int LTRAowner; int LTRAstate; int LTRAposNode1; int LTRAnegNode1; int LTRAposNode2; int LTRAnegNode2; int LTRAbrEq1; int LTRAbrEq2; double LTRAinput1; double LTRAinput2; double LTRAinitVolt1; double LTRAinitCur1; double LTRAinitVolt2; double LTRAinitCur2; double *LTRAv1; double *LTRAi1; double *LTRAv2; double *LTRAi2; int LTRAinstListSize; double *LTRAibr1Ibr1Ptr; double *LTRAibr1Ibr2Ptr; double *LTRAibr1Pos1Ptr; double *LTRAibr1Neg1Ptr; double *LTRAibr1Pos2Ptr; double *LTRAibr1Neg2Ptr; double *LTRAibr2Ibr1Ptr; double *LTRAibr2Ibr2Ptr; double *LTRAibr2Pos1Ptr; double *LTRAibr2Neg1Ptr; double *LTRAibr2Pos2Ptr; double *LTRAibr2Neg2Ptr; double *LTRAneg1Ibr1Ptr; double *LTRAneg2Ibr2Ptr; double *LTRApos1Ibr1Ptr; double *LTRApos2Ibr2Ptr; double *LTRApos1Pos1Ptr; double *LTRAneg1Neg1Ptr; double *LTRApos2Pos2Ptr; double *LTRAneg2Neg2Ptr; unsigned int LTRAicV1Given; unsigned int LTRAicC1Given; unsigned int LTRAicV2Given; unsigned int LTRAicC2Given; } *

variable_types: temp int

return_type: int

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

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

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


BJTsetup

original_code:
int
BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
{
    BJTmodel *model = (BJTmodel*)inModel;
    BJTinstance *here;
    int error;
    CKTnode *tmp;
    for( ; model != ((void *)0); model = model->BJTnextModel ) {
        if(model->BJTtype != 1 && model->BJTtype != -1) {
            model->BJTtype = 1;
        }
        if(!model->BJTsatCurGiven) {
            model->BJTsatCur = 1e-16;
        }
        if(!model->BJTbetaFGiven) {
            model->BJTbetaF = 100;
        }
        if(!model->BJTemissionCoeffFGiven) {
            model->BJTemissionCoeffF = 1;
        }
        if(!model->BJTleakBEemissionCoeffGiven) {
            model->BJTleakBEemissionCoeff = 1.5;
        }
        if(!model->BJTbetaRGiven) {
            model->BJTbetaR = 1;
        }
        if(!model->BJTemissionCoeffRGiven) {
            model->BJTemissionCoeffR = 1;
        }
        if(!model->BJTleakBCemissionCoeffGiven) {
            model->BJTleakBCemissionCoeff = 2;
        }
        if(!model->BJTbaseResistGiven) {
            model->BJTbaseResist = 0;
        }
        if(!model->BJTemitterResistGiven) {
            model->BJTemitterResist = 0;
        }
        if(!model->BJTcollectorResistGiven) {
            model->BJTcollectorResist = 0;
        }
        if(!model->BJTdepletionCapBEGiven) {
            model->BJTdepletionCapBE = 0;
        }
        if(!model->BJTpotentialBEGiven) {
            model->BJTpotentialBE = .75;
        }
        if(!model->BJTjunctionExpBEGiven) {
            model->BJTjunctionExpBE = .33;
        }
        if(!model->BJTtransitTimeFGiven) {
            model->BJTtransitTimeF = 0;
        }
        if(!model->BJTtransitTimeBiasCoeffFGiven) {
            model->BJTtransitTimeBiasCoeffF = 0;
        }
        if(!model->BJTtransitTimeHighCurrentFGiven) {
            model->BJTtransitTimeHighCurrentF = 0;
        }
        if(!model->BJTexcessPhaseGiven) {
            model->BJTexcessPhase = 0;
        }
        if(!model->BJTdepletionCapBCGiven) {
            model->BJTdepletionCapBC = 0;
        }
        if(!model->BJTpotentialBCGiven) {
            model->BJTpotentialBC = .75;
        }
        if(!model->BJTjunctionExpBCGiven) {
            model->BJTjunctionExpBC = .33;
        }
        if(!model->BJTbaseFractionBCcapGiven) {
            model->BJTbaseFractionBCcap = 1;
        }
        if(!model->BJTtransitTimeRGiven) {
            model->BJTtransitTimeR = 0;
        }
        if(!model->BJTcapCSGiven) {
            model->BJTcapCS = 0;
        }
        if(!model->BJTpotentialSubstrateGiven) {
            model->BJTpotentialSubstrate = .75;
        }
        if(!model->BJTexponentialSubstrateGiven) {
            model->BJTexponentialSubstrate = 0;
        }
        if(!model->BJTbetaExpGiven) {
            model->BJTbetaExp = 0;
        }
        if(!model->BJTenergyGapGiven) {
            model->BJTenergyGap = 1.11;
        }
        if(!model->BJTtempExpISGiven) {
            model->BJTtempExpIS = 3;
        }
 if(!model->BJTfNcoefGiven) {
     model->BJTfNcoef = 0;
 }
 if(!model->BJTfNexpGiven) {
     model->BJTfNexp = 1;
 }
        for (here = model->BJTinstances; here != ((void *)0) ;
                here=here->BJTnextInstance) {
     CKTnode *tmpNode;
     IFuid tmpName;
     if (here->BJTowner != ARCHme)
  goto matrixpointers;
            if(!here->BJTareaGiven) {
                here->BJTarea = 1.0;
            }
     if(!here->BJTareabGiven) {
                here->BJTareab = here->BJTarea;
            }
     if(!here->BJTareacGiven) {
                here->BJTareac = here->BJTarea;
            }
     if(!here->BJTmGiven) {
                here->BJTm = 1.0;
            }
            here->BJTstate = *states;
            *states += 21;
            if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & 0x2) ){
                *states += 8 * (ckt->CKTsenInfo->SENparms);
            }
matrixpointers:
            if(model->BJTcollectorResist == 0) {
                here->BJTcolPrimeNode = here->BJTcolNode;
            } else if(here->BJTcolPrimeNode == 0) {
                error = CKTmkVolt(ckt,&tmp,here->BJTname,"collector");
                if(error) return(error);
                here->BJTcolPrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if(model->BJTbaseResist == 0) {
                here->BJTbasePrimeNode = here->BJTbaseNode;
            } else if(here->BJTbasePrimeNode == 0){
                error = CKTmkVolt(ckt,&tmp,here->BJTname, "base");
                if(error) return(error);
                here->BJTbasePrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,2,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if(model->BJTemitterResist == 0) {
                here->BJTemitPrimeNode = here->BJTemitNode;
            } else if(here->BJTemitPrimeNode == 0) {
                error = CKTmkVolt(ckt,&tmp,here->BJTname, "emitter");
                if(error) return(error);
                here->BJTemitPrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if((here->BJTcolColPrimePtr = SMPmakeElt(matrix,here->BJTcolNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseBasePrimePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitEmitPrimePtr = SMPmakeElt(matrix,here->BJTemitNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeColPtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTcolNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeBasePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeColPrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeEmitPtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTemitNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeColPrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolColPtr = SMPmakeElt(matrix,here->BJTcolNode,here->BJTcolNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseBasePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitEmitPtr = SMPmakeElt(matrix,here->BJTemitNode,here->BJTemitNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeColPrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTsubstSubstPtr = SMPmakeElt(matrix,here->BJTsubstNode,here->BJTsubstNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeSubstPtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTsubstNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTsubstColPrimePtr = SMPmakeElt(matrix,here->BJTsubstNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseColPrimePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeBasePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
        }
    }
    return(0);
}

canonical_original_code:
int BJTsetup(void *matrix, struct sGENmodel *inModel, struct CKTcircuit *ckt, int *states)
{
    struct sBJTmodel *model = (BJTmodel*)inModel;
    struct sBJTinstance *here;
    int error;
    struct sCKTnode *tmp;
    for( ; model != ((void *)0); model = model->BJTnextModel ) {
        if(model->BJTtype != 1 && model->BJTtype != -1) {
            model->BJTtype = 1;
        }
        if(!model->BJTsatCurGiven) {
            model->BJTsatCur = 1e-16;
        }
        if(!model->BJTbetaFGiven) {
            model->BJTbetaF = 100;
        }
        if(!model->BJTemissionCoeffFGiven) {
            model->BJTemissionCoeffF = 1;
        }
        if(!model->BJTleakBEemissionCoeffGiven) {
            model->BJTleakBEemissionCoeff = 1.5;
        }
        if(!model->BJTbetaRGiven) {
            model->BJTbetaR = 1;
        }
        if(!model->BJTemissionCoeffRGiven) {
            model->BJTemissionCoeffR = 1;
        }
        if(!model->BJTleakBCemissionCoeffGiven) {
            model->BJTleakBCemissionCoeff = 2;
        }
        if(!model->BJTbaseResistGiven) {
            model->BJTbaseResist = 0;
        }
        if(!model->BJTemitterResistGiven) {
            model->BJTemitterResist = 0;
        }
        if(!model->BJTcollectorResistGiven) {
            model->BJTcollectorResist = 0;
        }
        if(!model->BJTdepletionCapBEGiven) {
            model->BJTdepletionCapBE = 0;
        }
        if(!model->BJTpotentialBEGiven) {
            model->BJTpotentialBE = .75;
        }
        if(!model->BJTjunctionExpBEGiven) {
            model->BJTjunctionExpBE = .33;
        }
        if(!model->BJTtransitTimeFGiven) {
            model->BJTtransitTimeF = 0;
        }
        if(!model->BJTtransitTimeBiasCoeffFGiven) {
            model->BJTtransitTimeBiasCoeffF = 0;
        }
        if(!model->BJTtransitTimeHighCurrentFGiven) {
            model->BJTtransitTimeHighCurrentF = 0;
        }
        if(!model->BJTexcessPhaseGiven) {
            model->BJTexcessPhase = 0;
        }
        if(!model->BJTdepletionCapBCGiven) {
            model->BJTdepletionCapBC = 0;
        }
        if(!model->BJTpotentialBCGiven) {
            model->BJTpotentialBC = .75;
        }
        if(!model->BJTjunctionExpBCGiven) {
            model->BJTjunctionExpBC = .33;
        }
        if(!model->BJTbaseFractionBCcapGiven) {
            model->BJTbaseFractionBCcap = 1;
        }
        if(!model->BJTtransitTimeRGiven) {
            model->BJTtransitTimeR = 0;
        }
        if(!model->BJTcapCSGiven) {
            model->BJTcapCS = 0;
        }
        if(!model->BJTpotentialSubstrateGiven) {
            model->BJTpotentialSubstrate = .75;
        }
        if(!model->BJTexponentialSubstrateGiven) {
            model->BJTexponentialSubstrate = 0;
        }
        if(!model->BJTbetaExpGiven) {
            model->BJTbetaExp = 0;
        }
        if(!model->BJTenergyGapGiven) {
            model->BJTenergyGap = 1.11;
        }
        if(!model->BJTtempExpISGiven) {
            model->BJTtempExpIS = 3;
        }
 if(!model->BJTfNcoefGiven) {
     model->BJTfNcoef = 0;
 }
 if(!model->BJTfNexpGiven) {
     model->BJTfNexp = 1;
 }
        for (here = model->BJTinstances; here != ((void *)0) ;
                here=here->BJTnextInstance) {
     struct sCKTnode *tmpNode;
     char *tmpName;
     if (here->BJTowner != ARCHme)
  goto matrixpointers;
            if(!here->BJTareaGiven) {
                here->BJTarea = 1.0;
            }
     if(!here->BJTareabGiven) {
                here->BJTareab = here->BJTarea;
            }
     if(!here->BJTareacGiven) {
                here->BJTareac = here->BJTarea;
            }
     if(!here->BJTmGiven) {
                here->BJTm = 1.0;
            }
            here->BJTstate = *states;
            *states += 21;
            if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & 0x2) ){
                *states += 8 * (ckt->CKTsenInfo->SENparms);
            }
matrixpointers:
            if(model->BJTcollectorResist == 0) {
                here->BJTcolPrimeNode = here->BJTcolNode;
            } else if(here->BJTcolPrimeNode == 0) {
                error = CKTmkVolt(ckt,&tmp,here->BJTname,"collector");
                if(error) return(error);
                here->BJTcolPrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if(model->BJTbaseResist == 0) {
                here->BJTbasePrimeNode = here->BJTbaseNode;
            } else if(here->BJTbasePrimeNode == 0){
                error = CKTmkVolt(ckt,&tmp,here->BJTname, "base");
                if(error) return(error);
                here->BJTbasePrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,2,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if(model->BJTemitterResist == 0) {
                here->BJTemitPrimeNode = here->BJTemitNode;
            } else if(here->BJTemitPrimeNode == 0) {
                error = CKTmkVolt(ckt,&tmp,here->BJTname, "emitter");
                if(error) return(error);
                here->BJTemitPrimeNode = tmp->number;
                if (ckt->CKTcopyNodesets) {
                  if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==0) {
                     if (tmpNode->nsGiven) {
                       tmp->nodeset=tmpNode->nodeset;
                       tmp->nsGiven=tmpNode->nsGiven;
                     }
                  }
                }
            }
            if((here->BJTcolColPrimePtr = SMPmakeElt(matrix,here->BJTcolNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseBasePrimePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitEmitPrimePtr = SMPmakeElt(matrix,here->BJTemitNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeColPtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTcolNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeBasePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeColPrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeEmitPtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTemitNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeColPrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolColPtr = SMPmakeElt(matrix,here->BJTcolNode,here->BJTcolNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseBasePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitEmitPtr = SMPmakeElt(matrix,here->BJTemitNode,here->BJTemitNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeColPrimePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbasePrimeBasePrimePtr = SMPmakeElt(matrix,here->BJTbasePrimeNode,here->BJTbasePrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTemitPrimeEmitPrimePtr = SMPmakeElt(matrix,here->BJTemitPrimeNode,here->BJTemitPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTsubstSubstPtr = SMPmakeElt(matrix,here->BJTsubstNode,here->BJTsubstNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeSubstPtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTsubstNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTsubstColPrimePtr = SMPmakeElt(matrix,here->BJTsubstNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTbaseColPrimePtr = SMPmakeElt(matrix,here->BJTbaseNode,here->BJTcolPrimeNode))==(double *)((void *)0)){ return(8);}
            if((here->BJTcolPrimeBasePtr = SMPmakeElt(matrix,here->BJTcolPrimeNode,here->BJTbaseNode))==(double *)((void *)0)){ return(8);}
        }
    }
    return(0);
}

variable_types:
matrix
void *

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:
states
int *

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

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

variable_types: error int

variable_types:
tmpName
char *


LTRAacLoad

original_code:
int
LTRAacLoad(GENmodel *inModel, CKTcircuit *ckt)
{
  LTRAmodel *model = (LTRAmodel *) inModel;
  LTRAinstance *here;
  double y0_r, y0_i, lambda_r, lambda_i, mag, theta;
  double exparg_r, exparg_i, explambda_r, explambda_i;
  double y0exp_r, y0exp_i;
  int savemode, error;
  for (; model != ((void *)0); model = model->LTRAnextModel) {
    switch (model->LTRAspecialCase) {
    case 40:
      y0_r = model->LTRAadmit;
      y0_i = 0.0;
      lambda_i = model->LTRAtd * ckt->CKTomega;
      lambda_r = 0.0;
      break;
    case 37:
      theta = 0.5 * atan(model->LTRAresist / (ckt->CKTomega*model->LTRAinduct));
      mag = sqrt(ckt->CKTomega * model->LTRAcapac /
   sqrt(model->LTRAresist * model->LTRAresist +
       ckt->CKTomega * ckt->CKTomega * model->LTRAinduct *
       model->LTRAinduct));
      y0_r = mag * cos(theta);
      y0_i = mag * sin(theta);
      theta = 3.14159265358979323846 / 2 - theta;
      mag *= sqrt(model->LTRAresist * model->LTRAresist +
   ckt->CKTomega * ckt->CKTomega * model->LTRAinduct *
   model->LTRAinduct);
      lambda_r = mag * cos(theta);
      lambda_i = mag * sin(theta);
      break;
    case 38:
      y0_r = y0_i = sqrt(0.5 * ckt->CKTomega * model->LTRAcByR);
      lambda_r = lambda_i =
   sqrt(0.5 * ckt->CKTomega * model->LTRAresist * model->LTRAcapac);
      break;
    case 39:
      savemode = ckt->CKTmode;
      ckt->CKTmode |= 0x70;
      error = LTRAload(inModel, ckt);
      ckt->CKTmode = savemode;
      return (error);
      break;
    default:
      return (7);
    }
    exparg_r = -lambda_r * model->LTRAlength;
    exparg_i = -lambda_i * model->LTRAlength;
    explambda_r = exp(exparg_r) * cos(exparg_i);
    explambda_i = exp(exparg_r) * sin(exparg_i);
    y0exp_r = y0_r * explambda_r - y0_i * explambda_i;
    y0exp_i = y0_r * explambda_i + y0_i * explambda_r;
    for (here = model->LTRAinstances; here != ((void *)0);
 here = here->LTRAnextInstance) {
      if (here->LTRAowner != ARCHme) continue;
      *(here->LTRAibr1Pos1Ptr + 0) += y0_r;
      *(here->LTRAibr1Pos1Ptr + 1) += y0_i;
      *(here->LTRAibr1Neg1Ptr + 0) -= y0_r;
      *(here->LTRAibr1Neg1Ptr + 1) -= y0_i;
      *(here->LTRAibr1Ibr1Ptr + 0) -= 1.0;
      *(here->LTRAibr1Pos2Ptr + 0) -= y0exp_r;
      *(here->LTRAibr1Pos2Ptr + 1) -= y0exp_i;
      *(here->LTRAibr1Neg2Ptr + 0) += y0exp_r;
      *(here->LTRAibr1Neg2Ptr + 1) += y0exp_i;
      *(here->LTRAibr1Ibr2Ptr + 0) -= explambda_r;
      *(here->LTRAibr1Ibr2Ptr + 1) -= explambda_i;
      *(here->LTRAibr2Pos2Ptr + 0) += y0_r;
      *(here->LTRAibr2Pos2Ptr + 1) += y0_i;
      *(here->LTRAibr2Neg2Ptr + 0) -= y0_r;
      *(here->LTRAibr2Neg2Ptr + 1) -= y0_i;
      *(here->LTRAibr2Ibr2Ptr + 0) -= 1.0;
      *(here->LTRAibr2Pos1Ptr + 0) -= y0exp_r;
      *(here->LTRAibr2Pos1Ptr + 1) -= y0exp_i;
      *(here->LTRAibr2Neg1Ptr + 0) += y0exp_r;
      *(here->LTRAibr2Neg1Ptr + 1) += y0exp_i;
      *(here->LTRAibr2Ibr1Ptr + 0) -= explambda_r;
      *(here->LTRAibr2Ibr1Ptr + 1) -= explambda_i;
      *(here->LTRApos1Ibr1Ptr + 0) += 1.0;
      *(here->LTRAneg1Ibr1Ptr + 0) -= 1.0;
      *(here->LTRApos2Ibr2Ptr + 0) += 1.0;
      *(here->LTRAneg2Ibr2Ptr + 0) -= 1.0;
    }
  }
  return (0);
}

canonical_original_code:
int LTRAacLoad(struct sGENmodel *inModel, struct CKTcircuit *ckt)
{
  struct sLTRAmodel *model = (LTRAmodel *) inModel;
  struct sLTRAinstance *here;
  double y0_r; double y0_i; double lambda_r; double lambda_i; double mag; double theta;
  double exparg_r; double exparg_i; double explambda_r; double explambda_i;
  double y0exp_r; double y0exp_i;
  int savemode; int error;
  for (; model != ((void *)0); model = model->LTRAnextModel) {
    switch (model->LTRAspecialCase) {
    case 40:
      y0_r = model->LTRAadmit;
      y0_i = 0.0;
      lambda_i = model->LTRAtd * ckt->CKTomega;
      lambda_r = 0.0;
      break;
    case 37:
      theta = 0.5 * atan(model->LTRAresist / (ckt->CKTomega*model->LTRAinduct));
      mag = sqrt(ckt->CKTomega * model->LTRAcapac /
   sqrt(model->LTRAresist * model->LTRAresist +
       ckt->CKTomega * ckt->CKTomega * model->LTRAinduct *
       model->LTRAinduct));
      y0_r = mag * cos(theta);
      y0_i = mag * sin(theta);
      theta = 3.14159265358979323846 / 2 - theta;
      mag *= sqrt(model->LTRAresist * model->LTRAresist +
   ckt->CKTomega * ckt->CKTomega * model->LTRAinduct *
   model->LTRAinduct);
      lambda_r = mag * cos(theta);
      lambda_i = mag * sin(theta);
      break;
    case 38:
      y0_r = y0_i = sqrt(0.5 * ckt->CKTomega * model->LTRAcByR);
      lambda_r = lambda_i =
   sqrt(0.5 * ckt->CKTomega * model->LTRAresist * model->LTRAcapac);
      break;
    case 39:
      savemode = ckt->CKTmode;
      ckt->CKTmode |= 0x70;
      error = LTRAload(inModel, ckt);
      ckt->CKTmode = savemode;
      return (error);
      break;
    default:
      return (7);
    }
    exparg_r = -lambda_r * model->LTRAlength;
    exparg_i = -lambda_i * model->LTRAlength;
    explambda_r = exp(exparg_r) * cos(exparg_i);
    explambda_i = exp(exparg_r) * sin(exparg_i);
    y0exp_r = y0_r * explambda_r - y0_i * explambda_i;
    y0exp_i = y0_r * explambda_i + y0_i * explambda_r;
    for (here = model->LTRAinstances; here != ((void *)0);
 here = here->LTRAnextInstance) {
      if (here->LTRAowner != ARCHme) continue;
      *(here->LTRAibr1Pos1Ptr + 0) += y0_r;
      *(here->LTRAibr1Pos1Ptr + 1) += y0_i;
      *(here->LTRAibr1Neg1Ptr + 0) -= y0_r;
      *(here->LTRAibr1Neg1Ptr + 1) -= y0_i;
      *(here->LTRAibr1Ibr1Ptr + 0) -= 1.0;
      *(here->LTRAibr1Pos2Ptr + 0) -= y0exp_r;
      *(here->LTRAibr1Pos2Ptr + 1) -= y0exp_i;
      *(here->LTRAibr1Neg2Ptr + 0) += y0exp_r;
      *(here->LTRAibr1Neg2Ptr + 1) += y0exp_i;
      *(here->LTRAibr1Ibr2Ptr + 0) -= explambda_r;
      *(here->LTRAibr1Ibr2Ptr + 1) -= explambda_i;
      *(here->LTRAibr2Pos2Ptr + 0) += y0_r;
      *(here->LTRAibr2Pos2Ptr + 1) += y0_i;
      *(here->LTRAibr2Neg2Ptr + 0) -= y0_r;
      *(here->LTRAibr2Neg2Ptr + 1) -= y0_i;
      *(here->LTRAibr2Ibr2Ptr + 0) -= 1.0;
      *(here->LTRAibr2Pos1Ptr + 0) -= y0exp_r;
      *(here->LTRAibr2Pos1Ptr + 1) -= y0exp_i;
      *(here->LTRAibr2Neg1Ptr + 0) += y0exp_r;
      *(here->LTRAibr2Neg1Ptr + 1) += y0exp_i;
      *(here->LTRAibr2Ibr1Ptr + 0) -= explambda_r;
      *(here->LTRAibr2Ibr1Ptr + 1) -= explambda_i;
      *(here->LTRApos1Ibr1Ptr + 0) += 1.0;
      *(here->LTRAneg1Ibr1Ptr + 0) -= 1.0;
      *(here->LTRApos2Ibr2Ptr + 0) += 1.0;
      *(here->LTRAneg2Ibr2Ptr + 0) -= 1.0;
    }
  }
  return (0);
}

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

variable_types: mag double

variable_types: theta double

variable_types: savemode int

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

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


SWparam

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

if ( a2 == 2 )
{
result = *(unsigned int *)a3;
if ( (_DWORD)result )
{
*(_BYTE *)(a4 + 96) &= 0xFEu;
result = 0LL;
}
}
else if ( a2 == 7 )
{
*(_QWORD *)(a4 + 48) = *a3;
result = 0LL;
}
else
{
result = 7LL;
if ( a2 == 1 )
{
result = *(unsigned int *)a3;
if ( (_DWORD)result )
{
*(_BYTE *)(a4 + 96) |= 1u;
result = 0LL;
}
}
}
return result;
}

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

if ( a2 == 2 )
{
result = *(unsigned int *)a3;
if ( (_DWORD)result )
{
*(_BYTE *)(a4 + 96) &= 0xFEu;
result = 0LL;
}
}
else if ( a2 == 7 )
{
*(_QWORD *)(a4 + 48) = *a3;
result = 0LL;
}
else
{
result = 7LL;
if ( a2 == 1 )
{
result = *(unsigned int *)a3;
if ( (_DWORD)result )
{
*(_BYTE *)(a4 + 96) |= 1u;
result = 0LL;
}
}
}
return result;
}

original_code:
int
SWparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
{
    SWinstance *here = (SWinstance *)inst;
    switch(param) {
        case 1:
            if(value->iValue) {
                here->SWzero_stateGiven = 1;
            }
            break;
        case 2:
            if(value->iValue) {
                here->SWzero_stateGiven = 0;
            }
            break;
        default:
            return(7);
    }
    return(0);
}

canonical_original_code:
int SWparam(int param, union uIFvalue *value, struct sGENinstance *inst, union uIFvalue *select)
{
    struct sSWinstance *here = (SWinstance *)inst;
    switch(param) {
        case 1:
            if(value->iValue) {
                here->SWzero_stateGiven = 1;
            }
            break;
        case 2:
            if(value->iValue) {
                here->SWzero_stateGiven = 0;
            }
            break;
        default:
            return(7);
    }
    return(0);
}

variable_types: param int

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

variable_types: struct sSWinstance { struct sSWmodel { int SWmodType; struct sSWmodel *SWnextModel; struct sSWinstance *SWinstances; char *SWmodName; double SWonResistance; double SWoffResistance; double SWvThreshold; double SWvHysteresis; double SWonConduct; double SWoffConduct; unsigned int SWonGiven; unsigned int SWoffGiven; unsigned int SWthreshGiven; unsigned int SWhystGiven; } *SWmodPtr; struct sSWinstance *SWnextInstance; char *SWname; int SWowner; int SWstate; int SWposNode; int SWnegNode; int SWposCntrlNode; int SWnegCntrlNode; double *SWposPosptr; double *SWnegPosptr; double *SWposNegptr; double *SWnegNegptr; double SWcond; unsigned int SWzero_stateGiven; double SWnVar[3]; } *

user_defined_types: struct sSWinstance { struct sSWmodel *SWmodPtr; struct sSWinstance *SWnextInstance; char *SWname; int SWowner; int SWstate; int SWposNode; int SWnegNode; int SWposCntrlNode; int SWnegCntrlNode; double *SWposPosptr; double *SWnegPosptr; double *SWposNegptr; double *SWnegNegptr; double SWcond; unsigned int SWzero_stateGiven; double SWnVar[3]; }

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