#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 *);
double MetricViscosity(float);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
double sqrt(float);
void LongUSTable(void) {
  FILE *Itxt;
  int i;
  float altKm;
  float sigma, delta, theta;
  float temp, pressure, density, asound;
  float viscosity, kinematicViscosity;
  Itxt = fopen("us1c.prt", "w");
  fprintf(Itxt, " alt   sigma     delta    theta ");
  fprintf(Itxt, " temp   press     dens       a    visc  k.visc\n");
  fprintf(Itxt, " Kft                            ");
  fprintf(Itxt, " degR lb/sq.ft  s/cu.ft     fps s/ft-s sq.ft/s\n");
  for (i = -1; i <= 56; i++) {
    altKm = 5 * i * 0.3048;
    Atmosphere(altKm, &sigma, &delta, &theta);
    fprintf(Itxt, "%4i %9.3E %9.3E %6.4f ", 5 * i, sigma, delta, theta);
    temp = (1.8 * 288.15) * theta;
    pressure = (101325.0 / 47.880258) * delta;
    density = (1.225 / 515.379) * sigma;
    asound = (340.294 / 0.3048) * sqrt(theta);
    fprintf(Itxt, "%5.1f %8.3E %9.3E %6.1f", temp, pressure, density, asound);
    viscosity = (1.0 / 47.880258) * MetricViscosity(theta);
    kinematicViscosity = viscosity / density;
    fprintf(Itxt, "%6.3f %8.2E\n", 1.0E6 * viscosity, kinematicViscosity);
  }
  fclose(Itxt);
}


x86 assembly (clang, -O0):
<LongUSTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec9(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1060 <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    0xec8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xef5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0xc(%rbp)
cmpl   $0x38,-0xc(%rbp)
jg     135d <LongUSTable+0x1fd>
imul   $0x5,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe48(%rip),%xmm1
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   1070 <Atmosphere@plt>
mov    -0x8(%rbp),%rdi
imul   $0x5,-0xc(%rbp),%edx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xeb0(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xddb(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd65(%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    0xe15(%rip),%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
call   1050 <MetricViscosity@plt>
movaps %xmm0,%xmm1
movsd  0xd05(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
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  0xccc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdcc(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ce <LongUSTable+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LongUSTable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb3(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xeb0(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xec7(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xecf(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    $0xfffffffb,%ebp
mov    %rsp,%r12
lea    0xede(%rip),%r13
lea    0xeee(%rip),%r14
lea    0xeff(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0xdd1(%rip),%xmm0
cvtsd2ss %xmm0,%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  0xd83(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x14(%rsp)
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd6f(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x10(%rsp)
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd5b(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
call   1080 <sqrt@plt>
mulsd  0xd4c(%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>
mulsd  0xd0c(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
divss  0x4(%rsp),%xmm1
mulsd  0xcf8(%rip),%xmm0
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
add    $0x5,%ebp
cmp    $0x11d,%ebp
jne    1220 <LongUSTable+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"us1c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [33 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 = [33 x i8] c" Kft \00"
@.str.5 = [48 x i8] c" degR lb/sq.ft s/cu.ft fps s/ft-s sq.ft/s\0A\00"
@.str.6 = [23 x i8] c"%4i %9.3E %9.3E %6.4f \00"
@.str.7 = [24 x i8] c"%5.1f %8.3E %9.3E %6.1f\00"
@.str.8 = [13 x i8] c"%6.3f %8.2E\0A\00"
define void @LongUSTable() {
%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 ([33 x i8], [33 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 ([33 x i8], [33 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 = %83, %0
%23 = load i32, i32* %2
%24 = icmp sle i32 %23, 56
br i1 %24, label %25, label %86
25: ; preds = %22
%26 = load i32, i32* %2
%27 = mul nsw i32 5, %26
%28 = sitofp i32 %27 to double
%29 = fmul double %28, 3.048000e-01
%30 = fptrunc double %29 to float
store float %30, float* %3
%31 = load float, float* %3
%32 = call i32 @Atmosphere(float %31, float* %4, float* %5, float* %6)
%33 = load i32*, i32** %1
%34 = load i32, i32* %2
%35 = mul nsw i32 5, %34
%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 ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %35, double %37, double %39, double %41)
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = fmul double 5.186700e+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 0x40A0886EEEFA3759, %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 0x3F6378B3F1C69FA8, %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 0x409171CCEF33BCCE, %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 double @MetricViscosity(float %69)
%71 = fmul double 0x3F9562FDCB52B51F, %70
%72 = fptrunc double %71 to float
store float %72, float* %11
%73 = load float, float* %11
%74 = load float, float* %9
%75 = fdiv float %73, %74
store float %75, float* %12
%76 = load i32*, i32** %1
%77 = load float, float* %11
%78 = fpext float %77 to double
%79 = fmul double 1.000000e+06, %78
%80 = load float, float* %12
%81 = fpext float %80 to double
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %76, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %79, double %81)
br label %83
83: ; preds = %25
%84 = load i32, i32* %2
%85 = add nsw i32 %84, 1
store i32 %85, i32* %2
br label %22
86: ; preds = %22
%87 = load i32*, i32** %1
%88 = call i32 @fclose(i32* %87)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"us1c.prt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [33 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 = [33 x i8] c" Kft \00"
@.str.5 = [48 x i8] c" degR lb/sq.ft s/cu.ft fps s/ft-s sq.ft/s\0A\00"
@.str.6 = [23 x i8] c"%4i %9.3E %9.3E %6.4f \00"
@.str.7 = [24 x i8] c"%5.1f %8.3E %9.3E %6.1f\00"
@.str.8 = [13 x i8] c"%6.3f %8.2E\0A\00"
define void @LongUSTable() {
%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 ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i64 32, 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 ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i64 32, 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 ], [ %55, %12 ]
%14 = mul nsw i32 %13, 5
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 3.048000e-01
%17 = fptrunc double %16 to float
%18 = call i32 @Atmosphere(float %17, float* %1, float* %2, float* %3)
%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 ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %14, double %20, double %22, double %24)
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = fmul double %27, 5.186700e+02
%29 = fptrunc double %28 to float
%30 = load float, float* %2
%31 = fpext float %30 to double
%32 = fmul double %31, 0x40A0886EEEFA3759
%33 = fptrunc double %32 to float
%34 = load float, float* %1
%35 = fpext float %34 to double
%36 = fmul double %35, 0x3F6378B3F1C69FA8
%37 = fptrunc double %36 to float
%38 = call double @sqrt(float %26)
%39 = fmul double %38, 0x409171CCEF33BCCE
%40 = fptrunc double %39 to float
%41 = fpext float %29 to double
%42 = fpext float %33 to double
%43 = fpext float %37 to double
%44 = fpext float %40 to double
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), double %41, double %42, double %43, double %44)
%46 = load float, float* %3
%47 = call double @MetricViscosity(float %46)
%48 = fmul double %47, 0x3F9562FDCB52B51F
%49 = fptrunc double %48 to float
%50 = fdiv float %49, %37
%51 = fpext float %49 to double
%52 = fmul double %51, 1.000000e+06
%53 = fpext float %50 to double
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %52, double %53)
%55 = add nsw i32 %13, 1
%56 = icmp eq i32 %55, 57
br i1 %56, label %57, label %12
57: ; preds = %12
%58 = call i32 @fclose(i32* %7)
ret void
}