#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 atan(double);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float diameter, height, height2, diameter2, Radius, Volume, Area;
  int idiameter, iheight;
  printf("This program will give you the volume of a cylinder in customary "
         "units\n");
  printf("Enter Diameter in meters: \n");
  scanf("%f", &diameter);
  getchar();
  printf("Enter height in meters: \n");
  scanf("%f", &height);
  getchar();
  Radius = diameter / 2;
  Area = 4.0 * atan(1.0) * (Radius * Radius);
  Volume = Area * height;
  diameter = diameter * 3.28084;
  height = height * 3.28084;
  Volume = Volume * 264.172;
  idiameter = diameter;
  diameter2 = (diameter - idiameter) * 12;
  iheight = height;
  height2 = (height - iheight) * 12;
  printf("Volume in US gallons: %.3f\n", Volume);
  printf("Height in ft: %.3f \n", height);
  printf("Diameter in ft: %.3f \n\n", diameter);
  printf("Volume in US gallons: %.3f\n", Volume);
  printf("Height in ft and in: %i ft. %.3f in.\n", iheight, height2);
  printf("Diameter in ft and in: %i ft. %.3f in.\n", idiameter, diameter2);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe50(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movsd  0xe5b(%rip),%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdfc(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdde(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x24(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  0xd85(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x28(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  0xd5e(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdee(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xf63(%rip),%rdi
call   1030 <puts@plt>
lea    0xf9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xf92(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movss  0x8(%rsp),%xmm0
mulss  0xe47(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
movsd  0xe41(%rip),%xmm0
call   1060 <atan@plt>
movss  0x10(%rsp),%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe2e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  0x8(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xe16(%rip),%xmm3
mulsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0x8(%rsp)
cvtss2sd %xmm1,%xmm1
mulsd  %xmm3,%xmm1
xorps  %xmm3,%xmm3
cvtsd2ss %xmm1,%xmm3
movss  %xmm3,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xdef(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvttss2si %xmm2,%r14d
cvttps2dq %xmm2,%xmm1
cvtdq2ps %xmm1,%xmm1
subss  %xmm1,%xmm2
movss  0xdb7(%rip),%xmm1
mulss  %xmm1,%xmm2
movaps %xmm2,0x10(%rsp)
cvttss2si %xmm3,%ebp
cvttps2dq %xmm3,%xmm2
cvtdq2ps %xmm2,%xmm2
subss  %xmm2,%xmm3
mulss  %xmm1,%xmm3
movaps %xmm3,0x30(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0xdac(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdad(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdaa(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movaps 0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd9b(%rip),%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movaps 0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda8(%rip),%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [72 x i8] c"This program will give you the volume of a cylinder in customary units\0A\00"
@.str.1 = [28 x i8] c"Enter Diameter in meters: \0A\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [26 x i8] c"Enter height in meters: \0A\00"
@.str.4 = [28 x i8] c"Volume in US gallons: %.3f\0A\00"
@.str.5 = [21 x i8] c"Height in ft: %.3f \0A\00"
@.str.6 = [24 x i8] c"Diameter in ft: %.3f \0A\0A\00"
@.str.7 = [38 x i8] c"Height in ft and in: %i ft. %.3f in.\0A\00"
@.str.8 = [40 x i8] c"Diameter in ft and in: %i ft. %.3f in.\0A\00"
define i32 @main() {
%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 i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%14 = call i32 (...) @getchar()
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%17 = call i32 (...) @getchar()
%18 = load float, float* %2
%19 = fdiv float %18, 2.000000e+00
store float %19, float* %6
%20 = call double @atan(double 1.000000e+00)
%21 = fmul double 4.000000e+00, %20
%22 = load float, float* %6
%23 = load float, float* %6
%24 = fmul float %22, %23
%25 = fpext float %24 to double
%26 = fmul double %21, %25
%27 = fptrunc double %26 to float
store float %27, float* %8
%28 = load float, float* %8
%29 = load float, float* %3
%30 = fmul float %28, %29
store float %30, float* %7
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = fmul double %32, 3.280840e+00
%34 = fptrunc double %33 to float
store float %34, float* %2
%35 = load float, float* %3
%36 = fpext float %35 to double
%37 = fmul double %36, 3.280840e+00
%38 = fptrunc double %37 to float
store float %38, float* %3
%39 = load float, float* %7
%40 = fpext float %39 to double
%41 = fmul double %40, 2.641720e+02
%42 = fptrunc double %41 to float
store float %42, float* %7
%43 = load float, float* %2
%44 = fptosi float %43 to i32
store i32 %44, i32* %9
%45 = load float, float* %2
%46 = load i32, i32* %9
%47 = sitofp i32 %46 to float
%48 = fsub float %45, %47
%49 = fmul float %48, 1.200000e+01
store float %49, float* %5
%50 = load float, float* %3
%51 = fptosi float %50 to i32
store i32 %51, i32* %10
%52 = load float, float* %3
%53 = load i32, i32* %10
%54 = sitofp i32 %53 to float
%55 = fsub float %52, %54
%56 = fmul float %55, 1.200000e+01
store float %56, float* %4
%57 = load float, float* %7
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %58)
%60 = load float, float* %3
%61 = fpext float %60 to double
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %61)
%63 = load float, float* %2
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %64)
%66 = load float, float* %7
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %67)
%69 = load i32, i32* %10
%70 = load float, float* %4
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %69, double %71)
%73 = load i32, i32* %9
%74 = load float, float* %5
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i32 %73, double %75)
%77 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%f\00"
@.str.4 = [28 x i8] c"Volume in US gallons: %.3f\0A\00"
@.str.5 = [21 x i8] c"Height in ft: %.3f \0A\00"
@.str.6 = [24 x i8] c"Diameter in ft: %.3f \0A\0A\00"
@.str.7 = [38 x i8] c"Height in ft and in: %i ft. %.3f in.\0A\00"
@.str.8 = [40 x i8] c"Diameter in ft and in: %i ft. %.3f in.\0A\00"
@str = [71 x i8] c"This program will give you the volume of a cylinder in customary units\00"
@str.9 = [27 x i8] c"Enter Diameter in meters: \00"
@str.10 = [25 x i8] c"Enter height in meters: \00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%8 = call i32 (...) @getchar()
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%11 = call i32 (...) @getchar()
%12 = load float, float* %1
%13 = fmul float %12, 5.000000e-01
%14 = call double @atan(double 1.000000e+00)
%15 = fmul float %13, %13
%16 = fpext float %15 to double
%17 = fmul double %16, 0x400921FB54442D18
%18 = fptrunc double %17 to float
%19 = load float, float* %2
%20 = fmul float %19, %18
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = fmul double %22, 3.280840e+00
%24 = fptrunc double %23 to float
store float %24, float* %1
%25 = fpext float %19 to double
%26 = fmul double %25, 3.280840e+00
%27 = fptrunc double %26 to float
store float %27, float* %2
%28 = fpext float %20 to double
%29 = fmul double %28, 2.641720e+02
%30 = fptrunc double %29 to float
%31 = fptosi float %24 to i32
%32 = sitofp i32 %31 to float
%33 = fsub float %24, %32
%34 = fmul float %33, 1.200000e+01
%35 = fptosi float %27 to i32
%36 = sitofp i32 %35 to float
%37 = fsub float %27, %36
%38 = fmul float %37, 1.200000e+01
%39 = fpext float %30 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %39)
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %42)
%44 = load float, float* %1
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %39)
%48 = fpext float %38 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %35, double %48)
%50 = fpext float %34 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i32 %31, double %50)
%52 = call i32 (...) @getchar()
ret i32 0
}