#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 */
double distance(double *, double *);
double fabs(double);
double simple_angle(double *, double *);
double sin(double);
double sqrt(double);
int probe_eats_circle(double probe_radius, double probe_center[3],
                      double circle_center[3], double circle_radius,
                      double circle_axis[3]) {
  int k, circle_eaten;
  double dist3, ang, sinang, law;
  double pcvect[3];
  circle_eaten = 0;
  dist3 = distance(circle_center, probe_center);
  if (dist3 + circle_radius <= probe_radius)
    circle_eaten = 1;
  if (circle_eaten)
    return (1);
  for (k = 0; k < 3; k++)
    pcvect[k] = circle_center[k] - probe_center[k];
  ang = simple_angle(circle_axis, pcvect);
  sinang = sin(ang);
  sinang = fabs(sinang);
  law = dist3 * dist3 + 2 * sinang * dist3 * circle_radius +
        circle_radius * circle_radius;
  if (law < 0.0)
    law = 0.0;
  law = sqrt(law);
  circle_eaten = (law < probe_radius);
  return (circle_eaten);
}


x86 assembly (clang, -O0):
<probe_eats_circle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <distance@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1197 <probe_eats_circle+0x57>
movl   $0x1,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     11ad <probe_eats_circle+0x6d>
movl   $0x1,-0x4(%rbp)
jmp    12aa <probe_eats_circle+0x16a>
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x34(%rbp)
jge    11f0 <probe_eats_circle+0xb0>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x34(%rbp),%rax
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b4 <probe_eats_circle+0x74>
mov    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <simple_angle@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movaps 0xdf3(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  0xdc8(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    127c <probe_eats_circle+0x13c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probe_eats_circle>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
movsd  %xmm1,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  %xmm0,0x10(%rsp)
mov    %rsi,%rdi
mov    %r15,%rsi
call   1060 <distance@plt>
movapd %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
mov    $0x1,%eax
movsd  0x10(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jae    1220 <probe_eats_circle+0xe0>
movupd (%rbx),%xmm2
movsd  %xmm0,0x18(%rsp)
movupd (%r15),%xmm1
subpd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
movsd  0x10(%rbx),%xmm0
subsd  0x10(%r15),%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1040 <simple_angle@plt>
call   1030 <sin@plt>
andpd  0xe34(%rip),%xmm0
addsd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     120c <probe_eats_circle+0xcc>
sqrtsd %xmm0,%xmm0
jmp    1211 <probe_eats_circle+0xd1>
call   1050 <sqrt@plt>
xor    %eax,%eax
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @probe_eats_circle(double %0, double* %1, double* %2, double %3, double* %4) {
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %6 to i8*
%8 = tail call double @distance(double* %2, double* %1)
%9 = fadd double %8, %3
%10 = fcmp ugt double %9, %0
br i1 %10, label %11, label %38
11: ; preds = %5
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%13 = bitcast double* %2 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = bitcast double* %1 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = fsub <2 x double> %14, %16
%18 = bitcast [3 x double]* %6 to <2 x double>*
store <2 x double> %17, <2 x double>* %18
%19 = getelementptr inbounds double, double* %2, i64 2
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 2
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %23, double* %24
%25 = call double @simple_angle(double* %4, double* %12)
%26 = call double @sin(double %25)
%27 = call double @llvm.fabs.f64(double %26)
%28 = fmul double %27, 2.000000e+00
%29 = fmul double %8, %28
%30 = fmul double %29, %3
%31 = call double @llvm.fmuladd.f64(double %8, double %8, double %30)
%32 = call double @llvm.fmuladd.f64(double %3, double %3, double %31)
%33 = fcmp olt double %32, 0.000000e+00
%34 = select i1 %33, double 0.000000e+00, double %32
%35 = call double @sqrt(double %34)
%36 = fcmp olt double %35, %0
%37 = zext i1 %36 to i32
br label %38
38: ; preds = %5, %11
%39 = phi i32 [ %37, %11 ], [ 1, %5 ]
ret i32 %39
}