#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*/ free(int *);
int *malloc(int);
void bfSeperation(int npoin, double *x, double *y) {
  int i, j, k;
  double xp = 0.34;
  double yp = 0.1;
  double rp = xp * xp + yp * yp;
  double r = 0.15;
  double u, v, d;
  int *inRadius = NULL;
  inRadius = malloc(sizeof(int) * npoin * npoin);
  k = 0;
  for (i = 0; i < npoin; i++) {
    u = x[i];
    for (j = 0; j < npoin; j++) {
      inRadius[k] = 0;
      v = y[j];
      d = (u * u + v * v) + rp - 2 * ((u * xp) + (v * yp));
      if (d <= r * r) {
        inRadius[i] = 1;
      }
      k = k + 1;
    }
  }
  free(inRadius);
}


x86 assembly (clang, -O0):
<bfSeperation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movq   $0x0,-0x68(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
movslq -0x4(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    129a <bfSeperation+0x17a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1287 <bfSeperation+0x167>
mov    -0x68(%rbp),%rax
movslq -0x24(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm2
mulsd  -0x38(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1270 <bfSeperation+0x150>
mov    -0x68(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d1 <bfSeperation+0xb1>
jmp    128c <bfSeperation+0x16c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ac <bfSeperation+0x8c>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfSeperation>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
imul   %edi,%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
test   %ebp,%ebp
jle    11e5 <bfSeperation+0xc5>
mov    %ebp,%ecx
xor    %edx,%edx
movsd  0xeb5(%rip),%xmm0
movsd  0xeb5(%rip),%xmm1
movsd  0xeb5(%rip),%xmm2
movsd  0xeb5(%rip),%xmm3
xor    %esi,%esi
jmp    117c <bfSeperation+0x5c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdx
add    %rdi,%rsi
cmp    %rcx,%rdx
je     11e5 <bfSeperation+0xc5>
movsd  (%r14,%rdx,8),%xmm4
movslq %esi,%rsi
lea    (%rax,%rsi,4),%rbp
xor    %edi,%edi
jmp    1199 <bfSeperation+0x79>
nopl   (%rax)
add    $0x1,%rdi
cmp    %rdi,%rcx
je     1170 <bfSeperation+0x50>
movl   $0x0,0x0(%rbp,%rdi,4)
movsd  (%rbx,%rdi,8),%xmm5
movapd %xmm5,%xmm6
mulsd  %xmm5,%xmm6
movapd %xmm4,%xmm7
mulsd  %xmm4,%xmm7
addsd  %xmm6,%xmm7
addsd  %xmm0,%xmm7
mulsd  %xmm1,%xmm5
movapd %xmm4,%xmm6
mulsd  %xmm2,%xmm6
addsd  %xmm5,%xmm6
addsd  %xmm6,%xmm6
subsd  %xmm6,%xmm7
ucomisd %xmm7,%xmm3
jb     1190 <bfSeperation+0x70>
movl   $0x1,(%rax,%rdx,4)
jmp    1190 <bfSeperation+0x70>
mov    %rax,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @bfSeperation(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32*
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store double 3.400000e-01, double* %10
store double 1.000000e-01, double* %11
%18 = load double, double* %10
%19 = load double, double* %10
%20 = load double, double* %11
%21 = load double, double* %11
%22 = fmul double %20, %21
%23 = call double @llvm.fmuladd.f64(double %18, double %19, double %22)
store double %23, double* %12
store double 1.500000e-01, double* %13
store i32* null, i32** %17
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = mul i64 4, %25
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = mul i64 %26, %28
%30 = trunc i64 %29 to i32
%31 = call i32* @malloc(i32 %30)
store i32* %31, i32** %17
store i32 0, i32* %9
store i32 0, i32* %7
br label %32
32: ; preds = %88, %3
%33 = load i32, i32* %7
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %91
36: ; preds = %32
%37 = load double*, double** %5
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
store double %41, double* %14
store i32 0, i32* %8
br label %42
42: ; preds = %84, %36
%43 = load i32, i32* %8
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %87
46: ; preds = %42
%47 = load i32*, i32** %17
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %47, i64 %49
store i32 0, i32* %50
%51 = load double*, double** %6
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = load double, double* %54
store double %55, double* %15
%56 = load double, double* %14
%57 = load double, double* %14
%58 = load double, double* %15
%59 = load double, double* %15
%60 = fmul double %58, %59
%61 = call double @llvm.fmuladd.f64(double %56, double %57, double %60)
%62 = load double, double* %12
%63 = fadd double %61, %62
%64 = load double, double* %14
%65 = load double, double* %10
%66 = load double, double* %15
%67 = load double, double* %11
%68 = fmul double %66, %67
%69 = call double @llvm.fmuladd.f64(double %64, double %65, double %68)
%70 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %69, double %63)
store double %70, double* %16
%71 = load double, double* %16
%72 = load double, double* %13
%73 = load double, double* %13
%74 = fmul double %72, %73
%75 = fcmp ole double %71, %74
br i1 %75, label %76, label %81
76: ; preds = %46
%77 = load i32*, i32** %17
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %77, i64 %79
store i32 1, i32* %80
br label %81
81: ; preds = %76, %46
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %84
84: ; preds = %81
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
store i32 %86, i32* %8
br label %42
87: ; preds = %42
br label %88
88: ; preds = %87
%89 = load i32, i32* %7
%90 = add nsw i32 %89, 1
store i32 %90, i32* %7
br label %32
91: ; preds = %32
%92 = load i32*, i32** %17
%93 = call i32 @free(i32* %92)
ret void
}

LLVM IR (-O2):
define void @bfSeperation(i32 %0, double* nocapture %1, double* nocapture %2) {
%4 = shl i32 %0, 2
%5 = mul i32 %4, %0
%6 = tail call i32* @malloc(i32 %5)
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %39
8: ; preds = %3
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %36, %8
%11 = phi i64 [ 0, %8 ], [ %37, %36 ]
%12 = phi i64 [ 0, %8 ], [ %33, %36 ]
%13 = getelementptr inbounds double, double* %1, i64 %11
%14 = load double, double* %13
%15 = getelementptr inbounds i32, i32* %6, i64 %11
%16 = shl i64 %12, 32
%17 = ashr exact i64 %16, 32
br label %18
18: ; preds = %10, %32
%19 = phi i64 [ %17, %10 ], [ %33, %32 ]
%20 = phi i64 [ 0, %10 ], [ %34, %32 ]
%21 = getelementptr inbounds i32, i32* %6, i64 %19
store i32 0, i32* %21
%22 = getelementptr inbounds double, double* %2, i64 %20
%23 = load double, double* %22
%24 = fmul double %23, %23
%25 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %24)
%26 = fadd double %25, 0x3FC013A92A305533
%27 = fmul double %23, 1.000000e-01
%28 = tail call double @llvm.fmuladd.f64(double %14, double 3.400000e-01, double %27)
%29 = tail call double @llvm.fmuladd.f64(double %28, double -2.000000e+00, double %26)
%30 = fcmp ugt double %29, 2.250000e-02
br i1 %30, label %32, label %31
31: ; preds = %18
store i32 1, i32* %15
br label %32
32: ; preds = %31, %18
%33 = add nsw i64 %19, 1
%34 = add nuw nsw i64 %20, 1
%35 = icmp eq i64 %34, %9
br i1 %35, label %36, label %18
36: ; preds = %32
%37 = add nuw nsw i64 %11, 1
%38 = icmp eq i64 %37, %9
br i1 %38, label %39, label %10
39: ; preds = %36, %3
%40 = tail call i32 @free(i32* %6)
ret void
}