int BSIM4RdsEndSha(Weffcj, Rsh, DMCG, DMCI, DMDG, nuEnd, rgeo, Type, Rend)
double Weffcj, Rsh, DMCG, DMCI, DMDG;
int rgeo, Type;
double nuEnd, *Rend;
{
  if (Type == 1) {
    switch (rgeo) {
    case 1:
    case 2:
    case 5:
      if (nuEnd == 0.0)
        *Rend = 0.0;
      else
        *Rend = Rsh * DMCG / (Weffcj * nuEnd);
      break;
    case 3:
    case 4:
    case 6:
      if (DMCG == 0.0)
        printf("DMCG can not be equal to zero\n");
      if (nuEnd == 0.0)
        *Rend = 0.0;
      else
        *Rend = Rsh * Weffcj / (6.0 * nuEnd * DMCG);
      break;
    default:
      printf("Warning: Specified RGEO = %d not matched\n", rgeo);
    }
  } else {
    switch (rgeo) {
    case 1:
    case 3:
    case 7:
      if (nuEnd == 0.0)
        *Rend = 0.0;
      else
        *Rend = Rsh * DMCG / (Weffcj * nuEnd);
      break;
    case 2:
    case 4:
    case 8:
      if (DMCG == 0.0)
        printf("DMCG can not be equal to zero\n");
      if (nuEnd == 0.0)
        *Rend = 0.0;
      else
        *Rend = Rsh * Weffcj / (6.0 * nuEnd * DMCG);
      break;
    default:
      printf("Warning: Specified RGEO = %d not matched\n", rgeo);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<BSIM4RdsEndSha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
mov    %esi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
cmpl   $0x1,-0x38(%rbp)
jne    1275 <BSIM4RdsEndSha+0x165>
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     1197 <BSIM4RdsEndSha+0x87>
jmp    1161 <BSIM4RdsEndSha+0x51>
mov    -0x44(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x2,%eax
jb     11e4 <BSIM4RdsEndSha+0xd4>
jmp    1175 <BSIM4RdsEndSha+0x65>
mov    -0x44(%rbp),%eax
sub    $0x5,%eax
je     1197 <BSIM4RdsEndSha+0x87>
jmp    1186 <BSIM4RdsEndSha+0x76>
mov    -0x44(%rbp),%eax
sub    $0x6,%eax
je     11e4 <BSIM4RdsEndSha+0xd4>
jmp    125f <BSIM4RdsEndSha+0x14f>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bf <BSIM4RdsEndSha+0xaf>
jp     11bf <BSIM4RdsEndSha+0xaf>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11df <BSIM4RdsEndSha+0xcf>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1270 <BSIM4RdsEndSha+0x160>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    120a <BSIM4RdsEndSha+0xfa>
jp     120a <BSIM4RdsEndSha+0xfa>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1232 <BSIM4RdsEndSha+0x122>
jp     1232 <BSIM4RdsEndSha+0x122>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    125a <BSIM4RdsEndSha+0x14a>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xdbc(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1270 <BSIM4RdsEndSha+0x160>
mov    -0x34(%rbp),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13bc <BSIM4RdsEndSha+0x2ac>
mov    -0x34(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x1,%eax
je     12de <BSIM4RdsEndSha+0x1ce>
jmp    1289 <BSIM4RdsEndSha+0x179>
mov    -0x48(%rbp),%eax
sub    $0x2,%eax
je     132b <BSIM4RdsEndSha+0x21b>
jmp    129a <BSIM4RdsEndSha+0x18a>
mov    -0x48(%rbp),%eax
sub    $0x3,%eax
je     12de <BSIM4RdsEndSha+0x1ce>
jmp    12ab <BSIM4RdsEndSha+0x19b>
mov    -0x48(%rbp),%eax
sub    $0x4,%eax
je     132b <BSIM4RdsEndSha+0x21b>
jmp    12bc <BSIM4RdsEndSha+0x1ac>
mov    -0x48(%rbp),%eax
sub    $0x7,%eax
je     12de <BSIM4RdsEndSha+0x1ce>
jmp    12cd <BSIM4RdsEndSha+0x1bd>
mov    -0x48(%rbp),%eax
sub    $0x8,%eax
je     132b <BSIM4RdsEndSha+0x21b>
jmp    13a6 <BSIM4RdsEndSha+0x296>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1306 <BSIM4RdsEndSha+0x1f6>
jp     1306 <BSIM4RdsEndSha+0x1f6>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1326 <BSIM4RdsEndSha+0x216>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13b7 <BSIM4RdsEndSha+0x2a7>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1351 <BSIM4RdsEndSha+0x241>
jp     1351 <BSIM4RdsEndSha+0x241>
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1379 <BSIM4RdsEndSha+0x269>
jp     1379 <BSIM4RdsEndSha+0x269>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    13a1 <BSIM4RdsEndSha+0x291>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xc75(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13b7 <BSIM4RdsEndSha+0x2a7>
mov    -0x34(%rbp),%esi
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13bc <BSIM4RdsEndSha+0x2ac>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSIM4RdsEndSha>:
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
mov    %edi,%eax
cmp    $0x1,%esi
jne    1155 <BSIM4RdsEndSha+0x35>
cmp    $0x6,%eax
ja     1209 <BSIM4RdsEndSha+0xe9>
mov    $0x26,%ecx
bt     %eax,%ecx
jb     11e2 <BSIM4RdsEndSha+0xc2>
mov    $0x58,%ecx
bt     %eax,%ecx
jb     1176 <BSIM4RdsEndSha+0x56>
jmp    1209 <BSIM4RdsEndSha+0xe9>
cmp    $0x8,%eax
ja     1209 <BSIM4RdsEndSha+0xe9>
mov    $0x8a,%ecx
bt     %eax,%ecx
jb     11e2 <BSIM4RdsEndSha+0xc2>
mov    $0x114,%ecx
bt     %eax,%ecx
jae    1209 <BSIM4RdsEndSha+0xe9>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    11c0 <BSIM4RdsEndSha+0xa0>
jp     11c0 <BSIM4RdsEndSha+0xa0>
lea    0xea9(%rip),%rdi
movsd  %xmm0,0x18(%rsp)
movsd  %xmm5,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm2,(%rsp)
call   1030 <puts@plt>
xorpd  %xmm3,%xmm3
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm5
movsd  0x18(%rsp),%xmm0
ucomisd %xmm3,%xmm5
jne    11c8 <BSIM4RdsEndSha+0xa8>
jnp    11ee <BSIM4RdsEndSha+0xce>
mulsd  0xe30(%rip),%xmm5
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm5
divsd  %xmm5,%xmm0
movsd  %xmm0,(%rbx)
jmp    1219 <BSIM4RdsEndSha+0xf9>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm5
jne    11f7 <BSIM4RdsEndSha+0xd7>
jp     11f7 <BSIM4RdsEndSha+0xd7>
movq   $0x0,(%rbx)
jmp    1219 <BSIM4RdsEndSha+0xf9>
mulsd  %xmm2,%xmm1
mulsd  %xmm5,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
jmp    1219 <BSIM4RdsEndSha+0xf9>
lea    0xdf8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"DMCG can not be equal to zero\0A\00"
@.str.1 = [42 x i8] c"Warning: Specified RGEO = %d not matched\0A\00"
define i32 @BSIM4RdsEndSha(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7, double* %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca double*
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store double* %8, double** %18
%19 = load i32, i32* %17
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %63
21: ; preds = %9
%22 = load i32, i32* %16
switch i32 %22, label %59 [
i32 1, label %23
i32 2, label %23
i32 5, label %23
i32 3, label %38
i32 4, label %38
i32 6, label %38
]
23: ; preds = %21, %21, %21
%24 = load double, double* %15
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load double*, double** %18
store double 0.000000e+00, double* %27
br label %37
28: ; preds = %23
%29 = load double, double* %11
%30 = load double, double* %12
%31 = fmul double %29, %30
%32 = load double, double* %10
%33 = load double, double* %15
%34 = fmul double %32, %33
%35 = fdiv double %31, %34
%36 = load double*, double** %18
store double %35, double* %36
br label %37
37: ; preds = %28, %26
br label %62
38: ; preds = %21, %21, %21
%39 = load double, double* %12
%40 = fcmp oeq double %39, 0.000000e+00
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = load double, double* %15
%45 = fcmp oeq double %44, 0.000000e+00
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = load double*, double** %18
store double 0.000000e+00, double* %47
br label %58
48: ; preds = %43
%49 = load double, double* %11
%50 = load double, double* %10
%51 = fmul double %49, %50
%52 = load double, double* %15
%53 = fmul double 6.000000e+00, %52
%54 = load double, double* %12
%55 = fmul double %53, %54
%56 = fdiv double %51, %55
%57 = load double*, double** %18
store double %56, double* %57
br label %58
58: ; preds = %48, %46
br label %62
59: ; preds = %21
%60 = load i32, i32* %16
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %59, %58, %37
br label %105
63: ; preds = %9
%64 = load i32, i32* %16
switch i32 %64, label %101 [
i32 1, label %65
i32 3, label %65
i32 7, label %65
i32 2, label %80
i32 4, label %80
i32 8, label %80
]
65: ; preds = %63, %63, %63
%66 = load double, double* %15
%67 = fcmp oeq double %66, 0.000000e+00
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = load double*, double** %18
store double 0.000000e+00, double* %69
br label %79
70: ; preds = %65
%71 = load double, double* %11
%72 = load double, double* %12
%73 = fmul double %71, %72
%74 = load double, double* %10
%75 = load double, double* %15
%76 = fmul double %74, %75
%77 = fdiv double %73, %76
%78 = load double*, double** %18
store double %77, double* %78
br label %79
79: ; preds = %70, %68
br label %104
80: ; preds = %63, %63, %63
%81 = load double, double* %12
%82 = fcmp oeq double %81, 0.000000e+00
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %85
85: ; preds = %83, %80
%86 = load double, double* %15
%87 = fcmp oeq double %86, 0.000000e+00
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = load double*, double** %18
store double 0.000000e+00, double* %89
br label %100
90: ; preds = %85
%91 = load double, double* %11
%92 = load double, double* %10
%93 = fmul double %91, %92
%94 = load double, double* %15
%95 = fmul double 6.000000e+00, %94
%96 = load double, double* %12
%97 = fmul double %95, %96
%98 = fdiv double %93, %97
%99 = load double*, double** %18
store double %98, double* %99
br label %100
100: ; preds = %90, %88
br label %104
101: ; preds = %63
%102 = load i32, i32* %16
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %101, %100, %79
br label %105
105: ; preds = %104, %62
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"Warning: Specified RGEO = %d not matched\0A\00"
@str.2 = [30 x i8] c"DMCG can not be equal to zero\00"
define i32 @BSIM4RdsEndSha(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7, double* nocapture writeonly %8) {
%10 = icmp eq i32 %7, 1
br i1 %10, label %11, label %33
11: ; preds = %9
switch i32 %6, label %31 [
i32 1, label %12
i32 2, label %12
i32 5, label %12
i32 3, label %19
i32 4, label %19
i32 6, label %19
]
12: ; preds = %11, %11, %11
%13 = fcmp oeq double %5, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %12
store double 0.000000e+00, double* %8
br label %55
15: ; preds = %12
%16 = fmul double %1, %2
%17 = fmul double %0, %5
%18 = fdiv double %16, %17
store double %18, double* %8
br label %55
19: ; preds = %11, %11, %11
%20 = fcmp oeq double %2, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = fcmp oeq double %5, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %23
store double 0.000000e+00, double* %8
br label %55
26: ; preds = %23
%27 = fmul double %0, %1
%28 = fmul double %5, 6.000000e+00
%29 = fmul double %28, %2
%30 = fdiv double %27, %29
store double %30, double* %8
br label %55
31: ; preds = %11
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %55
33: ; preds = %9
switch i32 %6, label %53 [
i32 1, label %34
i32 3, label %34
i32 7, label %34
i32 2, label %41
i32 4, label %41
i32 8, label %41
]
34: ; preds = %33, %33, %33
%35 = fcmp oeq double %5, 0.000000e+00
br i1 %35, label %36, label %37
36: ; preds = %34
store double 0.000000e+00, double* %8
br label %55
37: ; preds = %34
%38 = fmul double %1, %2
%39 = fmul double %0, %5
%40 = fdiv double %38, %39
store double %40, double* %8
br label %55
41: ; preds = %33, %33, %33
%42 = fcmp oeq double %2, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
%46 = fcmp oeq double %5, 0.000000e+00
br i1 %46, label %47, label %48
47: ; preds = %45
store double 0.000000e+00, double* %8
br label %55
48: ; preds = %45
%49 = fmul double %0, %1
%50 = fmul double %5, 6.000000e+00
%51 = fmul double %50, %2
%52 = fdiv double %49, %51
store double %52, double* %8
br label %55
53: ; preds = %33
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %55
55: ; preds = %53, %37, %36, %48, %47, %31, %15, %14, %26, %25
ret i32 0
}