#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*/ isfinite(double);
int perp_bisector_2d(double *out, double *P, double *Q) {
  double *delta;
  double scratch[2];
  if (!P) {
    out[0] = Q[0] / 2;
    out[1] = Q[1] / 2;
    out[2] = -Q[0] / Q[1];
    return !isfinite(out[2]);
  }
  out[0] = (Q[0] + P[0]) / 2;
  out[1] = (Q[1] + P[1]) / 2;
  out[2] = -((Q[0] - P[0]) / (Q[1] - P[1]));
  return !isfinite(out[2]);
}


x86 assembly (clang, -O0):
<perp_bisector_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11bd <perp_bisector_2d+0xad>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xec1(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
divsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    126c <perp_bisector_2d+0x15c>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  0xe05(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1030 <isfinite@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perp_bisector_2d>:
push   %rax
movsd  (%rdx),%xmm0
test   %rsi,%rsi
je     1161 <perp_bisector_2d+0x51>
addsd  (%rsi),%xmm0
movsd  0xeda(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rdx),%xmm0
addsd  0x8(%rsi),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
subsd  (%rsi),%xmm0
subsd  0x8(%rsi),%xmm1
xorpd  0xeb5(%rip),%xmm0
divsd  %xmm1,%xmm0
jmp    118c <perp_bisector_2d+0x7c>
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
mulsd  0x8(%rdx),%xmm1
movsd  %xmm1,0x8(%rdi)
movsd  (%rdx),%xmm0
xorpd  0xe89(%rip),%xmm0
divsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
call   1030 <isfinite@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @perp_bisector_2d(double* %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca [2 x double]
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
%10 = load double*, double** %6
%11 = icmp ne double* %10, null
br i1 %11, label %42, label %12
12: ; preds = %3
%13 = load double*, double** %7
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = fdiv double %15, 2.000000e+00
%17 = load double*, double** %5
%18 = getelementptr inbounds double, double* %17, i64 0
store double %16, double* %18
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fdiv double %21, 2.000000e+00
%23 = load double*, double** %5
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double*, double** %7
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = fneg double %27
%29 = load double*, double** %7
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = fdiv double %28, %31
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 2
store double %32, double* %34
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = call i32 @isfinite(double %37)
%39 = icmp ne i32 %38, 0
%40 = xor i1 %39, true
%41 = zext i1 %40 to i32
store i32 %41, i32* %4
br label %88
42: ; preds = %3
%43 = load double*, double** %7
%44 = getelementptr inbounds double, double* %43, i64 0
%45 = load double, double* %44
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = fadd double %45, %48
%50 = fdiv double %49, 2.000000e+00
%51 = load double*, double** %5
%52 = getelementptr inbounds double, double* %51, i64 0
store double %50, double* %52
%53 = load double*, double** %7
%54 = getelementptr inbounds double, double* %53, i64 1
%55 = load double, double* %54
%56 = load double*, double** %6
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = fadd double %55, %58
%60 = fdiv double %59, 2.000000e+00
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 1
store double %60, double* %62
%63 = load double*, double** %7
%64 = getelementptr inbounds double, double* %63, i64 0
%65 = load double, double* %64
%66 = load double*, double** %6
%67 = getelementptr inbounds double, double* %66, i64 0
%68 = load double, double* %67
%69 = fsub double %65, %68
%70 = load double*, double** %7
%71 = getelementptr inbounds double, double* %70, i64 1
%72 = load double, double* %71
%73 = load double*, double** %6
%74 = getelementptr inbounds double, double* %73, i64 1
%75 = load double, double* %74
%76 = fsub double %72, %75
%77 = fdiv double %69, %76
%78 = fneg double %77
%79 = load double*, double** %5
%80 = getelementptr inbounds double, double* %79, i64 2
store double %78, double* %80
%81 = load double*, double** %5
%82 = getelementptr inbounds double, double* %81, i64 2
%83 = load double, double* %82
%84 = call i32 @isfinite(double %83)
%85 = icmp ne i32 %84, 0
%86 = xor i1 %85, true
%87 = zext i1 %86 to i32
store i32 %87, i32* %4
br label %88
88: ; preds = %42, %12
%89 = load i32, i32* %4
ret i32 %89
}

LLVM IR (-O2):
define i32 @perp_bisector_2d(double* nocapture writeonly %0, double* %1, double* nocapture %2) {
%4 = icmp eq double* %1, null
%5 = load double, double* %2
br i1 %4, label %6, label %16
6: ; preds = %3
%7 = fmul double %5, 5.000000e-01
store double %7, double* %0
%8 = getelementptr inbounds double, double* %2, i64 1
%9 = load double, double* %8
%10 = fmul double %9, 5.000000e-01
%11 = getelementptr inbounds double, double* %0, i64 1
store double %10, double* %11
%12 = load double, double* %2
%13 = fneg double %12
%14 = load double, double* %8
%15 = fdiv double %13, %14
br label %35
16: ; preds = %3
%17 = load double, double* %1
%18 = fadd double %5, %17
%19 = fmul double %18, 5.000000e-01
store double %19, double* %0
%20 = getelementptr inbounds double, double* %2, i64 1
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %1, i64 1
%23 = load double, double* %22
%24 = fadd double %21, %23
%25 = fmul double %24, 5.000000e-01
%26 = getelementptr inbounds double, double* %0, i64 1
store double %25, double* %26
%27 = load double, double* %2
%28 = load double, double* %1
%29 = fsub double %27, %28
%30 = load double, double* %20
%31 = load double, double* %22
%32 = fsub double %30, %31
%33 = fneg double %29
%34 = fdiv double %33, %32
br label %35
35: ; preds = %16, %6
%36 = phi double [ %34, %16 ], [ %15, %6 ]
%37 = getelementptr inbounds double, double* %0, i64 2
store double %36, double* %37
%38 = tail call i32 @isfinite(double %36)
%39 = icmp eq i32 %38, 0
%40 = zext i1 %39 to i32
ret i32 %40
}