#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 */
scalar_t__ az_dapprox(double, double);
int /*<<< orphan*/ printf(char *, char const *, double, double);
int /*<<< orphan*/ test_failure();
bool _expect_approx(double expected, double actual, const char *message) {
  if (az_dapprox(expected, actual))
    return true;
  test_failure();
  printf(" \x1b[1;31mFAILED:\x1b[m %s\n  %.20g vs. %.20g\n", message, expected,
         actual);
  return false;
}


x86 assembly (clang, -O0):
<_expect_approx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <az_dapprox@plt>
cmp    $0x0,%rax
je     116b <_expect_approx+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1193 <_expect_approx+0x63>
mov    $0x0,%al
call   1050 <test_failure@plt>
mov    -0x20(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect_approx>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1030 <az_dapprox@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1178 <_expect_approx+0x48>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <test_failure@plt>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A %.20g vs. %.20g\0A\00"
define i32 @_expect_approx(double %0, double %1, i8* %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i8*
store double %0, double* %5
store double %1, double* %6
store i8* %2, i8** %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call i64 @az_dapprox(double %8, double %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 1, i32* %4
br label %19
13: ; preds = %3
%14 = call i32 (...) @test_failure()
%15 = load i8*, i8** %7
%16 = load double, double* %5
%17 = load double, double* %6
%18 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %15, double %16, double %17)
store i32 0, i32* %4
br label %19
19: ; preds = %13, %12
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [41 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A %.20g vs. %.20g\0A\00"
define i32 @_expect_approx(double %0, double %1, i8* %2) {
%4 = tail call i64 @az_dapprox(double %0, double %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 (...) @test_failure()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %2, double %0, double %1)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %10
}