#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 radius;
  printf("Example of simple Symbolic Constants\n\n");
  printf("Please enter a number: ");
  scanf("%lf", &radius);
  printf("The area of the circle is %2.3lf\n", 3.14159265439 * radius * radius);
  printf("The circumference of the circle is %2.3lf\n\n",
         2.0 * 3.14159265439 * radius);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xea5(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xedf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe7d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xee6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf42(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm1
movsd  0xe99(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xeb6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
mulsd  0xe7e(%rip),%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Example of simple Symbolic Constants\0A\0A\00"
@.str.1 = [24 x i8] c"Please enter a number: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [34 x i8] c"The area of the circle is %2.3lf\0A\00"
@.str.4 = [44 x i8] c"The circumference of the circle is %2.3lf\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = fmul double 0x400921FB545FABCA, %6
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %9)
%11 = load double, double* %2
%12 = fmul double 0x401921FB545FABCA, %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), double %12)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"Please enter a number: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [34 x i8] c"The area of the circle is %2.3lf\0A\00"
@.str.4 = [44 x i8] c"The circumference of the circle is %2.3lf\0A\0A\00"
@str = [38 x i8] c"Example of simple Symbolic Constants\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%6 = load double, double* %1
%7 = fmul double %6, 0x400921FB545FABCA
%8 = fmul double %6, %7
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %8)
%10 = load double, double* %1
%11 = fmul double %10, 0x401921FB545FABCA
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), double %11)
ret i32 0
}