#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 *);
int main() {
  int r;
  float surface, perimeter;
  printf("Please enter radius of your circle: ");
  scanf("%d", &r);
  surface = 3.14 * r * r;
  perimeter = 2 * 3.14 * r;
  printf("Surface: %f\n", surface);
  printf("Perimeter: %f", perimeter);
  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    0xef1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xeae(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe83(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe94(%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    0xeff(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
movsd  0xeb2(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
mulsd  0xea6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xebf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Please enter radius of your circle: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Surface: %f\0A\00"
@.str.3 = [14 x i8] c"Perimeter: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
%9 = fmul double 3.140000e+00, %8
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
%13 = fptrunc double %12 to float
store float %13, float* %3
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = fmul double 6.280000e+00, %15
%17 = fptrunc double %16 to float
store float %17, float* %4
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %19)
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Please enter radius of your circle: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Surface: %f\0A\00"
@.str.3 = [14 x i8] c"Perimeter: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 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 = sitofp i32 %5 to double
%7 = fmul double %6, 3.140000e+00
%8 = fmul double %7, %6
%9 = fptrunc double %8 to float
%10 = fmul double %6, 6.280000e+00
%11 = fptrunc double %10 to float
%12 = fpext float %9 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = fpext float %11 to double
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %14)
ret i32 0
}