#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 */
scalar_t__ rdz_strcmp(char *, char *, char *, int);
char *rdz_strdup(char *);
char *rdz_string_expected(char *, char *, char *);
char *rdz_string_eq(char *operator, char * result, char *expected) {
  if (expected == NULL && result == NULL)
    return NULL;
  if (result == NULL)
    return rdz_strdup("     result is NULL");
  if (expected && rdz_strcmp(operator, result, expected, -1) == 0)
    return NULL;
  return rdz_string_expected(result, "to equal", expected);
}


x86 assembly (clang, -O0):
<rdz_string_eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1167 <rdz_string_eq+0x37>
cmpq   $0x0,-0x18(%rbp)
jne    1167 <rdz_string_eq+0x37>
movq   $0x0,-0x8(%rbp)
jmp    11d7 <rdz_string_eq+0xa7>
cmpq   $0x0,-0x18(%rbp)
jne    1187 <rdz_string_eq+0x57>
lea    0xe87(%rip),%rdi
call   1050 <rdz_strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11d7 <rdz_string_eq+0xa7>
cmpq   $0x0,-0x20(%rbp)
je     11bf <rdz_string_eq+0x8f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <rdz_strcmp@plt>
cmp    $0x0,%rax
jne    11bf <rdz_string_eq+0x8f>
movq   $0x0,-0x8(%rbp)
jmp    11d7 <rdz_string_eq+0xa7>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe46(%rip),%rsi
call   1040 <rdz_string_expected@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdz_string_eq>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
or     %rdx,%rax
jne    1146 <rdz_string_eq+0x16>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsi,%rbx
test   %rsi,%rsi
je     1184 <rdz_string_eq+0x54>
mov    %rdx,%r14
test   %rdx,%rdx
je     116b <rdz_string_eq+0x3b>
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0xffffffff,%ecx
call   1030 <rdz_strcmp@plt>
test   %rax,%rax
je     113c <rdz_string_eq+0xc>
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <rdz_string_expected@plt>
lea    0xe75(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <rdz_strdup@plt>

LLVM IR (-O0):
@.str = [20 x i8] c" result is NULL\00"
@.str.1 = [9 x i8] c"to equal\00"
define i8* @rdz_string_eq(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* null, i8** %4
br label %33
14: ; preds = %10, %3
%15 = load i8*, i8** %6
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i8* @rdz_strdup(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i8* %18, i8** %4
br label %33
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i8*, i8** %5
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = call i64 @rdz_strcmp(i8* %23, i8* %24, i8* %25, i32 -1)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %22
store i8* null, i8** %4
br label %33
29: ; preds = %22, %19
%30 = load i8*, i8** %6
%31 = load i8*, i8** %7
%32 = call i8* @rdz_string_expected(i8* %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %31)
store i8* %32, i8** %4
br label %33
33: ; preds = %29, %28, %17, %13
%34 = load i8*, i8** %4
ret i8* %34
}

LLVM IR (-O2):
@.str = [20 x i8] c" result is NULL\00"
@.str.1 = [9 x i8] c"to equal\00"
define i8* @rdz_string_eq(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %2, null
%5 = icmp eq i8* %1, null
%6 = and i1 %5, %4
br i1 %6, label %16, label %7
7: ; preds = %3
br i1 %5, label %8, label %10
8: ; preds = %7
%9 = tail call i8* @rdz_strdup(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
10: ; preds = %7
br i1 %4, label %14, label %11
11: ; preds = %10
%12 = tail call i64 @rdz_strcmp(i8* %0, i8* %1, i8* %2, i32 -1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11, %10
%15 = tail call i8* @rdz_string_expected(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %16
16: ; preds = %11, %3, %14, %8
%17 = phi i8* [ %9, %8 ], [ %15, %14 ], [ null, %3 ], [ null, %11 ]
ret i8* %17
}