double spmpar(int *i) {
  static int K1 = 4;
  static int K2 = 8;
  static int K3 = 9;
  static int K4 = 10;
  static double spmpar, b, binv, bm1, one, w, z;
  static int emax, emin, ibeta, m;
  if (*i > 1)
    goto S10;
  b = ipmpar(&K1);
  m = ipmpar(&K2);
  spmpar = pow(b, (double)(1 - m));
  return spmpar;
S10:
  if (*i > 2)
    goto S20;
  b = ipmpar(&K1);
  emin = ipmpar(&K3);
  one = 1.0;
  binv = one / b;
  w = pow(b, (double)(emin + 2));
  spmpar = w * binv * binv * binv;
  return spmpar;
S20:
  ibeta = ipmpar(&K1);
  m = ipmpar(&K2);
  emax = ipmpar(&K4);
  b = ibeta;
  bm1 = ibeta - 1;
  one = 1.0;
  z = pow(b, (double)(m - 1));
  w = ((z - one) * b + bm1) / (b * z);
  z = pow(b, (double)(emax - 2));
  spmpar = w * z * b * b;
  return spmpar;
}


x86 assembly (clang, -O0):
<spmpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jle    113e <spmpar+0x1e>
jmp    11a2 <spmpar+0x82>
lea    0x2eeb(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2ef8(%rip)
lea    0x2ed5(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
mov    %eax,0x2f20(%rip)
movsd  0x2edc(%rip),%xmm0
mov    $0x1,%eax
sub    0x2f0d(%rip),%eax
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x2eb8(%rip)
movsd  0x2eb0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1394 <spmpar+0x274>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
jle    11b4 <spmpar+0x94>
jmp    1266 <spmpar+0x146>
lea    0x2e75(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2e82(%rip)
lea    0x2e63(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
mov    %eax,0x2ea2(%rip)
movsd  0xe16(%rip),%xmm0
movsd  %xmm0,0x2e76(%rip)
movsd  0x2e6e(%rip),%xmm0
divsd  0x2e4e(%rip),%xmm0
movsd  %xmm0,0x2e4e(%rip)
movsd  0x2e3e(%rip),%xmm0
mov    0x2e6c(%rip),%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x2e44(%rip)
movsd  0x2e3c(%rip),%xmm0
mulsd  0x2e1c(%rip),%xmm0
mulsd  0x2e14(%rip),%xmm0
mulsd  0x2e0c(%rip),%xmm0
movsd  %xmm0,0x2df4(%rip)
movsd  0x2dec(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1394 <spmpar+0x274>
lea    0x2dc3(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
mov    %eax,0x2e0e(%rip)
lea    0x2db3(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
mov    %eax,0x2dfe(%rip)
lea    0x2da7(%rip),%rdi
mov    $0x0,%al
call   1030 <ipmpar@plt>
mov    %eax,0x2dde(%rip)
cvtsi2sdl 0x2dde(%rip),%xmm0
movsd  %xmm0,0x2d9e(%rip)
mov    0x2dd0(%rip),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2d99(%rip)
movsd  0xd31(%rip),%xmm0
movsd  %xmm0,0x2d91(%rip)
movsd  0x2d71(%rip),%xmm0
mov    0x2da7(%rip),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x2d7f(%rip)
movsd  0x2d77(%rip),%xmm0
subsd  0x2d5f(%rip),%xmm0
movsd  0x2d3f(%rip),%xmm2
movsd  0x2d47(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2d27(%rip),%xmm1
mulsd  0x2d47(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2d33(%rip)
movsd  0x2d0b(%rip),%xmm0
mov    0x2d35(%rip),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x2d19(%rip)
movsd  0x2d09(%rip),%xmm0
mulsd  0x2d09(%rip),%xmm0
mulsd  0x2cd9(%rip),%xmm0
mulsd  0x2cd1(%rip),%xmm0
movsd  %xmm0,0x2cc1(%rip)
movsd  0x2cb9(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spmpar>:
push   %rbx
mov    (%rdi),%ebx
lea    0x2f06(%rip),%rdi
xor    %eax,%eax
cmp    $0x1,%ebx
jle    11ae <spmpar+0x8e>
call   1030 <ipmpar@plt>
cmp    $0x2,%ebx
jne    11ec <spmpar+0xcc>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2efd(%rip)
lea    0x2ee6(%rip),%rdi
xor    %eax,%eax
call   1030 <ipmpar@plt>
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x2ef6(%rip)
movsd  0x2ed6(%rip),%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x2eca(%rip)
add    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x2ecb(%rip)
movsd  0x2eab(%rip),%xmm1
mulsd  %xmm1,%xmm0
jmp    12ba <spmpar+0x19a>
call   1030 <ipmpar@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2e89(%rip)
lea    0x2e6e(%rip),%rdi
xor    %eax,%eax
call   1030 <ipmpar@plt>
mov    %eax,0x2ea5(%rip)
movsd  0x2e6d(%rip),%xmm0
mov    $0x1,%ecx
sub    %eax,%ecx
cvtsi2sd %ecx,%xmm1
pop    %rbx
jmp    1040 <pow@plt>
mov    %eax,0x2e82(%rip)
lea    0x2e3b(%rip),%rdi
xor    %eax,%eax
call   1030 <ipmpar@plt>
mov    %eax,0x2e72(%rip)
lea    0x2e2f(%rip),%rdi
xor    %eax,%eax
call   1030 <ipmpar@plt>
mov    0x2e5a(%rip),%ecx
cvtsi2sd %ecx,%xmm0
mov    %eax,0x2e4c(%rip)
add    $0xffffffff,%ecx
cvtsi2sd %ecx,%xmm1
movsd  %xmm0,0x2e15(%rip)
movsd  %xmm1,0x2e1d(%rip)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x2e14(%rip)
mov    0x2e26(%rip),%eax
add    $0xffffffff,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movapd %xmm0,%xmm1
subsd  0x2df3(%rip),%xmm1
movsd  0x2dd3(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  0x2dd7(%rip),%xmm1
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x2dd7(%rip)
mov    0x2dd9(%rip),%eax
add    $0xfffffffe,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd %xmm2,%xmm0
call   1040 <pow@plt>
mulsd  0x2db6(%rip),%xmm0
movsd  0x2d8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
@spmpar.K1 = internal global i32 4
@spmpar.K2 = internal global i32 8
@spmpar.K3 = internal global i32 9
@spmpar.K4 = internal global i32 10
@spmpar.spmpar = internal global double 0.000000e+00
@spmpar.b = internal global double 0.000000e+00
@spmpar.binv = internal global double 0.000000e+00
@spmpar.bm1 = internal global double 0.000000e+00
@spmpar.one = internal global double 0.000000e+00
@spmpar.w = internal global double 0.000000e+00
@spmpar.z = internal global double 0.000000e+00
@spmpar.emax = internal global i32 0
@spmpar.emin = internal global i32 0
@spmpar.ibeta = internal global i32 0
@spmpar.m = internal global i32 0
define double @spmpar(i32* %0) {
%2 = alloca double
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
br label %18
8: ; preds = %1
%9 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K1)
%10 = sitofp i32 %9 to double
store double %10, double* @spmpar.b
%11 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K2)
store i32 %11, i32* @spmpar.m
%12 = load double, double* @spmpar.b
%13 = load i32, i32* @spmpar.m
%14 = sub nsw i32 1, %13
%15 = sitofp i32 %14 to double
%16 = call double @pow(double %12, double %15)
store double %16, double* @spmpar.spmpar
%17 = load double, double* @spmpar.spmpar
store double %17, double* %2
br label %80
18: ; preds = %7
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = icmp sgt i32 %20, 2
br i1 %21, label %22, label %23
22: ; preds = %18
br label %43
23: ; preds = %18
%24 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K1)
%25 = sitofp i32 %24 to double
store double %25, double* @spmpar.b
%26 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K3)
store i32 %26, i32* @spmpar.emin
store double 1.000000e+00, double* @spmpar.one
%27 = load double, double* @spmpar.one
%28 = load double, double* @spmpar.b
%29 = fdiv double %27, %28
store double %29, double* @spmpar.binv
%30 = load double, double* @spmpar.b
%31 = load i32, i32* @spmpar.emin
%32 = add nsw i32 %31, 2
%33 = sitofp i32 %32 to double
%34 = call double @pow(double %30, double %33)
store double %34, double* @spmpar.w
%35 = load double, double* @spmpar.w
%36 = load double, double* @spmpar.binv
%37 = fmul double %35, %36
%38 = load double, double* @spmpar.binv
%39 = fmul double %37, %38
%40 = load double, double* @spmpar.binv
%41 = fmul double %39, %40
store double %41, double* @spmpar.spmpar
%42 = load double, double* @spmpar.spmpar
store double %42, double* %2
br label %80
43: ; preds = %22
%44 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K1)
store i32 %44, i32* @spmpar.ibeta
%45 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K2)
store i32 %45, i32* @spmpar.m
%46 = call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K4)
store i32 %46, i32* @spmpar.emax
%47 = load i32, i32* @spmpar.ibeta
%48 = sitofp i32 %47 to double
store double %48, double* @spmpar.b
%49 = load i32, i32* @spmpar.ibeta
%50 = sub nsw i32 %49, 1
%51 = sitofp i32 %50 to double
store double %51, double* @spmpar.bm1
store double 1.000000e+00, double* @spmpar.one
%52 = load double, double* @spmpar.b
%53 = load i32, i32* @spmpar.m
%54 = sub nsw i32 %53, 1
%55 = sitofp i32 %54 to double
%56 = call double @pow(double %52, double %55)
store double %56, double* @spmpar.z
%57 = load double, double* @spmpar.z
%58 = load double, double* @spmpar.one
%59 = fsub double %57, %58
%60 = load double, double* @spmpar.b
%61 = load double, double* @spmpar.bm1
%62 = call double @llvm.fmuladd.f64(double %59, double %60, double %61)
%63 = load double, double* @spmpar.b
%64 = load double, double* @spmpar.z
%65 = fmul double %63, %64
%66 = fdiv double %62, %65
store double %66, double* @spmpar.w
%67 = load double, double* @spmpar.b
%68 = load i32, i32* @spmpar.emax
%69 = sub nsw i32 %68, 2
%70 = sitofp i32 %69 to double
%71 = call double @pow(double %67, double %70)
store double %71, double* @spmpar.z
%72 = load double, double* @spmpar.w
%73 = load double, double* @spmpar.z
%74 = fmul double %72, %73
%75 = load double, double* @spmpar.b
%76 = fmul double %74, %75
%77 = load double, double* @spmpar.b
%78 = fmul double %76, %77
store double %78, double* @spmpar.spmpar
%79 = load double, double* @spmpar.spmpar
store double %79, double* %2
br label %80
80: ; preds = %43, %23, %8
%81 = load double, double* %2
ret double %81
}

LLVM IR (-O2):
@spmpar.K1 = internal global i32 4
@spmpar.K2 = internal global i32 8
@spmpar.K3 = internal global i32 9
@spmpar.K4 = internal global i32 10
@spmpar.b = internal unnamed_addr global double 0.000000e+00
@spmpar.binv = internal unnamed_addr global double 0.000000e+00
@spmpar.bm1 = internal unnamed_addr global double 0.000000e+00
@spmpar.one = internal unnamed_addr global double 0.000000e+00
@spmpar.w = internal unnamed_addr global double 0.000000e+00
@spmpar.emax = internal unnamed_addr global i32 0
@spmpar.ibeta = internal unnamed_addr global i32 0
@spmpar.m = internal unnamed_addr global i32 0
define double @spmpar(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp sgt i32 %2, 1
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K1)
%6 = sitofp i32 %5 to double
store double %6, double* @spmpar.b
%7 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K2)
store i32 %7, i32* @spmpar.m
%8 = load double, double* @spmpar.b
%9 = sub nsw i32 1, %7
%10 = sitofp i32 %9 to double
%11 = tail call double @pow(double %8, double %10)
br label %54
12: ; preds = %1
%13 = icmp eq i32 %2, 2
%14 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K1)
br i1 %13, label %15, label %27
15: ; preds = %12
%16 = sitofp i32 %14 to double
store double %16, double* @spmpar.b
%17 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K3)
store double 1.000000e+00, double* @spmpar.one
%18 = load double, double* @spmpar.b
%19 = fdiv double 1.000000e+00, %18
store double %19, double* @spmpar.binv
%20 = add nsw i32 %17, 2
%21 = sitofp i32 %20 to double
%22 = tail call double @pow(double %18, double %21)
store double %22, double* @spmpar.w
%23 = load double, double* @spmpar.binv
%24 = fmul double %22, %23
%25 = fmul double %23, %24
%26 = fmul double %23, %25
br label %54
27: ; preds = %12
store i32 %14, i32* @spmpar.ibeta
%28 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K2)
store i32 %28, i32* @spmpar.m
%29 = tail call i32 (i32*, ...) bitcast (i32 (...)* @ipmpar to i32 (i32*, ...)*)(i32* @spmpar.K4)
store i32 %29, i32* @spmpar.emax
%30 = load i32, i32* @spmpar.ibeta
%31 = sitofp i32 %30 to double
store double %31, double* @spmpar.b
%32 = add nsw i32 %30, -1
%33 = sitofp i32 %32 to double
store double %33, double* @spmpar.bm1
store double 1.000000e+00, double* @spmpar.one
%34 = load i32, i32* @spmpar.m
%35 = add nsw i32 %34, -1
%36 = sitofp i32 %35 to double
%37 = tail call double @pow(double %31, double %36)
%38 = load double, double* @spmpar.one
%39 = fsub double %37, %38
%40 = load double, double* @spmpar.b
%41 = load double, double* @spmpar.bm1
%42 = tail call double @llvm.fmuladd.f64(double %39, double %40, double %41)
%43 = fmul double %37, %40
%44 = fdiv double %42, %43
store double %44, double* @spmpar.w
%45 = load i32, i32* @spmpar.emax
%46 = add nsw i32 %45, -2
%47 = sitofp i32 %46 to double
%48 = tail call double @pow(double %40, double %47)
%49 = load double, double* @spmpar.w
%50 = fmul double %48, %49
%51 = load double, double* @spmpar.b
%52 = fmul double %50, %51
%53 = fmul double %51, %52
br label %54
54: ; preds = %27, %15, %4
%55 = phi double [ %53, %27 ], [ %26, %15 ], [ %11, %4 ]
ret double %55
}