double r_net(double bbalb, double ndvi, double tempk, double dtair, double e0,
             double tsw, double doy, double utc, double sunzangle) {
  double Kin = 0.0, Lin = 0.0, Lout = 0.0, Lcorr = 0.0, result = 0.0;
  double ds = 0.0, e_atm = 0.0, delta = 0.0;
  double tsw_for_e_atm = 0.7;
  e_atm = 1.08 * pow(-log(tsw_for_e_atm), 0.265);
  ds = 1.0 + 0.01672 * sin(2 * 3.1415927 * (doy - 93.5) / 365);
  delta = 0.4093 * sin((2 * 3.1415927 * doy / 365) - 1.39);
  Kin = 1367.0 * (cos(sunzangle * 3.1415927 / 180) * tsw / (ds * ds));
  Lin = (e_atm)*5.67 * pow(10, -8) * pow((tempk - dtair), 4);
  Lout = e0 * 5.67 * pow(10, -8) * pow(tempk, 4);
  Lcorr = (1.0 - e0) * Lin;
  result = (1.0 - bbalb) * Kin + Lin - Lout - Lcorr;
  return result;
}


x86 assembly (clang, -O0):
<r_net>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1050 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe83(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe6b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xe4d(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe1d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  0xe1c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdb0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdf7(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xde2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdce(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xdb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd99(%rip),%xmm0
mulsd  0x10(%rbp),%xmm0
movsd  0xd84(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd55(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd3c(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xd17(%rip),%xmm0
movsd  0xd17(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xcd9(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcd0(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xcab(%rip),%xmm0
movsd  0xcab(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xc72(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xc49(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc32(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_net>:
sub    $0x38,%rsp
movsd  %xmm6,0x8(%rsp)
movsd  %xmm5,0x10(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm0,0x30(%rsp)
movsd  0xea0(%rip),%xmm0
addsd  %xmm6,%xmm0
mulsd  0xe9c(%rip),%xmm0
divsd  0xe9c(%rip),%xmm0
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe81(%rip),%xmm1
divsd  0xe81(%rip),%xmm1
addsd  0xe81(%rip),%xmm1
movapd %xmm0,%xmm2
ucomisd 0xe7d(%rip),%xmm1
jae    12a3 <r_net+0x173>
movsd  0xe77(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    12a3 <r_net+0x173>
mulsd  0xe6d(%rip),%xmm2
addsd  0xe6d(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x40(%rsp),%xmm0
mulsd  0xe61(%rip),%xmm0
divsd  0xe61(%rip),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
mulsd  0xe48(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
movsd  0xe36(%rip),%xmm1
call   1050 <pow@plt>
mulsd  0xe31(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe2b(%rip),%xmm0
mulsd  0x28(%rsp),%xmm0
mulsd  0xe25(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0xdf9(%rip),%xmm1
call   1050 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0xdc6(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm3
mulsd  %xmm3,%xmm1
subsd  0x30(%rsp),%xmm2
mulsd  0x8(%rsp),%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
add    $0x38,%rsp
ret
movapd %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm2
jmp    11bb <r_net+0x8b>

LLVM IR (-O0):
define double @r_net(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = 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 double %6, double* %16
store double %7, double* %17
store double %8, double* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0x3FE6666666666666, double* %27
%28 = load double, double* %27
%29 = call double @log(double %28)
%30 = fneg double %29
%31 = call double @pow(double %30, double 2.650000e-01)
%32 = fmul double 1.080000e+00, %31
store double %32, double* %25
%33 = load double, double* %16
%34 = fsub double %33, 9.350000e+01
%35 = fmul double 0x401921FB5A7ED197, %34
%36 = fdiv double %35, 3.650000e+02
%37 = call double @sin(double %36)
%38 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %37, double 1.000000e+00)
store double %38, double* %24
%39 = load double, double* %16
%40 = fmul double 0x401921FB5A7ED197, %39
%41 = fdiv double %40, 3.650000e+02
%42 = fsub double %41, 1.390000e+00
%43 = call double @sin(double %42)
%44 = fmul double 4.093000e-01, %43
store double %44, double* %26
%45 = load double, double* %18
%46 = fmul double %45, 0x400921FB5A7ED197
%47 = fdiv double %46, 1.800000e+02
%48 = call double @cos(double %47)
%49 = load double, double* %15
%50 = fmul double %48, %49
%51 = load double, double* %24
%52 = load double, double* %24
%53 = fmul double %51, %52
%54 = fdiv double %50, %53
%55 = fmul double 1.367000e+03, %54
store double %55, double* %19
%56 = load double, double* %25
%57 = fmul double %56, 5.670000e+00
%58 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%59 = fmul double %57, %58
%60 = load double, double* %12
%61 = load double, double* %13
%62 = fsub double %60, %61
%63 = call double @pow(double %62, double 4.000000e+00)
%64 = fmul double %59, %63
store double %64, double* %20
%65 = load double, double* %14
%66 = fmul double %65, 5.670000e+00
%67 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%68 = fmul double %66, %67
%69 = load double, double* %12
%70 = call double @pow(double %69, double 4.000000e+00)
%71 = fmul double %68, %70
store double %71, double* %21
%72 = load double, double* %14
%73 = fsub double 1.000000e+00, %72
%74 = load double, double* %20
%75 = fmul double %73, %74
store double %75, double* %22
%76 = load double, double* %10
%77 = fsub double 1.000000e+00, %76
%78 = load double, double* %19
%79 = load double, double* %20
%80 = call double @llvm.fmuladd.f64(double %77, double %78, double %79)
%81 = load double, double* %21
%82 = fsub double %80, %81
%83 = load double, double* %22
%84 = fsub double %82, %83
store double %84, double* %23
%85 = load double, double* %23
ret double %85
}

LLVM IR (-O2):
define double @r_net(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = fadd double %6, -9.350000e+01
%11 = fmul double %10, 0x401921FB5A7ED197
%12 = fdiv double %11, 3.650000e+02
%13 = tail call double @sin(double %12)
%14 = fmul double %6, 0x401921FB5A7ED197
%15 = fdiv double %14, 3.650000e+02
%16 = fadd double %15, -1.390000e+00
%17 = fcmp oeq double %16, 0xFFF0000000000000
%18 = fcmp oeq double %16, 0x7FF0000000000000
%19 = or i1 %18, %17
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = tail call double @sin(double %16)
br label %22
22: ; preds = %9, %20
%23 = tail call double @llvm.fmuladd.f64(double %13, double 1.672000e-02, double 1.000000e+00)
%24 = fmul double %8, 0x400921FB5A7ED197
%25 = fdiv double %24, 1.800000e+02
%26 = tail call double @cos(double %25)
%27 = fmul double %26, %5
%28 = fmul double %23, %23
%29 = fdiv double %27, %28
%30 = fmul double %29, 1.367000e+03
%31 = fsub double %2, %3
%32 = tail call double @pow(double %31, double 4.000000e+00)
%33 = fmul double %32, 0x3E69044253BC121A
%34 = fmul double %4, 5.670000e+00
%35 = fmul double %34, 1.000000e-08
%36 = tail call double @pow(double %2, double 4.000000e+00)
%37 = fmul double %35, %36
%38 = fsub double 1.000000e+00, %4
%39 = fmul double %38, %33
%40 = fsub double 1.000000e+00, %0
%41 = tail call double @llvm.fmuladd.f64(double %40, double %30, double %33)
%42 = fsub double %41, %37
%43 = fsub double %42, %39
ret double %43
}