#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, const char *argv[]) {
  FILE *lab4_1;
  char satir[250];
  char sozcuk[250];
  char anlam[250];
  char girilen[100];
  int i = 0;
  int j = 0;
  int a = 0;
  int b = 1;
  lab4_1 = fopen("/home/daimon/Development/C/C-Lecture-Notes/2-lab-4/2-lab-4-2/"
                 "dictionary.txt",
                 "r");
  printf("Aramak istediğiniz sözcüğü girin : ");
  printf("\n");
  gets(girilen);
  printf("\n");
  while (fgets(satir, sizeof satir, lab4_1) != NULL) {
    for (i = 0; satir[i] != ':'; i++) {
      if (satir[i] == girilen[i]) {
        puts(satir);
        a++;
        break;
      }
    }
  }
  if (a == 0) {
    printf("I don't know this word\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x394(%rbp)
movl   $0x0,-0x398(%rbp)
movl   $0x0,-0x39c(%rbp)
movl   $0x1,-0x3a0(%rbp)
lea    0xe68(%rip),%rdi
lea    0xead(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
lea    -0x390(%rbp),%rdi
call   1060 <gets@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0xfa,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     127d <main+0x12d>
movl   $0x0,-0x394(%rbp)
movslq -0x394(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
je     1278 <main+0x128>
movslq -0x394(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%eax
ff
movslq -0x394(%rbp),%rcx
movsbl -0x390(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    125f <main+0x10f>
lea    -0x120(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x39c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x39c(%rbp)
jmp    1278 <main+0x128>
jmp    1264 <main+0x114>
mov    -0x394(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x394(%rbp)
jmp    1201 <main+0xb1>
jmp    11d8 <main+0x88>
cmpl   $0x0,-0x39c(%rbp)
jne    1296 <main+0x146>
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x170,%rsp
lea    0xe8d(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xec5(%rip),%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
call   1070 <gets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x70(%rsp),%rdi
mov    $0xfa,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1219 <main+0xb9>
xor    %r15d,%r15d
lea    0x70(%rsp),%r14
jmp    11f1 <main+0x91>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x1,%r15d
mov    %r14,%rdi
mov    $0xfa,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1214 <main+0xb4>
mov    0x70(%rsp),%al
cmp    $0x3a,%al
je     11dc <main+0x7c>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    (%rsp,%rcx,1),%al
je     11d0 <main+0x70>
movzbl 0x71(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x3a,%al
jne    1200 <main+0xa0>
jmp    11dc <main+0x7c>
test   %r15d,%r15d
jne    1225 <main+0xc5>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x170,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [76 x i8] c"/home/daimon/Development/C/C-Lecture-Notes/2-lab-4/2-lab-4-2/dictionary.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [41 x i8] c"Aramak istedi\C4\9Finiz s\C3\B6zc\C3\BC\C4\9F\C3\BC girin : \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [24 x i8] c"I don't know this word\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [250 x i8]
%8 = alloca [250 x i8]
%9 = alloca [250 x i8]
%10 = alloca [100 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 1, i32* %14
%15 = call i32* @fopen(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %6
%16 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%19 = call i32 @gets(i8* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %55, %2
%22 = getelementptr inbounds [250 x i8], [250 x i8]* %7, i64 0, i64 0
%23 = load i32*, i32** %6
%24 = call i32* @fgets(i8* %22, i32 250, i32* %23)
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %56
26: ; preds = %21
store i32 0, i32* %11
br label %27
27: ; preds = %52, %26
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [250 x i8], [250 x i8]* %7, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 58
br i1 %33, label %34, label %55
34: ; preds = %27
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [250 x i8], [250 x i8]* %7, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %39, %44
br i1 %45, label %46, label %51
46: ; preds = %34
%47 = getelementptr inbounds [250 x i8], [250 x i8]* %7, i64 0, i64 0
%48 = call i32 @puts(i8* %47)
%49 = load i32, i32* %13
%50 = add nsw i32 %49, 1
store i32 %50, i32* %13
br label %55
51: ; preds = %34
br label %52
52: ; preds = %51
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
br label %27
55: ; preds = %46, %27
br label %21
56: ; preds = %21
%57 = load i32, i32* %13
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
ret i32 0
}

LLVM IR (-O2):
@.str = [76 x i8] c"/home/daimon/Development/C/C-Lecture-Notes/2-lab-4/2-lab-4-2/dictionary.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [41 x i8] c"Aramak istedi\C4\9Finiz s\C3\B6zc\C3\BC\C4\9F\C3\BC girin : \00"
@str = [23 x i8] c"I don't know this word\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [250 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @putchar(i32 10)
%10 = call i32 @gets(i8* %6)
%11 = call i32 @putchar(i32 10)
%12 = call i32* @fgets(i8* %5, i32 250, i32* %7)
%13 = icmp eq i32* %12, null
br i1 %13, label %38, label %14
14: ; preds = %2, %32
%15 = phi i32 [ %33, %32 ], [ 0, %2 ]
%16 = load i8, i8* %5
%17 = icmp eq i8 %16, 58
br i1 %17, label %32, label %22
18: ; preds = %22
%19 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %28
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 58
br i1 %21, label %32, label %22
22: ; preds = %14, %18
%23 = phi i64 [ %28, %18 ], [ 0, %14 ]
%24 = phi i8 [ %20, %18 ], [ %16, %14 ]
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %23
%26 = load i8, i8* %25
%27 = icmp eq i8 %24, %26
%28 = add nuw i64 %23, 1
br i1 %27, label %29, label %18
29: ; preds = %22
%30 = call i32 @puts(i8* %5)
%31 = add nsw i32 %15, 1
br label %32
32: ; preds = %18, %14, %29
%33 = phi i32 [ %31, %29 ], [ %15, %14 ], [ %15, %18 ]
%34 = call i32* @fgets(i8* %5, i32 250, i32* %7)
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %14
36: ; preds = %32
%37 = icmp eq i32 %33, 0
br i1 %37, label %38, label %40
38: ; preds = %2, %36
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %40
40: ; preds = %38, %36
ret i32 0
}