#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 pi = 3.14159265439;
  double radius, area, circumference;
  printf("Calculate Info About a Circle\n"
         "=============================\n\n"
         "Enter the circle's radius: ");
  scanf("%lf", &radius);
  area = pi * radius * radius;
  circumference = 2.0 * pi * radius;
  printf("\nThe circle's radius is: %6.4lf\n"
         "The circle's circumference is %6.4lf\n"
         "The circle's area is %6.4lf\n\n",
         radius, area, circumference);
  printf("Another way to represent the calculations:\n"
         "%6.4lf %6.4lf %6.4lf\n\n",
         radius, pi * radius * radius, 2.0 * pi * radius);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8a(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xed2(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe42(%rip),%xmm2
mulsd  -0x10(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
lea    0xf01(%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
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  0xeb1(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
mulsd  0xea9(%rip),%xmm2
lea    0xf07(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
movsd  0xe86(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe7e(%rip),%xmm2
mulsd  %xmm0,%xmm2
lea    0xf3b(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [89 x i8] c"Calculate Info About a Circle\0A=============================\0A\0AEnter the circle's radius: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [99 x i8] c"\0AThe circle's radius is: %6.4lf\0AThe circle's circumference is %6.4lf\0AThe circle's area is %6.4lf\0A\0A\00"
@.str.3 = [66 x i8] c"Another way to represent the calculations:\0A%6.4lf %6.4lf %6.4lf\0A\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
store double 0x400921FB545FABCA, double* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([89 x i8], [89 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* %3)
%8 = load double, double* %2
%9 = load double, double* %3
%10 = fmul double %8, %9
%11 = load double, double* %3
%12 = fmul double %10, %11
store double %12, double* %4
%13 = load double, double* %2
%14 = fmul double 2.000000e+00, %13
%15 = load double, double* %3
%16 = fmul double %14, %15
store double %16, double* %5
%17 = load double, double* %3
%18 = load double, double* %4
%19 = load double, double* %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), double %17, double %18, double %19)
%21 = load double, double* %3
%22 = load double, double* %2
%23 = load double, double* %3
%24 = fmul double %22, %23
%25 = load double, double* %3
%26 = fmul double %24, %25
%27 = load double, double* %2
%28 = fmul double 2.000000e+00, %27
%29 = load double, double* %3
%30 = fmul double %28, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %21, double %26, double %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [89 x i8] c"Calculate Info About a Circle\0A=============================\0A\0AEnter the circle's radius: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [99 x i8] c"\0AThe circle's radius is: %6.4lf\0AThe circle's circumference is %6.4lf\0AThe circle's area is %6.4lf\0A\0A\00"
@.str.3 = [66 x i8] c"Another way to represent the calculations:\0A%6.4lf %6.4lf %6.4lf\0A\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 ([89 x i8], [89 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, 0x400921FB545FABCA
%7 = fmul double %5, %6
%8 = fmul double %5, 0x401921FB545FABCA
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str.2, i64 0, i64 0), double %5, double %7, double %8)
%10 = load double, double* %1
%11 = fmul double %10, 0x400921FB545FABCA
%12 = fmul double %10, %11
%13 = fmul double %10, 0x401921FB545FABCA
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %10, double %12, double %13)
ret i32 0
}