#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 *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ ok(int, char *);
scalar_t__ strcmp(char const *, char const *);
char *strescape(char const *);
void is_str_escape(const char *got, const char *expect, char *name) {
  if (strcmp(got, expect) == 0)
    ok(1, name);
  else {
    char *got_e = strescape(got);
    char *expect_e = strescape(expect);
    ok(0, name);
    diag("got \"%s\" expected \"%s\"", got_e, expect_e);
    free(got_e);
    free(expect_e);
  }
}


x86 assembly (clang, -O0):
<is_str_escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    118e <is_str_escape+0x3e>
mov    -0x18(%rbp),%rsi
mov    $0x1,%edi
call   1040 <ok@plt>
jmp    11d9 <is_str_escape+0x89>
mov    -0x8(%rbp),%rdi
call   1070 <strescape@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <strescape@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1040 <ok@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe3e(%rip),%rdi
call   1050 <diag@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_str_escape>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1060 <strcmp@plt>
test   %rax,%rax
je     11b8 <is_str_escape+0x68>
mov    %rbx,%rdi
call   1070 <strescape@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1070 <strescape@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <ok@plt>
lea    0xe6e(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <diag@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>
mov    $0x1,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <ok@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"got \22%s\22 expected \22%s\22\00"
define void @is_str_escape(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = call i32 @ok(i32 1, i8* %14)
br label %30
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = call i8* @strescape(i8* %17)
store i8* %18, i8** %7
%19 = load i8*, i8** %5
%20 = call i8* @strescape(i8* %19)
store i8* %20, i8** %8
%21 = load i8*, i8** %6
%22 = call i32 @ok(i32 0, i8* %21)
%23 = load i8*, i8** %7
%24 = load i8*, i8** %8
%25 = call i32 @diag(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %7
%27 = call i32 @free(i8* %26)
%28 = load i8*, i8** %8
%29 = call i32 @free(i8* %28)
br label %30
30: ; preds = %16, %13
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"got \22%s\22 expected \22%s\22\00"
define void @is_str_escape(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @ok(i32 1, i8* %2)
br label %15
8: ; preds = %3
%9 = tail call i8* @strescape(i8* %0)
%10 = tail call i8* @strescape(i8* %1)
%11 = tail call i32 @ok(i32 0, i8* %2)
%12 = tail call i32 @diag(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%13 = tail call i32 @free(i8* %9)
%14 = tail call i32 @free(i8* %10)
br label %15
15: ; preds = %8, %6
ret void
}