#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*/ gets(char *);
int /*<<< orphan*/ memset(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strlen(char *);
char *strstr(char *, char *);
int main() {
  char cumle[256];
  char kelime[64];
  printf("Bir cumle giriniz.\n");
  gets(cumle);
  printf("Sansurlenmesini istediginiz kelimeyi giriniz.\n");
  gets(kelime);
  char *index;
  while (index = strstr(cumle, kelime)) {
    memset(index, '*', strlen(kelime));
  }
  printf("Orijinal cumle: %s\n", cumle);
  printf("Sansurlenmis cumle: %s\n", cumle);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <gets@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x150(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x110(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x158(%rbp)
cmp    $0x0,%rax
je     11ec <main+0x9c>
mov    -0x158(%rbp),%rax
mov    %rax,-0x160(%rbp)
lea    -0x150(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x160(%rbp),%rdi
mov    %eax,%edx
mov    $0x2a,%esi
call   1050 <memset@plt>
jmp    1196 <main+0x46>
lea    -0x110(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%r14
mov    %r14,%rdi
call   1070 <gets@plt>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11ea <main+0x8a>
mov    %rax,%rbx
mov    %rsp,%r15
lea    0x40(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %eax,%edx
call   1060 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <strstr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c0 <main+0x60>
lea    0xe0f(%rip),%rdi
lea    0x40(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Bir cumle giriniz.\0A\00"
@.str.1 = [47 x i8] c"Sansurlenmesini istediginiz kelimeyi giriniz.\0A\00"
@.str.2 = [20 x i8] c"Orijinal cumle: %s\0A\00"
@.str.3 = [24 x i8] c"Sansurlenmis cumle: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [64 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
br label %11
11: ; preds = %16, %0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%14 = call i8* @strstr(i8* %12, i8* %13)
store i8* %14, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @memset(i8* %17, i8 signext 42, i32 %19)
br label %11
21: ; preds = %11
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [20 x i8] c"Orijinal cumle: %s\0A\00"
@.str.3 = [24 x i8] c"Sansurlenmis cumle: %s\0A\00"
@str = [19 x i8] c"Bir cumle giriniz.\00"
@str.4 = [46 x i8] c"Sansurlenmesini istediginiz kelimeyi giriniz.\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i8* @strstr(i8* %3, i8* %4)
%10 = icmp eq i8* %9, null
br i1 %10, label %17, label %11
11: ; preds = %0, %11
%12 = phi i8* [ %15, %11 ], [ %9, %0 ]
%13 = call i32 @strlen(i8* %4)
%14 = call i32 @memset(i8* %12, i8 signext 42, i32 %13)
%15 = call i8* @strstr(i8* %3, i8* %4)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %11
17: ; preds = %11, %0
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 0
}