#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 */
scalar_t__ strcmp(char const *, char const *);
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ test_fail_string_message(int /*<<< orphan*/ *, char const *,
                                            int, char *, char const *,
                                            char const *, char *, char const *,
                                            int /*<<< orphan*/, char const *,
                                            int /*<<< orphan*/);
int test_str_eq(const char *file, int line, const char *st1, const char *st2,
                const char *s1, const char *s2) {
  if (s1 == NULL && s2 == NULL)
    return 1;
  if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {
    test_fail_string_message(NULL, file, line, "string", st1, st2, "==", s1,
                             s1 == NULL ? 0 : strlen(s1), s2,
                             s2 == NULL ? 0 : strlen(s2));
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<test_str_eq>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1177 <test_str_eq+0x47>
cmpq   $0x0,-0x48(%rbp)
jne    1177 <test_str_eq+0x47>
movl   $0x1,-0x14(%rbp)
jmp    1288 <test_str_eq+0x158>
cmpq   $0x0,-0x40(%rbp)
je     11a4 <test_str_eq+0x74>
cmpq   $0x0,-0x48(%rbp)
je     11a4 <test_str_eq+0x74>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1281 <test_str_eq+0x151>
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11df <test_str_eq+0xaf>
xor    %eax,%eax
mov    %eax,-0x74(%rbp)
jmp    11eb <test_str_eq+0xbb>
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1214 <test_str_eq+0xe4>
xor    %eax,%eax
mov    %eax,-0x88(%rbp)
jmp    1223 <test_str_eq+0xf3>
mov    -0x48(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x88(%rbp)
mov    -0x80(%rbp),%r10
mov    -0x84(%rbp),%r11d
mov    -0x50(%rbp),%rbx
mov    -0x58(%rbp),%r9
mov    -0x60(%rbp),%r8
mov    -0x64(%rbp),%edx
mov    -0x70(%rbp),%rsi
mov    -0x88(%rbp),%eax
xor    %ecx,%ecx
mov    %ecx,%edi
lea    0xdae(%rip),%rcx
lea    0xdae(%rip),%r14
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1050 <test_fail_string_message@plt>
movl   $0x0,-0x14(%rbp)
jmp    1288 <test_str_eq+0x158>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_str_eq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x1,%r15d
mov    %r8,%rax
or     %r9,%rax
je     11ef <test_str_eq+0xbf>
mov    %r9,%rbx
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,0x20(%rsp)
test   %r8,%r8
je     117d <test_str_eq+0x4d>
test   %rbx,%rbx
je     117d <test_str_eq+0x4d>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11ef <test_str_eq+0xbf>
mov    %ebp,0xc(%rsp)
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
xor    %r13d,%r13d
mov    $0x0,%r12d
test   %r14,%r14
je     11a4 <test_str_eq+0x74>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
test   %rbx,%rbx
je     11b4 <test_str_eq+0x84>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
sub    $0x8,%rsp
lea    0xe48(%rip),%rax
lea    0xe3a(%rip),%rcx
xor    %r15d,%r15d
xor    %edi,%edi
mov    0x28(%rsp),%rsi
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
push   %r13
push   %rbx
push   %r12
push   %r14
push   %rax
call   1050 <test_fail_string_message@plt>
add    $0x30,%rsp
mov    %r15d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"string\00"
@.str.1 = [3 x i8] c"==\00"
define i32 @test_str_eq(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%14 = load i8*, i8** %12
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %6
%17 = load i8*, i8** %13
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 1, i32* %7
br label %56
20: ; preds = %16, %6
%21 = load i8*, i8** %12
%22 = icmp eq i8* %21, null
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = load i8*, i8** %13
%25 = icmp eq i8* %24, null
br i1 %25, label %31, label %26
26: ; preds = %23
%27 = load i8*, i8** %12
%28 = load i8*, i8** %13
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %55
31: ; preds = %26, %23, %20
%32 = load i8*, i8** %8
%33 = load i32, i32* %9
%34 = load i8*, i8** %10
%35 = load i8*, i8** %11
%36 = load i8*, i8** %12
%37 = load i8*, i8** %12
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %31
br label %43
40: ; preds = %31
%41 = load i8*, i8** %12
%42 = call i32 @strlen(i8* %41)
br label %43
43: ; preds = %40, %39
%44 = phi i32 [ 0, %39 ], [ %42, %40 ]
%45 = load i8*, i8** %13
%46 = load i8*, i8** %13
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %43
br label %52
49: ; preds = %43
%50 = load i8*, i8** %13
%51 = call i32 @strlen(i8* %50)
br label %52
52: ; preds = %49, %48
%53 = phi i32 [ 0, %48 ], [ %51, %49 ]
%54 = call i32 @test_fail_string_message(i32* null, i8* %32, i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %34, i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %36, i32 %44, i8* %45, i32 %53)
store i32 0, i32* %7
br label %56
55: ; preds = %26
store i32 1, i32* %7
br label %56
56: ; preds = %55, %52, %19
%57 = load i32, i32* %7
ret i32 %57
}

LLVM IR (-O2):
@.str = [7 x i8] c"string\00"
@.str.1 = [3 x i8] c"==\00"
define i32 @test_str_eq(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = icmp eq i8* %4, null
%8 = icmp eq i8* %5, null
%9 = and i1 %7, %8
br i1 %9, label %25, label %10
10: ; preds = %6
%11 = or i1 %7, %8
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = tail call i64 @strcmp(i8* %4, i8* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %12, %10
br i1 %7, label %18, label %16
16: ; preds = %15
%17 = tail call i32 @strlen(i8* %4)
br label %18
18: ; preds = %15, %16
%19 = phi i32 [ %17, %16 ], [ 0, %15 ]
br i1 %8, label %22, label %20
20: ; preds = %18
%21 = tail call i32 @strlen(i8* %5)
br label %22
22: ; preds = %18, %20
%23 = phi i32 [ %21, %20 ], [ 0, %18 ]
%24 = tail call i32 @test_fail_string_message(i32* null, i8* %0, i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %19, i8* %5, i32 %23)
br label %25
25: ; preds = %12, %6, %22
%26 = phi i32 [ 0, %22 ], [ 1, %6 ], [ 1, %12 ]
ret i32 %26
}