#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 fmax(double, int);
double fmin(double, double);
double sqrt(double);
double tke_ell(double cn, double e, double buoy_freq, double delta) {
  double ell;
  if (buoy_freq > 1.0e-10) {
    ell = fmax(fmin(cn * sqrt(fmax(e, 0.0) / buoy_freq), delta), 1e-10);
  } else {
    ell = delta;
  }
  return ell;
}


x86 assembly (clang, -O0):
<tke_ell>:
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  -0x18(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b0 <tke_ell+0x90>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
divsd  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  -0x30(%rbp),%xmm3
mulsd  %xmm0,%xmm3
movsd  -0x20(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    11ba <tke_ell+0x9a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tke_ell>:
sub    $0x28,%rsp
ucomisd 0xed4(%rip),%xmm2
jbe    115e <tke_ell+0x3e>
movsd  %xmm0,0x8(%rsp)
movaps %xmm3,0x10(%rsp)
movapd %xmm1,%xmm0
xor    %edi,%edi
movsd  %xmm2,(%rsp)
call   1030 <fmax@plt>
divsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1166 <tke_ell+0x46>
sqrtsd %xmm0,%xmm0
jmp    116b <tke_ell+0x4b>
movaps %xmm3,%xmm0
add    $0x28,%rsp
ret
call   1040 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm1
minsd  %xmm0,%xmm1
cmpunordsd %xmm0,%xmm0
movapd %xmm0,%xmm2
andnpd %xmm1,%xmm2
andpd  %xmm3,%xmm0
orpd   %xmm2,%xmm0
xor    %edi,%edi
add    $0x28,%rsp
jmp    1030 <fmax@plt>

LLVM IR (-O0):
define double @tke_ell(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %7
%11 = fcmp ogt double %10, 1.000000e-10
br i1 %11, label %12, label %23
12: ; preds = %4
%13 = load double, double* %5
%14 = load double, double* %6
%15 = call double @fmax(double %14, i32 0)
%16 = load double, double* %7
%17 = fdiv double %15, %16
%18 = call double @sqrt(double %17)
%19 = fmul double %13, %18
%20 = load double, double* %8
%21 = call double @llvm.minnum.f64(double %19, double %20)
%22 = call double @fmax(double %21, i32 0)
store double %22, double* %9
br label %25
23: ; preds = %4
%24 = load double, double* %8
store double %24, double* %9
br label %25
25: ; preds = %23, %12
%26 = load double, double* %9
ret double %26
}

LLVM IR (-O2):
define double @tke_ell(double %0, double %1, double %2, double %3) {
%5 = fcmp ogt double %2, 1.000000e-10
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = tail call double @fmax(double %1, i32 0)
%8 = fdiv double %7, %2
%9 = tail call double @sqrt(double %8)
%10 = fmul double %9, %0
%11 = tail call double @llvm.minnum.f64(double %10, double %3)
%12 = tail call double @fmax(double %11, i32 0)
br label %13
13: ; preds = %4, %6
%14 = phi double [ %12, %6 ], [ %3, %4 ]
ret double %14
}