#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 abs(int);
double sqrt(double);
int inCircle(int size, int x, int y) {
  int result = 0;
  x = abs(x);
  y = abs(y);
  double y_ratio = sqrt(3);
  double fx = (double)x;
  double fy = (double)y;
  fy *= y_ratio;
  double distance = sqrt((fx * fx) + (fy * fy));
  if ((distance) < (size / 2)) {
    result = 1;
  }
  return (result);
}


x86 assembly (clang, -O0):
<inCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
movsd  0xeaa(%rip),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
ucomisd %xmm1,%xmm0
jbe    11ce <inCircle+0xae>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inCircle>:
push   %rbx
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
mov    %edi,%ebx
mov    %edx,%ecx
neg    %ecx
cmovs  %edx,%ecx
cvtsi2sd %eax,%xmm0
cvtsi2sd %ecx,%xmm1
mulsd  0xecf(%rip),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     114d <inCircle+0x3d>
sqrtsd %xmm0,%xmm0
jmp    1152 <inCircle+0x42>
call   1030 <sqrt@plt>
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inCircle(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%12 = load i32, i32* %5
%13 = call i32 @abs(i32 %12)
store i32 %13, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @abs(i32 %14)
store i32 %15, i32* %6
%16 = call double @sqrt(double 3.000000e+00)
store double %16, double* %8
%17 = load i32, i32* %5
%18 = sitofp i32 %17 to double
store double %18, double* %9
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
store double %20, double* %10
%21 = load double, double* %8
%22 = load double, double* %10
%23 = fmul double %22, %21
store double %23, double* %10
%24 = load double, double* %9
%25 = load double, double* %9
%26 = load double, double* %10
%27 = load double, double* %10
%28 = fmul double %26, %27
%29 = call double @llvm.fmuladd.f64(double %24, double %25, double %28)
%30 = call double @sqrt(double %29)
store double %30, double* %11
%31 = load double, double* %11
%32 = load i32, i32* %4
%33 = sdiv i32 %32, 2
%34 = sitofp i32 %33 to double
%35 = fcmp olt double %31, %34
br i1 %35, label %36, label %37
36: ; preds = %3
store i32 1, i32* %7
br label %37
37: ; preds = %36, %3
%38 = load i32, i32* %7
ret i32 %38
}

LLVM IR (-O2):
define i32 @inCircle(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%5 = tail call i32 @llvm.abs.i32(i32 %2, i1 true)
%6 = sitofp i32 %4 to double
%7 = sitofp i32 %5 to double
%8 = fmul double %7, 0x3FFBB67AE8584CAA
%9 = fmul double %8, %8
%10 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %9)
%11 = tail call double @sqrt(double %10)
%12 = sdiv i32 %0, 2
%13 = sitofp i32 %12 to double
%14 = fcmp olt double %11, %13
%15 = zext i1 %14 to i32
ret i32 %15
}