#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 fabs(double);
int pow(double, double);
double sqrt(double);
double Q_Bernoulli(double HW, double TW, double area, double Rh, double S0,
                   double L, double n, double ke, double g) {
  if (area > 0.) {
    double v2 = 2. * g * fabs(HW + S0 * L - TW) /
                (ke + 1. + 2. * g * n * n * L / pow(Rh, 1.333));
    return area * sqrt(v2);
  }
  return 0.;
}


x86 assembly (clang, -O0):
<Q_Bernoulli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1253 <Q_Bernoulli+0x123>
movsd  0xe85(%rip),%xmm0
mulsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  -0x78(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe48(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe2e(%rip),%xmm0
mulsd  0x10(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
cvtsi2sd %eax,%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    125b <Q_Bernoulli+0x12b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_Bernoulli>:
movapd %xmm0,%xmm8
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    1227 <Q_Bernoulli+0xf7>
sub    $0x38,%rsp
movsd  %xmm2,0x30(%rsp)
movsd  0x40(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mulsd  %xmm5,%xmm4
addsd  %xmm8,%xmm4
subsd  %xmm1,%xmm4
movapd %xmm4,%xmm0
movsd  %xmm7,0x8(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm5,0x18(%rsp)
movsd  %xmm6,0x10(%rsp)
call   1030 <fabs@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  0xe61(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe33(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
movsd  0x28(%rsp),%xmm1
divsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     1218 <Q_Bernoulli+0xe8>
sqrtsd %xmm0,%xmm0
jmp    121d <Q_Bernoulli+0xed>
call   1050 <sqrt@plt>
mulsd  0x30(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @Q_Bernoulli(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
%21 = load double, double* %13
%22 = fcmp ogt double %21, 0.000000e+00
br i1 %22, label %23, label %55
23: ; preds = %9
%24 = load double, double* %19
%25 = fmul double 2.000000e+00, %24
%26 = load double, double* %11
%27 = load double, double* %15
%28 = load double, double* %16
%29 = call double @llvm.fmuladd.f64(double %27, double %28, double %26)
%30 = load double, double* %12
%31 = fsub double %29, %30
%32 = call i32 @fabs(double %31)
%33 = sitofp i32 %32 to double
%34 = fmul double %25, %33
%35 = load double, double* %18
%36 = fadd double %35, 1.000000e+00
%37 = load double, double* %19
%38 = fmul double 2.000000e+00, %37
%39 = load double, double* %17
%40 = fmul double %38, %39
%41 = load double, double* %17
%42 = fmul double %40, %41
%43 = load double, double* %16
%44 = fmul double %42, %43
%45 = load double, double* %14
%46 = call i32 @pow(double %45, double 1.333000e+00)
%47 = sitofp i32 %46 to double
%48 = fdiv double %44, %47
%49 = fadd double %36, %48
%50 = fdiv double %34, %49
store double %50, double* %20
%51 = load double, double* %13
%52 = load double, double* %20
%53 = call double @sqrt(double %52)
%54 = fmul double %51, %53
store double %54, double* %10
br label %56
55: ; preds = %9
store double 0.000000e+00, double* %10
br label %56
56: ; preds = %55, %23
%57 = load double, double* %10
ret double %57
}

LLVM IR (-O2):
define double @Q_Bernoulli(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = fcmp ogt double %2, 0.000000e+00
br i1 %10, label %11, label %29
11: ; preds = %9
%12 = fmul double %8, 2.000000e+00
%13 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %0)
%14 = fsub double %13, %1
%15 = tail call i32 @fabs(double %14)
%16 = sitofp i32 %15 to double
%17 = fmul double %12, %16
%18 = fadd double %7, 1.000000e+00
%19 = fmul double %12, %6
%20 = fmul double %19, %6
%21 = fmul double %20, %5
%22 = tail call i32 @pow(double %3, double 1.333000e+00)
%23 = sitofp i32 %22 to double
%24 = fdiv double %21, %23
%25 = fadd double %18, %24
%26 = fdiv double %17, %25
%27 = tail call double @sqrt(double %26)
%28 = fmul double %27, %2
br label %29
29: ; preds = %9, %11
%30 = phi double [ %28, %11 ], [ 0.000000e+00, %9 ]
ret double %30
}