#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*/ addFailure(char *, long, char const *);
int /*<<< orphan*/ sprintf(char *, char *, float, float, float, float);
int assertImplementationFloat(float expected, float actual, float deviation,
                              long line, const char *file) {
  char buffer[128];
  float dif, percent;
  dif = expected - actual;
  if (dif < 0)
    dif = -dif;
  if (expected != 0) {
    percent = dif / expected;
    if (percent < 0)
      percent = -percent;
  } else
    percent = dif;
  if (percent < deviation)
    return 0;
  sprintf(buffer, "exp: %.4f ... was: %.4f ... dif: %.f ... deviation: %f%%",
          expected, actual, dif, percent);
  addFailure(buffer, line, file);
  return 1;
}


x86 assembly (clang, -O0):
<assertImplementationFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xa4(%rbp)
ff
xorps  %xmm0,%xmm0
ucomiss -0xa4(%rbp),%xmm0
jbe    1181 <assertImplementationFloat+0x61>
movss  -0xa4(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xa4(%rbp)
ff
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    119d <assertImplementationFloat+0x7d>
jp     119d <assertImplementationFloat+0x7d>
jmp    11e4 <assertImplementationFloat+0xc4>
movss  -0xa4(%rbp),%xmm0
ff
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
ucomiss -0xa8(%rbp),%xmm0
jbe    11df <assertImplementationFloat+0xbf>
movss  -0xa8(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
jmp    11f4 <assertImplementationFloat+0xd4>
movss  -0xa4(%rbp),%xmm0
ff
movss  %xmm0,-0xa8(%rbp)
ff
movss  -0xa8(%rbp),%xmm1
ff
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1216 <assertImplementationFloat+0xf6>
movl   $0x0,-0x4(%rbp)
jmp    125e <assertImplementationFloat+0x13e>
lea    -0xa0(%rbp),%rdi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0xa4(%rbp),%xmm2
ff
movss  -0xa8(%rbp),%xmm3
ff
lea    0xdc2(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <addFailure@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertImplementationFloat>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movaps %xmm0,%xmm4
subss  %xmm1,%xmm4
movaps 0xec0(%rip),%xmm6
xorps  %xmm4,%xmm6
xorps  %xmm5,%xmm5
movaps %xmm4,%xmm3
cmpltss %xmm5,%xmm3
andps  %xmm3,%xmm6
andnps %xmm4,%xmm3
orps   %xmm6,%xmm3
movaps %xmm3,%xmm4
ucomiss %xmm5,%xmm0
jne    1161 <assertImplementationFloat+0x41>
jnp    1171 <assertImplementationFloat+0x51>
divss  %xmm0,%xmm3
ucomiss %xmm3,%xmm5
jbe    1171 <assertImplementationFloat+0x51>
xorps  0xe8f(%rip),%xmm3
xor    %eax,%eax
ucomiss %xmm3,%xmm2
ja     11a0 <assertImplementationFloat+0x80>
lea    0xe91(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
movaps %xmm4,%xmm2
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <addFailure@plt>
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [57 x i8] c"exp: %.4f ... was: %.4f ... dif: %.f ... deviation: %f%%\00"
define i32 @assertImplementationFloat(float %0, float %1, float %2, i64 %3, i8* %4) {
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i64
%11 = alloca i8*
%12 = alloca [128 x i8]
%13 = alloca float
%14 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store i64 %3, i64* %10
store i8* %4, i8** %11
%15 = load float, float* %7
%16 = load float, float* %8
%17 = fsub float %15, %16
store float %17, float* %13
%18 = load float, float* %13
%19 = fcmp olt float %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %5
%21 = load float, float* %13
%22 = fneg float %21
store float %22, float* %13
br label %23
23: ; preds = %20, %5
%24 = load float, float* %7
%25 = fcmp une float %24, 0.000000e+00
br i1 %25, label %26, label %36
26: ; preds = %23
%27 = load float, float* %13
%28 = load float, float* %7
%29 = fdiv float %27, %28
store float %29, float* %14
%30 = load float, float* %14
%31 = fcmp olt float %30, 0.000000e+00
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load float, float* %14
%34 = fneg float %33
store float %34, float* %14
br label %35
35: ; preds = %32, %26
br label %38
36: ; preds = %23
%37 = load float, float* %13
store float %37, float* %14
br label %38
38: ; preds = %36, %35
%39 = load float, float* %14
%40 = load float, float* %9
%41 = fcmp olt float %39, %40
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 0, i32* %6
br label %54
43: ; preds = %38
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%45 = load float, float* %7
%46 = load float, float* %8
%47 = load float, float* %13
%48 = load float, float* %14
%49 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), float %45, float %46, float %47, float %48)
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%51 = load i64, i64* %10
%52 = load i8*, i8** %11
%53 = call i32 @addFailure(i8* %50, i64 %51, i8* %52)
store i32 1, i32* %6
br label %54
54: ; preds = %43, %42
%55 = load i32, i32* %6
ret i32 %55
}

LLVM IR (-O2):
@.str = [57 x i8] c"exp: %.4f ... was: %.4f ... dif: %.f ... deviation: %f%%\00"
define i32 @assertImplementationFloat(float %0, float %1, float %2, i64 %3, i8* %4) {
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = fsub float %0, %1
%9 = fcmp olt float %8, 0.000000e+00
%10 = fneg float %8
%11 = select i1 %9, float %10, float %8
%12 = fcmp une float %0, 0.000000e+00
br i1 %12, label %13, label %18
13: ; preds = %5
%14 = fdiv float %11, %0
%15 = fcmp olt float %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = fneg float %14
br label %18
18: ; preds = %5, %13, %16
%19 = phi float [ %17, %16 ], [ %14, %13 ], [ %11, %5 ]
%20 = fcmp olt float %19, %2
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), float %0, float %1, float %11, float %19)
%23 = call i32 @addFailure(i8* %7, i64 %3, i8* %4)
br label %24
24: ; preds = %18, %21
%25 = phi i32 [ 1, %21 ], [ 0, %18 ]
ret i32 %25
}