#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 Fahr2Cent(double);
double Ft2M(double);
double HeatLoss(double, double, double);
double HeatTransferCoef(double, double);
double NusseltNum(double);
double RayleighNum(double, double, double);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double Length, Height, TempIn, TempOut, SArea, DeltaTemp, Nusselt;
  double HeatCoef, Heat_Loss, Ra;
  printf("Enter the length of the house (ft.):\n");
  scanf("%lf", &Length);
  getchar();
  printf("Enter the height of the house (ft.):\n");
  scanf("%lf", &Height);
  getchar();
  printf("Enter temperature outside house (F):\n");
  scanf("%lf", &TempOut);
  getchar();
  printf("Enter temperature inside house (F):\n");
  scanf("%lf", &TempIn);
  getchar();
  TempIn = Fahr2Cent(TempIn);
  TempOut = Fahr2Cent(TempOut);
  Length = Ft2M(Length);
  Height = Ft2M(Height);
  DeltaTemp = TempIn - TempOut;
  SArea = Length * Height;
  Ra = RayleighNum(DeltaTemp, TempOut, Height);
  Nusselt = NusseltNum(Ra);
  HeatCoef = HeatTransferCoef(Nusselt, Height);
  Heat_Loss = HeatLoss(HeatCoef, DeltaTemp, SArea);
  printf("The calculated heat loss is (W):\n");
  printf("%lf\n", Heat_Loss);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4d(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe28(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe03(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movsd  -0x20(%rbp),%xmm0
call   10a0 <Fahr2Cent@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
call   10a0 <Fahr2Cent@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <Ft2M@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <Ft2M@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   10b0 <RayleighNum@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1080 <NusseltNum@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1070 <HeatTransferCoef@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1030 <HeatLoss@plt>
movsd  %xmm0,-0x50(%rbp)
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xe5d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe48(%rip),%rbx
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe65(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
movsd  0x10(%rsp),%xmm0
call   10b0 <Fahr2Cent@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   10b0 <Fahr2Cent@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <Ft2M@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <Ft2M@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x20(%rsp),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
call   10c0 <RayleighNum@plt>
call   1090 <NusseltNum@plt>
movsd  0x18(%rsp),%xmm1
call   1080 <HeatTransferCoef@plt>
movsd  0x28(%rsp),%xmm1
movsd  (%rsp),%xmm2
call   1030 <HeatLoss@plt>
movsd  %xmm0,(%rsp)
lea    0xdd2(%rip),%rdi
call   1040 <puts@plt>
lea    0xd2e(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Enter the length of the house (ft.):\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [38 x i8] c"Enter the height of the house (ft.):\0A\00"
@.str.3 = [38 x i8] c"Enter temperature outside house (F):\0A\00"
@.str.4 = [37 x i8] c"Enter temperature inside house (F):\0A\00"
@.str.5 = [34 x i8] c"The calculated heat loss is (W):\0A\00"
@.str.6 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%14 = call i32 (...) @getchar()
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%17 = call i32 (...) @getchar()
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%20 = call i32 (...) @getchar()
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%23 = call i32 (...) @getchar()
%24 = load double, double* %4
%25 = call double @Fahr2Cent(double %24)
store double %25, double* %4
%26 = load double, double* %5
%27 = call double @Fahr2Cent(double %26)
store double %27, double* %5
%28 = load double, double* %2
%29 = call double @Ft2M(double %28)
store double %29, double* %2
%30 = load double, double* %3
%31 = call double @Ft2M(double %30)
store double %31, double* %3
%32 = load double, double* %4
%33 = load double, double* %5
%34 = fsub double %32, %33
store double %34, double* %7
%35 = load double, double* %2
%36 = load double, double* %3
%37 = fmul double %35, %36
store double %37, double* %6
%38 = load double, double* %7
%39 = load double, double* %5
%40 = load double, double* %3
%41 = call double @RayleighNum(double %38, double %39, double %40)
store double %41, double* %11
%42 = load double, double* %11
%43 = call double @NusseltNum(double %42)
store double %43, double* %8
%44 = load double, double* %8
%45 = load double, double* %3
%46 = call double @HeatTransferCoef(double %44, double %45)
store double %46, double* %9
%47 = load double, double* %9
%48 = load double, double* %7
%49 = load double, double* %6
%50 = call double @HeatLoss(double %47, double %48, double %49)
store double %50, double* %10
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%52 = load double, double* %10
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %52)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.6 = [5 x i8] c"%lf\0A\00"
@str = [37 x i8] c"Enter the length of the house (ft.):\00"
@str.7 = [37 x i8] c"Enter the height of the house (ft.):\00"
@str.8 = [37 x i8] c"Enter temperature outside house (F):\00"
@str.9 = [36 x i8] c"Enter temperature inside house (F):\00"
@str.10 = [33 x i8] c"The calculated heat loss is (W):\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%11 = call i32 (...) @getchar()
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%14 = call i32 (...) @getchar()
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.8, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%17 = call i32 (...) @getchar()
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.9, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%20 = call i32 (...) @getchar()
%21 = load double, double* %3
%22 = call double @Fahr2Cent(double %21)
store double %22, double* %3
%23 = load double, double* %4
%24 = call double @Fahr2Cent(double %23)
store double %24, double* %4
%25 = load double, double* %1
%26 = call double @Ft2M(double %25)
store double %26, double* %1
%27 = load double, double* %2
%28 = call double @Ft2M(double %27)
store double %28, double* %2
%29 = load double, double* %3
%30 = load double, double* %4
%31 = fsub double %29, %30
%32 = load double, double* %1
%33 = fmul double %28, %32
%34 = call double @RayleighNum(double %31, double %30, double %28)
%35 = call double @NusseltNum(double %34)
%36 = load double, double* %2
%37 = call double @HeatTransferCoef(double %35, double %36)
%38 = call double @HeatLoss(double %37, double %31, double %33)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.10, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %38)
ret i32 0
}