#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 */
float const cos(float);
float const fabs(float);
float const sin(float);
int inDisk(const double centroid[3], const float r, const float h, float phi,
           const float pos[3]) {
  float d[3];
  phi *= 3.14159265358979323846 / 180.0 * (-1.0);
  d[0] = pos[0] - centroid[0];
  d[1] = (pos[1] - centroid[1]) * cos(phi) - (pos[2] - centroid[2]) * sin(phi);
  d[2] = (pos[1] - centroid[1]) * sin(phi) + (pos[2] - centroid[2]) * cos(phi);
  return ((d[0] * d[0] + d[1] * d[1] <= r * r) && (fabs(d[2]) <= h / 2.0));
}


x86 assembly (clang, -O0):
<inDisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <cos@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
cvtss2sd %xmm3,%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <sin@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
cvtss2sd %xmm3,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm2
movss  -0x28(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
xor    %eax,%eax
ucomiss %xmm1,%xmm0
mov    %al,-0x2d(%rbp)
jb     12fe <inDisk+0x1ce>
movss  -0x24(%rbp),%xmm0
call   1030 <fabs@plt>
cvtss2sd %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd18(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inDisk>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
movss  %xmm1,0x24(%rsp)
movss  %xmm0,0x2c(%rsp)
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xeb8(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  (%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  (%rdi),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x28(%rsp)
movss  0x4(%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x4(%r14),%xmm0
movss  %xmm0,0x20(%rsp)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%r14),%xmm0
movss  %xmm0,0x1c(%rsp)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x30(%rsp)
movss  0x4(%rsp),%xmm0
call   1040 <cos@plt>
movss  0x8(%rsp),%xmm2
mulss  %xmm2,%xmm2
movss  0x28(%rsp),%xmm1
mulss  %xmm1,%xmm1
addss  %xmm2,%xmm1
movaps %xmm1,%xmm2
movss  0x2c(%rsp),%xmm1
mulss  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm2,%xmm1
jb     12b2 <inDisk+0x192>
movss  0x20(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  0x10(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  0x30(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
andps  0xd7d(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x24(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xd5f(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setae  %al
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @inDisk(double* %0, float %1, float %2, float %3, float* %4) {
%6 = alloca double*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
%11 = alloca [3 x float]
store double* %0, double** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float* %4, float** %10
%12 = load float, float* %9
%13 = fpext float %12 to double
%14 = fmul double %13, 0xBF91DF46A2529D39
%15 = fptrunc double %14 to float
store float %15, float* %9
%16 = load float*, float** %10
%17 = getelementptr inbounds float, float* %16, i64 0
%18 = load float, float* %17
%19 = fpext float %18 to double
%20 = load double*, double** %6
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fsub double %19, %22
%24 = fptrunc double %23 to float
%25 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
store float %24, float* %25
%26 = load float*, float** %10
%27 = getelementptr inbounds float, float* %26, i64 1
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = fsub double %29, %32
%34 = load float, float* %9
%35 = call float @cos(float %34)
%36 = fpext float %35 to double
%37 = load float*, float** %10
%38 = getelementptr inbounds float, float* %37, i64 2
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 2
%43 = load double, double* %42
%44 = fsub double %40, %43
%45 = load float, float* %9
%46 = call float @sin(float %45)
%47 = fpext float %46 to double
%48 = fmul double %44, %47
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double %33, double %36, double %49)
%51 = fptrunc double %50 to float
%52 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 1
store float %51, float* %52
%53 = load float*, float** %10
%54 = getelementptr inbounds float, float* %53, i64 1
%55 = load float, float* %54
%56 = fpext float %55 to double
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double, double* %58
%60 = fsub double %56, %59
%61 = load float, float* %9
%62 = call float @sin(float %61)
%63 = fpext float %62 to double
%64 = load float*, float** %10
%65 = getelementptr inbounds float, float* %64, i64 2
%66 = load float, float* %65
%67 = fpext float %66 to double
%68 = load double*, double** %6
%69 = getelementptr inbounds double, double* %68, i64 2
%70 = load double, double* %69
%71 = fsub double %67, %70
%72 = load float, float* %9
%73 = call float @cos(float %72)
%74 = fpext float %73 to double
%75 = fmul double %71, %74
%76 = call double @llvm.fmuladd.f64(double %60, double %63, double %75)
%77 = fptrunc double %76 to float
%78 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 2
store float %77, float* %78
%79 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
%80 = load float, float* %79
%81 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
%82 = load float, float* %81
%83 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 1
%84 = load float, float* %83
%85 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 1
%86 = load float, float* %85
%87 = fmul float %84, %86
%88 = call float @llvm.fmuladd.f32(float %80, float %82, float %87)
%89 = load float, float* %7
%90 = load float, float* %7
%91 = fmul float %89, %90
%92 = fcmp ole float %88, %91
br i1 %92, label %93, label %102
93: ; preds = %5
%94 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 2
%95 = load float, float* %94
%96 = call float @fabs(float %95)
%97 = fpext float %96 to double
%98 = load float, float* %8
%99 = fpext float %98 to double
%100 = fdiv double %99, 2.000000e+00
%101 = fcmp ole double %97, %100
br label %102
102: ; preds = %93, %5
%103 = phi i1 [ false, %5 ], [ %101, %93 ]
%104 = zext i1 %103 to i32
ret i32 %104
}

LLVM IR (-O2):
define i32 @inDisk(double* nocapture %0, float %1, float %2, float %3, float* nocapture %4) {
%6 = fpext float %3 to double
%7 = fmul double %6, 0xBF91DF46A2529D39
%8 = fptrunc double %7 to float
%9 = load float, float* %4
%10 = fpext float %9 to double
%11 = load double, double* %0
%12 = fsub double %10, %11
%13 = fptrunc double %12 to float
%14 = getelementptr inbounds float, float* %4, i64 1
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = getelementptr inbounds double, double* %0, i64 1
%18 = load double, double* %17
%19 = fsub double %16, %18
%20 = tail call float @cos(float %8)
%21 = fpext float %20 to double
%22 = getelementptr inbounds float, float* %4, i64 2
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = getelementptr inbounds double, double* %0, i64 2
%26 = load double, double* %25
%27 = fsub double %24, %26
%28 = tail call float @sin(float %8)
%29 = fpext float %28 to double
%30 = fneg double %27
%31 = fmul double %30, %29
%32 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %31)
%33 = fptrunc double %32 to float
%34 = load float, float* %14
%35 = load double, double* %17
%36 = tail call float @sin(float %8)
%37 = load float, float* %22
%38 = load double, double* %25
%39 = tail call float @cos(float %8)
%40 = fmul float %33, %33
%41 = tail call float @llvm.fmuladd.f32(float %13, float %13, float %40)
%42 = fmul float %1, %1
%43 = fcmp ugt float %41, %42
br i1 %43, label %60, label %44
44: ; preds = %5
%45 = fpext float %34 to double
%46 = fsub double %45, %35
%47 = fpext float %36 to double
%48 = fpext float %37 to double
%49 = fsub double %48, %38
%50 = fpext float %39 to double
%51 = fmul double %49, %50
%52 = tail call double @llvm.fmuladd.f64(double %46, double %47, double %51)
%53 = fptrunc double %52 to float
%54 = tail call float @llvm.fabs.f32(float %53)
%55 = fpext float %54 to double
%56 = fpext float %2 to double
%57 = fmul double %56, 5.000000e-01
%58 = fcmp oge double %57, %55
%59 = zext i1 %58 to i32
br label %60
60: ; preds = %44, %5
%61 = phi i32 [ 0, %5 ], [ %59, %44 ]
ret i32 %61
}