#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 vabs(double *);
int /*<<< orphan*/ vadd(double *, double *, double *);
int /*<<< orphan*/ vsub(double *, double *, double *);
int vequal(double v1[3], double v2[3], double t) {
  double vs[3], va[3];
  vsub(v1, v2, vs);
  vadd(v1, v2, va);
  return (vabs(vs) <= t && vabs(va) <= t) || (vabs(vs) / vabs(va) <= t);
}


x86 assembly (clang, -O0):
<vequal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <vsub@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1040 <vadd@plt>
lea    -0x30(%rbp),%rdi
call   1050 <vabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a2 <vequal+0x72>
lea    -0x50(%rbp),%rdi
call   1050 <vabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jae    11d1 <vequal+0xa1>
lea    -0x30(%rbp),%rdi
call   1050 <vabs@plt>
movsd  %xmm0,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <vabs@plt>
movsd  -0x60(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vequal>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x30(%rsp),%r15
mov    %r15,%rdx
call   1030 <vsub@plt>
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <vadd@plt>
mov    %r15,%rdi
call   1050 <vabs@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     118e <vequal+0x5e>
lea    0x10(%rsp),%rdi
call   1050 <vabs@plt>
mov    $0x1,%eax
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    11c0 <vequal+0x90>
lea    0x30(%rsp),%rdi
call   1050 <vabs@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <vabs@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
xor    %eax,%eax
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @vequal(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 = load double*, double** %5
%11 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%12 = call i32 @vsub(double* %9, double* %10, double* %11)
%13 = load double*, double** %4
%14 = load double*, double** %5
%15 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%16 = call i32 @vadd(double* %13, double* %14, double* %15)
%17 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%18 = call double @vabs(double* %17)
%19 = load double, double* %6
%20 = fcmp ole double %18, %19
br i1 %20, label %21, label %26
21: ; preds = %3
%22 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%23 = call double @vabs(double* %22)
%24 = load double, double* %6
%25 = fcmp ole double %23, %24
br i1 %25, label %34, label %26
26: ; preds = %21, %3
%27 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%28 = call double @vabs(double* %27)
%29 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%30 = call double @vabs(double* %29)
%31 = fdiv double %28, %30
%32 = load double, double* %6
%33 = fcmp ole double %31, %32
br label %34
34: ; preds = %26, %21
%35 = phi i1 [ true, %21 ], [ %33, %26 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
define i32 @vequal(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 @vsub(double* %0, double* %1, double* %8)
%10 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%11 = call i32 @vadd(double* %0, double* %1, double* %10)
%12 = call double @vabs(double* %8)
%13 = fcmp ugt double %12, %2
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = call double @vabs(double* %10)
%16 = fcmp ugt double %15, %2
br i1 %16, label %17, label %23
17: ; preds = %14, %3
%18 = call double @vabs(double* %8)
%19 = call double @vabs(double* %10)
%20 = fdiv double %18, %19
%21 = fcmp ole double %20, %2
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %17, %14
%24 = phi i32 [ 1, %14 ], [ %22, %17 ]
ret i32 %24
}