#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
float MetricViscosity(float);
int /*<<< orphan*/ SimpleAtmosphere(float, float *, float *, float *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
double sqrt(float);
void ShortSITable() {
  FILE *Itxt;
  int i;
  float altKm;
  float sigma, delta, theta;
  float temp, pressure, density, asound;
  float viscosity, kinematicViscosity, vratio;
  Itxt = fopen("si2c.prt", "w");
  fprintf(Itxt, " alt  sigma  delta  theta");
  fprintf(Itxt, "  temp  press  dens   a    visc   k.visc ratio\n");
  fprintf(Itxt, "  Km                     ");
  fprintf(Itxt, "    K  N/sq.m  kcm  m/sec kg/m-s  sq.m/s  1/m\n");
  for (i = -1; i <= 40; i++) {
    altKm = 0.5 * i;
    SimpleAtmosphere(altKm, &sigma, &delta, &theta);
    fprintf(Itxt, "%4.1f %6.4f %6.4f %6.4f", altKm, sigma, delta, theta);
    temp = 288.15 * theta;
    pressure = 101325.0 * delta;
    density = 1.225 * sigma;
    asound = 340.294 * sqrt(theta);
    fprintf(Itxt, "%6.1f %6.0f %5.3f %5.1f", temp, pressure, density, asound);
    viscosity = MetricViscosity(theta);
    kinematicViscosity = viscosity / density;
    vratio = asound / kinematicViscosity;
    fprintf(Itxt, "%6.2f %8.2E %5.2f\n", 1.0E6 * viscosity, kinematicViscosity,
            1.0E-6 * vratio);
  }
  fclose(Itxt);
}


x86 assembly (clang, -O0):
<ShortSITable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec9(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0xc(%rbp)
cmpl   $0x28,-0xc(%rbp)
jg     1370 <ShortSITable+0x210>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe4b(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <SimpleAtmosphere@plt>
mov    -0x8(%rbp),%rdi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x18(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x1c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe9f(%rip),%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdb3(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd8d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd63(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x2c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe05(%rip),%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
call   1050 <MetricViscosity@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
divss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x2c(%rbp),%xmm0
divss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcd6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x38(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xcb0(%rip),%xmm2
mulsd  %xmm3,%xmm2
lea    0xdab(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ce <ShortSITable+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShortSITable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebf(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xeb4(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xeb5(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xecc(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xecd(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
movsd  0xe00(%rip),%xmm0
mov    $0x2a,%r15d
lea    0x8(%rsp),%r12
lea    0xed0(%rip),%r13
lea    0xee1(%rip),%rbp
lea    0xef2(%rip),%r14
movsd  %xmm0,0x20(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xdd4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    %r12,%rdx
call   1060 <SimpleAtmosphere@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x8(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulsd  0xd76(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x18(%rsp)
movss  0xc(%rsp),%xmm1
mulss  0xd8e(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd4e(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
call   1080 <sqrt@plt>
mulsd  0xd3f(%rip),%xmm0
xorps  %xmm3,%xmm3
cvtsd2ss %xmm0,%xmm3
movss  %xmm3,0x1c(%rsp)
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x4(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  0x8(%rsp),%xmm0
call   1050 <MetricViscosity@plt>
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
divss  0x4(%rsp),%xmm0
movss  0x1c(%rsp),%xmm2
divss  %xmm0,%xmm2
mulsd  0xce1(%rip),%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
cvtss2sd %xmm2,%xmm2
mulsd  0xcd6(%rip),%xmm2
mov    %rbx,%rdi
mov    %r14,%rsi
movapd %xmm3,%xmm0
mov    $0x3,%al
call   1040 <fprintf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0xcbf(%rip),%xmm0
add    $0xffffffff,%r15d
jne    1220 <ShortSITable+0xb0>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"si2c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c" alt sigma delta theta\00"
@.str.3 = [48 x i8] c" temp press dens a visc k.visc ratio\0A\00"
@.str.4 = [26 x i8] c" Km \00"
@.str.5 = [47 x i8] c" K N/sq.m kcm m/sec kg/m-s sq.m/s 1/m\0A\00"
@.str.6 = [24 x i8] c"%4.1f %6.4f %6.4f %6.4f\00"
@.str.7 = [24 x i8] c"%6.1f %6.0f %5.3f %5.1f\00"
@.str.8 = [19 x i8] c"%6.2f %8.2E %5.2f\0A\00"
define void @ShortSITable() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %1
%15 = load i32*, i32** %1
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32*, i32** %1
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32*, i32** %1
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %2
br label %23
23: ; preds = %87, %0
%24 = load i32, i32* %2
%25 = icmp sle i32 %24, 40
br i1 %25, label %26, label %90
26: ; preds = %23
%27 = load i32, i32* %2
%28 = sitofp i32 %27 to double
%29 = fmul double 5.000000e-01, %28
%30 = fptrunc double %29 to float
store float %30, float* %3
%31 = load float, float* %3
%32 = call i32 @SimpleAtmosphere(float %31, float* %4, float* %5, float* %6)
%33 = load i32*, i32** %1
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = load float, float* %4
%37 = fpext float %36 to double
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = load float, float* %6
%41 = fpext float %40 to double
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %35, double %37, double %39, double %41)
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = fmul double 2.881500e+02, %44
%46 = fptrunc double %45 to float
store float %46, float* %7
%47 = load float, float* %5
%48 = fpext float %47 to double
%49 = fmul double 1.013250e+05, %48
%50 = fptrunc double %49 to float
store float %50, float* %8
%51 = load float, float* %4
%52 = fpext float %51 to double
%53 = fmul double 1.225000e+00, %52
%54 = fptrunc double %53 to float
store float %54, float* %9
%55 = load float, float* %6
%56 = call double @sqrt(float %55)
%57 = fmul double 3.402940e+02, %56
%58 = fptrunc double %57 to float
store float %58, float* %10
%59 = load i32*, i32** %1
%60 = load float, float* %7
%61 = fpext float %60 to double
%62 = load float, float* %8
%63 = fpext float %62 to double
%64 = load float, float* %9
%65 = fpext float %64 to double
%66 = load float, float* %10
%67 = fpext float %66 to double
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %61, double %63, double %65, double %67)
%69 = load float, float* %6
%70 = call float @MetricViscosity(float %69)
store float %70, float* %11
%71 = load float, float* %11
%72 = load float, float* %9
%73 = fdiv float %71, %72
store float %73, float* %12
%74 = load float, float* %10
%75 = load float, float* %12
%76 = fdiv float %74, %75
store float %76, float* %13
%77 = load i32*, i32** %1
%78 = load float, float* %11
%79 = fpext float %78 to double
%80 = fmul double 1.000000e+06, %79
%81 = load float, float* %12
%82 = fpext float %81 to double
%83 = load float, float* %13
%84 = fpext float %83 to double
%85 = fmul double 0x3EB0C6F7A0B5ED8D, %84
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %77, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %80, double %82, double %85)
br label %87
87: ; preds = %26
%88 = load i32, i32* %2
%89 = add nsw i32 %88, 1
store i32 %89, i32* %2
br label %23
90: ; preds = %23
%91 = load i32*, i32** %1
%92 = call i32 @fclose(i32* %91)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"si2c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c" alt sigma delta theta\00"
@.str.3 = [48 x i8] c" temp press dens a visc k.visc ratio\0A\00"
@.str.4 = [26 x i8] c" Km \00"
@.str.5 = [47 x i8] c" K N/sq.m kcm m/sec kg/m-s sq.m/s 1/m\0A\00"
@.str.6 = [24 x i8] c"%4.1f %6.4f %6.4f %6.4f\00"
@.str.7 = [24 x i8] c"%6.1f %6.0f %5.3f %5.1f\00"
@.str.8 = [19 x i8] c"%6.2f %8.2E %5.2f\0A\00"
define void @ShortSITable() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 25, i64 1, i32* %7)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i64 47, i64 1, i32* %7)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i64 25, i64 1, i32* %7)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i64 46, i64 1, i32* %7)
br label %12
12: ; preds = %0, %12
%13 = phi i32 [ -1, %0 ], [ %54, %12 ]
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 5.000000e-01
%16 = fptrunc double %15 to float
%17 = call i32 @SimpleAtmosphere(float %16, float* %1, float* %2, float* %3)
%18 = fpext float %16 to double
%19 = load float, float* %1
%20 = fpext float %19 to double
%21 = load float, float* %2
%22 = fpext float %21 to double
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %18, double %20, double %22, double %24)
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = fmul double %27, 2.881500e+02
%29 = fptrunc double %28 to float
%30 = load float, float* %2
%31 = fmul float %30, 1.013250e+05
%32 = load float, float* %1
%33 = fpext float %32 to double
%34 = fmul double %33, 1.225000e+00
%35 = fptrunc double %34 to float
%36 = call double @sqrt(float %26)
%37 = fmul double %36, 3.402940e+02
%38 = fptrunc double %37 to float
%39 = fpext float %29 to double
%40 = fpext float %31 to double
%41 = fpext float %35 to double
%42 = fpext float %38 to double
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %39, double %40, double %41, double %42)
%44 = load float, float* %3
%45 = call float @MetricViscosity(float %44)
%46 = fdiv float %45, %35
%47 = fdiv float %38, %46
%48 = fpext float %45 to double
%49 = fmul double %48, 1.000000e+06
%50 = fpext float %46 to double
%51 = fpext float %47 to double
%52 = fmul double %51, 0x3EB0C6F7A0B5ED8D
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %49, double %50, double %52)
%54 = add nsw i32 %13, 1
%55 = icmp eq i32 %54, 41
br i1 %55, label %56, label %12
56: ; preds = %12
%57 = call i32 @fclose(i32* %7)
ret void
}