#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*/ Assert_real(int, char *, int, char *);
char *strrstr(char *, char *);
void strrstr_repeated() {
  char *string = "TestTest";
  Assert_real((strrstr(string, "Test") == string + 4),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/string/strrstr.c",
              35, ("String should be found at second occurrence"));
}


x86 assembly (clang, -O0):
<strrstr_repeated>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strrstr@plt>
mov    -0x8(%rbp),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xeac(%rip),%rsi
mov    $0x23,%edx
lea    0xf44(%rip),%rcx
call   1040 <Assert_real@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrstr_repeated>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strrstr@plt>
lea    0xec9(%rip),%rcx
xor    %edi,%edi
cmp    %rcx,%rax
sete   %dil
lea    0xebe(%rip),%rsi
lea    0xf5b(%rip),%rcx
mov    $0x23,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"TestTest\00"
@.str.1 = [5 x i8] c"Test\00"
@.str.2 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/string/strrstr.c\00"
@.str.3 = [44 x i8] c"String should be found at second occurrence\00"
define void @strrstr_repeated() {
%1 = alloca i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i8* @strrstr(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 4
%6 = icmp eq i8* %3, %5
%7 = zext i1 %6 to i32
%8 = call i32 @Assert_real(i32 %7, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.2, i64 0, i64 0), i32 35, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"TestTest\00"
@.str.1 = [5 x i8] c"Test\00"
@.str.2 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/string/strrstr.c\00"
@.str.3 = [44 x i8] c"String should be found at second occurrence\00"
define void @strrstr_repeated() {
%1 = tail call i8* @strrstr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i8* %1, getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 4)
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.2, i64 0, i64 0), i32 35, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
ret void
}