#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 */
scalar_t__ line_intersection(double, double, double, double, double, double,
                             double *, double *);
int /*<<< orphan*/ perpendicular_line_from_two_points(double, double, double,
                                                      double, double *,
                                                      double *, double *);
double sqrt(double);
int circle_from_three_points(double x1, double y1, double x2, double y2,
                             double x3, double y3, double *x, double *y,
                             double *r) {
  double a1, b1, c1, a2, b2, c2, dx, dy;
  perpendicular_line_from_two_points(x1, y1, x2, y2, &a1, &b1, &c1);
  perpendicular_line_from_two_points(x2, y2, x3, y3, &a2, &b2, &c2);
  if (line_intersection(a1, b1, c1, a2, b2, c2, x, y))
    return -1;
  dx = *x - x1;
  dy = *y - y1;
  *r = sqrt(dx * dx + dy * dy);
  return 0;
}


x86 assembly (clang, -O0):
<circle_from_three_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    %rdi,-0x40(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %rdx,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
call   1040 <perpendicular_line_from_two_points@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
lea    -0x70(%rbp),%rdi
lea    -0x78(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1040 <perpendicular_line_from_two_points@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x78(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1030 <line_intersection@plt>
cmp    $0x0,%rax
je     11f0 <circle_from_three_points+0xc0>
movl   $0xffffffff,-0x4(%rbp)
jmp    1256 <circle_from_three_points+0x126>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x90(%rbp),%xmm1
ff
mulsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circle_from_three_points>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm5,0x28(%rsp)
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
lea    0x58(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x48(%rsp),%rdx
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1040 <perpendicular_line_from_two_points@plt>
lea    0x40(%rsp),%rdi
lea    0x38(%rsp),%rsi
lea    0x30(%rsp),%rdx
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
call   1040 <perpendicular_line_from_two_points@plt>
movsd  0x58(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x38(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <line_intersection@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    121d <circle_from_three_points+0xed>
movsd  (%rbx),%xmm0
subsd  (%rsp),%xmm0
movsd  (%r15),%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1211 <circle_from_three_points+0xe1>
sqrtsd %xmm0,%xmm0
jmp    1216 <circle_from_three_points+0xe6>
call   1050 <sqrt@plt>
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @circle_from_three_points(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
%28 = load double, double* %11
%29 = load double, double* %12
%30 = load double, double* %13
%31 = load double, double* %14
%32 = call i32 @perpendicular_line_from_two_points(double %28, double %29, double %30, double %31, double* %20, double* %21, double* %22)
%33 = load double, double* %13
%34 = load double, double* %14
%35 = load double, double* %15
%36 = load double, double* %16
%37 = call i32 @perpendicular_line_from_two_points(double %33, double %34, double %35, double %36, double* %23, double* %24, double* %25)
%38 = load double, double* %20
%39 = load double, double* %21
%40 = load double, double* %22
%41 = load double, double* %23
%42 = load double, double* %24
%43 = load double, double* %25
%44 = load double*, double** %17
%45 = load double*, double** %18
%46 = call i64 @line_intersection(double %38, double %39, double %40, double %41, double %42, double %43, double* %44, double* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %9
store i32 -1, i32* %10
br label %66
49: ; preds = %9
%50 = load double*, double** %17
%51 = load double, double* %50
%52 = load double, double* %11
%53 = fsub double %51, %52
store double %53, double* %26
%54 = load double*, double** %18
%55 = load double, double* %54
%56 = load double, double* %12
%57 = fsub double %55, %56
store double %57, double* %27
%58 = load double, double* %26
%59 = load double, double* %26
%60 = load double, double* %27
%61 = load double, double* %27
%62 = fmul double %60, %61
%63 = call double @llvm.fmuladd.f64(double %58, double %59, double %62)
%64 = call double @sqrt(double %63)
%65 = load double*, double** %19
store double %64, double* %65
store i32 0, i32* %10
br label %66
66: ; preds = %49, %48
%67 = load i32, i32* %10
ret i32 %67
}

LLVM IR (-O2):
define i32 @circle_from_three_points(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* nocapture writeonly %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = bitcast double* %10 to i8*
%17 = bitcast double* %11 to i8*
%18 = bitcast double* %12 to i8*
%19 = bitcast double* %13 to i8*
%20 = bitcast double* %14 to i8*
%21 = bitcast double* %15 to i8*
%22 = call i32 @perpendicular_line_from_two_points(double %0, double %1, double %2, double %3, double* %10, double* %11, double* %12)
%23 = call i32 @perpendicular_line_from_two_points(double %2, double %3, double %4, double %5, double* %13, double* %14, double* %15)
%24 = load double, double* %10
%25 = load double, double* %11
%26 = load double, double* %12
%27 = load double, double* %13
%28 = load double, double* %14
%29 = load double, double* %15
%30 = call i64 @line_intersection(double %24, double %25, double %26, double %27, double %28, double %29, double* %6, double* %7)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %9
%33 = load double, double* %6
%34 = fsub double %33, %0
%35 = load double, double* %7
%36 = fsub double %35, %1
%37 = fmul double %36, %36
%38 = call double @llvm.fmuladd.f64(double %34, double %34, double %37)
%39 = call double @sqrt(double %38)
store double %39, double* %8
br label %40
40: ; preds = %9, %32
%41 = phi i32 [ 0, %32 ], [ -1, %9 ]
ret i32 %41
}