#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*/ dump_string(char const *);
int /*<<< orphan*/ printf(char *, char const *, char const *);
int strcmp(char const *, char const *);
int string_compare(const char *expected, const char *actual) {
  int comparrison = strcmp(expected, actual);
  if (comparrison != 0) {
    printf("strings are not equal: expected: '%s' actual: '%s'\n", expected,
           actual);
    dump_string(expected);
    dump_string(actual);
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<string_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     118c <string_compare+0x5c>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <dump_string@plt>
mov    -0x18(%rbp),%rdi
call   1050 <dump_string@plt>
movl   $0x0,-0x4(%rbp)
jmp    1193 <string_compare+0x63>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_compare>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strcmp@plt>
test   %eax,%eax
je     1169 <string_compare+0x39>
lea    0xeb6(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <dump_string@plt>
mov    %r14,%rdi
call   1050 <dump_string@plt>
xor    %eax,%eax
jmp    116e <string_compare+0x3e>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [52 x i8] c"strings are not equal: expected: '%s' actual: '%s'\0A\00"
define i32 @string_compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @strcmp(i8* %7, i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @dump_string(i8* %16)
%18 = load i8*, i8** %5
%19 = call i32 @dump_string(i8* %18)
store i32 0, i32* %3
br label %21
20: ; preds = %2
store i32 1, i32* %3
br label %21
21: ; preds = %20, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [52 x i8] c"strings are not equal: expected: '%s' actual: '%s'\0A\00"
define i32 @string_compare(i8* %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%7 = tail call i32 @dump_string(i8* %0)
%8 = tail call i32 @dump_string(i8* %1)
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %10
}