#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_pipe(double, double, double, int, double, double, double, double,
              double);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  double HW, TW, B, D, S0, L, N, KE, G;
  int type;
  B = 1.0;
  D = 1.0;
  type = 1;
  S0 = 0.01;
  L = 10.0;
  N = 0.013;
  KE = 1.0;
  G = 9.81;
  printf("B D S0 L N KE G\n");
  printf("%g %g %g %g %g %g %g\n", B, D, S0, L, N, KE, G);
  printf("type\n");
  printf("%d\n", type);
  printf("HW TW Q_Box Q_Pipe\n");
  for (TW = 0.; TW <= 1.5 * D; TW += 0.001) {
    for (HW = 0.1; HW <= 20.; HW += 0.1)
      printf("--->%g %g %g\n", HW, TW,
             Q_pipe(HW, TW, D, type, S0, L, N, KE, G));
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x5c(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x48(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm5
movsd  -0x58(%rbp),%xmm6
lea    0xe89(%rip),%rdi
mov    $0x7,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5c(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe0f(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12e3 <main+0x1c3>
movsd  0xe00(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdfb(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     12be <main+0x19e>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x5c(%rbp),%edi
movsd  -0x38(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm5
movsd  -0x50(%rbp),%xmm6
movsd  -0x58(%rbp),%xmm7
call   1040 <Q_pipe@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
lea    0xded(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0xd81(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1235 <main+0x115>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xd6c(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    120c <main+0xec>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf24(%rip),%rdi
call   1040 <puts@plt>
lea    0xef0(%rip),%rdi
movsd  0xea0(%rip),%xmm2
movsd  0xea0(%rip),%xmm3
movsd  0xea0(%rip),%xmm4
movsd  0xea0(%rip),%xmm0
movsd  0xea0(%rip),%xmm6
movapd %xmm0,%xmm1
movapd %xmm0,%xmm5
mov    $0x7,%al
call   1050 <printf@plt>
lea    0xeea(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
xorpd  %xmm0,%xmm0
movsd  0xe62(%rip),%xmm1
lea    0xe95(%rip),%rbx
nopl   (%rax)
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
movsd  (%rsp),%xmm1
movsd  0xe21(%rip),%xmm2
mov    $0x1,%edi
movsd  0xdfc(%rip),%xmm3
movsd  0xdfc(%rip),%xmm4
movsd  0xdfc(%rip),%xmm5
movaps %xmm2,%xmm6
movsd  0xe01(%rip),%xmm7
call   1060 <Q_pipe@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm1
addsd  0xddd(%rip),%xmm1
movsd  0xddd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    11e0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  (%rsp),%xmm1
addsd  0xdc8(%rip),%xmm1
movsd  0xdc8(%rip),%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm1,%xmm0
movsd  0xda0(%rip),%xmm1
jae    11d0 <main+0x90>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"B D S0 L N KE G\0A\00"
@.str.1 = [22 x i8] c"%g %g %g %g %g %g %g\0A\00"
@.str.2 = [6 x i8] c"type\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [20 x i8] c"HW TW Q_Box Q_Pipe\0A\00"
@.str.5 = [14 x i8] c"--->%g %g %g\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e+00, double* %8
store double 1.000000e+00, double* %9
store i32 1, i32* %15
store double 1.000000e-02, double* %10
store double 1.000000e+01, double* %11
store double 1.300000e-02, double* %12
store double 1.000000e+00, double* %13
store double 9.810000e+00, double* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%17 = load double, double* %8
%18 = load double, double* %9
%19 = load double, double* %10
%20 = load double, double* %11
%21 = load double, double* %12
%22 = load double, double* %13
%23 = load double, double* %14
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %17, double %18, double %19, double %20, double %21, double %22, double %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %15
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store double 0.000000e+00, double* %7
br label %29
29: ; preds = %57, %2
%30 = load double, double* %7
%31 = load double, double* %9
%32 = fmul double 1.500000e+00, %31
%33 = fcmp ole double %30, %32
br i1 %33, label %34, label %60
34: ; preds = %29
store double 1.000000e-01, double* %6
br label %35
35: ; preds = %52, %34
%36 = load double, double* %6
%37 = fcmp ole double %36, 2.000000e+01
br i1 %37, label %38, label %55
38: ; preds = %35
%39 = load double, double* %6
%40 = load double, double* %7
%41 = load double, double* %6
%42 = load double, double* %7
%43 = load double, double* %9
%44 = load i32, i32* %15
%45 = load double, double* %10
%46 = load double, double* %11
%47 = load double, double* %12
%48 = load double, double* %13
%49 = load double, double* %14
%50 = call double @Q_pipe(double %41, double %42, double %43, i32 %44, double %45, double %46, double %47, double %48, double %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %39, double %40, double %50)
br label %52
52: ; preds = %38
%53 = load double, double* %6
%54 = fadd double %53, 1.000000e-01
store double %54, double* %6
br label %35
55: ; preds = %35
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %57
57: ; preds = %55
%58 = load double, double* %7
%59 = fadd double %58, 1.000000e-03
store double %59, double* %7
br label %29
60: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"%g %g %g %g %g %g %g\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.5 = [14 x i8] c"--->%g %g %g\0A\00"
@str = [16 x i8] c"B D S0 L N KE G\00"
@str.7 = [5 x i8] c"type\00"
@str.8 = [19 x i8] c"HW TW Q_Box Q_Pipe\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+00, double 1.000000e+00, double 1.000000e-02, double 1.000000e+01, double 1.300000e-02, double 1.000000e+00, double 9.810000e+00)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0))
br label %8
8: ; preds = %2, %16
%9 = phi double [ 0.000000e+00, %2 ], [ %18, %16 ]
br label %10
10: ; preds = %8, %10
%11 = phi double [ 1.000000e-01, %8 ], [ %14, %10 ]
%12 = tail call double @Q_pipe(double %11, double %9, double 1.000000e+00, i32 1, double 1.000000e-02, double 1.000000e+01, double 1.300000e-02, double 1.000000e+00, double 9.810000e+00)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %11, double %9, double %12)
%14 = fadd double %11, 1.000000e-01
%15 = fcmp ugt double %14, 2.000000e+01
br i1 %15, label %16, label %10
16: ; preds = %10
%17 = tail call i32 @putchar(i32 10)
%18 = fadd double %9, 1.000000e-03
%19 = fcmp ugt double %18, 1.500000e+00
br i1 %19, label %20, label %8
20: ; preds = %16
ret i32 0
}