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 temp = 0.0, ds = 0.0, e_atm = 0.0, delta = 0.0;
  double tsw_for_e_atm = 0.7;
  e_atm = 1.08 * pow(-log10(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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1060 <log10@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe78(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe60(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xe42(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe26(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe12(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  0xe11(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xdec(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdc3(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xda7(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd8b(%rip),%xmm0
mulsd  0x10(%rbp),%xmm0
movsd  0xd76(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd47(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd2e(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xd09(%rip),%xmm0
movsd  0xd09(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xccb(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcc2(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xc9d(%rip),%xmm0
movsd  0xc9d(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xc64(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xc3b(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc24(%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
%28 = 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 0.000000e+00, double* %27
store double 0x3FE6666666666666, double* %28
%29 = load double, double* %28
%30 = call double @log10(double %29)
%31 = fneg double %30
%32 = call double @pow(double %31, double 2.650000e-01)
%33 = fmul double 1.080000e+00, %32
store double %33, double* %26
%34 = load double, double* %16
%35 = fsub double %34, 9.350000e+01
%36 = fmul double 0x401921FB5A7ED197, %35
%37 = fdiv double %36, 3.650000e+02
%38 = call double @sin(double %37)
%39 = call double @llvm.fmuladd.f64(double 1.672000e-02, double %38, double 1.000000e+00)
store double %39, double* %25
%40 = load double, double* %16
%41 = fmul double 0x401921FB5A7ED197, %40
%42 = fdiv double %41, 3.650000e+02
%43 = fsub double %42, 1.390000e+00
%44 = call double @sin(double %43)
%45 = fmul double 4.093000e-01, %44
store double %45, double* %27
%46 = load double, double* %18
%47 = fmul double %46, 0x400921FB5A7ED197
%48 = fdiv double %47, 1.800000e+02
%49 = call double @cos(double %48)
%50 = load double, double* %15
%51 = fmul double %49, %50
%52 = load double, double* %25
%53 = load double, double* %25
%54 = fmul double %52, %53
%55 = fdiv double %51, %54
%56 = fmul double 1.367000e+03, %55
store double %56, double* %19
%57 = load double, double* %26
%58 = fmul double %57, 5.670000e+00
%59 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%60 = fmul double %58, %59
%61 = load double, double* %12
%62 = load double, double* %13
%63 = fsub double %61, %62
%64 = call double @pow(double %63, double 4.000000e+00)
%65 = fmul double %60, %64
store double %65, double* %20
%66 = load double, double* %14
%67 = fmul double %66, 5.670000e+00
%68 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%69 = fmul double %67, %68
%70 = load double, double* %12
%71 = call double @pow(double %70, double 4.000000e+00)
%72 = fmul double %69, %71
store double %72, double* %21
%73 = load double, double* %14
%74 = fsub double 1.000000e+00, %73
%75 = load double, double* %20
%76 = fmul double %74, %75
store double %76, double* %22
%77 = load double, double* %10
%78 = fsub double 1.000000e+00, %77
%79 = load double, double* %19
%80 = load double, double* %20
%81 = call double @llvm.fmuladd.f64(double %78, double %79, double %80)
%82 = load double, double* %21
%83 = fsub double %81, %82
%84 = load double, double* %22
%85 = fsub double %83, %84
store double %85, double* %23
%86 = load double, double* %23
ret double %86
}

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, 0x3E640E4E4C1C20BB
%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
}