#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 r;
  double surface;
  double volume;
  double perimeter;
  printf("%s: ", "Enter radius");
  scanf("%lf", &r);
  perimeter = 2 * M_PI * r;
  surface = 4 * M_PI * (r * r);
  volume = (4.0 / 3.0) * M_PI * (r * r * r);
  printf("Perimeter: %lf\n", perimeter);
  printf("Surface: %lf\n", surface);
  printf("Volume: %lf\n", volume);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e50(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe4a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xedd(%rip),%rdi
lea    0xedb(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
lea    (%rax,%rax,1),%ecx
cvtsi2sd %ecx,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
lea    0x0(,%rax,4),%ecx
cvtsi2sd %ecx,%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm2
movsd  %xmm2,(%rsp)
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  0xe71(%rip),%xmm2
mulsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
lea    0xe7a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [13 x i8] c"Enter radius\00"
@.str.2 = [4 x i8] c"%lf\00"
@M_PI = global i32 0
@.str.3 = [16 x i8] c"Perimeter: %lf\0A\00"
@.str.4 = [14 x i8] c"Surface: %lf\0A\00"
@.str.5 = [13 x i8] c"Volume: %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, 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* %5
%13 = load i32, i32* @M_PI
%14 = mul nsw i32 4, %13
%15 = sitofp i32 %14 to double
%16 = load double, double* %2
%17 = load double, double* %2
%18 = fmul double %16, %17
%19 = fmul double %15, %18
store double %19, double* %3
%20 = load i32, i32* @M_PI
%21 = sitofp i32 %20 to double
%22 = fmul double 0x3FF5555555555555, %21
%23 = load double, double* %2
%24 = load double, double* %2
%25 = fmul double %23, %24
%26 = load double, double* %2
%27 = fmul double %25, %26
%28 = fmul double %22, %27
store double %28, double* %4
%29 = load double, double* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %29)
%31 = load double, double* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %31)
%33 = load double, double* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [13 x i8] c"Enter radius\00"
@.str.2 = [4 x i8] c"%lf\00"
@M_PI = global i32 0
@.str.3 = [16 x i8] c"Perimeter: %lf\0A\00"
@.str.4 = [14 x i8] c"Surface: %lf\0A\00"
@.str.5 = [13 x i8] c"Volume: %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, 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, %8
%13 = fmul double %12, %11
%14 = sitofp i32 %5 to double
%15 = fmul double %14, 0x3FF5555555555555
%16 = fmul double %8, %12
%17 = fmul double %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %9)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %13)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %17)
ret i32 0
}