#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;
  v2 = 3.1416 * radius * radius * h2;
  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;
  sa2 = 2 * 3.1416 * radius * h2;
  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    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xf08(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe56(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe3a(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xeea(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xefb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xf08(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xdca(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdb3(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xed2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xee5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
lea    0xef4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf05(%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    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeee(%rip),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xef3(%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    0xf03(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xfd5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0xe42(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xec6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xee1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0xdd4(%rip),%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xed9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf12(%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 = fmul double %21, %22
store double %23, double* %5
%24 = load double, double* %2
%25 = fmul double 3.141600e+00, %24
%26 = load double, double* %2
%27 = fmul double %25, %26
%28 = load double, double* %4
%29 = fmul double %27, %28
store double %29, double* %6
%30 = load double, double* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %30)
%32 = load double, double* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %32)
%34 = load double, double* %5
%35 = load double, double* %6
%36 = fsub double %34, %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%39 = load double, double* %2
%40 = fmul double 6.283200e+00, %39
%41 = load double, double* %3
%42 = fmul double %40, %41
store double %42, double* %7
%43 = load double, double* %2
%44 = fmul double 6.283200e+00, %43
%45 = load double, double* %4
%46 = fmul double %44, %45
store double %46, double* %8
%47 = load double, double* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), double %47)
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), double %49)
%51 = load double, double* %7
%52 = load double, double* %8
%53 = fsub double %51, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), double %53)
%55 = 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 %19, %18
%21 = load double, double* %3
%22 = fmul double %18, %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), double %20)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %22)
%25 = fsub double %20, %22
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.13, i64 0, i64 0))
%28 = load double, double* %1
%29 = fmul double %28, 6.283200e+00
%30 = load double, double* %2
%31 = fmul double %29, %30
%32 = load double, double* %3
%33 = fmul double %29, %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), double %31)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), double %33)
%36 = fsub double %31, %33
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), double %36)
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}