#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 */
char *strcasestr(char *, char const *);
int strlen(char const *);
void applyCensorship(char text[], const char forbidden_strings[][100]) {
  int i, j, string_length;
  char *pointer;
  int number_of_forbidden_strings;
  number_of_forbidden_strings = 2;
  for (i = 0; i < number_of_forbidden_strings; i++) {
    pointer = strcasestr(text, forbidden_strings[i]);
    string_length = strlen(forbidden_strings[i]);
    for (j = 0; j < string_length; j++) {
      *pointer = '*';
      pointer++;
    }
  }
}


x86 assembly (clang, -O0):
<applyCensorship>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11c4 <applyCensorship+0xa4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1040 <strcasestr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b1 <applyCensorship+0x91>
mov    -0x28(%rbp),%rax
movb   $0x2a,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1184 <applyCensorship+0x64>
jmp    11b6 <applyCensorship+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <applyCensorship+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<applyCensorship>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1050 <strcasestr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    115e <applyCensorship+0x2e>
mov    %eax,%edx
mov    %r15,%rdi
mov    $0x2a,%esi
call   1040 <memset@plt>
add    $0x64,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcasestr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    118b <applyCensorship+0x5b>
mov    %eax,%edx
mov    %r14,%rdi
mov    $0x2a,%esi
call   1040 <memset@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @applyCensorship(i8* %0, [100 x i8]* %1) {
%3 = alloca i8*
%4 = alloca [100 x i8]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %3
store [100 x i8]* %1, [100 x i8]** %4
store i32 2, i32* %9
store i32 0, i32* %5
br label %10
10: ; preds = %40, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %9
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %43
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load [100 x i8]*, [100 x i8]** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 %18
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %19, i64 0, i64 0
%21 = call i8* @strcasestr(i8* %15, i8* %20)
store i8* %21, i8** %8
%22 = load [100 x i8]*, [100 x i8]** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %22, i64 %24
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
store i32 %27, i32* %7
store i32 0, i32* %6
br label %28
28: ; preds = %36, %14
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load i8*, i8** %8
store i8 42, i8* %33
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %8
br label %36
36: ; preds = %32
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %28
39: ; preds = %28
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %10
43: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @applyCensorship(i8* %0, [100 x i8]* %1) {
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = tail call i8* @strcasestr(i8* %0, i8* %3)
%5 = tail call i32 @strlen(i8* %3)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %2
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 1, i64 0
%11 = tail call i8* @strcasestr(i8* %0, i8* %10)
%12 = tail call i32 @strlen(i8* %10)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = zext i32 %12 to i64
br label %16
16: ; preds = %14, %9
ret void
}