#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*/ SEEK_END;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int ReadFromFile(char kelimeler[2400][5]) {
  FILE *words;
  long words_size;
  int word_count;
  int i;
  words = fopen("kelime.txt", "r");
  if (words == NULL) {
    printf("Error occured while opening %s file. Aborting. ", "kelime.txt");
    exit(-1);
  }
  fseek(words, 0, SEEK_END);
  words_size = ftell(words);
  word_count = words_size / (5 + 2);
  rewind(words);
  for (i = 0; i < 2400; i++) {
    fscanf(words, "%s", kelimeler[i]);
  }
  fclose(words);
  return word_count;
}


x86 assembly (clang, -O0):
<ReadFromFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe6d(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cb <ReadFromFile+0x4b>
lea    0xe58(%rip),%rdi
lea    0xe44(%rip),%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e12(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1080 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1070 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x7,%ecx
cqto
idiv   %rcx
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x960,-0x20(%rbp)
jge    1247 <ReadFromFile+0xc7>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x20(%rbp),%rax
imul   $0x5,%rax,%rax
add    %rax,%rdx
lea    0xe09(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    120d <ReadFromFile+0x8d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadFromFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
lea    0xe6d(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     122e <ReadFromFile+0xae>
mov    %rax,%r13
mov    0x2e36(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
mov    %r13,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r13,%rdi
call   1070 <ftell@plt>
mov    %rax,%r15
mov    %r13,%rdi
call   1050 <rewind@plt>
lea    0xe63(%rip),%r12
nopw   0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%rdx
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <fscanf@plt>
add    $0x5,%rbx
cmp    $0x2ee0,%rbx
jne    11e0 <ReadFromFile+0x60>
movabs $0x4924924924924925,%rcx
92 24 49
mov    %r15,%rax
imul   %rcx
mov    %rdx,%r14
shr    $0x3f,%r14
shr    %rdx
add    %edx,%r14d
mov    %r13,%rdi
call   1030 <fclose@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xdd8(%rip),%rdi
lea    0xdc4(%rip),%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"kelime.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [48 x i8] c"Error occured while opening %s file. Aborting. \00"
@SEEK_END = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @ReadFromFile([5 x i8]* %0) {
%2 = alloca [5 x i8]*
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store [5 x i8]* %0, [5 x i8]** %2
%7 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %1
%14 = load i32*, i32** %3
%15 = load i32, i32* @SEEK_END
%16 = call i32 @fseek(i32* %14, i32 0, i32 %15)
%17 = load i32*, i32** %3
%18 = call i64 @ftell(i32* %17)
store i64 %18, i64* %4
%19 = load i64, i64* %4
%20 = sdiv i64 %19, 7
%21 = trunc i64 %20 to i32
store i32 %21, i32* %5
%22 = load i32*, i32** %3
%23 = call i32 @rewind(i32* %22)
store i32 0, i32* %6
br label %24
24: ; preds = %35, %13
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 2400
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i32*, i32** %3
%29 = load [5 x i8]*, [5 x i8]** %2
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %29, i64 %31
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %32, i64 0, i64 0
%34 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %24
38: ; preds = %24
%39 = load i32*, i32** %3
%40 = call i32 @fclose(i32* %39)
%41 = load i32, i32* %5
ret i32 %41
}

LLVM IR (-O2):
@.str = [11 x i8] c"kelime.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [48 x i8] c"Error occured while opening %s file. Aborting. \00"
@SEEK_END = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @ReadFromFile([5 x i8]* %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
%8 = load i32, i32* @SEEK_END
%9 = tail call i32 @fseek(i32* %2, i32 0, i32 %8)
%10 = tail call i64 @ftell(i32* %2)
%11 = tail call i32 @rewind(i32* %2)
br label %12
12: ; preds = %7, %12
%13 = phi i64 [ 0, %7 ], [ %16, %12 ]
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %13, i64 0
%15 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = add nuw nsw i64 %13, 1
%17 = icmp eq i64 %16, 2400
br i1 %17, label %18, label %12
18: ; preds = %12
%19 = sdiv i64 %10, 7
%20 = trunc i64 %19 to i32
%21 = tail call i32 @fclose(i32* %2)
ret i32 %20
}