#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*/ printString(char *);
int /*<<< orphan*/ readSector(char *, char);
scalar_t__ strncmp(char *, char *, int);
int readFile(char *fileName, char *buffer, int notDebug) {
  char directory[512];
  unsigned int i, j, k;
  char notFound[17];
  readSector(directory, 2);
  for (i = 0; i < 512; i += 32) {
    if (directory[i] == 0) {
      continue;
    } else if (strncmp(fileName, directory + i, 6)) {
      for (j = 6, k = 0; j < 32; j++, k += 512) {
        if (directory[i + j] == 0) {
          return 0;
        } else {
          readSector(buffer + k, directory[i + j]);
        }
      }
      return 0;
    }
  }
  if (!notDebug) {
    notFound[0] = 'F';
    notFound[1] = 'i';
    notFound[2] = 'l';
    notFound[3] = 'e';
    notFound[4] = ' ';
    notFound[5] = 'n';
    notFound[6] = 'o';
    notFound[7] = 't';
    notFound[8] = ' ';
    notFound[9] = 'F';
    notFound[10] = 'o';
    notFound[11] = 'u';
    notFound[12] = 'n';
    notFound[13] = 'd';
    notFound[14] = '\r';
    notFound[15] = '\n';
    notFound[16] = '\0';
    printString(notFound);
  }
  return -1;
}


x86 assembly (clang, -O0):
<readFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    -0x220(%rbp),%rdi
mov    $0x2,%esi
call   1050 <readSector@plt>
movl   $0x0,-0x224(%rbp)
cmpl   $0x200,-0x224(%rbp)
jae    127d <readFile+0x14d>
mov    -0x224(%rbp),%eax
movsbl -0x220(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    118d <readFile+0x5d>
jmp    1269 <readFile+0x139>
mov    -0x10(%rbp),%rdi
lea    -0x220(%rbp),%rsi
mov    -0x224(%rbp),%eax
add    %rax,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     125f <readFile+0x12f>
movl   $0x6,-0x228(%rbp)
movl   $0x0,-0x22c(%rbp)
cmpl   $0x20,-0x228(%rbp)
jae    1253 <readFile+0x123>
mov    -0x224(%rbp),%eax
add    -0x228(%rbp),%eax
mov    %eax,%eax
movsbl -0x220(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1201 <readFile+0xd1>
movl   $0x0,-0x4(%rbp)
jmp    1311 <readFile+0x1e1>
mov    -0x18(%rbp),%rdi
mov    -0x22c(%rbp),%eax
add    %rax,%rdi
mov    -0x224(%rbp),%eax
add    -0x228(%rbp),%eax
mov    %eax,%eax
movsbl -0x220(%rbp,%rax,1),%esi
ff
call   1050 <readSector@plt>
jmp    122e <readFile+0xfe>
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
mov    -0x22c(%rbp),%eax
add    $0x200,%eax
mov    %eax,-0x22c(%rbp)
jmp    11c9 <readFile+0x99>
movl   $0x0,-0x4(%rbp)
jmp    1311 <readFile+0x1e1>
jmp    1264 <readFile+0x134>
jmp    1269 <readFile+0x139>
mov    -0x224(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x224(%rbp)
jmp    1161 <readFile+0x31>
cmpl   $0x0,-0x1c(%rbp)
jne    130a <readFile+0x1da>
movb   $0x46,-0x240(%rbp)
movb   $0x69,-0x23f(%rbp)
movb   $0x6c,-0x23e(%rbp)
movb   $0x65,-0x23d(%rbp)
movb   $0x20,-0x23c(%rbp)
movb   $0x6e,-0x23b(%rbp)
movb   $0x6f,-0x23a(%rbp)
movb   $0x74,-0x239(%rbp)
movb   $0x20,-0x238(%rbp)
movb   $0x46,-0x237(%rbp)
movb   $0x6f,-0x236(%rbp)
movb   $0x75,-0x235(%rbp)
movb   $0x6e,-0x234(%rbp)
movb   $0x64,-0x233(%rbp)
movb   $0xd,-0x232(%rbp)
movb   $0xa,-0x231(%rbp)
movb   $0x0,-0x230(%rbp)
lea    -0x240(%rbp),%rdi
call   1040 <printString@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFile>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x220,%rsp
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <readSector@plt>
mov    $0xffffffffffffffe0,%rbp
jmp    1181 <readFile+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x20,%rbx
add    $0x20,%rbp
cmp    $0x1e0,%rbp
jae    11d9 <readFile+0xa9>
cmpb   $0x0,(%rbx)
je     1170 <readFile+0x40>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1170 <readFile+0x40>
add    $0x6,%rbx
xor    %r15d,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
test   %al,%al
je     11fc <readFile+0xcc>
lea    (%r14,%rbp,1),%rdi
movsbl %al,%esi
call   1050 <readSector@plt>
add    $0x200,%rbp
add    $0x1,%rbx
cmp    $0x3400,%rbp
jne    11b0 <readFile+0x80>
jmp    11fc <readFile+0xcc>
mov    $0xffffffff,%r15d
test   %r12d,%r12d
jne    11fc <readFile+0xcc>
movaps 0xe15(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rdi
call   1040 <printString@plt>
mov    %r15d,%eax
add    $0x220,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [512 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [17 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%14 = call i32 @readSector(i8* %13, i8 signext 2)
store i32 0, i32* %9
br label %15
15: ; preds = %69, %3
%16 = load i32, i32* %9
%17 = icmp ult i32 %16, 512
br i1 %17, label %18, label %72
18: ; preds = %15
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %18
br label %69
26: ; preds = %18
%27 = load i8*, i8** %5
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%29 = load i32, i32* %9
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = call i64 @strncmp(i8* %27, i8* %31, i32 6)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %67
34: ; preds = %26
store i32 6, i32* %10
store i32 0, i32* %11
br label %35
35: ; preds = %61, %34
%36 = load i32, i32* %10
%37 = icmp ult i32 %36, 32
br i1 %37, label %38, label %66
38: ; preds = %35
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = add i32 %39, %40
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %38
store i32 0, i32* %4
br label %96
48: ; preds = %38
%49 = load i8*, i8** %6
%50 = load i32, i32* %11
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i32, i32* %9
%54 = load i32, i32* %10
%55 = add i32 %53, %54
%56 = zext i32 %55 to i64
%57 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = call i32 @readSector(i8* %52, i8 signext %58)
br label %60
60: ; preds = %48
br label %61
61: ; preds = %60
%62 = load i32, i32* %10
%63 = add i32 %62, 1
store i32 %63, i32* %10
%64 = load i32, i32* %11
%65 = add i32 %64, 512
store i32 %65, i32* %11
br label %35
66: ; preds = %35
store i32 0, i32* %4
br label %96
67: ; preds = %26
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68, %25
%70 = load i32, i32* %9
%71 = add i32 %70, 32
store i32 %71, i32* %9
br label %15
72: ; preds = %15
%73 = load i32, i32* %7
%74 = icmp ne i32 %73, 0
br i1 %74, label %95, label %75
75: ; preds = %72
%76 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
store i8 70, i8* %76
%77 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 1
store i8 105, i8* %77
%78 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 2
store i8 108, i8* %78
%79 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 3
store i8 101, i8* %79
%80 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 4
store i8 32, i8* %80
%81 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 5
store i8 110, i8* %81
%82 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 6
store i8 111, i8* %82
%83 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 7
store i8 116, i8* %83
%84 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 8
store i8 32, i8* %84
%85 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 9
store i8 70, i8* %85
%86 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 10
store i8 111, i8* %86
%87 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 11
store i8 117, i8* %87
%88 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 12
store i8 110, i8* %88
%89 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 13
store i8 100, i8* %89
%90 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 14
store i8 13, i8* %90
%91 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 15
store i8 10, i8* %91
%92 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 16
store i8 0, i8* %92
%93 = getelementptr inbounds [17 x i8], [17 x i8]* %12, i64 0, i64 0
%94 = call i32 @printString(i8* %93)
br label %95
95: ; preds = %75, %72
store i32 -1, i32* %4
br label %96
96: ; preds = %95, %66, %47
%97 = load i32, i32* %4
ret i32 %97
}

LLVM IR (-O2):
define i32 @readFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = alloca [17 x i8]
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 0
%8 = call i32 @readSector(i8* %6, i8 signext 2)
br label %9
9: ; preds = %3, %32
%10 = phi i64 [ 0, %3 ], [ %33, %32 ]
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %32, label %14
14: ; preds = %9
%15 = call i64 @strncmp(i8* %0, i8* %11, i32 6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %32, label %17
17: ; preds = %14
%18 = and i64 %10, 4294967264
br label %19
19: ; preds = %17, %26
%20 = phi i64 [ 6, %17 ], [ %29, %26 ]
%21 = phi i64 [ 0, %17 ], [ %30, %26 ]
%22 = add nuw nsw i64 %20, %18
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %41, label %26
26: ; preds = %19
%27 = getelementptr inbounds i8, i8* %1, i64 %21
%28 = call i32 @readSector(i8* %27, i8 signext %24)
%29 = add nuw nsw i64 %20, 1
%30 = add nuw nsw i64 %21, 512
%31 = icmp eq i64 %29, 32
br i1 %31, label %41, label %19
32: ; preds = %14, %9
%33 = add nuw nsw i64 %10, 32
%34 = icmp ult i64 %10, 480
br i1 %34, label %9, label %35
35: ; preds = %32
%36 = icmp eq i32 %2, 0
br i1 %36, label %37, label %41
37: ; preds = %35
%38 = bitcast [17 x i8]* %5 to <16 x i8>*
store <16 x i8> <i8 70, i8 105, i8 108, i8 101, i8 32, i8 110, i8 111, i8 116, i8 32, i8 70, i8 111, i8 117, i8 110, i8 100, i8 13, i8 10>, <16 x i8>* %38
%39 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 16
store i8 0, i8* %39
%40 = call i32 @printString(i8* %7)
br label %41
41: ; preds = %26, %19, %35, %37
%42 = phi i32 [ -1, %37 ], [ -1, %35 ], [ 0, %19 ], [ 0, %26 ]
ret i32 %42
}