#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 */
double 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 ShortUSTable(void) {
  FILE *Itxt;
  float altKm;
  float sigma, delta, theta;
  float temp, pressure, density, asound;
  float viscosity, kinematicViscosity, vratio;
  int i;
  Itxt = fopen("us2c.prt", "w");
  fprintf(Itxt, " alt  sigma  delta  theta");
  fprintf(Itxt, "  temp  press    dens     a     visc   k.visc ratio\n");
  fprintf(Itxt, " Kft                     ");
  fprintf(Itxt, "  degR   psf   s/cu.ft   fps s/ft-sec sq.ft/s   1/ft\n");
  for (i = -1; i <= 65; i++) {
    altKm = i * 0.3048;
    SimpleAtmosphere(altKm, &sigma, &delta, &theta);
    fprintf(Itxt, "%4i %6.4f %6.4f %6.4f", i, sigma, delta, theta);
    temp = 1.8 * 288.15 * theta;
    pressure = 101325.0 * delta / 47.88;
    density = 1.225 * sigma / 515.379;
    asound = (340.294 / 0.3048) * sqrt(theta);
    fprintf(Itxt, "%6.1f %6.1f %9.7f %6.1f", temp, pressure, density, asound);
    viscosity = (1.0 / 47.880258) * MetricViscosity(theta);
    kinematicViscosity = viscosity / density;
    vratio = asound / kinematicViscosity;
    fprintf(Itxt, "%6.3f %8.2E %4.2f\n", 1.0E6 * viscosity, kinematicViscosity,
            1.0E-6 * vratio);
  }
  fclose(Itxt);
}


x86 assembly (clang, -O0):
<ShortUSTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xee1(%rip),%rdi
lea    0xee3(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xefc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf04(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x38(%rbp)
cmpl   $0x41,-0x38(%rbp)
jg     1395 <ShortUSTable+0x235>
cvtsi2sdl -0x38(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <SimpleAtmosphere@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%edx
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x18(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xec9(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf7(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdbd(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd97(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd83(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd59(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x24(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x28(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe15(%rip),%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  -0x18(%rbp),%xmm0
call   1050 <MetricViscosity@plt>
movaps %xmm0,%xmm1
movsd  0xcf9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
divss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x28(%rbp),%xmm0
divss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcb1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x34(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xc8b(%rip),%xmm2
mulsd  %xmm3,%xmm2
lea    0xda8(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ce <ShortUSTable+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShortUSTable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xedb(%rip),%rdi
lea    0xedd(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xed0(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xed1(%rip),%rdi
mov    $0x34,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xeed(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xeee(%rip),%rdi
mov    $0x35,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    $0xffffffff,%ebp
movsd  0xdfb(%rip),%xmm0
lea    0x4(%rsp),%r12
lea    0xef9(%rip),%r13
lea    0xf08(%rip),%r14
lea    0xf19(%rip),%r15
nop
movsd  %xmm0,0x20(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xdd4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    %r12,%rdx
call   1060 <SimpleAtmosphere@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x4(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    $0x3,%al
call   1040 <fprintf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulsd  0xd84(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x1c(%rsp)
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd70(%rip),%xmm1
divsd  0xd70(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x14(%rsp)
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd5c(%rip),%xmm1
divsd  0xd5c(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x8(%rsp)
call   1080 <sqrt@plt>
mulsd  0xd4d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm3
movss  %xmm3,0x18(%rsp)
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x8(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  0x4(%rsp),%xmm0
call   1050 <MetricViscosity@plt>
mulsd  0xd09(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
divss  0x8(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
divss  %xmm1,%xmm2
mulsd  0xceb(%rip),%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mulsd  0xce3(%rip),%xmm2
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0xcd0(%rip),%xmm0
add    $0x1,%ebp
cmp    $0x42,%ebp
jne    1220 <ShortUSTable+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"us2c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c" alt sigma delta theta\00"
@.str.3 = [53 x i8] c" temp press dens a visc k.visc ratio\0A\00"
@.str.4 = [26 x i8] c" Kft \00"
@.str.5 = [54 x i8] c" degR psf s/cu.ft fps s/ft-sec sq.ft/s 1/ft\0A\00"
@.str.6 = [22 x i8] c"%4i %6.4f %6.4f %6.4f\00"
@.str.7 = [24 x i8] c"%6.1f %6.1f %9.7f %6.1f\00"
@.str.8 = [19 x i8] c"%6.3f %8.2E %4.2f\0A\00"
define void @ShortUSTable() {
%1 = alloca i32*
%2 = alloca float
%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 i32
%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 ([53 x i8], [53 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 ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %13
br label %23
23: ; preds = %90, %0
%24 = load i32, i32* %13
%25 = icmp sle i32 %24, 65
br i1 %25, label %26, label %93
26: ; preds = %23
%27 = load i32, i32* %13
%28 = sitofp i32 %27 to double
%29 = fmul double %28, 3.048000e-01
%30 = fptrunc double %29 to float
store float %30, float* %2
%31 = load float, float* %2
%32 = call i32 @SimpleAtmosphere(float %31, float* %3, float* %4, float* %5)
%33 = load i32*, i32** %1
%34 = load i32, i32* %13
%35 = load float, float* %3
%36 = fpext float %35 to double
%37 = load float, float* %4
%38 = fpext float %37 to double
%39 = load float, float* %5
%40 = fpext float %39 to double
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %34, double %36, double %38, double %40)
%42 = load float, float* %5
%43 = fpext float %42 to double
%44 = fmul double 5.186700e+02, %43
%45 = fptrunc double %44 to float
store float %45, float* %6
%46 = load float, float* %4
%47 = fpext float %46 to double
%48 = fmul double 1.013250e+05, %47
%49 = fdiv double %48, 4.788000e+01
%50 = fptrunc double %49 to float
store float %50, float* %7
%51 = load float, float* %3
%52 = fpext float %51 to double
%53 = fmul double 1.225000e+00, %52
%54 = fdiv double %53, 5.153790e+02
%55 = fptrunc double %54 to float
store float %55, float* %8
%56 = load float, float* %5
%57 = call double @sqrt(float %56)
%58 = fmul double 0x409171CCEF33BCCE, %57
%59 = fptrunc double %58 to float
store float %59, float* %9
%60 = load i32*, i32** %1
%61 = load float, float* %6
%62 = fpext float %61 to double
%63 = load float, float* %7
%64 = fpext float %63 to double
%65 = load float, float* %8
%66 = fpext float %65 to double
%67 = load float, float* %9
%68 = fpext float %67 to double
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %62, double %64, double %66, double %68)
%70 = load float, float* %5
%71 = call double @MetricViscosity(float %70)
%72 = fmul double 0x3F9562FDCB52B51F, %71
%73 = fptrunc double %72 to float
store float %73, float* %10
%74 = load float, float* %10
%75 = load float, float* %8
%76 = fdiv float %74, %75
store float %76, float* %11
%77 = load float, float* %9
%78 = load float, float* %11
%79 = fdiv float %77, %78
store float %79, float* %12
%80 = load i32*, i32** %1
%81 = load float, float* %10
%82 = fpext float %81 to double
%83 = fmul double 1.000000e+06, %82
%84 = load float, float* %11
%85 = fpext float %84 to double
%86 = load float, float* %12
%87 = fpext float %86 to double
%88 = fmul double 0x3EB0C6F7A0B5ED8D, %87
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %83, double %85, double %88)
br label %90
90: ; preds = %26
%91 = load i32, i32* %13
%92 = add nsw i32 %91, 1
store i32 %92, i32* %13
br label %23
93: ; preds = %23
%94 = load i32*, i32** %1
%95 = call i32 @fclose(i32* %94)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"us2c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c" alt sigma delta theta\00"
@.str.3 = [53 x i8] c" temp press dens a visc k.visc ratio\0A\00"
@.str.4 = [26 x i8] c" Kft \00"
@.str.5 = [54 x i8] c" degR psf s/cu.ft fps s/ft-sec sq.ft/s 1/ft\0A\00"
@.str.6 = [22 x i8] c"%4i %6.4f %6.4f %6.4f\00"
@.str.7 = [24 x i8] c"%6.1f %6.1f %9.7f %6.1f\00"
@.str.8 = [19 x i8] c"%6.3f %8.2E %4.2f\0A\00"
define void @ShortUSTable() {
%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 ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i64 52, 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 ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i64 53, i64 1, i32* %7)
br label %12
12: ; preds = %0, %12
%13 = phi i32 [ -1, %0 ], [ %59, %12 ]
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 3.048000e-01
%16 = fptrunc double %15 to float
%17 = call i32 @SimpleAtmosphere(float %16, float* %1, float* %2, float* %3)
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %13, double %19, double %21, double %23)
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = fmul double %26, 5.186700e+02
%28 = fptrunc double %27 to float
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = fmul double %30, 1.013250e+05
%32 = fdiv double %31, 4.788000e+01
%33 = fptrunc double %32 to float
%34 = load float, float* %1
%35 = fpext float %34 to double
%36 = fmul double %35, 1.225000e+00
%37 = fdiv double %36, 5.153790e+02
%38 = fptrunc double %37 to float
%39 = call double @sqrt(float %25)
%40 = fmul double %39, 0x409171CCEF33BCCE
%41 = fptrunc double %40 to float
%42 = fpext float %28 to double
%43 = fpext float %33 to double
%44 = fpext float %38 to double
%45 = fpext float %41 to double
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %42, double %43, double %44, double %45)
%47 = load float, float* %3
%48 = call double @MetricViscosity(float %47)
%49 = fmul double %48, 0x3F9562FDCB52B51F
%50 = fptrunc double %49 to float
%51 = fdiv float %50, %38
%52 = fdiv float %41, %51
%53 = fpext float %50 to double
%54 = fmul double %53, 1.000000e+06
%55 = fpext float %51 to double
%56 = fpext float %52 to double
%57 = fmul double %56, 0x3EB0C6F7A0B5ED8D
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %54, double %55, double %57)
%59 = add nsw i32 %13, 1
%60 = icmp eq i32 %59, 66
br i1 %60, label %61, label %12
61: ; preds = %12
%62 = call i32 @fclose(i32* %7)
ret void
}