int planeBoxOverlap(double normal[3], double vert[3], double maxbox[3]) {
  int q;
  double vmin[3], vmax[3], v;
  for (q = 0; q <= 2; q++) {
    v = vert[q];
    if (normal[q] > 0.0f) {
      vmin[q] = -maxbox[q] - v;
      vmax[q] = maxbox[q] - v;
    } else {
      vmin[q] = maxbox[q] - v;
      vmax[q] = -maxbox[q] - v;
    }
  }
  if ((normal[0] * vmin[0] + normal[1] * vmin[1] + normal[2] * vmin[2]) > 0.0f)
    return 0;
  if ((normal[0] * vmax[0] + normal[1] * vmax[1] + normal[2] * vmax[2]) >= 0.0f)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<planeBoxOverlap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jg     1203 <planeBoxOverlap+0x103>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11a1 <planeBoxOverlap+0xa1>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x68(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x68(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
jmp    11f0 <planeBoxOverlap+0xf0>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x68(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x68(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
jmp    11f5 <planeBoxOverlap+0xf5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1117 <planeBoxOverlap+0x17>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1255 <planeBoxOverlap+0x155>
movl   $0x0,-0x4(%rbp)
jmp    12ae <planeBoxOverlap+0x1ae>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x60(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12a7 <planeBoxOverlap+0x1a7>
movl   $0x1,-0x4(%rbp)
jmp    12ae <planeBoxOverlap+0x1ae>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<planeBoxOverlap>:
movsd  (%rdi),%xmm13
movsd  0x8(%rdi),%xmm11
movsd  (%rdx),%xmm9
movsd  0x8(%rdx),%xmm14
movapd 0xee2(%rip),%xmm1
movapd %xmm9,%xmm10
xorpd  %xmm1,%xmm10
xorpd  %xmm0,%xmm0
cmpltsd %xmm13,%xmm0
movapd %xmm0,%xmm3
andpd  %xmm10,%xmm3
movapd %xmm0,%xmm2
andnpd %xmm9,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm14,%xmm5
xorpd  %xmm1,%xmm5
xorpd  %xmm12,%xmm12
cmpltsd %xmm11,%xmm12
movapd %xmm12,%xmm3
andpd  %xmm5,%xmm3
movapd %xmm12,%xmm6
andnpd %xmm14,%xmm6
orpd   %xmm3,%xmm6
movsd  0x10(%rdi),%xmm7
movsd  0x10(%rdx),%xmm4
xorpd  %xmm4,%xmm1
xorpd  %xmm15,%xmm15
cmpltsd %xmm7,%xmm15
movapd %xmm15,%xmm3
andpd  %xmm1,%xmm3
movapd %xmm15,%xmm8
andnpd %xmm4,%xmm8
orpd   %xmm3,%xmm8
movsd  (%rsi),%xmm3
movsd  %xmm3,-0x10(%rsp)
subsd  %xmm3,%xmm2
movsd  0x8(%rsi),%xmm3
subsd  %xmm3,%xmm6
movsd  %xmm11,-0x8(%rsp)
mulsd  %xmm11,%xmm6
mulsd  %xmm13,%xmm2
addsd  %xmm6,%xmm2
movsd  0x10(%rsi),%xmm6
subsd  %xmm6,%xmm8
mulsd  %xmm7,%xmm8
addsd  %xmm2,%xmm8
xor    %eax,%eax
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm8
ja     1256 <planeBoxOverlap+0x156>
andpd  %xmm15,%xmm4
andnpd %xmm1,%xmm15
orpd   %xmm4,%xmm15
andpd  %xmm12,%xmm14
andnpd %xmm5,%xmm12
orpd   %xmm14,%xmm12
subsd  %xmm3,%xmm12
andpd  %xmm0,%xmm9
andnpd %xmm10,%xmm0
orpd   %xmm9,%xmm0
subsd  -0x10(%rsp),%xmm0
subsd  %xmm6,%xmm15
movsd  -0x8(%rsp),%xmm1
mulsd  %xmm12,%xmm1
mulsd  %xmm0,%xmm13
addsd  %xmm1,%xmm13
mulsd  %xmm15,%xmm7
addsd  %xmm13,%xmm7
xor    %eax,%eax
ucomisd %xmm2,%xmm7
setae  %al
ret

LLVM IR (-O0):
define i32 @planeBoxOverlap(double* %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 0, i32* %8
br label %12
12: ; preds = %72, %3
%13 = load i32, i32* %8
%14 = icmp sle i32 %13, 2
br i1 %14, label %15, label %75
15: ; preds = %12
%16 = load double*, double** %6
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
store double %20, double* %11
%21 = load double*, double** %5
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %27, label %49
27: ; preds = %15
%28 = load double*, double** %7
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = fneg double %32
%34 = load double, double* %11
%35 = fsub double %33, %34
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %37
store double %35, double* %38
%39 = load double*, double** %7
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = load double, double* %11
%45 = fsub double %43, %44
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %47
store double %45, double* %48
br label %71
49: ; preds = %15
%50 = load double*, double** %7
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = load double, double* %11
%56 = fsub double %54, %55
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %58
store double %56, double* %59
%60 = load double*, double** %7
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
%65 = fneg double %64
%66 = load double, double* %11
%67 = fsub double %65, %66
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %69
store double %67, double* %70
br label %71
71: ; preds = %49, %27
br label %72
72: ; preds = %71
%73 = load i32, i32* %8
%74 = add nsw i32 %73, 1
store i32 %74, i32* %8
br label %12
75: ; preds = %12
%76 = load double*, double** %5
%77 = getelementptr inbounds double, double* %76, i64 0
%78 = load double, double* %77
%79 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%80 = load double, double* %79
%81 = load double*, double** %5
%82 = getelementptr inbounds double, double* %81, i64 1
%83 = load double, double* %82
%84 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%85 = load double, double* %84
%86 = fmul double %83, %85
%87 = call double @llvm.fmuladd.f64(double %78, double %80, double %86)
%88 = load double*, double** %5
%89 = getelementptr inbounds double, double* %88, i64 2
%90 = load double, double* %89
%91 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%92 = load double, double* %91
%93 = call double @llvm.fmuladd.f64(double %90, double %92, double %87)
%94 = fcmp ogt double %93, 0.000000e+00
br i1 %94, label %95, label %96
95: ; preds = %75
store i32 0, i32* %4
br label %118
96: ; preds = %75
%97 = load double*, double** %5
%98 = getelementptr inbounds double, double* %97, i64 0
%99 = load double, double* %98
%100 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%101 = load double, double* %100
%102 = load double*, double** %5
%103 = getelementptr inbounds double, double* %102, i64 1
%104 = load double, double* %103
%105 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%106 = load double, double* %105
%107 = fmul double %104, %106
%108 = call double @llvm.fmuladd.f64(double %99, double %101, double %107)
%109 = load double*, double** %5
%110 = getelementptr inbounds double, double* %109, i64 2
%111 = load double, double* %110
%112 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
%113 = load double, double* %112
%114 = call double @llvm.fmuladd.f64(double %111, double %113, double %108)
%115 = fcmp oge double %114, 0.000000e+00
br i1 %115, label %116, label %117
116: ; preds = %96
store i32 1, i32* %4
br label %118
117: ; preds = %96
store i32 0, i32* %4
br label %118
118: ; preds = %117, %116, %95
%119 = load i32, i32* %4
ret i32 %119
}

LLVM IR (-O2):
define i32 @planeBoxOverlap(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %0
%6 = fcmp ogt double %5, 0.000000e+00
%7 = load double, double* %2
%8 = fneg double %7
%9 = select i1 %6, double %8, double %7
%10 = fsub double %9, %4
%11 = getelementptr inbounds double, double* %1, i64 1
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = fcmp ogt double %14, 0.000000e+00
%16 = getelementptr inbounds double, double* %2, i64 1
%17 = load double, double* %16
%18 = fneg double %17
%19 = select i1 %15, double %18, double %17
%20 = fsub double %19, %12
%21 = getelementptr inbounds double, double* %1, i64 2
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %0, i64 2
%24 = load double, double* %23
%25 = fcmp ogt double %24, 0.000000e+00
%26 = getelementptr inbounds double, double* %2, i64 2
%27 = load double, double* %26
%28 = fneg double %27
%29 = select i1 %25, double %28, double %27
%30 = fsub double %29, %22
%31 = fmul double %14, %20
%32 = tail call double @llvm.fmuladd.f64(double %5, double %10, double %31)
%33 = tail call double @llvm.fmuladd.f64(double %24, double %30, double %32)
%34 = fcmp ogt double %33, 0.000000e+00
br i1 %34, label %47, label %35
35: ; preds = %3
%36 = select i1 %25, double %27, double %28
%37 = select i1 %15, double %17, double %18
%38 = fsub double %37, %12
%39 = select i1 %6, double %7, double %8
%40 = fsub double %39, %4
%41 = fsub double %36, %22
%42 = fmul double %14, %38
%43 = tail call double @llvm.fmuladd.f64(double %5, double %40, double %42)
%44 = tail call double @llvm.fmuladd.f64(double %24, double %41, double %43)
%45 = fcmp oge double %44, 0.000000e+00
%46 = zext i1 %45 to i32
br label %47
47: ; preds = %35, %3
%48 = phi i32 [ 0, %3 ], [ %46, %35 ]
ret i32 %48
}