#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 */
int /*<<< orphan*/ printf(char *);
double hfluxresist(double tc_soil, double tc_air, double resist, double rhoair,
                   double cp) {
  double Hflux;
  if (resist == 0.) {
    printf("Resistance value of zero!! Setting Hflux to -9999.9!!\n");
    Hflux = -9999.9;
  } else {
    Hflux = ((tc_soil - tc_air) * rhoair * cp) / resist;
  }
  return (Hflux);
}


x86 assembly (clang, -O0):
<hfluxresist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1167 <hfluxresist+0x57>
jp     1167 <hfluxresist+0x57>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1185 <hfluxresist+0x75>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hfluxresist>:
xorpd  %xmm5,%xmm5
ucomisd %xmm5,%xmm2
jne    1136 <hfluxresist+0x26>
jp     1136 <hfluxresist+0x26>
push   %rax
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
movsd  0xecf(%rip),%xmm0
add    $0x8,%rsp
ret
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm4,%xmm0
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Resistance value of zero!! Setting Hflux to -9999.9!!\0A\00"
define double @hfluxresist(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
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
%12 = load double, double* %8
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
store double 0xC0C387F333333333, double* %11
br label %26
16: ; preds = %5
%17 = load double, double* %6
%18 = load double, double* %7
%19 = fsub double %17, %18
%20 = load double, double* %9
%21 = fmul double %19, %20
%22 = load double, double* %10
%23 = fmul double %21, %22
%24 = load double, double* %8
%25 = fdiv double %23, %24
store double %25, double* %11
br label %26
26: ; preds = %16, %14
%27 = load double, double* %11
ret double %27
}

LLVM IR (-O2):
@str = [54 x i8] c"Resistance value of zero!! Setting Hflux to -9999.9!!\00"
define double @hfluxresist(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp oeq double %2, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
br label %14
9: ; preds = %5
%10 = fsub double %0, %1
%11 = fmul double %10, %3
%12 = fmul double %11, %4
%13 = fdiv double %12, %2
br label %14
14: ; preds = %9, %7
%15 = phi double [ 0xC0C387F333333333, %7 ], [ %13, %9 ]
ret double %15
}