#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 *, float, float);
int sqrt(int);
int main() {
  int x1 = 2, x2 = 5, y1 = 2, y2 = 6;
  float r = (sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)))) / 2;
  float a = 3.14 * r * r;
  float p = 2 * 3.14 * r;
  printf("Area of Cirlce: %f \nPerimeter of the circle: %f\n", a, p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x6,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
imul   %eax,%edi
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x14(%rbp),%ecx
imul   %ecx,%eax
add    %eax,%edi
call   1040 <sqrt@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe76(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x19,%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cvtsi2ss %ecx,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mulsd  0xeb0(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Area of Cirlce: %f \0APerimeter of the circle: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store i32 2, i32* %2
store i32 5, i32* %3
store i32 2, i32* %4
store i32 6, i32* %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = mul nsw i32 %11, %14
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = sub nsw i32 %19, %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %15, %22
%24 = call i32 @sqrt(i32 %23)
%25 = sdiv i32 %24, 2
%26 = sitofp i32 %25 to float
store float %26, float* %6
%27 = load float, float* %6
%28 = fpext float %27 to double
%29 = fmul double 3.140000e+00, %28
%30 = load float, float* %6
%31 = fpext float %30 to double
%32 = fmul double %29, %31
%33 = fptrunc double %32 to float
store float %33, float* %7
%34 = load float, float* %6
%35 = fpext float %34 to double
%36 = fmul double 6.280000e+00, %35
%37 = fptrunc double %36 to float
store float %37, float* %8
%38 = load float, float* %7
%39 = load float, float* %8
%40 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), float %38, float %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"Area of Cirlce: %f \0APerimeter of the circle: %f\0A\00"
define i32 @main() {
%1 = tail call i32 @sqrt(i32 25)
%2 = sdiv i32 %1, 2
%3 = sitofp i32 %2 to float
%4 = fpext float %3 to double
%5 = fmul double %4, 3.140000e+00
%6 = fmul double %5, %4
%7 = fptrunc double %6 to float
%8 = fmul double %4, 6.280000e+00
%9 = fptrunc double %8 to float
%10 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), float %7, float %9)
ret i32 0
}