#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 M_PI;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double radius = 0;
  double circumference = 0, surfaceArea = 0, volume = 0;
  printf("Please enter the radius of the sphere \n Radius = ");
  scanf("%lf", &radius);
  circumference = 2 * M_PI * radius;
  surfaceArea = 4 * M_PI * radius * radius;
  volume = (4 * M_PI * radius * radius * radius) / 3;
  printf("Circumference = %lf\n Surface Area = %lf\n Volume = %lf",
         circumference, surfaceArea, volume);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe33(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xe4e(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf2e(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
lea    (%rax,%rax,1),%ecx
cvtsi2sd %ecx,%xmm0
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm2
divsd  0xe86(%rip),%xmm2
lea    0xeb9(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Please enter the radius of the sphere \0A Radius = \00"
@.str.1 = [4 x i8] c"%lf\00"
@M_PI = global i32 0
@.str.2 = [54 x i8] c"Circumference = %lf\0A Surface Area = %lf\0A Volume = %lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%8 = load i32, i32* @M_PI
%9 = mul nsw i32 2, %8
%10 = sitofp i32 %9 to double
%11 = load double, double* %2
%12 = fmul double %10, %11
store double %12, double* %3
%13 = load i32, i32* @M_PI
%14 = mul nsw i32 4, %13
%15 = sitofp i32 %14 to double
%16 = load double, double* %2
%17 = fmul double %15, %16
%18 = load double, double* %2
%19 = fmul double %17, %18
store double %19, double* %4
%20 = load i32, i32* @M_PI
%21 = mul nsw i32 4, %20
%22 = sitofp i32 %21 to double
%23 = load double, double* %2
%24 = fmul double %22, %23
%25 = load double, double* %2
%26 = fmul double %24, %25
%27 = load double, double* %2
%28 = fmul double %26, %27
%29 = fdiv double %28, 3.000000e+00
store double %29, double* %5
%30 = load double, double* %3
%31 = load double, double* %4
%32 = load double, double* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), double %30, double %31, double %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"Please enter the radius of the sphere \0A Radius = \00"
@.str.1 = [4 x i8] c"%lf\00"
@M_PI = global i32 0
@.str.2 = [54 x i8] c"Circumference = %lf\0A Surface Area = %lf\0A Volume = %lf\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load i32, i32* @M_PI
%6 = shl nsw i32 %5, 1
%7 = sitofp i32 %6 to double
%8 = load double, double* %1
%9 = fmul double %8, %7
%10 = shl nsw i32 %5, 2
%11 = sitofp i32 %10 to double
%12 = fmul double %8, %11
%13 = fmul double %8, %12
%14 = fmul double %8, %13
%15 = fdiv double %14, 3.000000e+00
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), double %9, double %13, double %15)
ret i32 0
}