#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 */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double radius;
  double h1;
  double h2;
  double v1;
  double v2;
  double sa1;
  double sa2;
  printf("\nPlease enter the value of the radius: ");
  scanf("%lf", &radius);
  printf("Please enter the height of the first cylinder: ");
  scanf("%lf", &h1);
  printf("Please enter the height of the second cylinder: ");
  scanf("%lf", &h2);
  printf("\nRadius is: %.2f\n", radius);
  printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
  v1 = (3.1416 * radius * radius * h1) +
       ((4.0 / 3) * 3.1416 * radius * radius * radius);
  v2 = (3.1416 * radius * radius * h2) +
       ((4.0 / 3) * 3.1416 * radius * radius * radius);
  printf("Volume of the first cylinder: %.2f\n", v1);
  printf("Volume of the second cylinder: %.2f\n", v2);
  printf("Volume difference: %.2f\n", (v1 - v2));
  printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
  sa1 = (2 * 3.1416 * radius * h1) + (4 * 3.1416 * radius * radius);
  sa2 = (2 * 3.1416 * radius * h2) + (4 * 3.1416 * radius * radius);
  printf("Surface Area of first cylinder: %.2f\n", sa1);
  printf("Surface Area of second cylinder: %.2f\n", sa2);
  printf("Surface Area difference: %.2f\n", (sa1 - sa2));
  printf("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xf18(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe66(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe47(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe2b(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xe0c(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xebc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xecd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xeda(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xd94(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xd7a(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd63(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xd49(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefe(%rip),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeee(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf03(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movsd  0x18(%rsp),%xmm0
lea    0xf13(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xfe5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0xe42(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe3a(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xed5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0xdc0(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xdbc(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0APlease enter the value of the radius: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [48 x i8] c"Please enter the height of the first cylinder: \00"
@.str.3 = [49 x i8] c"Please enter the height of the second cylinder: \00"
@.str.4 = [18 x i8] c"\0ARadius is: %.2f\0A\00"
@.str.5 = [41 x i8] c"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\0A\00"
@.str.6 = [36 x i8] c"Volume of the first cylinder: %.2f\0A\00"
@.str.7 = [37 x i8] c"Volume of the second cylinder: %.2f\0A\00"
@.str.8 = [25 x i8] c"Volume difference: %.2f\0A\00"
@.str.9 = [38 x i8] c"Surface Area of first cylinder: %.2f\0A\00"
@.str.10 = [39 x i8] c"Surface Area of second cylinder: %.2f\0A\00"
@.str.11 = [31 x i8] c"Surface Area difference: %.2f\0A\00"
@.str.12 = [42 x i8] c"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\0A\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
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 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* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%15 = load double, double* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%18 = load double, double* %2
%19 = fmul double 3.141600e+00, %18
%20 = load double, double* %2
%21 = fmul double %19, %20
%22 = load double, double* %3
%23 = load double, double* %2
%24 = fmul double 4.188800e+00, %23
%25 = load double, double* %2
%26 = fmul double %24, %25
%27 = load double, double* %2
%28 = fmul double %26, %27
%29 = call double @llvm.fmuladd.f64(double %21, double %22, double %28)
store double %29, double* %5
%30 = load double, double* %2
%31 = fmul double 3.141600e+00, %30
%32 = load double, double* %2
%33 = fmul double %31, %32
%34 = load double, double* %4
%35 = load double, double* %2
%36 = fmul double 4.188800e+00, %35
%37 = load double, double* %2
%38 = fmul double %36, %37
%39 = load double, double* %2
%40 = fmul double %38, %39
%41 = call double @llvm.fmuladd.f64(double %33, double %34, double %40)
store double %41, double* %6
%42 = load double, double* %5
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %42)
%44 = load double, double* %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %44)
%46 = load double, double* %5
%47 = load double, double* %6
%48 = fsub double %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%51 = load double, double* %2
%52 = fmul double 6.283200e+00, %51
%53 = load double, double* %3
%54 = load double, double* %2
%55 = fmul double 1.256640e+01, %54
%56 = load double, double* %2
%57 = fmul double %55, %56
%58 = call double @llvm.fmuladd.f64(double %52, double %53, double %57)
store double %58, double* %7
%59 = load double, double* %2
%60 = fmul double 6.283200e+00, %59
%61 = load double, double* %4
%62 = load double, double* %2
%63 = fmul double 1.256640e+01, %62
%64 = load double, double* %2
%65 = fmul double %63, %64
%66 = call double @llvm.fmuladd.f64(double %60, double %61, double %65)
store double %66, double* %8
%67 = load double, double* %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), double %67)
%69 = load double, double* %8
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), double %69)
%71 = load double, double* %7
%72 = load double, double* %8
%73 = fsub double %71, %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), double %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0APlease enter the value of the radius: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [48 x i8] c"Please enter the height of the first cylinder: \00"
@.str.3 = [49 x i8] c"Please enter the height of the second cylinder: \00"
@.str.4 = [18 x i8] c"\0ARadius is: %.2f\0A\00"
@.str.6 = [36 x i8] c"Volume of the first cylinder: %.2f\0A\00"
@.str.7 = [37 x i8] c"Volume of the second cylinder: %.2f\0A\00"
@.str.8 = [25 x i8] c"Volume difference: %.2f\0A\00"
@.str.9 = [38 x i8] c"Surface Area of first cylinder: %.2f\0A\00"
@.str.10 = [39 x i8] c"Surface Area of second cylinder: %.2f\0A\00"
@.str.11 = [31 x i8] c"Surface Area difference: %.2f\0A\00"
@str.13 = [40 x i8] c"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\00"
@str.14 = [41 x i8] c"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%13 = load double, double* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%16 = load double, double* %1
%17 = fmul double %16, 3.141600e+00
%18 = fmul double %16, %17
%19 = load double, double* %2
%20 = fmul double %16, 4.188800e+00
%21 = fmul double %16, %20
%22 = fmul double %16, %21
%23 = call double @llvm.fmuladd.f64(double %18, double %19, double %22)
%24 = load double, double* %3
%25 = call double @llvm.fmuladd.f64(double %18, double %24, double %22)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %23)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %25)
%28 = fsub double %23, %25
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %28)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%31 = load double, double* %1
%32 = fmul double %31, 6.283200e+00
%33 = load double, double* %2
%34 = fmul double %31, 1.256640e+01
%35 = fmul double %31, %34
%36 = call double @llvm.fmuladd.f64(double %32, double %33, double %35)
%37 = load double, double* %3
%38 = call double @llvm.fmuladd.f64(double %32, double %37, double %35)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), double %36)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), double %38)
%41 = fsub double %36, %38
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), double %41)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}