#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 */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int *malloc(int);
int /*<<< orphan*/ printf(char *);
int *fileReader(FILE *file) {
  if (file == NULL) {
    printf("Error: file not recognized. Cannot create entry.\n");
    return NULL;
  }
  int *content = NULL;
  content = malloc((int)600 * sizeof(int));
  char curChar;
  int i = 0;
  curChar = fgetc(file);
  while (curChar != EOF && i < 600 - 1) {
    switch (curChar) {
    case '#':
      content[i] = 1;
      break;
    case '0':
      content[i] = 4;
      break;
    case 'X':
      content[i] = 5;
      break;
    case '\n':
      content[i] = 2;
      break;
    default:
      content[i] = 0;
    }
    i++;
    curChar = fgetc(file);
  }
  content[i] = 3;
  return content;
}


x86 assembly (clang, -O0):
<fileReader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1160 <fileReader+0x30>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1299 <fileReader+0x169>
movq   $0x0,-0x18(%rbp)
mov    $0x960,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%ecx
mov    0x2e54(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
je     11b1 <fileReader+0x81>
cmpl   $0x257,-0x20(%rbp)
setl   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11c1 <fileReader+0x91>
jmp    1282 <fileReader+0x152>
movsbl -0x19(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0xa,%eax
je     1245 <fileReader+0x115>
jmp    11d6 <fileReader+0xa6>
mov    -0x28(%rbp),%eax
sub    $0x23,%eax
je     1209 <fileReader+0xd9>
jmp    11e7 <fileReader+0xb7>
mov    -0x28(%rbp),%eax
sub    $0x30,%eax
je     121d <fileReader+0xed>
jmp    11f8 <fileReader+0xc8>
mov    -0x28(%rbp),%eax
sub    $0x58,%eax
je     1231 <fileReader+0x101>
jmp    1259 <fileReader+0x129>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    1268 <fileReader+0x138>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x4,(%rax,%rcx,4)
jmp    1268 <fileReader+0x138>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
jmp    1268 <fileReader+0x138>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x2,(%rax,%rcx,4)
jmp    1268 <fileReader+0x138>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
jmp    1189 <fileReader+0x59>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x3,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileReader>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rdi,%rdi
je     1169 <fileReader+0x39>
mov    %rdi,%r12
mov    $0x960,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    0x2e8b(%rip),%r15
cmp    (%r15),%al
jne    117d <fileReader+0x4d>
xor    %ebx,%ebx
jmp    1215 <fileReader+0xe5>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
xor    %r14d,%r14d
jmp    121d <fileReader+0xed>
xor    %r13d,%r13d
movsbl %al,%ecx
cmp    $0x2f,%ecx
jg     11a0 <fileReader+0x70>
cmp    $0xa,%ecx
je     11c0 <fileReader+0x90>
mov    $0x1,%eax
cmp    $0x23,%ecx
je     11f0 <fileReader+0xc0>
jmp    11e0 <fileReader+0xb0>
nopl   0x0(%rax)
cmp    $0x58,%ecx
je     11d0 <fileReader+0xa0>
cmp    $0x30,%ecx
jne    11e0 <fileReader+0xb0>
mov    $0x4,%eax
jmp    11f0 <fileReader+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2,%eax
jmp    11f0 <fileReader+0xc0>
nopw   0x0(%rax,%rax,1)
mov    $0x5,%eax
jmp    11f0 <fileReader+0xc0>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,(%r14,%r13,4)
lea    0x1(%r13),%rbx
mov    %r12,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%al
je     1215 <fileReader+0xe5>
cmp    $0x256,%r13
mov    %rbx,%r13
jb     1180 <fileReader+0x50>
movl   $0x3,(%r14,%rbx,4)
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Error: file not recognized. Cannot create entry.\0A\00"
@EOF = global i8 0
define i32* @fileReader(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i32
store i32* %0, i32** %3
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store i32* null, i32** %2
br label %65
11: ; preds = %1
store i32* null, i32** %4
%12 = call i32* @malloc(i32 2400)
store i32* %12, i32** %4
store i32 0, i32* %6
%13 = load i32*, i32** %3
%14 = call signext i8 @fgetc(i32* %13)
store i8 %14, i8* %5
br label %15
15: ; preds = %54, %11
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 599
br label %24
24: ; preds = %21, %15
%25 = phi i1 [ false, %15 ], [ %23, %21 ]
br i1 %25, label %26, label %59
26: ; preds = %24
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
switch i32 %28, label %49 [
i32 35, label %29
i32 48, label %34
i32 88, label %39
i32 10, label %44
]
29: ; preds = %26
%30 = load i32*, i32** %4
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 1, i32* %33
br label %54
34: ; preds = %26
%35 = load i32*, i32** %4
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
store i32 4, i32* %38
br label %54
39: ; preds = %26
%40 = load i32*, i32** %4
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
store i32 5, i32* %43
br label %54
44: ; preds = %26
%45 = load i32*, i32** %4
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
store i32 2, i32* %48
br label %54
49: ; preds = %26
%50 = load i32*, i32** %4
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
store i32 0, i32* %53
br label %54
54: ; preds = %49, %44, %39, %34, %29
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
%57 = load i32*, i32** %3
%58 = call signext i8 @fgetc(i32* %57)
store i8 %58, i8* %5
br label %15
59: ; preds = %24
%60 = load i32*, i32** %4
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
store i32 3, i32* %63
%64 = load i32*, i32** %4
store i32* %64, i32** %2
br label %65
65: ; preds = %59, %9
%66 = load i32*, i32** %2
ret i32* %66
}

LLVM IR (-O2):
@EOF = global i8 0
@str = [49 x i8] c"Error: file not recognized. Cannot create entry.\00"
define noalias i32* @fileReader(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %32
5: ; preds = %1
%6 = tail call i32* @malloc(i32 2400)
%7 = tail call signext i8 @fgetc(i32* %0)
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %29, label %10
10: ; preds = %5, %18
%11 = phi i64 [ %21, %18 ], [ 0, %5 ]
%12 = phi i8 [ %22, %18 ], [ %7, %5 ]
%13 = sext i8 %12 to i32
switch i32 %13, label %17 [
i32 35, label %18
i32 48, label %14
i32 88, label %15
i32 10, label %16
]
14: ; preds = %10
br label %18
15: ; preds = %10
br label %18
16: ; preds = %10
br label %18
17: ; preds = %10
br label %18
18: ; preds = %10, %17, %16, %15, %14
%19 = phi i32 [ 0, %17 ], [ 2, %16 ], [ 5, %15 ], [ 4, %14 ], [ 1, %10 ]
%20 = getelementptr inbounds i32, i32* %6, i64 %11
store i32 %19, i32* %20
%21 = add nuw nsw i64 %11, 1
%22 = tail call signext i8 @fgetc(i32* %0)
%23 = load i8, i8* @EOF
%24 = icmp ne i8 %22, %23
%25 = icmp ult i64 %11, 598
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %10, label %27
27: ; preds = %18
%28 = and i64 %21, 4294967295
br label %29
29: ; preds = %27, %5
%30 = phi i64 [ 0, %5 ], [ %28, %27 ]
%31 = getelementptr inbounds i32, i32* %6, i64 %30
store i32 3, i32* %31
br label %32
32: ; preds = %29, %3
%33 = phi i32* [ null, %3 ], [ %6, %29 ]
ret i32* %33
}