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(-log(tsw), 0.265);
  ds = 1.0 / pow((1 + 0.033 * cos(2 * 3.1415927 * doy / 365)), 2);
  delta = 0.4093 * sin((2 * 3.1415927 * doy / 365) - 1.39);
  Kin = 1358.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  -0x30(%rbp),%xmm0
call   1050 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe7b(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe3a(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xe25(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0xe2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdb8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe0c(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xd9c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xde3(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0xdce(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdba(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xd9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd82(%rip),%xmm0
mulsd  0x10(%rbp),%xmm0
movsd  0xd6d(%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  0xd3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd25(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xd00(%rip),%xmm0
movsd  0xd00(%rip),%xmm1
call   1060 <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  0xcc2(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcb9(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xc94(%rip),%xmm0
movsd  0xc94(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  0xc5b(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xc32(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xc1b(%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    $0x58,%rsp
movsd  %xmm6,0x8(%rsp)
movaps %xmm4,0x40(%rsp)
movsd  %xmm3,0x30(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm0,0x38(%rsp)
movsd  %xmm5,0x28(%rsp)
movaps %xmm5,%xmm0
call   1050 <log@plt>
xorps  0xe8a(%rip),%xmm0
movsd  0xeb2(%rip),%xmm1
call   1060 <pow@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xea2(%rip),%xmm0
divsd  0xea2(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm1
addsd  0xe91(%rip),%xmm1
movapd %xmm0,%xmm2
ucomisd 0xe8d(%rip),%xmm1
jae    1301 <r_net+0x1c1>
movsd  0xe87(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    1301 <r_net+0x1c1>
mulsd  0xe7d(%rip),%xmm2
movsd  0xe7d(%rip),%xmm0
addsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  0xe65(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0x60(%rsp),%xmm0
mulsd  0xe59(%rip),%xmm0
divsd  0xe59(%rip),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
mulsd  0xe40(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  0xe34(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
movsd  0xe22(%rip),%xmm1
call   1060 <pow@plt>
movapd 0x40(%rsp),%xmm1
unpcklpd 0x10(%rsp),%xmm1
mulpd  0xd81(%rip),%xmm1
movapd 0xd89(%rip),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0xde5(%rip),%xmm1
call   1060 <pow@plt>
movsd  0xda8(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  0x40(%rsp),%xmm1
unpcklpd %xmm1,%xmm0
movapd 0x10(%rsp),%xmm1
mulpd  %xmm1,%xmm0
subsd  0x38(%rsp),%xmm2
mulsd  0x8(%rsp),%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret
movapd %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm2
jmp    11db <r_net+0x9b>

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* %15
%30 = call double @log(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 = fmul double 0x401921FB5A7ED197, %34
%36 = fdiv double %35, 3.650000e+02
%37 = call double @cos(double %36)
%38 = call double @llvm.fmuladd.f64(double 3.300000e-02, double %37, double 1.000000e+00)
%39 = call double @pow(double %38, double 2.000000e+00)
%40 = fdiv double 1.000000e+00, %39
store double %40, double* %25
%41 = load double, double* %16
%42 = fmul double 0x401921FB5A7ED197, %41
%43 = fdiv double %42, 3.650000e+02
%44 = fsub double %43, 1.390000e+00
%45 = call double @sin(double %44)
%46 = fmul double 4.093000e-01, %45
store double %46, double* %27
%47 = load double, double* %18
%48 = fmul double %47, 0x400921FB5A7ED197
%49 = fdiv double %48, 1.800000e+02
%50 = call double @cos(double %49)
%51 = load double, double* %15
%52 = fmul double %50, %51
%53 = load double, double* %25
%54 = load double, double* %25
%55 = fmul double %53, %54
%56 = fdiv double %52, %55
%57 = fmul double 1.358000e+03, %56
store double %57, double* %19
%58 = load double, double* %26
%59 = fmul double %58, 5.670000e+00
%60 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%61 = fmul double %59, %60
%62 = load double, double* %12
%63 = load double, double* %13
%64 = fsub double %62, %63
%65 = call double @pow(double %64, double 4.000000e+00)
%66 = fmul double %61, %65
store double %66, double* %20
%67 = load double, double* %14
%68 = fmul double %67, 5.670000e+00
%69 = call double @pow(double 1.000000e+01, double -8.000000e+00)
%70 = fmul double %68, %69
%71 = load double, double* %12
%72 = call double @pow(double %71, double 4.000000e+00)
%73 = fmul double %70, %72
store double %73, double* %21
%74 = load double, double* %14
%75 = fsub double 1.000000e+00, %74
%76 = load double, double* %20
%77 = fmul double %75, %76
store double %77, double* %22
%78 = load double, double* %10
%79 = fsub double 1.000000e+00, %78
%80 = load double, double* %19
%81 = load double, double* %20
%82 = call double @llvm.fmuladd.f64(double %79, double %80, double %81)
%83 = load double, double* %21
%84 = fsub double %82, %83
%85 = load double, double* %22
%86 = fsub double %84, %85
store double %86, double* %23
%87 = load double, double* %23
ret double %87
}

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 = tail call double @log(double %5)
%11 = fneg double %10
%12 = tail call double @pow(double %11, double 2.650000e-01)
%13 = fmul double %6, 0x401921FB5A7ED197
%14 = fdiv double %13, 3.650000e+02
%15 = tail call double @cos(double %14)
%16 = fadd double %14, -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 %15, double 3.300000e-02, double 1.000000e+00)
%24 = fmul double %23, %23
%25 = fdiv double 1.000000e+00, %24
%26 = fmul double %12, 1.080000e+00
%27 = fmul double %8, 0x400921FB5A7ED197
%28 = fdiv double %27, 1.800000e+02
%29 = tail call double @cos(double %28)
%30 = fmul double %29, %5
%31 = fmul double %25, %25
%32 = fdiv double %30, %31
%33 = fmul double %32, 1.358000e+03
%34 = fmul double %26, 5.670000e+00
%35 = fsub double %2, %3
%36 = tail call double @pow(double %35, double 4.000000e+00)
%37 = insertelement <2 x double> poison, double %4, i64 0
%38 = insertelement <2 x double> %37, double %34, i64 1
%39 = fmul <2 x double> %38, <double 5.670000e+00, double 1.000000e-08>
%40 = insertelement <2 x double> <double 1.000000e-08, double poison>, double %36, i64 1
%41 = fmul <2 x double> %39, %40
%42 = tail call double @pow(double %2, double 4.000000e+00)
%43 = fsub double 1.000000e+00, %4
%44 = insertelement <2 x double> poison, double %42, i64 0
%45 = insertelement <2 x double> %44, double %43, i64 1
%46 = fmul <2 x double> %41, %45
%47 = fsub double 1.000000e+00, %0
%48 = extractelement <2 x double> %41, i64 1
%49 = tail call double @llvm.fmuladd.f64(double %47, double %33, double %48)
%50 = extractelement <2 x double> %46, i64 0
%51 = fsub double %49, %50
%52 = extractelement <2 x double> %46, i64 1
%53 = fsub double %51, %52
ret double %53
}