#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*/ diff3(double *, double *, double *);
double triple_prod_and_min_abs_sine(double **, double *);
int are_4at_in_one_plane(double at_coord[][3], double min_sine) {
  double actual_min_sine, min_actual_min_sine;
  double coord[3][3], prod;
  int i, k, j;
  for (k = 0; k < 4; k++) {
    for (i = j = 0; i < 4; i++) {
      if (i != k) {
        diff3(at_coord[i], at_coord[k], coord[j]);
        j++;
      }
    }
    prod = triple_prod_and_min_abs_sine(coord, &actual_min_sine);
    if (!k || actual_min_sine < min_actual_min_sine) {
      min_actual_min_sine = actual_min_sine;
    }
  }
  return min_actual_min_sine <= min_sine;
}


x86 assembly (clang, -O0):
<are_4at_in_one_plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x80(%rbp)
cmpl   $0x4,-0x80(%rbp)
jge    1210 <are_4at_in_one_plane+0xf0>
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x4,-0x7c(%rbp)
jge    11c3 <are_4at_in_one_plane+0xa3>
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
je     11b0 <are_4at_in_one_plane+0x90>
mov    -0x8(%rbp),%rdi
movslq -0x7c(%rbp),%rax
imul   $0x18,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x80(%rbp),%rax
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0x84(%rbp),%rax
lea    -0x70(%rbp),%rdx
imul   $0x18,%rax,%rax
add    %rax,%rdx
call   1040 <diff3@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11b5 <are_4at_in_one_plane+0x95>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1156 <are_4at_in_one_plane+0x36>
lea    -0x70(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <triple_prod_and_min_abs_sine@plt>
movsd  %xmm0,-0x78(%rbp)
cmpl   $0x0,-0x80(%rbp)
je     11f3 <are_4at_in_one_plane+0xd3>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11fd <are_4at_in_one_plane+0xdd>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1202 <are_4at_in_one_plane+0xe2>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    113b <are_4at_in_one_plane+0x1b>
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<are_4at_in_one_plane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %rdi,%rbx
lea    0x18(%rdi),%r15
lea    0x20(%rsp),%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <diff3@plt>
lea    0x30(%rbx),%r12
lea    0x38(%rsp),%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <diff3@plt>
lea    0x48(%rbx),%rbp
lea    0x50(%rsp),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <diff3@plt>
lea    0x10(%rsp),%r13
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <triple_prod_and_min_abs_sine@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <diff3@plt>
mov    %r12,%rdi
mov    %r15,%rsi
lea    0x38(%rsp),%rdx
call   1040 <diff3@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
lea    0x50(%rsp),%rdx
call   1040 <diff3@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <triple_prod_and_min_abs_sine@plt>
movsd  0x10(%rsp),%xmm0
minsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <diff3@plt>
mov    %r15,%rdi
mov    %r12,%rsi
lea    0x38(%rsp),%rdx
call   1040 <diff3@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
lea    0x50(%rsp),%rdx
call   1040 <diff3@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <triple_prod_and_min_abs_sine@plt>
movsd  0x10(%rsp),%xmm0
minsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1040 <diff3@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
lea    0x38(%rsp),%rdx
call   1040 <diff3@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
lea    0x50(%rsp),%rdx
call   1040 <diff3@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <triple_prod_and_min_abs_sine@plt>
movsd  0x10(%rsp),%xmm0
minsd  0x8(%rsp),%xmm0
xor    %eax,%eax
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @are_4at_in_one_plane([3 x double]* %0, double %1) {
%3 = alloca [3 x double]*
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca [3 x [3 x double]]
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store [3 x double]* %0, [3 x double]** %3
store double %1, double* %4
store i32 0, i32* %10
br label %12
12: ; preds = %58, %2
%13 = load i32, i32* %10
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %61
15: ; preds = %12
store i32 0, i32* %11
store i32 0, i32* %9
br label %16
16: ; preds = %42, %15
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 4
br i1 %18, label %19, label %45
19: ; preds = %16
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %41
23: ; preds = %19
%24 = load [3 x double]*, [3 x double]** %3
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 %26
%28 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 0, i64 0
%29 = load [3 x double]*, [3 x double]** %3
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 %31
%33 = getelementptr inbounds [3 x double], [3 x double]* %32, i64 0, i64 0
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 %35
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0, i64 0
%38 = call i32 @diff3(double* %28, double* %33, double* %37)
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %41
41: ; preds = %23, %19
br label %42
42: ; preds = %41
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %16
45: ; preds = %16
%46 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%47 = bitcast [3 x double]* %46 to double**
%48 = call double @triple_prod_and_min_abs_sine(double** %47, double* %5)
store double %48, double* %8
%49 = load i32, i32* %10
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %45
%52 = load double, double* %5
%53 = load double, double* %6
%54 = fcmp olt double %52, %53
br i1 %54, label %55, label %57
55: ; preds = %51, %45
%56 = load double, double* %5
store double %56, double* %6
br label %57
57: ; preds = %55, %51
br label %58
58: ; preds = %57
%59 = load i32, i32* %10
%60 = add nsw i32 %59, 1
store i32 %60, i32* %10
br label %12
61: ; preds = %12
%62 = load double, double* %6
%63 = load double, double* %4
%64 = fcmp ole double %62, %63
%65 = zext i1 %64 to i32
ret i32 %65
}

LLVM IR (-O2):
define i32 @are_4at_in_one_plane([3 x double]* %0, double %1) {
%3 = alloca double
%4 = alloca [3 x [3 x double]]
%5 = bitcast double* %3 to i8*
%6 = bitcast [3 x [3 x double]]* %4 to i8*
%7 = bitcast [3 x [3 x double]]* %4 to double**
%8 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%9 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 0
%11 = call i32 @diff3(double* %9, double* %8, double* %10)
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 0
%14 = call i32 @diff3(double* %12, double* %8, double* %13)
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 3, i64 0
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 0
%17 = call i32 @diff3(double* %15, double* %8, double* %16)
%18 = call double @triple_prod_and_min_abs_sine(double** %7, double* %3)
%19 = load double, double* %3
%20 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%21 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 0
%22 = call i32 @diff3(double* %8, double* %20, double* %21)
%23 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 0
%25 = call i32 @diff3(double* %23, double* %20, double* %24)
%26 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 3, i64 0
%27 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 0
%28 = call i32 @diff3(double* %26, double* %20, double* %27)
%29 = call double @triple_prod_and_min_abs_sine(double** %7, double* %3)
%30 = load double, double* %3
%31 = fcmp olt double %30, %19
%32 = select i1 %31, double %30, double %19
%33 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 0
%34 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 1, i64 0
%35 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%36 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 0
%37 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 3, i64 0
%38 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%39 = call i32 @diff3(double* %8, double* %38, double* %33)
%40 = call i32 @diff3(double* %20, double* %38, double* %34)
%41 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 2, i64 0
%42 = call i32 @diff3(double* %37, double* %38, double* %41)
%43 = call double @triple_prod_and_min_abs_sine(double** %7, double* %3)
%44 = load double, double* %3
%45 = fcmp olt double %44, %32
%46 = select i1 %45, double %44, double %32
%47 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 3, i64 0
%48 = call i32 @diff3(double* %8, double* %47, double* %33)
%49 = call i32 @diff3(double* %20, double* %47, double* %34)
%50 = call i32 @diff3(double* %35, double* %47, double* %36)
%51 = call double @triple_prod_and_min_abs_sine(double** %7, double* %3)
%52 = load double, double* %3
%53 = fcmp olt double %52, %46
%54 = select i1 %53, double %52, double %46
%55 = fcmp ole double %54, %1
%56 = zext i1 %55 to i32
ret i32 %56
}