#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*/ printf(char *, char *, int);
char *strrchr(char *, char);
int test_strrchr(void) {
  char data[] = "xyyyz";
  do {
    if (!(&data[4] == strrchr(data, 'z'))) {
      printf("expression '%s' untrue at %d\n", "&data[4] == strrchr(data, 'z')",
             257);
      return 0;
    }
  } while (0);
  do {
    if (!(&data[4] == strrchr(data, 'z'))) {
      printf("expression '%s' untrue at %d\n", "&data[4] == strrchr(data, 'z')",
             258);
      return 0;
    }
  } while (0);
  do {
    if (!(&data[5] == strrchr(data, 0))) {
      printf("expression '%s' untrue at %d\n", "&data[5] == strrchr(data, 0)",
             261);
      return 0;
    }
  } while (0);
  do {
    if (!(&data[5] == strrchr(data, '\0'))) {
      printf("expression '%s' untrue at %d\n",
             "&data[5] == strrchr(data, '\\0')", 262);
      return 0;
    }
  } while (0);
  do {
    if (!(NULL == strrchr(data, 'd'))) {
      printf("expression '%s' untrue at %d\n", "NULL == strrchr(data, 'd')",
             264);
      return 0;
    }
  } while (0);
  do {
    if (!(&data[3] == strrchr(data, 'y'))) {
      printf("expression '%s' untrue at %d\n", "&data[3] == strrchr(data, 'y')",
             265);
      return 0;
    }
  } while (0);
  do {
    if (!(&data[0] == strrchr(data, 'x'))) {
      printf("expression '%s' untrue at %d\n", "&data[0] == strrchr(data, 'x')",
             266);
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<test_strrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xa(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x7a,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     118a <test_strrchr+0x6a>
lea    0xe99(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x101,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    118f <test_strrchr+0x6f>
jmp    1194 <test_strrchr+0x74>
lea    -0xa(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x7a,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     11e2 <test_strrchr+0xc2>
lea    0xe41(%rip),%rdi
lea    0xe58(%rip),%rsi
mov    $0x102,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    11e7 <test_strrchr+0xc7>
jmp    11ec <test_strrchr+0xcc>
lea    -0xa(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x28(%rbp)
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
je     1237 <test_strrchr+0x117>
lea    0xdec(%rip),%rdi
lea    0xe22(%rip),%rsi
mov    $0x105,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    123c <test_strrchr+0x11c>
jmp    1241 <test_strrchr+0x121>
lea    -0xa(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x30(%rbp)
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     128c <test_strrchr+0x16c>
lea    0xd97(%rip),%rdi
lea    0xdea(%rip),%rsi
mov    $0x106,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    1291 <test_strrchr+0x171>
jmp    1296 <test_strrchr+0x176>
lea    -0xa(%rbp),%rdi
mov    $0x64,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     12d6 <test_strrchr+0x1b6>
lea    0xd4d(%rip),%rdi
lea    0xdc0(%rip),%rsi
mov    $0x108,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    12db <test_strrchr+0x1bb>
jmp    12e0 <test_strrchr+0x1c0>
lea    -0xa(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x38(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x79,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     132e <test_strrchr+0x20e>
lea    0xcf5(%rip),%rdi
lea    0xd83(%rip),%rsi
mov    $0x109,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    1333 <test_strrchr+0x213>
jmp    1338 <test_strrchr+0x218>
lea    -0xa(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x78,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
je     1382 <test_strrchr+0x262>
lea    0xca1(%rip),%rdi
lea    0xd4e(%rip),%rsi
mov    $0x10a,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    138e <test_strrchr+0x26e>
jmp    1387 <test_strrchr+0x267>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strrchr>:
push   %r14
push   %rbx
push   %rax
movw   $0x7a,0x4(%rsp)
movl   $0x79797978,(%rsp)
lea    0x4(%rsp),%rbx
mov    %rsp,%rdi
mov    $0x7a,%esi
call   1050 <strrchr@plt>
cmp    %rax,%rbx
je     1171 <test_strrchr+0x41>
lea    0xea6(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x101,%edx
jmp    120f <test_strrchr+0xdf>
mov    %rsp,%rdi
call   1030 <strlen@plt>
cmp    $0x5,%rax
je     1194 <test_strrchr+0x64>
lea    0xe80(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x105,%edx
jmp    120f <test_strrchr+0xdf>
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     11bb <test_strrchr+0x8b>
lea    0xe59(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x108,%edx
jmp    120f <test_strrchr+0xdf>
lea    0x3(%rsp),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x79,%esi
call   1050 <strrchr@plt>
cmp    %rax,%r14
je     11ea <test_strrchr+0xba>
lea    0xe2a(%rip),%rdi
lea    0xe98(%rip),%rsi
mov    $0x109,%edx
jmp    120f <test_strrchr+0xdf>
mov    %rbx,%rdi
mov    $0x78,%esi
call   1050 <strrchr@plt>
cmp    %rax,%rbx
je     121e <test_strrchr+0xee>
lea    0xe03(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x10a,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%eax
jmp    1216 <test_strrchr+0xe6>

LLVM IR (-O0):
@__const.test_strrchr.data = [6 x i8] c"xyyyz\00"
@.str = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.1 = [31 x i8] c"&data[4] == strrchr(data, 'z')\00"
@.str.2 = [29 x i8] c"&data[5] == strrchr(data, 0)\00"
@.str.3 = [32 x i8] c"&data[5] == strrchr(data, '\\0')\00"
@.str.4 = [27 x i8] c"NULL == strrchr(data, 'd')\00"
@.str.5 = [31 x i8] c"&data[3] == strrchr(data, 'y')\00"
@.str.6 = [31 x i8] c"&data[0] == strrchr(data, 'x')\00"
define i32 @test_strrchr() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = bitcast [6 x i8]* %2 to i8*
br label %4
4: ; preds = %0
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 4
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = call i8* @strrchr(i8* %6, i8 signext 122)
%8 = icmp eq i8* %5, %7
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 257)
store i32 0, i32* %1
br label %66
11: ; preds = %4
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 4
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%16 = call i8* @strrchr(i8* %15, i8 signext 122)
%17 = icmp eq i8* %14, %16
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 258)
store i32 0, i32* %1
br label %66
20: ; preds = %13
br label %21
21: ; preds = %20
br label %22
22: ; preds = %21
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 5
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%25 = call i8* @strrchr(i8* %24, i8 signext 0)
%26 = icmp eq i8* %23, %25
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 261)
store i32 0, i32* %1
br label %66
29: ; preds = %22
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 5
%33 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%34 = call i8* @strrchr(i8* %33, i8 signext 0)
%35 = icmp eq i8* %32, %34
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 262)
store i32 0, i32* %1
br label %66
38: ; preds = %31
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
%41 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%42 = call i8* @strrchr(i8* %41, i8 signext 100)
%43 = icmp eq i8* null, %42
br i1 %43, label %46, label %44
44: ; preds = %40
%45 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 264)
store i32 0, i32* %1
br label %66
46: ; preds = %40
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
%49 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 3
%50 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%51 = call i8* @strrchr(i8* %50, i8 signext 121)
%52 = icmp eq i8* %49, %51
br i1 %52, label %55, label %53
53: ; preds = %48
%54 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 265)
store i32 0, i32* %1
br label %66
55: ; preds = %48
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
%58 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%59 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%60 = call i8* @strrchr(i8* %59, i8 signext 120)
%61 = icmp eq i8* %58, %60
br i1 %61, label %64, label %62
62: ; preds = %57
%63 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 266)
store i32 0, i32* %1
br label %66
64: ; preds = %57
br label %65
65: ; preds = %64
store i32 1, i32* %1
br label %66
66: ; preds = %65, %62, %53, %44, %36, %27, %18, %9
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@__const.test_strrchr.data = [6 x i8] c"xyyyz\00"
@.str = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.1 = [31 x i8] c"&data[4] == strrchr(data, 'z')\00"
@.str.2 = [29 x i8] c"&data[5] == strrchr(data, 0)\00"
@.str.4 = [27 x i8] c"NULL == strrchr(data, 'd')\00"
@.str.5 = [31 x i8] c"&data[3] == strrchr(data, 'y')\00"
@.str.6 = [31 x i8] c"&data[0] == strrchr(data, 'x')\00"
define i32 @test_strrchr() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
%4 = call i8* @strrchr(i8* %2, i8 signext 122)
%5 = icmp eq i8* %3, %4
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 257)
br label %31
8: ; preds = %0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
%10 = call i64 @strlen(i8* %2)
%11 = getelementptr [6 x i8], [6 x i8]* %1, i64 0, i64 %10
%12 = icmp eq i8* %9, %11
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 261)
br label %31
15: ; preds = %8
%16 = call i8* @strrchr(i8* %2, i8 signext 100)
%17 = icmp eq i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 264)
br label %31
20: ; preds = %15
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
%22 = call i8* @strrchr(i8* %2, i8 signext 121)
%23 = icmp eq i8* %21, %22
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 265)
br label %31
26: ; preds = %20
%27 = call i8* @strrchr(i8* %2, i8 signext 120)
%28 = icmp eq i8* %2, %27
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 266)
br label %31
31: ; preds = %26, %29, %24, %18, %13, %6
%32 = phi i32 [ 0, %29 ], [ 0, %24 ], [ 0, %18 ], [ 0, %13 ], [ 0, %6 ], [ 1, %26 ]
ret i32 %32
}