#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 advected_sensible_heat(double SnowCoverFract, double AirDens,
                              double Tair, double TGrnd, double Ra) {
  double Qbare;
  double Qadv;
  double Fs;
  double val;
  Qbare = AirDens * 1013.0 * (Tair - TGrnd) / Ra;
  if (SnowCoverFract > 0.6)
    Fs = 1.0;
  else if (SnowCoverFract > 0.5) {
    val = 3. * SnowCoverFract - 1.8;
    Fs = pow(10, val);
  } else if (SnowCoverFract > 0.2) {
    val = 5.6667 * SnowCoverFract - 3.1333;
    Fs = pow(10, val);
  } else
    Fs = 0.01;
  Qadv = (Qbare * (1.0 - SnowCoverFract)) / SnowCoverFract * Fs;
  return (Qadv);
}


x86 assembly (clang, -O0):
<advected_sensible_heat>:
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)
movsd  0xecf(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117f <advected_sensible_heat+0x6f>
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    123a <advected_sensible_heat+0x12a>
movsd  -0x8(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d1 <advected_sensible_heat+0xc1>
movsd  -0x8(%rbp),%xmm0
movsd  0xe95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    1235 <advected_sensible_heat+0x125>
movsd  -0x8(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1223 <advected_sensible_heat+0x113>
movsd  -0x8(%rbp),%xmm0
movsd  0xe33(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    1230 <advected_sensible_heat+0x120>
movsd  0xdf5(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1235 <advected_sensible_heat+0x125>
jmp    123a <advected_sensible_heat+0x12a>
movsd  -0x30(%rbp),%xmm0
movsd  0xe01(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<advected_sensible_heat>:
sub    $0x28,%rsp
movapd %xmm0,%xmm5
movsd  0xee0(%rip),%xmm6
ucomisd 0xee0(%rip),%xmm0
movapd %xmm6,%xmm0
ja     11e3 <advected_sensible_heat+0xd3>
ucomisd 0xed6(%rip),%xmm5
jbe    116f <advected_sensible_heat+0x5f>
movsd  %xmm1,(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  0xedd(%rip),%xmm0
movsd  %xmm5,0x20(%rsp)
mulsd  %xmm5,%xmm0
addsd  0xed3(%rip),%xmm0
jmp    11aa <advected_sensible_heat+0x9a>
ucomisd 0xea9(%rip),%xmm5
jbe    11db <advected_sensible_heat+0xcb>
movsd  %xmm1,(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  0xe90(%rip),%xmm0
movsd  %xmm5,0x20(%rsp)
mulsd  %xmm5,%xmm0
addsd  0xe86(%rip),%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  0xe44(%rip),%xmm6
movsd  0x20(%rsp),%xmm5
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm1
jmp    11e3 <advected_sensible_heat+0xd3>
movsd  0xe35(%rip),%xmm0
mulsd  0xe5d(%rip),%xmm1
subsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm4,%xmm2
subsd  %xmm5,%xmm6
mulsd  %xmm2,%xmm6
divsd  %xmm5,%xmm6
mulsd  %xmm0,%xmm6
movapd %xmm6,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @advected_sensible_heat(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%15 = load double, double* %7
%16 = fmul double %15, 1.013000e+03
%17 = load double, double* %8
%18 = load double, double* %9
%19 = fsub double %17, %18
%20 = fmul double %16, %19
%21 = load double, double* %10
%22 = fdiv double %20, %21
store double %22, double* %11
%23 = load double, double* %6
%24 = fcmp ogt double %23, 6.000000e-01
br i1 %24, label %25, label %26
25: ; preds = %5
store double 1.000000e+00, double* %13
br label %45
26: ; preds = %5
%27 = load double, double* %6
%28 = fcmp ogt double %27, 5.000000e-01
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load double, double* %6
%31 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %30, double -1.800000e+00)
store double %31, double* %14
%32 = load double, double* %14
%33 = call double @pow(i32 10, double %32)
store double %33, double* %13
br label %44
34: ; preds = %26
%35 = load double, double* %6
%36 = fcmp ogt double %35, 2.000000e-01
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load double, double* %6
%39 = call double @llvm.fmuladd.f64(double 5.666700e+00, double %38, double -3.133300e+00)
store double %39, double* %14
%40 = load double, double* %14
%41 = call double @pow(i32 10, double %40)
store double %41, double* %13
br label %43
42: ; preds = %34
store double 1.000000e-02, double* %13
br label %43
43: ; preds = %42, %37
br label %44
44: ; preds = %43, %29
br label %45
45: ; preds = %44, %25
%46 = load double, double* %11
%47 = load double, double* %6
%48 = fsub double 1.000000e+00, %47
%49 = fmul double %46, %48
%50 = load double, double* %6
%51 = fdiv double %49, %50
%52 = load double, double* %13
%53 = fmul double %51, %52
store double %53, double* %12
%54 = load double, double* %12
ret double %54
}

LLVM IR (-O2):
define double @advected_sensible_heat(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp ogt double %0, 6.000000e-01
br i1 %6, label %18, label %7
7: ; preds = %5
%8 = fcmp ogt double %0, 5.000000e-01
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call double @llvm.fmuladd.f64(double %0, double 3.000000e+00, double -1.800000e+00)
br label %15
11: ; preds = %7
%12 = fcmp ogt double %0, 2.000000e-01
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = tail call double @llvm.fmuladd.f64(double %0, double 5.666700e+00, double -3.133300e+00)
br label %15
15: ; preds = %13, %9
%16 = phi double [ %10, %9 ], [ %14, %13 ]
%17 = tail call double @pow(i32 10, double %16)
br label %18
18: ; preds = %15, %11, %5
%19 = phi double [ 1.000000e+00, %5 ], [ 1.000000e-02, %11 ], [ %17, %15 ]
%20 = fmul double %1, 1.013000e+03
%21 = fsub double %2, %3
%22 = fmul double %20, %21
%23 = fdiv double %22, %4
%24 = fsub double 1.000000e+00, %0
%25 = fmul double %24, %23
%26 = fdiv double %25, %0
%27 = fmul double %26, %19
ret double %27
}