#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_1(double, double, double, double);
double pow(double, int);
double Q_inlet_box(double HW, double B, double D, int type, double g) {
  double HW1 = HW;
  switch (type) {
  case 1:
    HW1 = HW;
    break;
  case 2:
    HW1 = D * pow(HW / D / 1.09, 1. / 0.99);
    break;
  case 3:
    HW1 = D * pow(HW / D / 1.07, 1. / 1.08);
    break;
  }
  return Q_inlet_box_1(B, HW1, D, g);
}


x86 assembly (clang, -O0):
<Q_inlet_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x1,%eax
je     117f <Q_inlet_box+0x5f>
jmp    115d <Q_inlet_box+0x3d>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
je     118e <Q_inlet_box+0x6e>
jmp    116e <Q_inlet_box+0x4e>
mov    -0x34(%rbp),%eax
sub    $0x3,%eax
je     11ce <Q_inlet_box+0xae>
jmp    1206 <Q_inlet_box+0xe6>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1206 <Q_inlet_box+0xe6>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1206 <Q_inlet_box+0xe6>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xe16(%rip),%xmm1
divsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1040 <Q_inlet_box_1@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_inlet_box>:
sub    $0x18,%rsp
movaps %xmm1,%xmm4
movapd %xmm0,%xmm1
cmp    $0x2,%edi
je     114c <Q_inlet_box+0x2c>
cmp    $0x3,%edi
jne    1194 <Q_inlet_box+0x74>
movsd  %xmm4,(%rsp)
movsd  %xmm3,0x8(%rsp)
xor    %edi,%edi
movsd  0xebe(%rip),%xmm0
jmp    1164 <Q_inlet_box+0x44>
movsd  %xmm4,(%rsp)
movsd  %xmm3,0x8(%rsp)
mov    $0x1,%edi
movsd  0xe9c(%rip),%xmm0
divsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  %xmm2,0x10(%rsp)
call   1030 <pow@plt>
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm4
movaps %xmm4,%xmm0
add    $0x18,%rsp
jmp    1040 <Q_inlet_box_1@plt>

LLVM IR (-O0):
define double @Q_inlet_box(double %0, double %1, double %2, i32 %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
store double %4, double* %10
%12 = load double, double* %6
store double %12, double* %11
%13 = load i32, i32* %9
switch i32 %13, label %32 [
i32 1, label %14
i32 2, label %16
i32 3, label %24
]
14: ; preds = %5
%15 = load double, double* %6
store double %15, double* %11
br label %32
16: ; preds = %5
%17 = load double, double* %8
%18 = load double, double* %6
%19 = load double, double* %8
%20 = fdiv double %18, %19
%21 = fdiv double %20, 1.090000e+00
%22 = call double @pow(double %21, i32 1)
%23 = fmul double %17, %22
store double %23, double* %11
br label %32
24: ; preds = %5
%25 = load double, double* %8
%26 = load double, double* %6
%27 = load double, double* %8
%28 = fdiv double %26, %27
%29 = fdiv double %28, 1.070000e+00
%30 = call double @pow(double %29, i32 0)
%31 = fmul double %25, %30
store double %31, double* %11
br label %32
32: ; preds = %5, %24, %16, %14
%33 = load double, double* %7
%34 = load double, double* %11
%35 = load double, double* %8
%36 = load double, double* %10
%37 = call double @Q_inlet_box_1(double %33, double %34, double %35, double %36)
ret double %37
}

LLVM IR (-O2):
define double @Q_inlet_box(double %0, double %1, double %2, i32 %3, double %4) {
switch i32 %3, label %14 [
i32 3, label %6
i32 2, label %7
]
6: ; preds = %5
br label %7
7: ; preds = %5, %6
%8 = phi double [ 1.070000e+00, %6 ], [ 1.090000e+00, %5 ]
%9 = phi i32 [ 0, %6 ], [ 1, %5 ]
%10 = fdiv double %0, %2
%11 = fdiv double %10, %8
%12 = tail call double @pow(double %11, i32 %9)
%13 = fmul double %12, %2
br label %14
14: ; preds = %7, %5
%15 = phi double [ %0, %5 ], [ %13, %7 ]
%16 = tail call double @Q_inlet_box_1(double %1, double %15, double %2, double %4)
ret double %16
}