#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 *, char *);
int strlen(char *);
char search_mention(char *full_message) {
  size_t i = 0, searchable_length;
  char aux;
  if (full_message == NULL)
    return 0;
  searchable_length = strlen(full_message) - 3;
  for (i = 0; i < searchable_length && full_message[i] != '\0'; i++) {
    aux = full_message[i + 4];
    full_message[i + 4] = '\0';
    if (!(strcmp(&full_message[i], "Rosa") &&
          strcmp(&full_message[i], "Rous")) ||
        !(strcmp(&full_message[i], "ROSA") &&
          strcmp(&full_message[i], "ROUS"))) {
      full_message[i + 4] = aux;
      return 1;
    }
    full_message[i + 4] = aux;
  }
  return 0;
}


x86 assembly (clang, -O0):
<search_mention>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <search_mention+0x28>
movb   $0x0,-0x1(%rbp)
jmp    126a <search_mention+0x14a>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x3,%eax
cltq
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x20(%rbp),%rcx
mov    %al,-0x22(%rbp)
jae    118a <search_mention+0x6a>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    119a <search_mention+0x7a>
jmp    1266 <search_mention+0x146>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    0x4(%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,0x4(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
add    -0x18(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122e <search_mention+0x10e>
mov    -0x10(%rbp),%rdi
add    -0x18(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122e <search_mention+0x10e>
mov    -0x10(%rbp),%rdi
add    -0x18(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     122e <search_mention+0x10e>
mov    -0x10(%rbp),%rdi
add    -0x18(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1246 <search_mention+0x126>
mov    -0x21(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,0x4(%rax,%rcx,1)
movb   $0x1,-0x1(%rbp)
jmp    126a <search_mention+0x14a>
mov    -0x21(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,0x4(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1162 <search_mention+0x42>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_mention>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     11c0 <search_mention+0xa0>
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    $0xfffffffd,%eax
je     11c0 <search_mention+0xa0>
movslq %eax,%rbp
lea    0xeb1(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0xead(%rip),%r12
nopl   (%rax)
cmpb   $0x0,(%rbx)
je     11c0 <search_mention+0xa0>
movzbl 0x4(%rbx),%r13d
movb   $0x0,0x4(%rbx)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c4 <search_mention+0xa4>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c4 <search_mention+0xa4>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c4 <search_mention+0xa4>
mov    %rbx,%rdi
lea    0xe67(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c4 <search_mention+0xa4>
mov    %r13b,0x4(%rbx)
add    $0x1,%rbx
add    $0xffffffffffffffff,%rbp
jne    1160 <search_mention+0x40>
xor    %eax,%eax
jmp    11ca <search_mention+0xaa>
mov    %r13b,0x4(%rbx)
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Rosa\00"
@.str.1 = [5 x i8] c"Rous\00"
@.str.2 = [5 x i8] c"ROSA\00"
@.str.3 = [5 x i8] c"ROUS\00"
define signext i8 @search_mention(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i8* %0, i8** %3
store i64 0, i64* %4
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i8 0, i8* %2
br label %77
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = sub nsw i32 %12, 3
%14 = sext i32 %13 to i64
store i64 %14, i64* %5
store i64 0, i64* %4
br label %15
15: ; preds = %73, %10
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i64, i64* %4
%22 = getelementptr inbounds i8, i8* %20, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br label %26
26: ; preds = %19, %15
%27 = phi i1 [ false, %15 ], [ %25, %19 ]
br i1 %27, label %28, label %76
28: ; preds = %26
%29 = load i8*, i8** %3
%30 = load i64, i64* %4
%31 = add i64 %30, 4
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
store i8 %33, i8* %6
%34 = load i8*, i8** %3
%35 = load i64, i64* %4
%36 = add i64 %35, 4
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 0, i8* %37
%38 = load i8*, i8** %3
%39 = load i64, i64* %4
%40 = getelementptr inbounds i8, i8* %38, i64 %39
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %61
43: ; preds = %28
%44 = load i8*, i8** %3
%45 = load i64, i64* %4
%46 = getelementptr inbounds i8, i8* %44, i64 %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %61
49: ; preds = %43
%50 = load i8*, i8** %3
%51 = load i64, i64* %4
%52 = getelementptr inbounds i8, i8* %50, i64 %51
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %61
55: ; preds = %49
%56 = load i8*, i8** %3
%57 = load i64, i64* %4
%58 = getelementptr inbounds i8, i8* %56, i64 %57
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%60 = icmp ne i64 %59, 0
br i1 %60, label %67, label %61
61: ; preds = %55, %49, %43, %28
%62 = load i8, i8* %6
%63 = load i8*, i8** %3
%64 = load i64, i64* %4
%65 = add i64 %64, 4
%66 = getelementptr inbounds i8, i8* %63, i64 %65
store i8 %62, i8* %66
store i8 1, i8* %2
br label %77
67: ; preds = %55
%68 = load i8, i8* %6
%69 = load i8*, i8** %3
%70 = load i64, i64* %4
%71 = add i64 %70, 4
%72 = getelementptr inbounds i8, i8* %69, i64 %71
store i8 %68, i8* %72
br label %73
73: ; preds = %67
%74 = load i64, i64* %4
%75 = add i64 %74, 1
store i64 %75, i64* %4
br label %15
76: ; preds = %26
store i8 0, i8* %2
br label %77
77: ; preds = %76, %61, %9
%78 = load i8, i8* %2
ret i8 %78
}

LLVM IR (-O2):
@.str = [5 x i8] c"Rosa\00"
@.str.1 = [5 x i8] c"Rous\00"
@.str.2 = [5 x i8] c"ROSA\00"
@.str.3 = [5 x i8] c"ROUS\00"
define signext i8 @search_mention(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %33, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -3
%6 = icmp eq i32 %5, 0
br i1 %6, label %33, label %7
7: ; preds = %3
%8 = sext i32 %5 to i64
br label %9
9: ; preds = %7, %30
%10 = phi i64 [ %31, %30 ], [ 0, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %33, label %14
14: ; preds = %9
%15 = add i64 %10, 4
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
store i8 0, i8* %16
%18 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %14
%21 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %26, %23, %20, %14
store i8 %17, i8* %16
br label %33
30: ; preds = %26
store i8 %17, i8* %16
%31 = add nuw i64 %10, 1
%32 = icmp eq i64 %31, %8
br i1 %32, label %33, label %9
33: ; preds = %30, %9, %3, %1, %29
%34 = phi i8 [ 1, %29 ], [ 0, %1 ], [ 0, %3 ], [ 0, %9 ], [ 0, %30 ]
ret i8 %34
}