#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 *, char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float radius = 0;
  float diameter = 0;
  float circumference = 0;
  float area = 0;
  float pi = 3.14159;
  printf("%s", "Enter Circle radius(-1 to exit): ");
  scanf("%f", &radius);
  while (radius != -1) {
    diameter = 2 * radius;
    circumference = 2 * pi * radius;
    area = pi * (radius * radius);
    printf("%s%f\n", "The circle diameter for the given radius is: ", diameter);
    printf("%s%f\n",
           "The circle circumference for the given radius is: ", circumference);
    printf("%s%f\n\n", "The circle area for the given radius is: ", area);
    printf("%s", "Enter Circle radius(-1 to exit): ");
    scanf("%f", &radius);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xea9(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xea9(%rip),%rdi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe76(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11a2 <main+0x82>
jp     11a2 <main+0x82>
jmp    1267 <main+0x147>
movss  0xe5e(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe4c(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe41(%rip),%rdi
lea    0xe40(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe23(%rip),%rdi
lea    0xe50(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6c(%rip),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdc8(%rip),%rdi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1181 <main+0x61>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
lea    0xecf(%rip),%rdi
lea    0xecb(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe97(%rip),%xmm0
jne    1171 <main+0x51>
jnp    1246 <main+0x126>
lea    0xebc(%rip),%rbx
lea    0xf23(%rip),%r13
lea    0xe86(%rip),%rbp
lea    0xe82(%rip),%r14
lea    0xe9d(%rip),%r15
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
movaps %xmm0,%xmm1
addss  %xmm0,%xmm0
movaps %xmm1,%xmm2
mulss  0xe52(%rip),%xmm2
movss  %xmm2,0x10(%rsp)
mulss  %xmm1,%xmm1
mulss  0xe44(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
lea    0xe62(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
lea    0xe75(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe90(%rip),%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xdc6(%rip),%xmm0
jne    11a0 <main+0x80>
jp     11a0 <main+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [34 x i8] c"Enter Circle radius(-1 to exit): \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [6 x i8] c"%s%f\0A\00"
@.str.4 = [46 x i8] c"The circle diameter for the given radius is: \00"
@.str.5 = [51 x i8] c"The circle circumference for the given radius is: \00"
@.str.6 = [7 x i8] c"%s%f\0A\0A\00"
@.str.7 = [42 x i8] c"The circle area for the given radius is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0x400921FA00000000, float* %6
%7 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
br label %9
9: ; preds = %12, %0
%10 = load float, float* %2
%11 = fcmp une float %10, -1.000000e+00
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load float, float* %2
%14 = fmul float 2.000000e+00, %13
store float %14, float* %3
%15 = load float, float* %6
%16 = fmul float 2.000000e+00, %15
%17 = load float, float* %2
%18 = fmul float %16, %17
store float %18, float* %4
%19 = load float, float* %6
%20 = load float, float* %2
%21 = load float, float* %2
%22 = fmul float %20, %21
%23 = fmul float %19, %22
store float %23, float* %5
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), double %25)
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), double %28)
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), double %31)
%33 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
br label %9
35: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [34 x i8] c"Enter Circle radius(-1 to exit): \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [6 x i8] c"%s%f\0A\00"
@.str.4 = [46 x i8] c"The circle diameter for the given radius is: \00"
@.str.5 = [51 x i8] c"The circle circumference for the given radius is: \00"
@.str.6 = [7 x i8] c"%s%f\0A\0A\00"
@.str.7 = [42 x i8] c"The circle area for the given radius is: \00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp une float %5, -1.000000e+00
br i1 %6, label %7, label %23
7: ; preds = %0, %7
%8 = phi float [ %21, %7 ], [ %5, %0 ]
%9 = fmul float %8, 2.000000e+00
%10 = fmul float %8, 0x401921FA00000000
%11 = fmul float %8, %8
%12 = fmul float %11, 0x400921FA00000000
%13 = fpext float %9 to double
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), double %13)
%15 = fpext float %10 to double
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), double %15)
%17 = fpext float %12 to double
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), double %17)
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%21 = load float, float* %1
%22 = fcmp une float %21, -1.000000e+00
br i1 %22, label %7, label %23
23: ; preds = %7, %0
ret i32 0
}