#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[][256]) {
  int i = 0, j = 0, string_length = 0;
  char *pointer;
  int number_of_forbidden_strings = 0;
  number_of_forbidden_strings = 2;
  for (i = 0; i < number_of_forbidden_strings; i++) {
    while (1) {
      if (strcasestr(text, forbidden_strings[i]) == NULL) {
        break;
      }
      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   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1211 <applyCensorship+0xf1>
jmp    116b <applyCensorship+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x8,%rax
add    %rax,%rsi
call   1040 <strcasestr@plt>
cmp    $0x0,%rax
jne    1192 <applyCensorship+0x72>
jmp    11fe <applyCensorship+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x8,%rax
add    %rax,%rsi
call   1040 <strcasestr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x8,%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    11f9 <applyCensorship+0xd9>
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    11cc <applyCensorship+0xac>
jmp    116b <applyCensorship+0x4b>
jmp    1203 <applyCensorship+0xe3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <applyCensorship+0x3a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<applyCensorship>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
jmp    1146 <applyCensorship+0x16>
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcasestr@plt>
test   %rax,%rax
je     117b <applyCensorship+0x4b>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcasestr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1140 <applyCensorship+0x10>
mov    %eax,%edx
mov    %r15,%rdi
mov    $0x2a,%esi
call   1040 <memset@plt>
jmp    1140 <applyCensorship+0x10>
add    $0x100,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcasestr@plt>
test   %rax,%rax
je     11cb <applyCensorship+0x9b>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcasestr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1190 <applyCensorship+0x60>
mov    %eax,%edx
mov    %r15,%rdi
mov    $0x2a,%esi
call   1040 <memset@plt>
jmp    1190 <applyCensorship+0x60>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @applyCensorship(i8* %0, [256 x i8]* %1) {
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = tail call i8* @strcasestr(i8* %0, i8* %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %9
6: ; preds = %13, %9
%7 = tail call i8* @strcasestr(i8* %0, i8* %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %2, %6
%10 = tail call i8* @strcasestr(i8* %0, i8* %3)
%11 = tail call i32 @strlen(i8* %3)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %9
%14 = zext i32 %11 to i64
br label %6
15: ; preds = %6, %2
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 1, i64 0
%17 = tail call i8* @strcasestr(i8* %0, i8* %16)
%18 = icmp eq i8* %17, null
br i1 %18, label %28, label %19
19: ; preds = %15, %25
%20 = tail call i8* @strcasestr(i8* %0, i8* %16)
%21 = tail call i32 @strlen(i8* %16)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = zext i32 %21 to i64
br label %25
25: ; preds = %23, %19
%26 = tail call i8* @strcasestr(i8* %0, i8* %16)
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %19
28: ; preds = %25, %15
ret void
}