#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*/ point_in_triangle(double, double, int /*<<< orphan*/, double,
                                     double, int /*<<< orphan*/, double, double,
                                     int /*<<< orphan*/, double, double,
                                     int /*<<< orphan*/);
double sqrt(double);
double cir3pts(double ax, double ay, double bx, double by, double cx, double cy,
               int type) {
  double a = bx - ax;
  double b = by - ay;
  double c = cx - ax;
  double d = cy - ay;
  double e = a * (ax + bx) + b * (ay + by);
  double f = c * (ax + cx) + d * (ay + cy);
  double g = 2 * (a * (cy - by) - b * (cx - bx));
  double cex, cey, rd;
  if (g != 0) {
    cex = (d * e - b * f) / g;
    cey = (a * f - c * e) / g;
    rd = sqrt((ax - cex) * (ax - cex) + (ay - cey) * (ay - cey));
  } else {
    cex = 0;
    cey = 0;
    rd = 0;
  }
  if (rd == 0) {
  } else {
    if (!point_in_triangle(cex, cey, 0, ax, ay, 0, bx, by, 0, cx, cy, 0)) {
      cex = 0;
      cey = 0;
      rd = 0;
    }
  }
  int return_val = 0;
  if (type == 0)
    return_val = cex;
  if (type == 1)
    return_val = cey;
  if (type == 2)
    return_val = rd * 1000;
  return (return_val);
}


x86 assembly (clang, -O0):
<cir3pts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
addsd  -0x18(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
addsd  -0x20(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
addsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
subsd  -0x20(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm3
subsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1255 <cir3pts+0x135>
jp     1255 <cir3pts+0x135>
jmp    1315 <cir3pts+0x1f5>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
subsd  -0x78(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
subsd  -0x80(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
subsd  -0x80(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1330 <cir3pts+0x210>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1350 <cir3pts+0x230>
jp     1350 <cir3pts+0x230>
jmp    13ae <cir3pts+0x28e>
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
movsd  -0x28(%rbp),%xmm6
movsd  -0x30(%rbp),%xmm7
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <point_in_triangle@plt>
cmp    $0x0,%eax
jne    13a9 <cir3pts+0x289>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    13ae <cir3pts+0x28e>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    13cd <cir3pts+0x2ad>
cvttsd2si -0x78(%rbp),%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    13e2 <cir3pts+0x2c2>
cvttsd2si -0x80(%rbp),%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x2,-0x34(%rbp)
jne    1406 <cir3pts+0x2e6>
movsd  0xc14(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
cvttsd2si %xmm0,%eax
mov    %eax,-0x8c(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm0
ff
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cir3pts>:
push   %rbx
sub    $0x80,%rsp
mov    %edi,%ebx
movapd %xmm3,%xmm10
movapd %xmm2,%xmm11
movapd %xmm1,%xmm7
movapd %xmm0,%xmm12
movapd %xmm3,%xmm6
subsd  %xmm1,%xmm6
movapd %xmm5,%xmm0
unpcklpd %xmm2,%xmm0
unpcklpd %xmm12,%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
movapd %xmm5,%xmm1
subsd  %xmm3,%xmm1
movapd %xmm4,%xmm3
subsd  %xmm11,%xmm3
mulsd  %xmm6,%xmm3
mulsd  %xmm2,%xmm1
subsd  %xmm3,%xmm1
addsd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    118f <cir3pts+0x6f>
jnp    124f <cir3pts+0x12f>
movapd %xmm5,%xmm9
movapd %xmm4,%xmm8
movapd %xmm4,%xmm2
subsd  %xmm12,%xmm2
movapd %xmm12,%xmm3
unpcklpd %xmm12,%xmm3
movapd %xmm11,%xmm4
unpcklpd %xmm8,%xmm4
addpd  %xmm3,%xmm4
movapd %xmm7,%xmm3
unpcklpd %xmm7,%xmm3
movapd %xmm10,%xmm5
unpcklpd %xmm9,%xmm5
addpd  %xmm3,%xmm5
movapd %xmm6,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm5,%xmm3
movapd %xmm0,%xmm5
shufpd $0x1,%xmm2,%xmm5
mulpd  %xmm4,%xmm5
addpd  %xmm3,%xmm5
xorpd  0xe0b(%rip),%xmm6
xorpd  0xe03(%rip),%xmm2
mulpd  %xmm5,%xmm0
shufpd $0x1,%xmm5,%xmm5
unpcklpd %xmm2,%xmm6
mulpd  %xmm5,%xmm6
addpd  %xmm0,%xmm6
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm6
movapd %xmm12,%xmm0
subsd  %xmm6,%xmm0
movapd %xmm6,%xmm1
unpckhpd %xmm6,%xmm1
movapd %xmm7,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1258 <cir3pts+0x138>
sqrtsd %xmm0,%xmm0
jmp    12c9 <cir3pts+0x1a9>
xorpd  %xmm6,%xmm6
jmp    1329 <cir3pts+0x209>
movapd %xmm6,0x10(%rsp)
movapd %xmm9,(%rsp)
movapd %xmm8,0x70(%rsp)
movapd %xmm10,0x60(%rsp)
movapd %xmm11,0x50(%rsp)
movapd %xmm7,0x40(%rsp)
movapd %xmm12,0x30(%rsp)
movapd %xmm1,0x20(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm2,%xmm2
movapd 0x20(%rsp),%xmm1
movapd 0x30(%rsp),%xmm12
movapd 0x40(%rsp),%xmm7
movapd 0x50(%rsp),%xmm11
movapd 0x60(%rsp),%xmm10
movapd 0x70(%rsp),%xmm8
movapd (%rsp),%xmm9
movapd 0x10(%rsp),%xmm6
ucomisd %xmm2,%xmm0
jne    12d7 <cir3pts+0x1b7>
jp     12d7 <cir3pts+0x1b7>
movapd %xmm0,%xmm2
jmp    1329 <cir3pts+0x209>
movsd  %xmm0,(%rsp)
movapd %xmm6,0x10(%rsp)
movapd %xmm6,%xmm0
xor    %edi,%edi
movapd %xmm12,%xmm2
movapd %xmm7,%xmm3
xor    %esi,%esi
movapd %xmm11,%xmm4
movapd %xmm10,%xmm5
xor    %edx,%edx
movapd %xmm8,%xmm6
movapd %xmm9,%xmm7
xor    %ecx,%ecx
call   1030 <point_in_triangle@plt>
xorpd  %xmm2,%xmm2
test   %eax,%eax
je     131d <cir3pts+0x1fd>
movsd  (%rsp),%xmm2
xorpd  %xmm6,%xmm6
je     1329 <cir3pts+0x209>
movapd 0x10(%rsp),%xmm6
xor    %eax,%eax
test   %ebx,%ebx
cvttsd2si %xmm6,%ecx
cmovne %eax,%ecx
unpckhpd %xmm6,%xmm6
cvttsd2si %xmm6,%eax
cmp    $0x1,%ebx
cmovne %ecx,%eax
cmp    $0x2,%ebx
mulsd  0xcc3(%rip),%xmm2
cvttsd2si %xmm2,%ecx
cmovne %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @cir3pts(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%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 i32
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store i32 %6, i32* %14
%26 = load double, double* %10
%27 = load double, double* %8
%28 = fsub double %26, %27
store double %28, double* %15
%29 = load double, double* %11
%30 = load double, double* %9
%31 = fsub double %29, %30
store double %31, double* %16
%32 = load double, double* %12
%33 = load double, double* %8
%34 = fsub double %32, %33
store double %34, double* %17
%35 = load double, double* %13
%36 = load double, double* %9
%37 = fsub double %35, %36
store double %37, double* %18
%38 = load double, double* %15
%39 = load double, double* %8
%40 = load double, double* %10
%41 = fadd double %39, %40
%42 = load double, double* %16
%43 = load double, double* %9
%44 = load double, double* %11
%45 = fadd double %43, %44
%46 = fmul double %42, %45
%47 = call double @llvm.fmuladd.f64(double %38, double %41, double %46)
store double %47, double* %19
%48 = load double, double* %17
%49 = load double, double* %8
%50 = load double, double* %12
%51 = fadd double %49, %50
%52 = load double, double* %18
%53 = load double, double* %9
%54 = load double, double* %13
%55 = fadd double %53, %54
%56 = fmul double %52, %55
%57 = call double @llvm.fmuladd.f64(double %48, double %51, double %56)
store double %57, double* %20
%58 = load double, double* %15
%59 = load double, double* %13
%60 = load double, double* %11
%61 = fsub double %59, %60
%62 = load double, double* %16
%63 = load double, double* %12
%64 = load double, double* %10
%65 = fsub double %63, %64
%66 = fmul double %62, %65
%67 = fneg double %66
%68 = call double @llvm.fmuladd.f64(double %58, double %61, double %67)
%69 = fmul double 2.000000e+00, %68
store double %69, double* %21
%70 = load double, double* %21
%71 = fcmp une double %70, 0.000000e+00
br i1 %71, label %72, label %106
72: ; preds = %7
%73 = load double, double* %18
%74 = load double, double* %19
%75 = load double, double* %16
%76 = load double, double* %20
%77 = fmul double %75, %76
%78 = fneg double %77
%79 = call double @llvm.fmuladd.f64(double %73, double %74, double %78)
%80 = load double, double* %21
%81 = fdiv double %79, %80
store double %81, double* %22
%82 = load double, double* %15
%83 = load double, double* %20
%84 = load double, double* %17
%85 = load double, double* %19
%86 = fmul double %84, %85
%87 = fneg double %86
%88 = call double @llvm.fmuladd.f64(double %82, double %83, double %87)
%89 = load double, double* %21
%90 = fdiv double %88, %89
store double %90, double* %23
%91 = load double, double* %8
%92 = load double, double* %22
%93 = fsub double %91, %92
%94 = load double, double* %8
%95 = load double, double* %22
%96 = fsub double %94, %95
%97 = load double, double* %9
%98 = load double, double* %23
%99 = fsub double %97, %98
%100 = load double, double* %9
%101 = load double, double* %23
%102 = fsub double %100, %101
%103 = fmul double %99, %102
%104 = call double @llvm.fmuladd.f64(double %93, double %96, double %103)
%105 = call double @sqrt(double %104)
store double %105, double* %24
br label %107
106: ; preds = %7
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
br label %107
107: ; preds = %106, %72
%108 = load double, double* %24
%109 = fcmp oeq double %108, 0.000000e+00
br i1 %109, label %110, label %111
110: ; preds = %107
br label %124
111: ; preds = %107
%112 = load double, double* %22
%113 = load double, double* %23
%114 = load double, double* %8
%115 = load double, double* %9
%116 = load double, double* %10
%117 = load double, double* %11
%118 = load double, double* %12
%119 = load double, double* %13
%120 = call i32 @point_in_triangle(double %112, double %113, i32 0, double %114, double %115, i32 0, double %116, double %117, i32 0, double %118, double %119, i32 0)
%121 = icmp ne i32 %120, 0
br i1 %121, label %123, label %122
122: ; preds = %111
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
br label %123
123: ; preds = %122, %111
br label %124
124: ; preds = %123, %110
store i32 0, i32* %25
%125 = load i32, i32* %14
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %130
127: ; preds = %124
%128 = load double, double* %22
%129 = fptosi double %128 to i32
store i32 %129, i32* %25
br label %130
130: ; preds = %127, %124
%131 = load i32, i32* %14
%132 = icmp eq i32 %131, 1
br i1 %132, label %133, label %136
133: ; preds = %130
%134 = load double, double* %23
%135 = fptosi double %134 to i32
store i32 %135, i32* %25
br label %136
136: ; preds = %133, %130
%137 = load i32, i32* %14
%138 = icmp eq i32 %137, 2
br i1 %138, label %139, label %143
139: ; preds = %136
%140 = load double, double* %24
%141 = fmul double %140, 1.000000e+03
%142 = fptosi double %141 to i32
store i32 %142, i32* %25
br label %143
143: ; preds = %139, %136
%144 = load i32, i32* %25
%145 = sitofp i32 %144 to double
ret double %145
}

LLVM IR (-O2):
define double @cir3pts(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6) {
%8 = fsub double %3, %1
%9 = fsub double %4, %0
%10 = insertelement <2 x double> poison, double %5, i64 0
%11 = insertelement <2 x double> %10, double %2, i64 1
%12 = insertelement <2 x double> poison, double %1, i64 0
%13 = insertelement <2 x double> %12, double %0, i64 1
%14 = fsub <2 x double> %11, %13
%15 = insertelement <2 x double> poison, double %0, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = insertelement <2 x double> poison, double %2, i64 0
%18 = insertelement <2 x double> %17, double %4, i64 1
%19 = fadd <2 x double> %16, %18
%20 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %3, i64 0
%22 = insertelement <2 x double> %21, double %5, i64 1
%23 = fadd <2 x double> %20, %22
%24 = insertelement <2 x double> poison, double %8, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> %14, <2 x i32> <i32 0, i32 2>
%26 = fmul <2 x double> %25, %23
%27 = extractelement <2 x double> %14, i64 1
%28 = insertelement <2 x double> poison, double %27, i64 0
%29 = insertelement <2 x double> %28, double %9, i64 1
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> %19, <2 x double> %26)
%31 = fsub double %5, %3
%32 = fsub double %4, %2
%33 = fneg double %8
%34 = fmul double %32, %33
%35 = tail call double @llvm.fmuladd.f64(double %27, double %31, double %34)
%36 = fmul double %35, 2.000000e+00
%37 = fcmp une double %36, 0.000000e+00
br i1 %37, label %38, label %61
38: ; preds = %7
%39 = fneg double %9
%40 = shufflevector <2 x double> %30, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%41 = insertelement <2 x double> poison, double %33, i64 0
%42 = insertelement <2 x double> %41, double %39, i64 1
%43 = fmul <2 x double> %40, %42
%44 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %30, <2 x double> %43)
%45 = insertelement <2 x double> poison, double %36, i64 0
%46 = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> zeroinitializer
%47 = fdiv <2 x double> %44, %46
%48 = extractelement <2 x double> %47, i64 0
%49 = fsub double %0, %48
%50 = extractelement <2 x double> %47, i64 1
%51 = fsub double %1, %50
%52 = fmul double %51, %51
%53 = tail call double @llvm.fmuladd.f64(double %49, double %49, double %52)
%54 = tail call double @sqrt(double %53)
%55 = fcmp oeq double %54, 0.000000e+00
br i1 %55, label %61, label %56
56: ; preds = %38
%57 = tail call i32 @point_in_triangle(double %48, double %50, i32 0, double %0, double %1, i32 0, double %2, double %3, i32 0, double %4, double %5, i32 0)
%58 = icmp eq i32 %57, 0
%59 = select i1 %58, double 0.000000e+00, double %54
%60 = select i1 %58, <2 x double> zeroinitializer, <2 x double> %47
br label %61
61: ; preds = %56, %7, %38
%62 = phi double [ %54, %38 ], [ 0.000000e+00, %7 ], [ %59, %56 ]
%63 = phi <2 x double> [ %47, %38 ], [ zeroinitializer, %7 ], [ %60, %56 ]
%64 = icmp eq i32 %6, 0
%65 = extractelement <2 x double> %63, i64 0
%66 = fptosi double %65 to i32
%67 = select i1 %64, i32 %66, i32 0
%68 = icmp eq i32 %6, 1
%69 = extractelement <2 x double> %63, i64 1
%70 = fptosi double %69 to i32
%71 = select i1 %68, i32 %70, i32 %67
%72 = icmp eq i32 %6, 2
%73 = fmul double %62, 1.000000e+03
%74 = fptosi double %73 to i32
%75 = select i1 %72, i32 %74, i32 %71
%76 = sitofp i32 %75 to double
ret double %76
}