#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*/ EXIT_FAILURE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fprintf(int /*<<< orphan*/, char const *, char const *, unsigned int,
                   int, char const *);
int /*<<< orphan*/ stderr;
void check(int expr, const char *file, unsigned line, const char *s) {
  const char *ok = "PASS (%s:%u) ** %d == %s\n";
  const char *ng = "FAIL (%s:%u) ** %d == %s\n";
  if (fprintf(stderr, (expr ? ok : ng), file, line, expr, s) < 0)
    abort();
  if (!expr)
    exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     117f <check+0x4f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1187 <check+0x57>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%r8d
mov    -0x20(%rbp),%r9
call   1040 <fprintf@plt>
cmp    $0x0,%rax
jge    11b3 <check+0x83>
mov    $0x0,%al
call   1030 <abort@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11cb <check+0x9b>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
mov    %rcx,%r9
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
test   %ebx,%ebx
lea    0xecd(%rip),%rax
lea    0xeac(%rip),%rsi
cmove  %rax,%rsi
mov    %ebx,%r8d
call   1040 <fprintf@plt>
test   %rax,%rax
js     116b <check+0x3b>
test   %ebx,%ebx
je     1172 <check+0x42>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"PASS (%s:%u) ** %d == %s\0A\00"
@.str.1 = [26 x i8] c"FAIL (%s:%u) ** %d == %s\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @check(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = load i32, i32* @stderr
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = load i8*, i8** %9
br label %18
16: ; preds = %4
%17 = load i8*, i8** %10
br label %18
18: ; preds = %16, %14
%19 = phi i8* [ %15, %14 ], [ %17, %16 ]
%20 = load i8*, i8** %6
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = load i8*, i8** %8
%24 = call i64 @fprintf(i32 %11, i8* %19, i8* %20, i32 %21, i32 %22, i8* %23)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 (...) @abort()
unreachable
28: ; preds = %18
%29 = load i32, i32* %5
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %28
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"PASS (%s:%u) ** %d == %s\0A\00"
@.str.1 = [26 x i8] c"FAIL (%s:%u) ** %d == %s\0A\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @check(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = icmp eq i32 %0, 0
%7 = select i1 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
%8 = tail call i64 @fprintf(i32 %5, i8* %7, i8* %1, i32 %2, i32 %0, i8* %3)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %4
br i1 %6, label %13, label %16
13: ; preds = %12
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %12
ret void
}