#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_original(double ra, double tavg, double tmax, double tmin, double p) {
  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 * (tavg + 17.8) * pow(td, 0.5);
  return result;
}


x86 assembly (clang, -O0):
<mh_original>:
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  %xmm4,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116d <mh_original+0x5d>
movsd  -0x10(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe99(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mh_original>:
push   %rax
movsd  0xee7(%rip),%xmm5
addsd  %xmm1,%xmm5
movsd  0xee3(%rip),%xmm4
cmpltsd %xmm1,%xmm4
andpd  %xmm4,%xmm5
andnpd %xmm1,%xmm4
orpd   %xmm5,%xmm4
mulsd  0xed2(%rip),%xmm0
mulsd  0xed2(%rip),%xmm0
subsd  %xmm3,%xmm2
addsd  0xece(%rip),%xmm4
mulsd  %xmm4,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec5(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mh_original(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
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
%13 = load double, double* %8
%14 = load double, double* %9
%15 = fsub double %13, %14
store double %15, double* %11
%16 = load double, double* %7
%17 = fcmp ogt double %16, 1.000000e+02
br i1 %17, label %18, label %21
18: ; preds = %5
%19 = load double, double* %7
%20 = fsub double %19, 2.731500e+02
store double %20, double* %7
br label %21
21: ; preds = %18, %5
%22 = load double, double* %6
%23 = fmul double %22, 8.460000e+07
store double %23, double* %6
%24 = load double, double* %6
%25 = fmul double 0x3F4EBFDEA7C0A3C9, %24
%26 = load double, double* %7
%27 = fadd double %26, 1.780000e+01
%28 = fmul double %25, %27
%29 = load double, double* %11
%30 = call double @pow(double %29, double 5.000000e-01)
%31 = fmul double %28, %30
store double %31, double* %12
%32 = load double, double* %12
ret double %32
}

LLVM IR (-O2):
define double @mh_original(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp ogt double %1, 1.000000e+02
%7 = fadd double %1, -2.731500e+02
%8 = select i1 %6, double %7, double %1
%9 = fsub double %2, %3
%10 = fmul double %0, 8.460000e+07
%11 = fmul double %10, 0x3F4EBFDEA7C0A3C9
%12 = fadd double %8, 1.780000e+01
%13 = fmul double %11, %12
%14 = tail call double @pow(double %9, double 5.000000e-01)
%15 = fmul double %13, %14
ret double %15
}