#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*/ ERR(char *, float, float const, float const, float const);
float fabs(float);
void check(const float e[]) {
  enum { X, Y, Z };
  float ee, err;
  ee = e[X] * e[X] + e[Y] * e[Y] + e[Z] * e[Z];
  err = fabs(ee - 1.f);
  if (err > 1e-3)
    ERR("rigid ic: Matrix should be rotation only. Do not support scaling\n"
        "error: %g, e = %g %g %g",
        err, e[X], e[Y], e[Z]);
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe86(%rip),%xmm1
subss  %xmm1,%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe5f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d6 <check+0xb6>
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm3
lea    0xe3b(%rip),%rdi
call   1040 <ERR@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
movaps %xmm1,%xmm4
mulss  %xmm1,%xmm4
addss  %xmm0,%xmm4
movss  0x8(%rdi),%xmm3
movaps %xmm3,%xmm0
mulss  %xmm3,%xmm0
addss  %xmm4,%xmm0
addss  0xebd(%rip),%xmm0
andps  0xec6(%rip),%xmm0
xorps  %xmm4,%xmm4
cvtss2sd %xmm0,%xmm4
ucomisd 0xec7(%rip),%xmm4
jbe    1167 <check+0x57>
lea    0xec6(%rip),%rdi
jmp    1030 <ERR@plt>
ret

LLVM IR (-O0):
@.str = [89 x i8] c"rigid ic: Matrix should be rotation only. Do not support scaling\0Aerror: %g, e = %g %g %g\00"
define void @check(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
store float* %0, float** %2
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %2
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = load float*, float** %2
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = load float*, float** %2
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = fmul float %13, %16
%18 = call float @llvm.fmuladd.f32(float %7, float %10, float %17)
%19 = load float*, float** %2
%20 = getelementptr inbounds float, float* %19, i64 2
%21 = load float, float* %20
%22 = load float*, float** %2
%23 = getelementptr inbounds float, float* %22, i64 2
%24 = load float, float* %23
%25 = call float @llvm.fmuladd.f32(float %21, float %24, float %18)
store float %25, float* %3
%26 = load float, float* %3
%27 = fsub float %26, 1.000000e+00
%28 = call float @fabs(float %27)
store float %28, float* %4
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = fcmp ogt double %30, 1.000000e-03
br i1 %31, label %32, label %44
32: ; preds = %1
%33 = load float, float* %4
%34 = load float*, float** %2
%35 = getelementptr inbounds float, float* %34, i64 0
%36 = load float, float* %35
%37 = load float*, float** %2
%38 = getelementptr inbounds float, float* %37, i64 1
%39 = load float, float* %38
%40 = load float*, float** %2
%41 = getelementptr inbounds float, float* %40, i64 2
%42 = load float, float* %41
%43 = call i32 @ERR(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), float %33, float %36, float %39, float %42)
br label %44
44: ; preds = %32, %1
ret void
}

LLVM IR (-O2):
@.str = [89 x i8] c"rigid ic: Matrix should be rotation only. Do not support scaling\0Aerror: %g, e = %g %g %g\00"
define void @check(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
%10 = fadd float %9, -1.000000e+00
%11 = tail call float @llvm.fabs.f32(float %10)
%12 = fpext float %11 to double
%13 = fcmp ogt double %12, 1.000000e-03
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = tail call i32 @ERR(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), float %11, float %2, float %4, float %8)
br label %16
16: ; preds = %14, %1
ret void
}