#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 *, int *);
main() {
  int r;
  printf("Input radius: ");
  scanf("%d", &r);
  printf("\nDiameter: %d", 2 * r);
  printf("\nPepimeter: %.4f", 2 * 3.14159 * r);
  printf("\nArea: %.4f", 3.14159 * r * r);
  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    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xeb4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe73(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
lea    0xe9d(%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    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    %esi,%esi
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
mulsd  0xe9e(%rip),%xmm0
lea    0xec4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2sdl 0x4(%rsp),%xmm1
movsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Input radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\0ADiameter: %d\00"
@.str.3 = [17 x i8] c"\0APepimeter: %.4f\00"
@.str.4 = [12 x i8] c"\0AArea: %.4f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 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 ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = fmul double 6.283180e+00, %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %10)
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fmul double 3.141590e+00, %13
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = fmul double %14, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Input radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\0ADiameter: %d\00"
@.str.3 = [17 x i8] c"\0APepimeter: %.4f\00"
@.str.4 = [12 x i8] c"\0AArea: %.4f\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 6.283180e+00
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %10)
%12 = load i32, i32* %1
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 3.141590e+00
%15 = fmul double %14, %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %15)
ret i32 0
}