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


x86 assembly (clang, -O0):
<abs2rel_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <rfile_fn_abs2rel@plt>
mov    %eax,%edi
call   1070 <non_null@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe39(%rip),%rsi
call   1040 <ok@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    11f6 <abs2rel_ok+0x96>
mov    -0x28(%rbp),%rsi
lea    0xe3a(%rip),%rdi
call   1050 <diag@plt>
mov    -0x18(%rbp),%rsi
lea    0xe33(%rip),%rdi
call   1050 <diag@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs2rel_ok>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
call   1080 <rfile_fn_abs2rel@plt>
mov    %eax,%edi
call   1070 <non_null@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
mov    %eax,%r15d
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
lea    0xe5c(%rip),%rsi
mov    %ebp,%edi
mov    (%rsp),%rdx
mov    %rbx,%rcx
mov    %r12,%r8
mov    %r14,%r9
call   1040 <ok@plt>
test   %r15d,%r15d
je     11db <abs2rel_ok+0x7b>
lea    0xe57(%rip),%rdi
mov    %r13,%rsi
call   1050 <diag@plt>
lea    0xe51(%rip),%rdi
mov    %r14,%rsi
call   1050 <diag@plt>
mov    %r13,%rdi
call   1030 <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 = [27 x i8] c"abs2rel: %s (%s, %s -> %s)\00"
@.str.1 = [9 x i8] c" got: %s\00"
@.str.2 = [9 x i8] c"want: %s\00"
define i32 @abs2rel_ok(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @rfile_fn_abs2rel(i8* %11, i8* %12)
%14 = call i8* @non_null(i32 %13)
store i8* %14, i8** %9
%15 = load i8*, i8** %9
%16 = load i8*, i8** %7
%17 = call i32 @strcmp(i8* %15, i8* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = load i8*, i8** %8
%23 = load i8*, i8** %5
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = call i32 @ok(i32 %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %23, i8* %24, i8* %25)
%27 = load i32, i32* %10
%28 = icmp ne i32 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %4
%30 = load i8*, i8** %9
%31 = call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %7
%33 = call i32 @diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %29, %4
%35 = load i8*, i8** %9
%36 = call i32 @free(i8* %35)
%37 = load i32, i32* %10
ret i32 %37
}

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