#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 Q_inlet_box(double, double, double, int, double);
double Q_outlet_box(double, double, double, double, double, double, double,
                    double, double);
double Q_box(double HW, double TW, double B, double D, int type, double S0,
             double L, double n, double ke, double g) {
  double Q_outlet_control = Q_outlet_box(HW, TW, B, D, S0, L, n, ke, g);
  double Q_inlet_control = Q_inlet_box(HW, B, D, type, g);
  return ((Q_outlet_control) < (Q_inlet_control) ? (Q_outlet_control)
                                                 : (Q_inlet_control));
}


x86 assembly (clang, -O0):
<Q_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  0x10(%rbp),%xmm8
movsd  %xmm8,(%rsp)
call   1040 <Q_outlet_box@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    -0x24(%rbp),%edi
movsd  0x10(%rbp),%xmm3
call   1030 <Q_inlet_box@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11db <Q_box+0xbb>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    11e5 <Q_box+0xc5>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_box>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm0,0x28(%rsp)
movsd  0x40(%rsp),%xmm8
movsd  %xmm8,(%rsp)
call   1040 <Q_outlet_box@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    %ebx,%edi
movsd  0x40(%rsp),%xmm3
call   1030 <Q_inlet_box@plt>
movsd  0x10(%rsp),%xmm1
minsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @Q_box(double %0, double %1, double %2, double %3, i32 %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store i32 %4, i32* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
store double %9, double* %20
%23 = load double, double* %11
%24 = load double, double* %12
%25 = load double, double* %13
%26 = load double, double* %14
%27 = load double, double* %16
%28 = load double, double* %17
%29 = load double, double* %18
%30 = load double, double* %19
%31 = load double, double* %20
%32 = call double @Q_outlet_box(double %23, double %24, double %25, double %26, double %27, double %28, double %29, double %30, double %31)
store double %32, double* %21
%33 = load double, double* %11
%34 = load double, double* %13
%35 = load double, double* %14
%36 = load i32, i32* %15
%37 = load double, double* %20
%38 = call double @Q_inlet_box(double %33, double %34, double %35, i32 %36, double %37)
store double %38, double* %22
%39 = load double, double* %21
%40 = load double, double* %22
%41 = fcmp olt double %39, %40
br i1 %41, label %42, label %44
42: ; preds = %10
%43 = load double, double* %21
br label %46
44: ; preds = %10
%45 = load double, double* %22
br label %46
46: ; preds = %44, %42
%47 = phi double [ %43, %42 ], [ %45, %44 ]
ret double %47
}

LLVM IR (-O2):
define double @Q_box(double %0, double %1, double %2, double %3, i32 %4, double %5, double %6, double %7, double %8, double %9) {
%11 = tail call double @Q_outlet_box(double %0, double %1, double %2, double %3, double %5, double %6, double %7, double %8, double %9)
%12 = tail call double @Q_inlet_box(double %0, double %2, double %3, i32 %4, double %9)
%13 = fcmp olt double %11, %12
%14 = select i1 %13, double %11, double %12
ret double %14
}