#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 */
struct clad_test {
  int dummy;
};

/* Variables and functions */
struct clad_test *clad_test_assert(struct clad_test *, int, char *, float,
                                   float, char const *);
struct clad_test *clad_test_floateq(struct clad_test *test, float d1, float d2,
                                    const char *explain) {
  float delta = d2 - d1;
  delta = ((delta < 0) ? -delta : delta);
  return clad_test_assert(test, delta < 0.0000001,
                          "Floats should be equal: %f %f; %s ", d1, d2,
                          explain);
}


x86 assembly (clang, -O0):
<clad_test_floateq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1162 <clad_test_floateq+0x52>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    116c <clad_test_floateq+0x5c>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe75(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%esi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rcx
lea    0xe5c(%rip),%rdx
call   1030 <clad_test_assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clad_test_floateq>:
movaps %xmm1,%xmm2
subss  %xmm0,%xmm2
movaps 0xee2(%rip),%xmm3
xorps  %xmm2,%xmm3
xorps  %xmm4,%xmm4
movaps %xmm2,%xmm5
cmpltss %xmm4,%xmm5
andps  %xmm5,%xmm3
andnps %xmm2,%xmm5
orps   %xmm3,%xmm5
xorps  %xmm2,%xmm2
cvtss2sd %xmm5,%xmm2
movsd  0xecc(%rip),%xmm3
xor    %eax,%eax
ucomisd %xmm2,%xmm3
mov    %rsi,%rcx
seta   %al
lea    0xec1(%rip),%rdx
mov    %eax,%esi
jmp    1030 <clad_test_assert@plt>

LLVM IR (-O0):
%struct.clad_test = type { i32 }
@.str = [35 x i8] c"Floats should be equal: %f %f; %s \00"
define %struct.clad_test* @clad_test_floateq(%struct.clad_test* %0, float %1, float %2, i8* %3) {
%5 = alloca %struct.clad_test*
%6 = alloca float
%7 = alloca float
%8 = alloca i8*
%9 = alloca float
store %struct.clad_test* %0, %struct.clad_test** %5
store float %1, float* %6
store float %2, float* %7
store i8* %3, i8** %8
%10 = load float, float* %7
%11 = load float, float* %6
%12 = fsub float %10, %11
store float %12, float* %9
%13 = load float, float* %9
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load float, float* %9
%17 = fneg float %16
br label %20
18: ; preds = %4
%19 = load float, float* %9
br label %20
20: ; preds = %18, %15
%21 = phi float [ %17, %15 ], [ %19, %18 ]
store float %21, float* %9
%22 = load %struct.clad_test*, %struct.clad_test** %5
%23 = load float, float* %9
%24 = fpext float %23 to double
%25 = fcmp olt double %24, 0x3E7AD7F29ABCAF48
%26 = zext i1 %25 to i32
%27 = load float, float* %6
%28 = load float, float* %7
%29 = load i8*, i8** %8
%30 = call %struct.clad_test* @clad_test_assert(%struct.clad_test* %22, i32 %26, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), float %27, float %28, i8* %29)
ret %struct.clad_test* %30
}

LLVM IR (-O2):
%struct.clad_test = type { i32 }
@.str = [35 x i8] c"Floats should be equal: %f %f; %s \00"
define %struct.clad_test* @clad_test_floateq(%struct.clad_test* %0, float %1, float %2, i8* %3) {
%5 = fsub float %2, %1
%6 = fcmp olt float %5, 0.000000e+00
%7 = fneg float %5
%8 = select i1 %6, float %7, float %5
%9 = fpext float %8 to double
%10 = fcmp olt double %9, 0x3E7AD7F29ABCAF48
%11 = zext i1 %10 to i32
%12 = tail call %struct.clad_test* @clad_test_assert(%struct.clad_test* %0, i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), float %1, float %2, i8* %3)
ret %struct.clad_test* %12
}