#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*/ strcmp(char const *, char const *);
int /*<<< orphan*/ t_diag(char *, char const *, char const *);
int /*<<< orphan*/ t_fail(char *, char const *);
int /*<<< orphan*/ t_pass(char *, char const *);
int ok_str(const char *a, const char *b, const char *name) {
  if ((!a && !b) || (a && b && !strcmp(a, b))) {
    t_pass("%s", name);
    return 1;
  }
  t_fail("%s", name);
  t_diag("'%s' != '%s'", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<ok_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116a <ok_str+0x2a>
cmpq   $0x0,-0x18(%rbp)
je     1196 <ok_str+0x56>
cmpq   $0x0,-0x10(%rbp)
je     11b2 <ok_str+0x72>
cmpq   $0x0,-0x18(%rbp)
je     11b2 <ok_str+0x72>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b2 <ok_str+0x72>
mov    -0x20(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   1030 <t_pass@plt>
movl   $0x1,-0x4(%rbp)
jmp    11dd <ok_str+0x9d>
mov    -0x20(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1060 <t_fail@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe32(%rip),%rdi
call   1050 <t_diag@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ok_str>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rax
or     %rsi,%rax
je     1194 <ok_str+0x54>
mov    %rsi,%r15
mov    %rdi,%rbx
test   %rdi,%rdi
je     116f <ok_str+0x2f>
test   %r15,%r15
je     116f <ok_str+0x2f>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1194 <ok_str+0x54>
lea    0xe8a(%rip),%rdi
mov    %r14,%rsi
call   1060 <t_fail@plt>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <t_diag@plt>
xor    %eax,%eax
jmp    11a8 <ok_str+0x68>
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
call   1030 <t_pass@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"'%s' != '%s'\00"
define i32 @ok_str(i8* %0, i8* %1, i8* %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = or i1 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = and i1 %4, %5
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = tail call i32 @strcmp(i8* %0, i8* %1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3, %9
%13 = tail call i32 @t_pass(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %17
14: ; preds = %9, %7
%15 = tail call i32 @t_fail(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%16 = tail call i32 @t_diag(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
br label %17
17: ; preds = %14, %12
%18 = phi i32 [ 0, %14 ], [ 1, %12 ]
ret i32 %18
}