#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, double);
double mh_samani(double ra, double tavg, double tmax, double tmin) {
  double td, result;
  td = tmax - tmin;
  if (tavg > 100.0) {
    tavg = tavg - 273.15;
  }
  ra = ra * (84600.0 * 1000.0);
  result =
      0.0023 * 0.408 * ra * pow(td, 0.5) * ((tmax + tmin) / 2 + 17.8) / 2.45;
  return result;
}


x86 assembly (clang, -O0):
<mh_samani>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1168 <mh_samani+0x58>
movsd  -0x10(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec8(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeae(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe64(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe50(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe38(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mh_samani>:
sub    $0x18,%rsp
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
mulsd  0xecd(%rip),%xmm1
mulsd  0xecd(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xec7(%rip),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
addsd  (%rsp),%xmm1
mulsd  0xeaf(%rip),%xmm1
addsd  0xeaf(%rip),%xmm1
mulsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xea5(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @mh_samani(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %7
%12 = load double, double* %8
%13 = fsub double %11, %12
store double %13, double* %9
%14 = load double, double* %6
%15 = fcmp ogt double %14, 1.000000e+02
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load double, double* %6
%18 = fsub double %17, 2.731500e+02
store double %18, double* %6
br label %19
19: ; preds = %16, %4
%20 = load double, double* %5
%21 = fmul double %20, 8.460000e+07
store double %21, double* %5
%22 = load double, double* %5
%23 = fmul double 0x3F4EBFDEA7C0A3C9, %22
%24 = load double, double* %9
%25 = call double @pow(double %24, double 5.000000e-01)
%26 = fmul double %23, %25
%27 = load double, double* %7
%28 = load double, double* %8
%29 = fadd double %27, %28
%30 = fdiv double %29, 2.000000e+00
%31 = fadd double %30, 1.780000e+01
%32 = fmul double %26, %31
%33 = fdiv double %32, 2.450000e+00
store double %33, double* %10
%34 = load double, double* %10
ret double %34
}

LLVM IR (-O2):
define double @mh_samani(double %0, double %1, double %2, double %3) {
%5 = fsub double %2, %3
%6 = fmul double %0, 8.460000e+07
%7 = fmul double %6, 0x3F4EBFDEA7C0A3C9
%8 = tail call double @pow(double %5, double 5.000000e-01)
%9 = fmul double %7, %8
%10 = fadd double %2, %3
%11 = fmul double %10, 5.000000e-01
%12 = fadd double %11, 1.780000e+01
%13 = fmul double %12, %9
%14 = fdiv double %13, 2.450000e+00
ret double %14
}