#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strstr(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  char cumle[100];
  char old_str[100];
  char new_str[100];
  printf("bir cumle girin: \n");
  fgets(cumle, 100, stdin);
  cumle[strlen(cumle) - 1] = '\0';
  printf("\n");
  printf("degistirilecek stringi girin: ");
  fgets(old_str, 100, stdin);
  old_str[strlen(old_str) - 1] = '\0';
  printf("\n");
  int eleman_sayi = strlen(cumle) / strlen(old_str);
  int search_index[eleman_sayi];
  memset(search_index, -1, eleman_sayi * sizeof(int));
  int i;
  char *adres = strstr(cumle, old_str);
  if (adres == NULL) {
    printf("Hata!!! Degistirilecek: %s bulunmamaktadir.\n", old_str);
    printf("\nDIKKATLI OL!!!\n");
    return 0;
  } else {
    for (i = 0; adres != NULL && i <= eleman_sayi; i++) {
      search_index[i] = adres - cumle;
      adres = strstr(adres + strlen(old_str), old_str);
    }
  }
  printf("yeni stringi girin: ");
  fgets(new_str, 100, stdin);
  new_str[strlen(new_str) - 1] = '\0';
  char cumle_new[100];
  int j = 0, eleman = 0, ara_kelime_boyutu;
  i = 0;
  while (i <= strlen(cumle) && cumle[i] != '\0') {
    if (i == search_index[eleman] && search_index[eleman] != -1) {
      strcat(cumle_new, new_str);
      i += strlen(old_str);
      j += strlen(new_str);
      eleman++;
    } else {
      if (search_index[eleman] != -1) {
        ara_kelime_boyutu = search_index[eleman] - i;
        strncat(cumle_new + j, cumle + i, ara_kelime_boyutu);
        i += ara_kelime_boyutu;
        j += ara_kelime_boyutu;
      } else {
        strcat(cumle_new + j, cumle + i);
        i += strlen(cumle + i);
        break;
      }
    }
  }
  printf("\ndegistirildikten sonra:\n%s\n", cumle_new);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
call   1040 <system@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x211(%rbp)
call   1050 <printf@plt>
mov    0x2e2f(%rip),%rax
mov    %rax,-0x228(%rbp)
mov    (%rax),%edx
lea    -0x70(%rbp),%rdi
mov    %rdi,-0x210(%rbp)
mov    $0x64,%esi
mov    %esi,-0x22c(%rbp)
call   1080 <fgets@plt>
mov    -0x210(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x211(%rbp),%al
add    $0xffffffff,%ecx
movslq %ecx,%rcx
movb   $0x0,-0x70(%rbp,%rcx,1)
lea    0xe14(%rip),%rdi
mov    %rdi,-0x220(%rbp)
call   1050 <printf@plt>
mov    -0x211(%rbp),%al
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x22c(%rbp),%esi
mov    -0x228(%rbp),%rax
mov    (%rax),%edx
lea    -0xe0(%rbp),%rdi
mov    %rdi,-0x208(%rbp)
call   1080 <fgets@plt>
mov    -0x208(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x220(%rbp),%rdi
mov    %eax,%ecx
mov    -0x211(%rbp),%al
add    $0xffffffff,%ecx
movslq %ecx,%rcx
movb   $0x0,-0xe0(%rbp,%rcx,1)
call   1050 <printf@plt>
mov    -0x210(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x208(%rbp),%rdi
mov    %eax,-0x1fc(%rbp)
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1fc(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x154(%rbp)
mov    -0x154(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x160(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x1f8(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x168(%rbp)
movslq -0x154(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
mov    $0xffffffff,%esi
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x178(%rbp)
cmpq   $0x0,-0x178(%rbp)
jne    1348 <main+0x1c8>
lea    -0xe0(%rbp),%rsi
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x17c(%rbp)
jmp    1646 <main+0x4c6>
movl   $0x0,-0x16c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x178(%rbp)
mov    %al,-0x22d(%rbp)
je     137d <main+0x1fd>
mov    -0x16c(%rbp),%eax
cmp    -0x154(%rbp),%eax
setle  %al
mov    %al,-0x22d(%rbp)
mov    -0x22d(%rbp),%al
test   $0x1,%al
jne    1390 <main+0x210>
jmp    13fe <main+0x27e>
mov    -0x1f8(%rbp),%rax
mov    -0x178(%rbp),%rcx
lea    -0x70(%rbp),%rdx
sub    %rdx,%rcx
mov    %ecx,%edx
movslq -0x16c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x178(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0xe0(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x238(%rbp),%rdi
cltq
add    %rax,%rdi
lea    -0xe0(%rbp),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x178(%rbp)
mov    -0x16c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x16c(%rbp)
jmp    1352 <main+0x1d2>
jmp    1403 <main+0x283>
lea    0xc6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x150(%rbp),%rdi
mov    0x2bc9(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1080 <fgets@plt>
lea    -0x150(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x150(%rbp,%rax,1)
movl   $0x0,-0x1e4(%rbp)
movl   $0x0,-0x1e8(%rbp)
movl   $0x0,-0x16c(%rbp)
mov    -0x16c(%rbp),%eax
mov    %eax,-0x240(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x240(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x239(%rbp)
jg     14a7 <main+0x327>
movslq -0x16c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x239(%rbp)
mov    -0x239(%rbp),%al
test   $0x1,%al
jne    14ba <main+0x33a>
jmp    1620 <main+0x4a0>
mov    -0x1f8(%rbp),%rcx
mov    -0x16c(%rbp),%eax
movslq -0x1e8(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1546 <main+0x3c6>
mov    -0x1f8(%rbp),%rax
movslq -0x1e8(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1546 <main+0x3c6>
lea    -0x1e0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x16c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
lea    -0x150(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x1e4(%rbp),%eax
mov    %eax,-0x1e4(%rbp)
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
jmp    161b <main+0x49b>
mov    -0x1f8(%rbp),%rax
movslq -0x1e8(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     15ce <main+0x44e>
mov    -0x1f8(%rbp),%rax
movslq -0x1e8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    -0x16c(%rbp),%eax
mov    %eax,-0x1ec(%rbp)
lea    -0x1e0(%rbp),%rdi
movslq -0x1e4(%rbp),%rax
add    %rax,%rdi
lea    -0x70(%rbp),%rsi
movslq -0x16c(%rbp),%rax
add    %rax,%rsi
mov    -0x1ec(%rbp),%edx
call   1070 <strncat@plt>
mov    -0x1ec(%rbp),%eax
add    -0x16c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
mov    -0x1ec(%rbp),%eax
add    -0x1e4(%rbp),%eax
mov    %eax,-0x1e4(%rbp)
jmp    1616 <main+0x496>
lea    -0x1e0(%rbp),%rdi
movslq -0x1e4(%rbp),%rax
add    %rax,%rdi
lea    -0x70(%rbp),%rsi
movslq -0x16c(%rbp),%rax
add    %rax,%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
movslq -0x16c(%rbp),%rax
add    %rax,%rdi
call   1030 <strlen@plt>
add    -0x16c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
jmp    1620 <main+0x4a0>
jmp    161b <main+0x49b>
jmp    1462 <main+0x2e2>
lea    -0x1e0(%rbp),%rsi
lea    0xa5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x17c(%rbp)
mov    -0x160(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
lea    0xe45(%rip),%rdi
call   1060 <system@plt>
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e15(%rip),%rbx
mov    (%rbx),%edx
lea    -0xa0(%rbp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   10a0 <fgets@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rbx),%edx
lea    -0x180(%rbp),%r15
mov    %r15,%rdi
mov    $0x64,%esi
call   10a0 <fgets@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    %rsp,%r13
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
lea    0xf(,%rbx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,%rsp
lea    0x0(,%rbx,4),%edx
mov    %rdi,-0x30(%rbp)
mov    $0xffffffff,%esi
call   1080 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     140b <main+0x26b>
mov    %r13,-0x38(%rbp)
test   %ebx,%ebx
mov    -0x30(%rbp),%r13
js     12fb <main+0x15b>
mov    %rax,%r12
mov    %ebx,%r15d
xor    %ebx,%ebx
lea    -0x180(%rbp),%r14
nopl   0x0(%rax,%rax,1)
mov    %r12d,%eax
lea    -0xa0(%rbp),%rcx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%rbx,4)
mov    %r14,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %r12,%rdi
mov    %r14,%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     12fb <main+0x15b>
mov    %rax,%r12
lea    0x1(%rbx),%rax
cmp    %r15,%rbx
mov    %rax,%rbx
jb     12c0 <main+0x120>
lea    0xd50(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edx
lea    -0x1f0(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
js     143e <main+0x29e>
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    13b6 <main+0x216>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x110(%rbp),%rdi
lea    -0x1f0(%rbp),%r13
mov    %r13,%rsi
call   10b0 <strcat@plt>
lea    -0x180(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
add    %ebx,%r15d
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%r13d
add    $0x1,%r14d
add    %r13d,%r12d
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %r15d,%ebx
cmp    %eax,%r15d
mov    -0x30(%rbp),%r13
jg     143e <main+0x29e>
movslq %ebx,%rax
cmpb   $0x0,-0xa0(%rbp,%rax,1)
je     143e <main+0x29e>
movslq %r14d,%rcx
mov    0x0(%r13,%rcx,4),%r15d
mov    %r15d,%r13d
sub    %ebx,%r13d
jne    13d9 <main+0x239>
cmp    $0xffffffff,%r15d
jne    1360 <main+0x1c0>
mov    %r14d,%ebx
lea    (%rax,%rbp,1),%r14
add    $0xffffffffffffff60,%r14
movslq %r12d,%rax
lea    (%rax,%rbp,1),%rdi
add    $0xfffffffffffffef0,%rdi
cmp    $0xffffffff,%r15d
je     142e <main+0x28e>
mov    %r14,%rsi
mov    %r13d,%edx
call   1090 <strncat@plt>
mov    %ebx,%r14d
jmp    1397 <main+0x1f7>
lea    0xc13(%rip),%rdi
lea    -0x180(%rbp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc6f(%rip),%rdi
call   1040 <puts@plt>
jmp    1457 <main+0x2b7>
mov    %r14,%rsi
call   10b0 <strcat@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xc22(%rip),%rdi
lea    -0x110(%rbp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x38(%rbp),%r13
mov    %r13,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [19 x i8] c"bir cumle girin: \0A\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [31 x i8] c"degistirilecek stringi girin: \00"
@.str.4 = [45 x i8] c"Hata!!! Degistirilecek: %s bulunmamaktadir.\0A\00"
@.str.5 = [17 x i8] c"\0ADIKKATLI OL!!!\0A\00"
@.str.6 = [21 x i8] c"yeni stringi girin: \00"
@.str.7 = [29 x i8] c"\0Adegistirildikten sonra:\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [100 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 100, i32 %18)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%28 = load i32, i32* @stdin
%29 = call i32 @fgets(i8* %27, i32 100, i32 %28)
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %33
store i8 0, i8* %34
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = sdiv i32 %37, %39
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = zext i32 %41 to i64
%43 = call i8* @llvm.stacksave()
store i8* %43, i8** %6
%44 = alloca i32, i64 %42
store i64 %42, i64* %7
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = mul i64 %46, 4
%48 = trunc i64 %47 to i32
%49 = call i32 @memset(i32* %44, i32 -1, i32 %48)
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%52 = call i8* @strstr(i8* %50, i8* %51)
store i8* %52, i8** %9
%53 = load i8*, i8** %9
%54 = icmp eq i8* %53, null
br i1 %54, label %55, label %59
55: ; preds = %0
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8* %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
store i32 1, i32* %10
br label %192
59: ; preds = %0
store i32 0, i32* %8
br label %60
60: ; preds = %86, %59
%61 = load i8*, i8** %9
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = load i32, i32* %8
%65 = load i32, i32* %5
%66 = icmp sle i32 %64, %65
br label %67
67: ; preds = %63, %60
%68 = phi i1 [ false, %60 ], [ %66, %63 ]
br i1 %68, label %69, label %89
69: ; preds = %67
%70 = load i8*, i8** %9
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%72 = ptrtoint i8* %70 to i64
%73 = ptrtoint i8* %71 to i64
%74 = sub i64 %72, %73
%75 = trunc i64 %74 to i32
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %44, i64 %77
store i32 %75, i32* %78
%79 = load i8*, i8** %9
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%81 = call i32 @strlen(i8* %80)
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %79, i64 %82
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%85 = call i8* @strstr(i8* %83, i8* %84)
store i8* %85, i8** %9
br label %86
86: ; preds = %69
%87 = load i32, i32* %8
%88 = add nsw i32 %87, 1
store i32 %88, i32* %8
br label %60
89: ; preds = %67
br label %90
90: ; preds = %89
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%93 = load i32, i32* @stdin
%94 = call i32 @fgets(i8* %92, i32 100, i32 %93)
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%96 = call i32 @strlen(i8* %95)
%97 = sub nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %98
store i8 0, i8* %99
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %8
br label %100
100: ; preds = %188, %90
%101 = load i32, i32* %8
%102 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%103 = call i32 @strlen(i8* %102)
%104 = icmp sle i32 %101, %103
br i1 %104, label %105, label %112
105: ; preds = %100
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %107
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp ne i32 %110, 0
br label %112
112: ; preds = %105, %100
%113 = phi i1 [ false, %100 ], [ %111, %105 ]
br i1 %113, label %114, label %189
114: ; preds = %112
%115 = load i32, i32* %8
%116 = load i32, i32* %13
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i32, i32* %44, i64 %117
%119 = load i32, i32* %118
%120 = icmp eq i32 %115, %119
br i1 %120, label %121, label %141
121: ; preds = %114
%122 = load i32, i32* %13
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i32, i32* %44, i64 %123
%125 = load i32, i32* %124
%126 = icmp ne i32 %125, -1
br i1 %126, label %127, label %141
127: ; preds = %121
%128 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%129 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%130 = call i32 @strcat(i8* %128, i8* %129)
%131 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%132 = call i32 @strlen(i8* %131)
%133 = load i32, i32* %8
%134 = add nsw i32 %133, %132
store i32 %134, i32* %8
%135 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%136 = call i32 @strlen(i8* %135)
%137 = load i32, i32* %12
%138 = add nsw i32 %137, %136
store i32 %138, i32* %12
%139 = load i32, i32* %13
%140 = add nsw i32 %139, 1
store i32 %140, i32* %13
br label %188
141: ; preds = %121, %114
%142 = load i32, i32* %13
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i32, i32* %44, i64 %143
%145 = load i32, i32* %144
%146 = icmp ne i32 %145, -1
br i1 %146, label %147, label %170
147: ; preds = %141
%148 = load i32, i32* %13
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %44, i64 %149
%151 = load i32, i32* %150
%152 = load i32, i32* %8
%153 = sub nsw i32 %151, %152
store i32 %153, i32* %14
%154 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%155 = load i32, i32* %12
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8, i8* %154, i64 %156
%158 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%159 = load i32, i32* %8
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
%162 = load i32, i32* %14
%163 = call i32 @strncat(i8* %157, i8* %161, i32 %162)
%164 = load i32, i32* %14
%165 = load i32, i32* %8
%166 = add nsw i32 %165, %164
store i32 %166, i32* %8
%167 = load i32, i32* %14
%168 = load i32, i32* %12
%169 = add nsw i32 %168, %167
store i32 %169, i32* %12
br label %187
170: ; preds = %141
%171 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%172 = load i32, i32* %12
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i8, i8* %171, i64 %173
%175 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%176 = load i32, i32* %8
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i8, i8* %175, i64 %177
%179 = call i32 @strcat(i8* %174, i8* %178)
%180 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%181 = load i32, i32* %8
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8, i8* %180, i64 %182
%184 = call i32 @strlen(i8* %183)
%185 = load i32, i32* %8
%186 = add nsw i32 %185, %184
store i32 %186, i32* %8
br label %189
187: ; preds = %147
br label %188
188: ; preds = %187, %127
br label %100
189: ; preds = %170, %112
%190 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %190)
store i32 0, i32* %1
store i32 1, i32* %10
br label %192
192: ; preds = %189, %55
%193 = load i8*, i8** %6
%194 = load i32, i32* %1
ret i32 %194
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@stdin = global i32 0
@.str.3 = [31 x i8] c"degistirilecek stringi girin: \00"
@.str.4 = [45 x i8] c"Hata!!! Degistirilecek: %s bulunmamaktadir.\0A\00"
@.str.6 = [21 x i8] c"yeni stringi girin: \00"
@.str.7 = [29 x i8] c"\0Adegistirildikten sonra:\0A%s\0A\00"
@str = [18 x i8] c"bir cumle girin: \00"
@str.8 = [16 x i8] c"\0ADIKKATLI OL!!!\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %6, i32 100, i32 %10)
%12 = call i32 @strlen(i8* %6)
%13 = add nsw i32 %12, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i32 @putchar(i32 10)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %7, i32 100, i32 %18)
%20 = call i32 @strlen(i8* %7)
%21 = add nsw i32 %20, -1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %22
store i8 0, i8* %23
%24 = call i32 @putchar(i32 10)
%25 = call i32 @strlen(i8* %6)
%26 = call i32 @strlen(i8* %7)
%27 = sdiv i32 %25, %26
%28 = zext i32 %27 to i64
%29 = call i8* @llvm.stacksave()
%30 = alloca i32, i64 %28
%31 = shl i32 %27, 2
%32 = call i32 @memset(i32* %30, i32 -1, i32 %31)
%33 = call i8* @strstr(i8* %6, i8* %7)
%34 = icmp eq i8* %33, null
br i1 %34, label %40, label %35
35: ; preds = %0
%36 = icmp sgt i32 %27, -1
br i1 %36, label %37, label %58
37: ; preds = %35
%38 = ptrtoint [100 x i8]* %1 to i64
%39 = zext i32 %27 to i64
br label %43
40: ; preds = %0
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
br label %110
43: ; preds = %37, %43
%44 = phi i64 [ 0, %37 ], [ %54, %43 ]
%45 = phi i8* [ %33, %37 ], [ %53, %43 ]
%46 = ptrtoint i8* %45 to i64
%47 = sub i64 %46, %38
%48 = trunc i64 %47 to i32
%49 = getelementptr inbounds i32, i32* %30, i64 %44
store i32 %48, i32* %49
%50 = call i32 @strlen(i8* %7)
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %45, i64 %51
%53 = call i8* @strstr(i8* %52, i8* %7)
%54 = add nuw nsw i64 %44, 1
%55 = icmp ne i8* %53, null
%56 = icmp ult i64 %44, %39
%57 = select i1 %55, i1 %56, i1 false
br i1 %57, label %43, label %58
58: ; preds = %43, %35
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%60 = load i32, i32* @stdin
%61 = call i32 @fgets(i8* %8, i32 100, i32 %60)
%62 = call i32 @strlen(i8* %8)
%63 = add nsw i32 %62, -1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %64
store i8 0, i8* %65
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%67 = call i32 @strlen(i8* %6)
%68 = icmp slt i32 %67, 0
br i1 %68, label %108, label %69
69: ; preds = %58, %101
%70 = phi i32 [ %104, %101 ], [ 0, %58 ]
%71 = phi i32 [ %105, %101 ], [ 0, %58 ]
%72 = phi i32 [ %102, %101 ], [ 0, %58 ]
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = icmp eq i8 %75, 0
br i1 %76, label %108, label %77
77: ; preds = %69
%78 = sext i32 %70 to i64
%79 = getelementptr inbounds i32, i32* %30, i64 %78
%80 = load i32, i32* %79
%81 = icmp ne i32 %80, %72
%82 = icmp eq i32 %80, -1
%83 = or i1 %81, %82
br i1 %83, label %90, label %84
84: ; preds = %77
%85 = call i32 @strcat(i8* %66, i8* %8)
%86 = call i32 @strlen(i8* %7)
%87 = add nsw i32 %86, %72
%88 = call i32 @strlen(i8* %8)
%89 = add nsw i32 %70, 1
br label %101
90: ; preds = %77
br i1 %82, label %96, label %91
91: ; preds = %90
%92 = sub nsw i32 %80, %72
%93 = sext i32 %71 to i64
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %93
%95 = call i32 @strncat(i8* %94, i8* %74, i32 %92)
br label %101
96: ; preds = %90
%97 = sext i32 %71 to i64
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %97
%99 = call i32 @strcat(i8* %98, i8* %74)
%100 = call i32 @strlen(i8* %74)
br label %108
101: ; preds = %91, %84
%102 = phi i32 [ %87, %84 ], [ %80, %91 ]
%103 = phi i32 [ %88, %84 ], [ %92, %91 ]
%104 = phi i32 [ %89, %84 ], [ %70, %91 ]
%105 = add nsw i32 %103, %71
%106 = call i32 @strlen(i8* %6)
%107 = icmp sgt i32 %102, %106
br i1 %107, label %108, label %69
108: ; preds = %69, %101, %58, %96
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %66)
br label %110
110: ; preds = %108, %40
ret i32 0
}