#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 fabs(int /*<<< orphan*/);
int /*<<< orphan*/ vdot(double *, double *);
int /*<<< orphan*/ vnorm2(double *, double *);
int vperpendicular(double v1[3], double v2[3], double t) {
  double tv1[3], tv2[3];
  vnorm2(v1, tv1);
  vnorm2(v2, tv2);
  return fabs(vdot(tv1, tv2)) <= t;
}


x86 assembly (clang, -O0):
<vperpendicular>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <vnorm2@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <vnorm2@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1050 <vdot@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vperpendicular>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%rbx
lea    0x30(%rsp),%r14
mov    %r14,%rsi
call   1030 <vnorm2@plt>
lea    0x10(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <vnorm2@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <vdot@plt>
mov    %eax,%edi
call   1040 <fabs@plt>
xor    %eax,%eax
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @vperpendicular(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca [3 x double]
%8 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%9 = load double*, double** %4
%10 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%11 = call i32 @vnorm2(double* %9, double* %10)
%12 = load double*, double** %5
%13 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%14 = call i32 @vnorm2(double* %12, double* %13)
%15 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%17 = call i32 @vdot(double* %15, double* %16)
%18 = call double @fabs(i32 %17)
%19 = load double, double* %6
%20 = fcmp ole double %18, %19
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @vperpendicular(double* %0, double* %1, double %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = bitcast [3 x double]* %4 to i8*
%7 = bitcast [3 x double]* %5 to i8*
%8 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%9 = call i32 @vnorm2(double* %0, double* %8)
%10 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%11 = call i32 @vnorm2(double* %1, double* %10)
%12 = call i32 @vdot(double* %8, double* %10)
%13 = call double @fabs(i32 %12)
%14 = fcmp ole double %13, %2
%15 = zext i1 %14 to i32
ret i32 %15
}