#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 matchNames(char *, char *, int);
int /*<<< orphan*/ readSector(char *, int);
int /*<<< orphan*/ writeSector(char *, int);
void deleteFile(char *name) {
  char directory[512], map[512];
  int entry, matched;
  int sector, curSector;
  readSector(directory, 2);
  readSector(map, 1);
  for (entry = 0; entry < 16; entry++) {
    matched = matchNames(name, directory + entry * 32, 6);
    if (matched == 1) {
      break;
    }
  }
  if (matched == 0) {
    return;
  }
  directory[entry * 32] = 0x00;
  for (sector = 0; sector < (32 - 6); sector++) {
    curSector = *(directory + entry * 32 + 6 + sector);
    if (curSector != 0x00) {
      map[curSector] = 0x00;
    } else {
      break;
    }
  }
  writeSector(directory, 2);
  writeSector(map, 1);
  return;
}


x86 assembly (clang, -O0):
<deleteFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x2,%esi
call   1040 <readSector@plt>
lea    -0x410(%rbp),%rdi
mov    $0x1,%esi
call   1040 <readSector@plt>
movl   $0x0,-0x414(%rbp)
cmpl   $0x10,-0x414(%rbp)
jge    11cc <deleteFile+0x9c>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    -0x414(%rbp),%eax
shl    $0x5,%eax
cltq
add    %rax,%rsi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    %eax,-0x418(%rbp)
cmpl   $0x1,-0x418(%rbp)
jne    11b3 <deleteFile+0x83>
jmp    11cc <deleteFile+0x9c>
jmp    11b8 <deleteFile+0x88>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    116b <deleteFile+0x3b>
cmpl   $0x0,-0x418(%rbp)
jne    11de <deleteFile+0xae>
jmp    1291 <deleteFile+0x161>
mov    -0x414(%rbp),%eax
shl    $0x5,%eax
cltq
movb   $0x0,-0x210(%rbp,%rax,1)
movl   $0x0,-0x41c(%rbp)
cmpl   $0x1a,-0x41c(%rbp)
jge    126f <deleteFile+0x13f>
lea    -0x210(%rbp),%rax
mov    -0x414(%rbp),%ecx
shl    $0x5,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x41c(%rbp),%rcx
movsbl 0x6(%rax,%rcx,1),%eax
mov    %eax,-0x420(%rbp)
cmpl   $0x0,-0x420(%rbp)
je     1251 <deleteFile+0x121>
movslq -0x420(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
jmp    1256 <deleteFile+0x126>
jmp    126f <deleteFile+0x13f>
jmp    125b <deleteFile+0x12b>
mov    -0x41c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x41c(%rbp)
jmp    11fb <deleteFile+0xcb>
lea    -0x210(%rbp),%rdi
mov    $0x2,%esi
call   1030 <writeSector@plt>
lea    -0x410(%rbp),%rdi
mov    $0x1,%esi
call   1030 <writeSector@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteFile>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <readSector@plt>
lea    0x200(%rsp),%rdi
mov    $0x1,%esi
call   1040 <readSector@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1050 <matchNames@plt>
cmp    $0x1,%eax
jne    117b <deleteFile+0x4b>
xor    %ecx,%ecx
jmp    1378 <deleteFile+0x248>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x20,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x40(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x40,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x60(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x60,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x80(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x80,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0xa0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0xa0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0xc0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0xc0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0xe0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0xe0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x100(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x100,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x120(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x120,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x140(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x140,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x160(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x160,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x180(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x180,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x1a0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x1a0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x1c0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
mov    $0x1c0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
lea    0x1e0(%rsp),%rsi
mov    %r14,%rdi
mov    $0x6,%edx
call   1050 <matchNames@plt>
test   %eax,%eax
je     13de <deleteFile+0x2ae>
mov    $0x1e0,%ecx
cmp    $0x1,%eax
je     1378 <deleteFile+0x248>
mov    $0x200,%ecx
movb   $0x0,(%rsp,%rcx,1)
lea    (%rsp,%rcx,1),%rax
add    $0x7,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movsbq -0x1(%rax,%rcx,1),%rdx
test   %rdx,%rdx
je     13bf <deleteFile+0x28f>
movb   $0x0,0x200(%rsp,%rdx,1)
movsbq (%rax,%rcx,1),%rdx
test   %rdx,%rdx
je     13bf <deleteFile+0x28f>
movb   $0x0,0x200(%rsp,%rdx,1)
add    $0x2,%rcx
cmp    $0x1a,%rcx
jne    1390 <deleteFile+0x260>
mov    %rsp,%rdi
mov    $0x2,%esi
call   1030 <writeSector@plt>
lea    0x200(%rsp),%rdi
mov    $0x1,%esi
call   1030 <writeSector@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @deleteFile(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%10 = call i32 @readSector(i8* %9, i32 2)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%12 = call i32 @readSector(i8* %11, i32 1)
store i32 0, i32* %5
br label %13
13: ; preds = %28, %1
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 16
br i1 %15, label %16, label %31
16: ; preds = %13
%17 = load i8*, i8** %2
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%19 = load i32, i32* %5
%20 = mul nsw i32 %19, 32
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = call i32 @matchNames(i8* %17, i8* %22, i32 6)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %16
br label %31
27: ; preds = %16
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %13
31: ; preds = %26, %13
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31
br label %71
35: ; preds = %31
%36 = load i32, i32* %5
%37 = mul nsw i32 %36, 32
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %38
store i8 0, i8* %39
store i32 0, i32* %7
br label %40
40: ; preds = %63, %35
%41 = load i32, i32* %7
%42 = icmp slt i32 %41, 26
br i1 %42, label %43, label %66
43: ; preds = %40
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%45 = load i32, i32* %5
%46 = mul nsw i32 %45, 32
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = getelementptr inbounds i8, i8* %48, i64 6
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
store i32 %54, i32* %8
%55 = load i32, i32* %8
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %43
%58 = load i32, i32* %8
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %59
store i8 0, i8* %60
br label %62
61: ; preds = %43
br label %66
62: ; preds = %57
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %40
66: ; preds = %61, %40
%67 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%68 = call i32 @writeSector(i8* %67, i32 2)
%69 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%70 = call i32 @writeSector(i8* %69, i32 1)
br label %71
71: ; preds = %66, %34
ret void
}

LLVM IR (-O2):
define void @deleteFile(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = call i32 @readSector(i8* %4, i32 2)
%7 = call i32 @readSector(i8* %5, i32 1)
%8 = call i32 @matchNames(i8* %0, i8* %4, i32 6)
%9 = icmp eq i32 %8, 1
br i1 %9, label %70, label %10
10: ; preds = %1
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 32
%12 = call i32 @matchNames(i8* %0, i8* %11, i32 6)
%13 = icmp eq i32 %12, 1
br i1 %13, label %70, label %14
14: ; preds = %10
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 64
%16 = call i32 @matchNames(i8* %0, i8* %15, i32 6)
%17 = icmp eq i32 %16, 1
br i1 %17, label %70, label %18
18: ; preds = %14
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 96
%20 = call i32 @matchNames(i8* %0, i8* %19, i32 6)
%21 = icmp eq i32 %20, 1
br i1 %21, label %70, label %22
22: ; preds = %18
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 128
%24 = call i32 @matchNames(i8* %0, i8* %23, i32 6)
%25 = icmp eq i32 %24, 1
br i1 %25, label %70, label %26
26: ; preds = %22
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 160
%28 = call i32 @matchNames(i8* %0, i8* %27, i32 6)
%29 = icmp eq i32 %28, 1
br i1 %29, label %70, label %30
30: ; preds = %26
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 192
%32 = call i32 @matchNames(i8* %0, i8* %31, i32 6)
%33 = icmp eq i32 %32, 1
br i1 %33, label %70, label %34
34: ; preds = %30
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 224
%36 = call i32 @matchNames(i8* %0, i8* %35, i32 6)
%37 = icmp eq i32 %36, 1
br i1 %37, label %70, label %38
38: ; preds = %34
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 256
%40 = call i32 @matchNames(i8* %0, i8* %39, i32 6)
%41 = icmp eq i32 %40, 1
br i1 %41, label %70, label %42
42: ; preds = %38
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 288
%44 = call i32 @matchNames(i8* %0, i8* %43, i32 6)
%45 = icmp eq i32 %44, 1
br i1 %45, label %70, label %46
46: ; preds = %42
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 320
%48 = call i32 @matchNames(i8* %0, i8* %47, i32 6)
%49 = icmp eq i32 %48, 1
br i1 %49, label %70, label %50
50: ; preds = %46
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 352
%52 = call i32 @matchNames(i8* %0, i8* %51, i32 6)
%53 = icmp eq i32 %52, 1
br i1 %53, label %70, label %54
54: ; preds = %50
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 384
%56 = call i32 @matchNames(i8* %0, i8* %55, i32 6)
%57 = icmp eq i32 %56, 1
br i1 %57, label %70, label %58
58: ; preds = %54
%59 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 416
%60 = call i32 @matchNames(i8* %0, i8* %59, i32 6)
%61 = icmp eq i32 %60, 1
br i1 %61, label %70, label %62
62: ; preds = %58
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 448
%64 = call i32 @matchNames(i8* %0, i8* %63, i32 6)
%65 = icmp eq i32 %64, 1
br i1 %65, label %70, label %66
66: ; preds = %62
%67 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 480
%68 = call i32 @matchNames(i8* %0, i8* %67, i32 6)
switch i32 %68, label %69 [
i32 1, label %70
i32 0, label %94
]
69: ; preds = %66
br label %70
70: ; preds = %66, %69, %1, %10, %14, %18, %22, %26, %30, %34, %38, %42, %46, %50, %54, %58, %62
%71 = phi i64 [ 0, %1 ], [ 32, %10 ], [ 64, %14 ], [ 96, %18 ], [ 128, %22 ], [ 160, %26 ], [ 192, %30 ], [ 224, %34 ], [ 256, %38 ], [ 288, %42 ], [ 320, %46 ], [ 352, %50 ], [ 384, %54 ], [ 416, %58 ], [ 448, %62 ], [ 480, %66 ], [ 512, %69 ]
%72 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %71
store i8 0, i8* %72
%73 = getelementptr inbounds i8, i8* %72, i64 6
br label %74
74: ; preds = %86, %70
%75 = phi i64 [ 0, %70 ], [ %89, %86 ]
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 0
br i1 %78, label %91, label %79
79: ; preds = %74
%80 = sext i8 %77 to i64
%81 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %80
store i8 0, i8* %81
%82 = or i64 %75, 1
%83 = getelementptr inbounds i8, i8* %73, i64 %82
%84 = load i8, i8* %83
%85 = icmp eq i8 %84, 0
br i1 %85, label %91, label %86
86: ; preds = %79
%87 = sext i8 %84 to i64
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %87
store i8 0, i8* %88
%89 = add nuw nsw i64 %75, 2
%90 = icmp eq i64 %89, 26
br i1 %90, label %91, label %74
91: ; preds = %86, %79, %74
%92 = call i32 @writeSector(i8* %4, i32 2)
%93 = call i32 @writeSector(i8* %5, i32 1)
br label %94
94: ; preds = %66, %91
ret void
}