#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 */
char *calloc(size_t, int);
scalar_t__ rdz_strcmp(char *, char *, char *, int);
char *rdz_strdup(char *);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *);
int strlen(char *);
char *rdz_string_neq(char *operator, char * result, char *not_expected) {
  if (result == NULL)
    return rdz_strdup("     result is NULL");
  if (not_expected == NULL)
    return NULL;
  if (rdz_strcmp(operator, result, not_expected, -1) != 0)
    return NULL;
  size_t l = strlen(not_expected) + 22;
  char *s = calloc(l, sizeof(char));
  snprintf(s, l, "     didn't expect \"%s\"", not_expected);
  return s;
}


x86 assembly (clang, -O0):
<rdz_string_neq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1184 <rdz_string_neq+0x34>
lea    0xe8a(%rip),%rdi
call   1070 <rdz_strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    120d <rdz_string_neq+0xbd>
cmpq   $0x0,-0x20(%rbp)
jne    119c <rdz_string_neq+0x4c>
movq   $0x0,-0x8(%rbp)
jmp    120d <rdz_string_neq+0xbd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <rdz_strcmp@plt>
cmp    $0x0,%rax
je     11c9 <rdz_string_neq+0x79>
movq   $0x0,-0x8(%rbp)
jmp    120d <rdz_string_neq+0xbd>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x16,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rcx
lea    0xe14(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdz_string_neq>:
test   %rsi,%rsi
je     1179 <rdz_string_neq+0x29>
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
test   %rdx,%rdx
je     1174 <rdz_string_neq+0x24>
mov    %rbx,%rdx
mov    $0xffffffff,%ecx
call   1030 <rdz_strcmp@plt>
test   %rax,%rax
je     1185 <rdz_string_neq+0x35>
xor    %r14d,%r14d
jmp    11b8 <rdz_string_neq+0x68>
lea    0xe80(%rip),%rdi
jmp    1070 <rdz_strdup@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
add    $0x16,%eax
movslq %eax,%r15
mov    %r15,%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%r14
lea    0xe6a(%rip),%rdx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c" result is NULL\00"
@.str.1 = [24 x i8] c" didn't expect \22%s\22\00"
define i8* @rdz_string_neq(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i8* @rdz_strdup(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %18
7: ; preds = %3
%8 = icmp eq i8* %2, null
br i1 %8, label %18, label %9
9: ; preds = %7
%10 = tail call i64 @rdz_strcmp(i8* %0, i8* %1, i8* %2, i32 -1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = tail call i32 @strlen(i8* %2)
%14 = add nsw i32 %13, 22
%15 = sext i32 %14 to i64
%16 = tail call i8* @calloc(i64 %15, i32 1)
%17 = tail call i32 @snprintf(i8* %16, i64 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %18
18: ; preds = %9, %7, %12, %5
%19 = phi i8* [ %6, %5 ], [ %16, %12 ], [ null, %7 ], [ null, %9 ]
ret i8* %19
}