#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*/ p_comment(char *, char *);
void test_print(int is_error, char *(*p_func)(char *str, void *data),
                void *data_expected, void *data_recieved) {
  char str[256];
  if (is_error)
    p_comment(p_func(str, data_expected), "expected: ");
  p_comment(p_func(str, data_recieved), is_error ? "received: " : " ");
}


x86 assembly (clang, -O0):
<test_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1154 <test_print+0x44>
mov    -0x10(%rbp),%rax
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   *%rax
mov    %rax,%rdi
lea    0xeb1(%rip),%rsi
call   1030 <p_comment@plt>
mov    -0x10(%rbp),%rax
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   *%rax
mov    %rax,%rdi
mov    -0x4(%rbp),%ecx
lea    0xe97(%rip),%rsi
lea    0xe92(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   1030 <p_comment@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_print>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rcx,%r14
mov    %rsi,%r15
test   %edi,%edi
je     1147 <test_print+0x37>
mov    %rsp,%rdi
mov    %rdx,%rsi
call   *%r15
lea    0xeca(%rip),%rsi
mov    %rax,%rdi
call   1030 <p_comment@plt>
lea    0xec6(%rip),%rbx
jmp    114e <test_print+0x3e>
lea    0xebb(%rip),%rbx
mov    %rsp,%rdi
mov    %r14,%rsi
call   *%r15
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <p_comment@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"expected: \00"
@.str.1 = [11 x i8] c"received: \00"
@.str.2 = [2 x i8] c" \00"
define void @test_print(i32 %0, i8* (i8*, i8*)* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8* (i8*, i8*)*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [256 x i8]
store i32 %0, i32* %5
store i8* (i8*, i8*)* %1, i8* (i8*, i8*)** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %4
%13 = load i8* (i8*, i8*)*, i8* (i8*, i8*)** %6
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = call i8* %13(i8* %14, i8* %15)
%17 = call i32 @p_comment(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %12, %4
%19 = load i8* (i8*, i8*)*, i8* (i8*, i8*)** %6
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%21 = load i8*, i8** %8
%22 = call i8* %19(i8* %20, i8* %21)
%23 = load i32, i32* %5
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%27 = call i32 @p_comment(i8* %22, i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"expected: \00"
@.str.1 = [11 x i8] c"received: \00"
@.str.2 = [2 x i8] c" \00"
define void @test_print(i32 %0, i8* (i8*, i8*)* nocapture %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = icmp eq i32 %0, 0
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = call i8* %1(i8* %6, i8* %2)
%10 = call i32 @p_comment(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %4
%12 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %4 ]
%13 = call i8* %1(i8* %6, i8* %3)
%14 = call i32 @p_comment(i8* %13, i8* %12)
ret void
}