#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() {
  double r, l, s, v;
  printf("please enter r:");
  scanf("%lf", &r);
  l = 2 * 3.1415926 * r;
  s = 3.1415926 * r * r;
  v = 4.0 / 3.0 * 3.1415926 * r * r * r;
  printf("r = %6.3lf\n l = %6.2lf\n s = %6.2lf\n v = %6.2lf\n", r, l, s, v);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xebb(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe82(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
lea    0xe7f(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
movsd  0xeb5(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xeb1(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xea9(%rip),%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm3
lea    0xeb2(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"please enter r:\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [48 x i8] c"r = %6.3lf\0A l = %6.2lf\0A s = %6.2lf\0A v = %6.2lf\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 ([16 x i8], [16 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 double, double* %2
%9 = fmul double 0x401921FB4D12D84A, %8
store double %9, double* %3
%10 = load double, double* %2
%11 = fmul double 0x400921FB4D12D84A, %10
%12 = load double, double* %2
%13 = fmul double %11, %12
store double %13, double* %4
%14 = load double, double* %2
%15 = fmul double 0x4010C1523361E586, %14
%16 = load double, double* %2
%17 = fmul double %15, %16
%18 = load double, double* %2
%19 = fmul double %17, %18
store double %19, double* %5
%20 = load double, double* %2
%21 = load double, double* %3
%22 = load double, double* %4
%23 = load double, double* %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), double %20, double %21, double %22, double %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"please enter r:\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [48 x i8] c"r = %6.3lf\0A l = %6.2lf\0A s = %6.2lf\0A v = %6.2lf\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 ([16 x i8], [16 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 double, double* %1
%6 = fmul double %5, 0x401921FB4D12D84A
%7 = fmul double %5, 0x400921FB4D12D84A
%8 = fmul double %5, %7
%9 = fmul double %5, 0x4010C1523361E586
%10 = fmul double %5, %9
%11 = fmul double %5, %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), double %5, double %6, double %8, double %11)
ret i32 0
}