#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(double, int);
double g_0(double bbalb, double ndvi, double tempk, double rnet, double time,
           int roerink) {
  double a, b, result;
  double r0_coef;
  if (time <= 9.0 || time > 15.0)
    r0_coef = 1.1;
  else if (time > 9.0 && time <= 11.0)
    r0_coef = 1.0;
  else if (time > 11.0 && time <= 13.0)
    r0_coef = 0.9;
  else if (time > 13.0 && time <= 15.0)
    r0_coef = 1.0;
  a = (0.0032 * (bbalb / r0_coef) +
       0.0062 * (bbalb / r0_coef) * (bbalb / r0_coef));
  b = (1 - 0.978 * pow(ndvi, 4));
  result = (rnet * (tempk - 273.15) / bbalb) * a * b;
  if (roerink)
    result = result * 1.430 - 0.0845;
  return result;
}


x86 assembly (clang, -O0):
<g_0>:
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)
mov    %edi,-0x2c(%rbp)
movsd  0xec4(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jae    115e <g_0+0x4e>
movsd  -0x28(%rbp),%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1170 <g_0+0x60>
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    122e <g_0+0x11e>
movsd  -0x28(%rbp),%xmm0
movsd  0xe83(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ac <g_0+0x9c>
movsd  0xe81(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     11ac <g_0+0x9c>
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1229 <g_0+0x119>
movsd  -0x28(%rbp),%xmm0
movsd  0xe57(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e8 <g_0+0xd8>
movsd  0xe4d(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     11e8 <g_0+0xd8>
movsd  0xe4a(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1224 <g_0+0x114>
movsd  -0x28(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121f <g_0+0x10f>
movsd  0xe01(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     121f <g_0+0x10f>
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1224 <g_0+0x114>
jmp    1229 <g_0+0x119>
jmp    122e <g_0+0x11e>
movsd  -0x8(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
divsd  -0x50(%rbp),%xmm2
movsd  0xe06(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm2
divsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xde4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd8c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xd89(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     12f7 <g_0+0x1e7>
movsd  -0x48(%rbp),%xmm0
movsd  0xd76(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd72(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_0>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
movsd  %xmm3,0x10(%rsp)
movapd %xmm0,%xmm5
movsd  0xed7(%rip),%xmm0
ucomisd %xmm4,%xmm0
movsd  0xed3(%rip),%xmm0
movsd  %xmm2,0x18(%rsp)
jae    11a7 <g_0+0x97>
ucomisd 0xecb(%rip),%xmm4
ja     11a7 <g_0+0x97>
ucomisd 0xeb1(%rip),%xmm4
jbe    1169 <g_0+0x59>
movsd  0xec7(%rip),%xmm0
ucomisd %xmm4,%xmm0
jb     1169 <g_0+0x59>
movsd  0xeb1(%rip),%xmm0
jmp    11a7 <g_0+0x97>
movsd  0xeb7(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm4,%xmm0
setae  %al
lea    0xedf(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm2
movsd  0xe92(%rip),%xmm0
cmpltsd %xmm4,%xmm0
andpd  %xmm0,%xmm2
movsd  0xe79(%rip),%xmm3
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
movapd %xmm5,%xmm2
divsd  %xmm0,%xmm2
movsd  0xe79(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0xe71(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,%xmm0
mov    $0x4,%edi
movsd  %xmm5,(%rsp)
call   1030 <pow@plt>
mulsd  0xe54(%rip),%xmm0
addsd  0xe24(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  0xe46(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  (%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
test   %ebx,%ebx
je     122b <g_0+0x11b>
mulsd  0xe2d(%rip),%xmm1
addsd  0xe2d(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @g_0(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32 %5, i32* %12
%17 = load double, double* %11
%18 = fcmp ole double %17, 9.000000e+00
br i1 %18, label %22, label %19
19: ; preds = %6
%20 = load double, double* %11
%21 = fcmp ogt double %20, 1.500000e+01
br i1 %21, label %22, label %23
22: ; preds = %19, %6
store double 1.100000e+00, double* %16
br label %47
23: ; preds = %19
%24 = load double, double* %11
%25 = fcmp ogt double %24, 9.000000e+00
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load double, double* %11
%28 = fcmp ole double %27, 1.100000e+01
br i1 %28, label %29, label %30
29: ; preds = %26
store double 1.000000e+00, double* %16
br label %46
30: ; preds = %26, %23
%31 = load double, double* %11
%32 = fcmp ogt double %31, 1.100000e+01
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load double, double* %11
%35 = fcmp ole double %34, 1.300000e+01
br i1 %35, label %36, label %37
36: ; preds = %33
store double 9.000000e-01, double* %16
br label %45
37: ; preds = %33, %30
%38 = load double, double* %11
%39 = fcmp ogt double %38, 1.300000e+01
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load double, double* %11
%42 = fcmp ole double %41, 1.500000e+01
br i1 %42, label %43, label %44
43: ; preds = %40
store double 1.000000e+00, double* %16
br label %44
44: ; preds = %43, %40, %37
br label %45
45: ; preds = %44, %36
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %22
%48 = load double, double* %7
%49 = load double, double* %16
%50 = fdiv double %48, %49
%51 = load double, double* %7
%52 = load double, double* %16
%53 = fdiv double %51, %52
%54 = fmul double 6.200000e-03, %53
%55 = load double, double* %7
%56 = load double, double* %16
%57 = fdiv double %55, %56
%58 = fmul double %54, %57
%59 = call double @llvm.fmuladd.f64(double 3.200000e-03, double %50, double %58)
store double %59, double* %13
%60 = load double, double* %8
%61 = call double @pow(double %60, i32 4)
%62 = call double @llvm.fmuladd.f64(double 0xBFEF4BC6A7EF9DB2, double %61, double 1.000000e+00)
store double %62, double* %14
%63 = load double, double* %10
%64 = load double, double* %9
%65 = fsub double %64, 2.731500e+02
%66 = fmul double %63, %65
%67 = load double, double* %7
%68 = fdiv double %66, %67
%69 = load double, double* %13
%70 = fmul double %68, %69
%71 = load double, double* %14
%72 = fmul double %70, %71
store double %72, double* %15
%73 = load i32, i32* %12
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %47
%76 = load double, double* %15
%77 = call double @llvm.fmuladd.f64(double %76, double 1.430000e+00, double -8.450000e-02)
store double %77, double* %15
br label %78
78: ; preds = %75, %47
%79 = load double, double* %15
ret double %79
}

LLVM IR (-O2):
define double @g_0(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = fcmp ole double %4, 9.000000e+00
%8 = fcmp ogt double %4, 1.500000e+01
%9 = or i1 %7, %8
br i1 %9, label %19, label %10
10: ; preds = %6
%11 = fcmp ogt double %4, 9.000000e+00
%12 = fcmp ole double %4, 1.100000e+01
%13 = and i1 %11, %12
br i1 %13, label %19, label %14
14: ; preds = %10
%15 = fcmp ogt double %4, 1.100000e+01
%16 = fcmp ole double %4, 1.300000e+01
%17 = and i1 %15, %16
%18 = select i1 %17, double 9.000000e-01, double 1.000000e+00
br label %19
19: ; preds = %14, %10, %6
%20 = phi double [ 1.100000e+00, %6 ], [ 1.000000e+00, %10 ], [ %18, %14 ]
%21 = fdiv double %0, %20
%22 = fmul double %21, 6.200000e-03
%23 = fmul double %21, %22
%24 = tail call double @llvm.fmuladd.f64(double %21, double 3.200000e-03, double %23)
%25 = tail call double @pow(double %1, i32 4)
%26 = tail call double @llvm.fmuladd.f64(double %25, double 0xBFEF4BC6A7EF9DB2, double 1.000000e+00)
%27 = fadd double %2, -2.731500e+02
%28 = fmul double %27, %3
%29 = fdiv double %28, %0
%30 = fmul double %29, %24
%31 = fmul double %26, %30
%32 = icmp eq i32 %5, 0
%33 = tail call double @llvm.fmuladd.f64(double %31, double 1.430000e+00, double -8.450000e-02)
%34 = select i1 %32, double %31, double %33
ret double %34
}