#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*/ test_printf_stderr(char *, ...);
void test_fail_message_prefix(const char *prefix, const char *file, int line,
                              const char *type, const char *left,
                              const char *right, const char *op) {
  test_printf_stderr("%s: ", prefix != NULL ? prefix : "ERROR");
  if (type)
    test_printf_stderr("(%s) ", type);
  if (op != NULL) {
    if (left != NULL && right != NULL)
      test_printf_stderr("'%s %s %s' failed", left, op, right);
    else
      test_printf_stderr("'%s'", op);
  }
  if (file != NULL) {
    test_printf_stderr(" @ %s:%d", file, line);
  }
  test_printf_stderr("\n");
}


x86 assembly (clang, -O0):
<test_fail_message_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <test_fail_message_prefix+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    115b <test_fail_message_prefix+0x4b>
lea    0xeb3(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    115b <test_fail_message_prefix+0x4b>
mov    -0x38(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
cmpq   $0x0,-0x20(%rbp)
je     118a <test_fail_message_prefix+0x7a>
mov    -0x20(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
cmpq   $0x0,0x10(%rbp)
je     11e1 <test_fail_message_prefix+0xd1>
cmpq   $0x0,-0x28(%rbp)
je     11ca <test_fail_message_prefix+0xba>
cmpq   $0x0,-0x30(%rbp)
je     11ca <test_fail_message_prefix+0xba>
mov    -0x28(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
jmp    11dc <test_fail_message_prefix+0xcc>
mov    0x10(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
jmp    11e1 <test_fail_message_prefix+0xd1>
cmpq   $0x0,-0x10(%rbp)
je     1201 <test_fail_message_prefix+0xf1>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <test_printf_stderr@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fail_message_prefix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %rsi,%r13
mov    0x40(%rsp),%rbp
test   %rdi,%rdi
lea    0xecc(%rip),%rsi
cmovne %rdi,%rsi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <test_printf_stderr@plt>
test   %rbx,%rbx
je     1161 <test_fail_message_prefix+0x51>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <test_printf_stderr@plt>
test   %rbp,%rbp
je     1187 <test_fail_message_prefix+0x77>
test   %r12,%r12
je     11bc <test_fail_message_prefix+0xac>
test   %r15,%r15
je     11bc <test_fail_message_prefix+0xac>
lea    0xe9a(%rip),%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <test_printf_stderr@plt>
test   %r13,%r13
je     11a0 <test_fail_message_prefix+0x90>
lea    0xe95(%rip),%rdi
mov    %r13,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <test_printf_stderr@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <test_printf_stderr@plt>
lea    0xe60(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <test_printf_stderr@plt>
test   %r13,%r13
jne    118c <test_fail_message_prefix+0x7c>
jmp    11a0 <test_fail_message_prefix+0x90>

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [6 x i8] c"ERROR\00"
@.str.2 = [6 x i8] c"(%s) \00"
@.str.3 = [18 x i8] c"'%s %s %s' failed\00"
@.str.4 = [5 x i8] c"'%s'\00"
@.str.5 = [9 x i8] c" @ %s:%d\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @test_fail_message_prefix(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%15 = load i8*, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %7
%18 = load i8*, i8** %8
br label %20
19: ; preds = %7
br label %20
20: ; preds = %19, %17
%21 = phi i8* [ %18, %17 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %19 ]
%22 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %11
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %11
%27 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %20
%29 = load i8*, i8** %14
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %46
31: ; preds = %28
%32 = load i8*, i8** %12
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = load i8*, i8** %13
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i8*, i8** %12
%39 = load i8*, i8** %14
%40 = load i8*, i8** %13
%41 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %38, i8* %39, i8* %40)
br label %45
42: ; preds = %34, %31
%43 = load i8*, i8** %14
%44 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %42, %37
br label %46
46: ; preds = %45, %28
%47 = load i8*, i8** %9
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %53
49: ; preds = %46
%50 = load i8*, i8** %9
%51 = load i32, i32* %10
%52 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %50, i32 %51)
br label %53
53: ; preds = %49, %46
%54 = call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [6 x i8] c"ERROR\00"
@.str.2 = [6 x i8] c"(%s) \00"
@.str.3 = [18 x i8] c"'%s %s %s' failed\00"
@.str.4 = [5 x i8] c"'%s'\00"
@.str.5 = [9 x i8] c" @ %s:%d\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @test_fail_message_prefix(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = icmp eq i8* %0, null
%9 = select i1 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0
%10 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = icmp eq i8* %3, null
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %14
14: ; preds = %12, %7
%15 = icmp eq i8* %6, null
br i1 %15, label %24, label %16
16: ; preds = %14
%17 = icmp ne i8* %4, null
%18 = icmp ne i8* %5, null
%19 = and i1 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %4, i8* %6, i8* %5)
br label %24
22: ; preds = %16
%23 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %6)
br label %24
24: ; preds = %20, %22, %14
%25 = icmp eq i8* %1, null
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %1, i32 %2)
br label %28
28: ; preds = %26, %24
%29 = tail call i32 (i8*, ...) @test_printf_stderr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}