#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_pipe_1(double, double, double);
double pow(double, int);
double Q_inlet_pipe(double HW, double D, int type, double g) {
  double HW1 = HW;
  switch (type) {
  case 1:
    HW1 = HW;
    break;
  case 2:
    HW1 = D * pow(HW / D / 0.92, 1. / 0.90);
    break;
  case 3:
    HW1 = D * pow(HW / D / 0.91, 1. / 0.94);
    break;
  }
  return Q_inlet_pipe_1(HW1, D, g);
}


x86 assembly (clang, -O0):
<Q_inlet_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x1,%eax
je     117a <Q_inlet_pipe+0x5a>
jmp    1158 <Q_inlet_pipe+0x38>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     1189 <Q_inlet_pipe+0x69>
jmp    1169 <Q_inlet_pipe+0x49>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     11c9 <Q_inlet_pipe+0xa9>
jmp    1204 <Q_inlet_pipe+0xe4>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1204 <Q_inlet_pipe+0xe4>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1204 <Q_inlet_pipe+0xe4>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xe1b(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <Q_inlet_pipe_1@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_inlet_pipe>:
sub    $0x18,%rsp
cmp    $0x2,%edi
je     113e <Q_inlet_pipe+0x1e>
cmp    $0x3,%edi
jne    1174 <Q_inlet_pipe+0x54>
movsd  %xmm2,0x8(%rsp)
movsd  0xecc(%rip),%xmm2
jmp    114c <Q_inlet_pipe+0x2c>
movsd  %xmm2,0x8(%rsp)
movsd  0xeb4(%rip),%xmm2
divsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mov    $0x1,%edi
movsd  %xmm1,0x10(%rsp)
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm2
add    $0x18,%rsp
jmp    1030 <Q_inlet_pipe_1@plt>

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

LLVM IR (-O2):
define double @Q_inlet_pipe(double %0, double %1, i32 %2, double %3) {
switch i32 %2, label %12 [
i32 3, label %5
i32 2, label %6
]
5: ; preds = %4
br label %6
6: ; preds = %4, %5
%7 = phi double [ 9.100000e-01, %5 ], [ 9.200000e-01, %4 ]
%8 = fdiv double %0, %1
%9 = fdiv double %8, %7
%10 = tail call double @pow(double %9, i32 1)
%11 = fmul double %10, %1
br label %12
12: ; preds = %6, %4
%13 = phi double [ %0, %4 ], [ %11, %6 ]
%14 = tail call double @Q_inlet_pipe_1(double %13, double %1, double %3)
ret double %14
}