#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(void) {
  double radius;
  printf("This program computes the area of a circle.\n\n");
  printf("Input the radius:   ");
  scanf("%lf", &radius);
  printf("\nArea = PI * radius * radius\n");
  printf("     = %.2f * %.2f * %.2f\n", 3.141592653589793, radius, radius);
  printf("     = %.5f\n", 3.141592653589793 * radius * radius);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
lea    0xef3(%rip),%rdi
movsd  0xe7e(%rip),%xmm0
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0xe6f(%rip),%xmm0
mulsd  -0x10(%rbp),%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    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm1
lea    0xeaf(%rip),%rdi
movsd  0xe86(%rip),%xmm0
movaps %xmm1,%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"This program computes the area of a circle.\0A\0A\00"
@.str.1 = [21 x i8] c"Input the radius: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [30 x i8] c"\0AArea = PI * radius * radius\0A\00"
@.str.4 = [27 x i8] c" = %.2f * %.2f * %.2f\0A\00"
@.str.5 = [13 x i8] c" = %.5f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%7 = load double, double* %2
%8 = load double, double* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double 0x400921FB54442D18, double %7, double %8)
%10 = load double, double* %2
%11 = fmul double 0x400921FB54442D18, %10
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %13)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"Input the radius: \00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.4 = [27 x i8] c" = %.2f * %.2f * %.2f\0A\00"
@.str.5 = [13 x i8] c" = %.5f\0A\00"
@str = [45 x i8] c"This program computes the area of a circle.\0A\00"
@str.6 = [29 x i8] c"\0AArea = PI * radius * radius\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
%7 = load double, double* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double 0x400921FB54442D18, double %7, double %7)
%9 = load double, double* %1
%10 = fmul double %9, 0x400921FB54442D18
%11 = fmul double %9, %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %11)
ret i32 0
}