#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 */
int /*<<< orphan*/ Atmosphere(float, float *, float *, float *);
float MetricViscosity(float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
double sqrt(float);
void LongSITable() {
  FILE *Itxt;
  int i;
  float altKm;
  float sigma, delta, theta;
  float temp, pressure, density, asound;
  float viscosity, kinematicViscosity;
  Itxt = fopen("si1c.prt", "w");
  fprintf(Itxt, " alt    sigma      delta    theta");
  fprintf(Itxt, "  temp   press      dens     a   visc   k.visc\n");
  fprintf(Itxt, "  Km                             ");
  fprintf(Itxt, "    K   N/sq.m    kg/cu.m  m/sec kg/m-s sq.m/s\n");
  for (i = -1; i <= 43; i++) {
    altKm = 2 * i;
    Atmosphere(altKm, &sigma, &delta, &theta);
    fprintf(Itxt, "%4i %8.4E %8.4E %6.4f", 2 * i, sigma, delta, theta);
    temp = 288.15 * theta;
    pressure = 101325.0 * delta;
    density = 1.225 * sigma;
    asound = 340.294 * sqrt(theta);
    fprintf(Itxt, "%6.1f %8.3E %8.3E %5.1f", temp, pressure, density, asound);
    viscosity = MetricViscosity(theta);
    kinematicViscosity = viscosity / density;
    fprintf(Itxt, "%6.2f %8.2E\n", 1.0E6 * viscosity, kinematicViscosity);
  }
  fclose(Itxt);
}


x86 assembly (clang, -O0):
<LongSITable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xeb9(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xed7(%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   $0x2b,-0xc(%rbp)
jg     133e <LongSITable+0x1de>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1070 <Atmosphere@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xeae(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xddf(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdb9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd93(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd69(%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    0xe12(%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)
mov    -0x8(%rbp),%rdi
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xceb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xddc(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ce <LongSITable+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LongSITable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9f(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xe9d(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xeb4(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xebd(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    $0xfffffffe,%ebp
mov    %rsp,%r12
lea    0xecc(%rip),%r13
lea    0xedb(%rip),%r14
lea    0xeec(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %r12,%rdx
call   1070 <Atmosphere@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  (%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    $0x3,%al
call   1040 <fprintf@plt>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulsd  0xd87(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x14(%rsp)
movss  0x8(%rsp),%xmm1
mulss  0xd8f(%rip),%xmm1
movss  %xmm1,0x10(%rsp)
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd5f(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
call   1080 <sqrt@plt>
mulsd  0xd50(%rip),%xmm0
xorps  %xmm3,%xmm3
cvtsd2ss %xmm0,%xmm3
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x4(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  (%rsp),%xmm0
call   1050 <MetricViscosity@plt>
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
divss  0x4(%rsp),%xmm0
mulsd  0xd03(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %rbx,%rdi
mov    %r15,%rsi
movapd %xmm2,%xmm0
mov    $0x2,%al
call   1040 <fprintf@plt>
add    $0x2,%ebp
cmp    $0x58,%ebp
jne    1220 <LongSITable+0xb0>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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