#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*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           char *);
char *print_string_maybe_null(char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char const *);
int strings_equal(const char *desc, const char *s1, const char *s2) {
  if (s1 == NULL && s2 == NULL)
    return 1;
  if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {
    fprintf(stderr, "%s mismatch: %s vs %s\n", desc,
            print_string_maybe_null(s1), print_string_maybe_null(s2));
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<strings_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1166 <strings_equal+0x36>
cmpq   $0x0,-0x20(%rbp)
jne    1166 <strings_equal+0x36>
movl   $0x1,-0x4(%rbp)
jmp    11ea <strings_equal+0xba>
cmpq   $0x0,-0x18(%rbp)
je     1193 <strings_equal+0x63>
cmpq   $0x0,-0x20(%rbp)
je     1193 <strings_equal+0x63>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11e3 <strings_equal+0xb3>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <print_string_maybe_null@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <print_string_maybe_null@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %rax,%r8
lea    0xe2e(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <strings_equal+0xba>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_equal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r15d
mov    %rsi,%rax
or     %rdx,%rax
je     11a0 <strings_equal+0x70>
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r14
test   %rsi,%rsi
je     1168 <strings_equal+0x38>
test   %rbx,%rbx
je     1168 <strings_equal+0x38>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a0 <strings_equal+0x70>
mov    0x2e71(%rip),%rax
mov    (%rax),%r15d
mov    %rbp,%rdi
call   1050 <print_string_maybe_null@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <print_string_maybe_null@plt>
lea    0xe74(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
call   1040 <fprintf@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"%s mismatch: %s vs %s\0A\00"
define i32 @strings_equal(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%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** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %4
br label %34
14: ; preds = %10, %3
%15 = load i8*, i8** %6
%16 = icmp eq i8* %15, null
br i1 %16, label %25, label %17
17: ; preds = %14
%18 = load i8*, i8** %7
%19 = icmp eq i8* %18, null
br i1 %19, label %25, label %20
20: ; preds = %17
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i64 @strcmp(i8* %21, i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %20, %17, %14
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %5
%28 = load i8*, i8** %6
%29 = call i8* @print_string_maybe_null(i8* %28)
%30 = load i8*, i8** %7
%31 = call i8* @print_string_maybe_null(i8* %30)
%32 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %27, i8* %29, i8* %31)
store i32 0, i32* %4
br label %34
33: ; preds = %20
store i32 1, i32* %4
br label %34
34: ; preds = %33, %25, %13
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"%s mismatch: %s vs %s\0A\00"
define i32 @strings_equal(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %1, null
%5 = icmp eq i8* %2, null
%6 = and i1 %4, %5
br i1 %6, label %17, label %7
7: ; preds = %3
%8 = or i1 %4, %5
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = tail call i64 @strcmp(i8* %1, i8* %2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9, %7
%13 = load i32, i32* @stderr
%14 = tail call i8* @print_string_maybe_null(i8* %1)
%15 = tail call i8* @print_string_maybe_null(i8* %2)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %14, i8* %15)
br label %17
17: ; preds = %9, %3, %12
%18 = phi i32 [ 0, %12 ], [ 1, %3 ], [ 1, %9 ]
ret i32 %18
}