#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double pow(int, double);
double fi(double z, double a, double EGV) {
  double fiF, I;
  fiF = 0;
  EGV = EGV / 1000.0;
  I = 0.183 * EGV;
  if ((I >= 0) & (I < 0.1)) {
    fiF = pow(
        10, (-0.5 * pow(z, 2) * (pow(I, 0.5) / (1 + 0.33 * a * pow(I, 0.5)))));
  } else {
    if ((0.1 <= I) & (I <= 0.5)) {
      fiF = pow(10, (-0.5 * pow(z, 2) *
                     ((pow(I, 0.5) / 1 + 0.33 * a * pow(I, 0.5)) - 0.2 * I)));
    }
  }
  return fiF;
}


x86 assembly (clang, -O0):
<fi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xebb(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xe8d(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     122b <fi+0x11b>
cvttsd2si -0x8(%rbp),%edi
movsd  0xea7(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x28(%rbp),%edi
movsd  0xe59(%rip),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xe57(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x28(%rbp),%edi
movsd  0xe30(%rip),%xmm0
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm3,%xmm2
movsd  0xe25(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    1319 <fi+0x209>
movsd  -0x28(%rbp),%xmm0
movsd  0xdc8(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
movsd  0xdcc(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1314 <fi+0x204>
cvttsd2si -0x8(%rbp),%edi
movsd  0xdce(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvttsd2si -0x28(%rbp),%edi
movsd  0xd80(%rip),%xmm0
call   1030 <pow@plt>
movsd  0xd8b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd72(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
cvttsd2si -0x28(%rbp),%edi
movsd  0xd4b(%rip),%xmm0
call   1030 <pow@plt>
movsd  -0x58(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  0xd27(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    1319 <fi+0x209>
movsd  -0x20(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fi>:
push   %rbx
sub    $0x20,%rsp
divsd  0xee3(%rip),%xmm2
mulsd  0xee3(%rip),%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jb     11c7 <fi+0xb7>
movsd  0xed5(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    11c7 <fi+0xb7>
cvttsd2si %xmm0,%edi
movsd  0xecf(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <pow@plt>
mulsd  0xebf(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
cvttsd2si 0x8(%rsp),%ebx
movsd  0xe9b(%rip),%xmm0
mov    %ebx,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe99(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
movsd  0xe72(%rip),%xmm0
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  0xe82(%rip),%xmm0
divsd  %xmm0,%xmm1
jmp    126a <fi+0x15a>
ucomisd 0xe41(%rip),%xmm2
jb     1283 <fi+0x173>
movsd  0xe3b(%rip),%xmm3
ucomisd %xmm2,%xmm3
jb     1283 <fi+0x173>
cvttsd2si %xmm0,%edi
movsd  0xe2d(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <pow@plt>
mulsd  0xe1d(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
cvttsd2si 0x8(%rsp),%ebx
movsd  0xdf9(%rip),%xmm0
mov    %ebx,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xdf7(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
movsd  0xdd0(%rip),%xmm0
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
mulsd  0xdd2(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
mov    $0xa,%edi
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
jmp    1030 <pow@plt>
xorps  %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @fi(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
%9 = load double, double* %6
%10 = fdiv double %9, 1.000000e+03
store double %10, double* %6
%11 = load double, double* %6
%12 = fmul double 1.830000e-01, %11
store double %12, double* %8
%13 = load double, double* %8
%14 = fcmp oge double %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = load double, double* %8
%17 = fcmp olt double %16, 1.000000e-01
%18 = zext i1 %17 to i32
%19 = and i32 %15, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %38
21: ; preds = %3
%22 = load double, double* %4
%23 = fptosi double %22 to i32
%24 = call double @pow(i32 %23, double 2.000000e+00)
%25 = fmul double -5.000000e-01, %24
%26 = load double, double* %8
%27 = fptosi double %26 to i32
%28 = call double @pow(i32 %27, double 5.000000e-01)
%29 = load double, double* %5
%30 = fmul double 3.300000e-01, %29
%31 = load double, double* %8
%32 = fptosi double %31 to i32
%33 = call double @pow(i32 %32, double 5.000000e-01)
%34 = call double @llvm.fmuladd.f64(double %30, double %33, double 1.000000e+00)
%35 = fdiv double %28, %34
%36 = fmul double %25, %35
%37 = call double @pow(i32 10, double %36)
store double %37, double* %7
br label %67
38: ; preds = %3
%39 = load double, double* %8
%40 = fcmp ole double 1.000000e-01, %39
%41 = zext i1 %40 to i32
%42 = load double, double* %8
%43 = fcmp ole double %42, 5.000000e-01
%44 = zext i1 %43 to i32
%45 = and i32 %41, %44
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %66
47: ; preds = %38
%48 = load double, double* %4
%49 = fptosi double %48 to i32
%50 = call double @pow(i32 %49, double 2.000000e+00)
%51 = fmul double -5.000000e-01, %50
%52 = load double, double* %8
%53 = fptosi double %52 to i32
%54 = call double @pow(i32 %53, double 5.000000e-01)
%55 = fdiv double %54, 1.000000e+00
%56 = load double, double* %5
%57 = fmul double 3.300000e-01, %56
%58 = load double, double* %8
%59 = fptosi double %58 to i32
%60 = call double @pow(i32 %59, double 5.000000e-01)
%61 = call double @llvm.fmuladd.f64(double %57, double %60, double %55)
%62 = load double, double* %8
%63 = call double @llvm.fmuladd.f64(double -2.000000e-01, double %62, double %61)
%64 = fmul double %51, %63
%65 = call double @pow(i32 10, double %64)
store double %65, double* %7
br label %66
66: ; preds = %47, %38
br label %67
67: ; preds = %66, %21
%68 = load double, double* %7
ret double %68
}

LLVM IR (-O2):
define double @fi(double %0, double %1, double %2) {
%4 = fdiv double %2, 1.000000e+03
%5 = fmul double %4, 1.830000e-01
%6 = fcmp oge double %5, 0.000000e+00
%7 = fcmp olt double %5, 1.000000e-01
%8 = and i1 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %3
%10 = fptosi double %0 to i32
%11 = tail call double @pow(i32 %10, double 2.000000e+00)
%12 = fmul double %11, -5.000000e-01
%13 = fptosi double %5 to i32
%14 = tail call double @pow(i32 %13, double 5.000000e-01)
%15 = fmul double %1, 3.300000e-01
%16 = tail call double @pow(i32 %13, double 5.000000e-01)
%17 = tail call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = fdiv double %14, %17
%19 = fmul double %12, %18
br label %35
20: ; preds = %3
%21 = fcmp oge double %5, 1.000000e-01
%22 = fcmp ole double %5, 5.000000e-01
%23 = and i1 %21, %22
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = fptosi double %0 to i32
%26 = tail call double @pow(i32 %25, double 2.000000e+00)
%27 = fmul double %26, -5.000000e-01
%28 = fptosi double %5 to i32
%29 = tail call double @pow(i32 %28, double 5.000000e-01)
%30 = fmul double %1, 3.300000e-01
%31 = tail call double @pow(i32 %28, double 5.000000e-01)
%32 = tail call double @llvm.fmuladd.f64(double %30, double %31, double %29)
%33 = tail call double @llvm.fmuladd.f64(double %5, double -2.000000e-01, double %32)
%34 = fmul double %27, %33
br label %35
35: ; preds = %9, %24
%36 = phi double [ %34, %24 ], [ %19, %9 ]
%37 = tail call double @pow(i32 10, double %36)
br label %38
38: ; preds = %35, %20
%39 = phi double [ 0.000000e+00, %20 ], [ %37, %35 ]
ret double %39
}