#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 sauer(double tk[], double slope, double usoil) {
  double tkdiff, b, rsoil;
  tkdiff = tk[1] - tk[0];
  if (tkdiff > 0.0) {
    b = 0.0025 * pow(tkdiff, (1.0 / 3.0));
  } else {
    b = 0.004;
  }
  rsoil = 1.0 / (b + (slope * usoil));
  return (rsoil);
}


x86 assembly (clang, -O0):
<sauer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1179 <sauer+0x69>
movsd  -0x20(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe9d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1186 <sauer+0x76>
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe73(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sauer>:
sub    $0x18,%rsp
movsd  0x8(%rdi),%xmm2
subsd  (%rdi),%xmm2
movapd %xmm1,%xmm3
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    1162 <sauer+0x52>
movsd  %xmm1,0x10(%rsp)
movsd  0xecb(%rip),%xmm1
movapd %xmm2,%xmm0
movsd  %xmm3,0x8(%rsp)
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
mulsd  0xeb0(%rip),%xmm0
jmp    116a <sauer+0x5a>
movsd  0xe96(%rip),%xmm0
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @sauer(double* %0, double %1, double %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double %2, double* %6
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = fsub double %12, %15
store double %16, double* %7
%17 = load double, double* %7
%18 = fcmp ogt double %17, 0.000000e+00
br i1 %18, label %19, label %23
19: ; preds = %3
%20 = load double, double* %7
%21 = call double @pow(double %20, double 0x3FD5555555555555)
%22 = fmul double 2.500000e-03, %21
store double %22, double* %8
br label %24
23: ; preds = %3
store double 4.000000e-03, double* %8
br label %24
24: ; preds = %23, %19
%25 = load double, double* %8
%26 = load double, double* %5
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double %25)
%29 = fdiv double 1.000000e+00, %28
store double %29, double* %9
%30 = load double, double* %9
ret double %30
}

LLVM IR (-O2):
define double @sauer(double* nocapture %0, double %1, double %2) {
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = load double, double* %0
%7 = fsub double %5, %6
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = tail call double @pow(double %7, double 0x3FD5555555555555)
%11 = fmul double %10, 2.500000e-03
br label %12
12: ; preds = %3, %9
%13 = phi double [ %11, %9 ], [ 4.000000e-03, %3 ]
%14 = tail call double @llvm.fmuladd.f64(double %1, double %2, double %13)
%15 = fdiv double 1.000000e+00, %14
ret double %15
}