#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*/ testPrintError(char *, char const *, char const *);
int /*<<< orphan*/ test_failed();
void testCompareStr(const char *z1, const char *z2, int *pRc) {
  if (*pRc == 0) {
    if (strcmp(z1, z2)) {
      testPrintError("testCompareStr: \"%s\" != \"%s\"\n", z1, z2);
      *pRc = 1;
      test_failed();
    }
  }
}


x86 assembly (clang, -O0):
<testCompareStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1192 <testCompareStr+0x62>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118d <testCompareStr+0x5d>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe89(%rip),%rdi
call   1030 <testPrintError@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   1050 <test_failed@plt>
jmp    1192 <testCompareStr+0x62>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testCompareStr>:
push   %r15
push   %r14
push   %rbx
cmpl   $0x0,(%rdx)
je     1140 <testCompareStr+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strcmp@plt>
test   %rax,%rax
je     113a <testCompareStr+0xa>
lea    0xea6(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <testPrintError@plt>
movl   $0x1,(%rbx)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <test_failed@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"testCompareStr: \22%s\22 != \22%s\22\0A\00"
define void @testCompareStr(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 @testPrintError(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i32*, i32** %6
store i32 1, i32* %19
%20 = call i32 (...) @test_failed()
br label %21
21: ; preds = %15, %10
br label %22
22: ; preds = %21, %3
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"testCompareStr: \22%s\22 != \22%s\22\0A\00"
define void @testCompareStr(i8* %0, i8* %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %0, i8* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @testPrintError(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
store i32 1, i32* %2
%11 = tail call i32 (...) @test_failed()
br label %12
12: ; preds = %6, %9, %3
ret void
}