#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 *, int);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ writeSector(char *, int);
void deleteFile(char *fileName) {
  char map[512];
  char directory[512];
  char notFound[17];
  unsigned int i, j;
  readSector(map, 1);
  readSector(directory, 2);
  for (i = 0; i < 512; i += 32) {
    if (directory[i] == 0) {
      continue;
    } else if (strncmp(fileName, directory + i, 6)) {
      directory[i] = 0;
      for (j = 6; j < 32; j++) {
        if (directory[i + j] == 0) {
          break;
        } else {
          map[directory[i + j] - 1] = 0;
        }
      }
      writeSector(map, 1);
      writeSector(directory, 2);
      return;
    }
  }
  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;
}


x86 assembly (clang, -O0):
<deleteFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x1,%esi
call   1060 <readSector@plt>
lea    -0x410(%rbp),%rdi
mov    $0x2,%esi
call   1060 <readSector@plt>
movl   $0x0,-0x434(%rbp)
cmpl   $0x200,-0x434(%rbp)
jae    1299 <deleteFile+0x159>
mov    -0x434(%rbp),%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    11a7 <deleteFile+0x67>
jmp    1285 <deleteFile+0x145>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    -0x434(%rbp),%eax
add    %rax,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     127b <deleteFile+0x13b>
mov    -0x434(%rbp),%eax
movb   $0x0,-0x410(%rbp,%rax,1)
movl   $0x6,-0x438(%rbp)
cmpl   $0x20,-0x438(%rbp)
jae    1254 <deleteFile+0x114>
mov    -0x434(%rbp),%eax
add    -0x438(%rbp),%eax
mov    %eax,%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1218 <deleteFile+0xd8>
jmp    1254 <deleteFile+0x114>
mov    -0x434(%rbp),%eax
add    -0x438(%rbp),%eax
mov    %eax,%eax
movsbl -0x410(%rbp,%rax,1),%eax
ff
sub    $0x1,%eax
cltq
movb   $0x0,-0x210(%rbp,%rax,1)
jmp    1240 <deleteFile+0x100>
mov    -0x438(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    11e7 <deleteFile+0xa7>
lea    -0x210(%rbp),%rdi
mov    $0x1,%esi
call   1040 <writeSector@plt>
lea    -0x410(%rbp),%rdi
mov    $0x2,%esi
call   1040 <writeSector@plt>
jmp    131c <deleteFile+0x1dc>
jmp    1280 <deleteFile+0x140>
jmp    1285 <deleteFile+0x145>
mov    -0x434(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x434(%rbp)
jmp    117b <deleteFile+0x3b>
movb   $0x46,-0x430(%rbp)
movb   $0x69,-0x42f(%rbp)
movb   $0x6c,-0x42e(%rbp)
movb   $0x65,-0x42d(%rbp)
movb   $0x20,-0x42c(%rbp)
movb   $0x6e,-0x42b(%rbp)
movb   $0x6f,-0x42a(%rbp)
movb   $0x74,-0x429(%rbp)
movb   $0x20,-0x428(%rbp)
movb   $0x46,-0x427(%rbp)
movb   $0x6f,-0x426(%rbp)
movb   $0x75,-0x425(%rbp)
movb   $0x6e,-0x424(%rbp)
movb   $0x64,-0x423(%rbp)
movb   $0xd,-0x422(%rbp)
movb   $0xa,-0x421(%rbp)
movb   $0x0,-0x420(%rbp)
lea    -0x430(%rbp),%rdi
call   1050 <printString@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rdi,%r15
lea    0x220(%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1060 <readSector@plt>
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    $0x2,%esi
call   1060 <readSector@plt>
mov    $0xffffffffffffffe0,%rbx
jmp    11a1 <deleteFile+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x20,%r12
add    $0x20,%rbx
cmp    $0x1e0,%rbx
jae    121f <deleteFile+0xdf>
cmpb   $0x0,(%r12)
je     1190 <deleteFile+0x50>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1190 <deleteFile+0x50>
movb   $0x0,(%r12)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbq 0x6(%r12,%rax,1),%rcx
test   %rcx,%rcx
je     11fc <deleteFile+0xbc>
movb   $0x0,-0x1(%rcx,%r14,1)
movsbq 0x7(%r12,%rax,1),%rcx
test   %rcx,%rcx
je     11fc <deleteFile+0xbc>
movb   $0x0,-0x1(%rcx,%r14,1)
add    $0x2,%rax
cmp    $0x1a,%rax
jne    11d0 <deleteFile+0x90>
lea    0x220(%rsp),%rdi
mov    $0x1,%esi
call   1040 <writeSector@plt>
lea    0x20(%rsp),%rdi
mov    $0x2,%esi
call   1040 <writeSector@plt>
jmp    1237 <deleteFile+0xf7>
movaps 0xdda(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rdi
call   1050 <printString@plt>
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @deleteFile(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca [17 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%8 = call i32 @readSector(i8* %5, i32 1)
%9 = call i32 @readSector(i8* %6, i32 2)
br label %10
10: ; preds = %1, %44
%11 = phi i64 [ 0, %1 ], [ %45, %44 ]
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %44, label %15
15: ; preds = %10
%16 = call i64 @strncmp(i8* %0, i8* %12, i32 6)
%17 = icmp eq i64 %16, 0
br i1 %17, label %44, label %18
18: ; preds = %15
store i8 0, i8* %12
%19 = and i64 %11, 4294967264
br label %20
20: ; preds = %35, %18
%21 = phi i64 [ 6, %18 ], [ %39, %35 ]
%22 = add nuw nsw i64 %21, %19
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %41, label %26
26: ; preds = %20
%27 = sext i8 %24 to i64
%28 = add nsw i64 %27, -1
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %28
store i8 0, i8* %29
%30 = or i64 %21, 1
%31 = add nuw nsw i64 %30, %19
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %26
%36 = sext i8 %33 to i64
%37 = add nsw i64 %36, -1
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %37
store i8 0, i8* %38
%39 = add nuw nsw i64 %21, 2
%40 = icmp eq i64 %39, 32
br i1 %40, label %41, label %20
41: ; preds = %35, %26, %20
%42 = call i32 @writeSector(i8* %5, i32 1)
%43 = call i32 @writeSector(i8* %6, i32 2)
br label %51
44: ; preds = %15, %10
%45 = add nuw nsw i64 %11, 32
%46 = icmp ult i64 %11, 480
br i1 %46, label %10, label %47
47: ; preds = %44
%48 = bitcast [17 x i8]* %4 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>* %48
%49 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 16
store i8 0, i8* %49
%50 = call i32 @printString(i8* %7)
br label %51
51: ; preds = %47, %41
ret void
}