#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*/ diag(char *, char const *);
int /*<<< orphan*/ free(char *);
char *non_null(int /*<<< orphan*/);
int /*<<< orphan*/ ok(int, char *, char const *, char const *, char const *);
int /*<<< orphan*/ rfile_fn_tidy(char const *);
int /*<<< orphan*/ strcmp(char *, char const *);
int tidy_ok(const char *a1, const char *want, const char *msg) {
  char *got = non_null(rfile_fn_tidy(a1));
  int r = !strcmp(got, want);
  ok(r,
     "tidy"
     ": %s ("
     "%s"
     " -> %s)",
     msg, a1, want);
  if (!r) {
    diag(" got: %s", got);
    diag("want: %s", want);
  }
  free(got);
  return r;
}


x86 assembly (clang, -O0):
<tidy_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rfile_fn_tidy@plt>
mov    %eax,%edi
call   1080 <non_null@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe45(%rip),%rsi
call   1050 <ok@plt>
cmpl   $0x0,-0x24(%rbp)
jne    11ea <tidy_ok+0x8a>
mov    -0x20(%rbp),%rsi
lea    0xe3f(%rip),%rdi
call   1060 <diag@plt>
mov    -0x10(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1060 <diag@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tidy_ok>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r13
call   1030 <rfile_fn_tidy@plt>
mov    %eax,%edi
call   1080 <non_null@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
mov    %eax,%ebx
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
lea    0xe61(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %r13,%rcx
mov    %r14,%r8
call   1050 <ok@plt>
test   %ebx,%ebx
je     11d1 <tidy_ok+0x71>
lea    0xe5a(%rip),%rdi
mov    %r12,%rsi
call   1060 <diag@plt>
lea    0xe54(%rip),%rdi
mov    %r14,%rsi
call   1060 <diag@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"tidy: %s (%s -> %s)\00"
@.str.1 = [9 x i8] c" got: %s\00"
@.str.2 = [9 x i8] c"want: %s\00"
define i32 @tidy_ok(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = call i32 @rfile_fn_tidy(i8* %9)
%11 = call i8* @non_null(i32 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = load i8*, i8** %5
%14 = call i32 @strcmp(i8* %12, i8* %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
%17 = zext i1 %16 to i32
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = load i8*, i8** %6
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = call i32 @ok(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i8* %21)
%23 = load i32, i32* %8
%24 = icmp ne i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %3
%26 = load i8*, i8** %7
%27 = call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %5
%29 = call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %25, %3
%31 = load i8*, i8** %7
%32 = call i32 @free(i8* %31)
%33 = load i32, i32* %8
ret i32 %33
}

LLVM IR (-O2):
@.str = [20 x i8] c"tidy: %s (%s -> %s)\00"
@.str.1 = [9 x i8] c" got: %s\00"
@.str.2 = [9 x i8] c"want: %s\00"
define i32 @tidy_ok(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @rfile_fn_tidy(i8* %0)
%5 = tail call i8* @non_null(i32 %4)
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %1)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @ok(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i8* %1)
br i1 %7, label %13, label %10
10: ; preds = %3
%11 = tail call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%12 = tail call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %13
13: ; preds = %10, %3
%14 = tail call i32 @free(i8* %5)
ret i32 %8
}