#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 *, int *);
int main() {
  int radius;
  printf("Enter the radius: ");
  scanf("%d", &radius);
  printf("Diameter %d\n", 2 * radius);
  printf("Area %.2f\n", M_PI * radius * radius);
  printf("Circumference %.2f\n", M_PI * radius * 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
imul   -0x8(%rbp),%esi
imul   -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
imul   -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
add    %esi,%esi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e89(%rip),%rbx
mov    0xc(%rsp),%eax
mov    (%rbx),%esi
imul   %eax,%esi
imul   %eax,%esi
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%esi
imul   0xc(%rsp),%esi
add    %esi,%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Diameter %d\0A\00"
@.str.3 = [11 x i8] c"Area %.2f\0A\00"
@M_PI = global i32 0
@.str.4 = [20 x i8] c"Circumference %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = mul nsw i32 2, %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @M_PI
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
%11 = load i32, i32* %2
%12 = mul nsw i32 %10, %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @M_PI
%15 = load i32, i32* %2
%16 = mul nsw i32 %14, %15
%17 = mul nsw i32 %16, 2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter the radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Diameter %d\0A\00"
@.str.3 = [11 x i8] c"Area %.2f\0A\00"
@M_PI = global i32 0
@.str.4 = [20 x i8] c"Circumference %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @M_PI
%9 = load i32, i32* %1
%10 = mul nsw i32 %9, %8
%11 = mul nsw i32 %10, %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @M_PI
%14 = load i32, i32* %1
%15 = shl i32 %13, 1
%16 = mul i32 %15, %14
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %16)
ret i32 0
}