#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*/ bzero(char *, int);
int /*<<< orphan*/ printString(char *);
scalar_t__ readFile(char *, char *, int);
int /*<<< orphan*/ readSector(char *, int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ writeSector(char *, int);
void writeFile(char *name, char *buffer, int numberOfSectors) {
  char map[512];
  char directory[512];
  unsigned int i, j, k, l;
  char fullName[6];
  char errorMsg[34];
  char temp;
  char tempBuffer[13312];
  if (readFile(name, tempBuffer, 1) == 0) {
    errorMsg[0] = 'A';
    errorMsg[1] = 'l';
    errorMsg[2] = 'r';
    errorMsg[3] = 'e';
    errorMsg[4] = 'a';
    errorMsg[5] = 'd';
    errorMsg[6] = 'y';
    errorMsg[7] = ' ';
    errorMsg[8] = 'e';
    errorMsg[9] = 'x';
    errorMsg[10] = 'i';
    errorMsg[11] = 's';
    errorMsg[12] = 't';
    errorMsg[13] = 's';
    errorMsg[14] = '\r';
    errorMsg[15] = '\n';
    errorMsg[16] = '\0';
    printString(errorMsg);
    return;
  }
  bzero(fullName, 6);
  readSector(map, 1);
  readSector(directory, 2);
  for (i = 0; i < 512; i += 32) {
    if (directory[i] == 0) {
      for (j = 0; j < 512 - numberOfSectors; j++) {
        if (map[j] == 0) {
          for (k = 0; k < numberOfSectors; k++) {
            directory[i + 6 + k] = j + k;
            map[j + k] = 0xFF;
            writeSector(buffer + k * 512, j + k);
          }
          for (k = 6 + 1 + k; k < 32; k++) {
            directory[k] = 0;
          }
          temp = directory[i + 6];
          strncpy(fullName, name, strlen(name));
          strncpy(directory + i, fullName, 6);
          directory[i + 6] = temp;
          writeSector(map, 1);
          writeSector(directory, 2);
          return;
        }
      }
      errorMsg[0] = 'N';
      errorMsg[1] = 'o';
      errorMsg[2] = 't';
      errorMsg[3] = ' ';
      errorMsg[4] = 'e';
      errorMsg[5] = 'n';
      errorMsg[6] = 'o';
      errorMsg[7] = 'u';
      errorMsg[8] = 'g';
      errorMsg[9] = 'h';
      errorMsg[10] = ' ';
      errorMsg[11] = 'f';
      errorMsg[12] = 'r';
      errorMsg[13] = 'e';
      errorMsg[14] = 'e';
      errorMsg[15] = ' ';
      errorMsg[16] = 's';
      errorMsg[17] = 'e';
      errorMsg[18] = 'c';
      errorMsg[19] = 't';
      errorMsg[20] = 'o';
      errorMsg[21] = 'r';
      errorMsg[22] = 's';
      errorMsg[23] = '!';
      errorMsg[24] = '\r';
      errorMsg[25] = '\n';
      errorMsg[26] = '\0';
      printString(errorMsg);
    }
  }
  errorMsg[0] = 'N';
  errorMsg[1] = 'o';
  errorMsg[2] = ' ';
  errorMsg[3] = 'm';
  errorMsg[4] = 'o';
  errorMsg[5] = 'r';
  errorMsg[6] = 'e';
  errorMsg[7] = ' ';
  errorMsg[8] = 'f';
  errorMsg[9] = 'r';
  errorMsg[10] = 'e';
  errorMsg[11] = 'e';
  errorMsg[12] = ' ';
  errorMsg[13] = 'd';
  errorMsg[14] = 'i';
  errorMsg[15] = 'r';
  errorMsg[16] = 'e';
  errorMsg[17] = 'c';
  errorMsg[18] = 't';
  errorMsg[19] = 'o';
  errorMsg[20] = 'r';
  errorMsg[21] = 'y';
  errorMsg[22] = ' ';
  errorMsg[23] = 'e';
  errorMsg[24] = 'n';
  errorMsg[25] = 't';
  errorMsg[26] = 'r';
  errorMsg[27] = 'i';
  errorMsg[28] = 'e';
  errorMsg[29] = 's';
  errorMsg[30] = '!';
  errorMsg[31] = '\r';
  errorMsg[32] = '\n';
  errorMsg[33] = '\0';
  printString(errorMsg);
  return;
}


x86 assembly (clang, -O0):
<writeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3880,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x3870(%rbp),%rsi
mov    $0x1,%edx
call   1090 <readFile@plt>
cmp    $0x0,%rax
jne    122d <writeFile+0xbd>
movb   $0x41,-0x460(%rbp)
movb   $0x6c,-0x45f(%rbp)
movb   $0x72,-0x45e(%rbp)
movb   $0x65,-0x45d(%rbp)
movb   $0x61,-0x45c(%rbp)
movb   $0x64,-0x45b(%rbp)
movb   $0x79,-0x45a(%rbp)
movb   $0x20,-0x459(%rbp)
movb   $0x65,-0x458(%rbp)
movb   $0x78,-0x457(%rbp)
movb   $0x69,-0x456(%rbp)
movb   $0x73,-0x455(%rbp)
movb   $0x74,-0x454(%rbp)
movb   $0x73,-0x453(%rbp)
movb   $0xd,-0x452(%rbp)
movb   $0xa,-0x451(%rbp)
movb   $0x0,-0x450(%rbp)
lea    -0x460(%rbp),%rdi
call   1060 <printString@plt>
jmp    1636 <writeFile+0x4c6>
lea    -0x436(%rbp),%rdi
mov    $0x6,%esi
call   1080 <bzero@plt>
lea    -0x220(%rbp),%rdi
mov    $0x1,%esi
call   1070 <readSector@plt>
lea    -0x420(%rbp),%rdi
mov    $0x2,%esi
call   1070 <readSector@plt>
movl   $0x0,-0x424(%rbp)
cmpl   $0x200,-0x424(%rbp)
jae    153c <writeFile+0x3cc>
mov    -0x424(%rbp),%eax
movsbl -0x420(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1523 <writeFile+0x3b3>
movl   $0x0,-0x428(%rbp)
mov    -0x428(%rbp),%eax
mov    $0x200,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jae    145a <writeFile+0x2ea>
mov    -0x428(%rbp),%eax
movsbl -0x220(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1441 <writeFile+0x2d1>
movl   $0x0,-0x42c(%rbp)
mov    -0x42c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1354 <writeFile+0x1e4>
mov    -0x428(%rbp),%eax
add    -0x42c(%rbp),%eax
mov    %al,%cl
mov    -0x424(%rbp),%eax
add    $0x6,%eax
add    -0x42c(%rbp),%eax
mov    %eax,%eax
mov    %cl,-0x420(%rbp,%rax,1)
mov    -0x428(%rbp),%eax
add    -0x42c(%rbp),%eax
mov    %eax,%eax
movb   $0xff,-0x220(%rbp,%rax,1)
ff
mov    -0x10(%rbp),%rdi
mov    -0x42c(%rbp),%eax
shl    $0x9,%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x428(%rbp),%esi
add    -0x42c(%rbp),%esi
call   1050 <writeSector@plt>
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    12d2 <writeFile+0x162>
mov    -0x42c(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x42c(%rbp)
cmpl   $0x20,-0x42c(%rbp)
jae    1392 <writeFile+0x222>
mov    -0x42c(%rbp),%eax
movb   $0x0,-0x420(%rbp,%rax,1)
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    1363 <writeFile+0x1f3>
mov    -0x424(%rbp),%eax
add    $0x6,%eax
mov    %eax,%eax
mov    -0x420(%rbp,%rax,1),%al
mov    %al,-0x461(%rbp)
lea    -0x436(%rbp),%rax
mov    %rax,-0x3880(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x3878(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x3880(%rbp),%rdi
mov    -0x3878(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
lea    -0x420(%rbp),%rdi
mov    -0x424(%rbp),%eax
add    %rax,%rdi
lea    -0x436(%rbp),%rsi
mov    $0x6,%edx
call   1030 <strncpy@plt>
mov    -0x461(%rbp),%cl
mov    -0x424(%rbp),%eax
add    $0x6,%eax
mov    %eax,%eax
mov    %cl,-0x420(%rbp,%rax,1)
lea    -0x220(%rbp),%rdi
mov    $0x1,%esi
call   1050 <writeSector@plt>
lea    -0x420(%rbp),%rdi
mov    $0x2,%esi
call   1050 <writeSector@plt>
jmp    1636 <writeFile+0x4c6>
jmp    1446 <writeFile+0x2d6>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    129b <writeFile+0x12b>
movb   $0x4e,-0x460(%rbp)
movb   $0x6f,-0x45f(%rbp)
movb   $0x74,-0x45e(%rbp)
movb   $0x20,-0x45d(%rbp)
movb   $0x65,-0x45c(%rbp)
movb   $0x6e,-0x45b(%rbp)
movb   $0x6f,-0x45a(%rbp)
movb   $0x75,-0x459(%rbp)
movb   $0x67,-0x458(%rbp)
movb   $0x68,-0x457(%rbp)
movb   $0x20,-0x456(%rbp)
movb   $0x66,-0x455(%rbp)
movb   $0x72,-0x454(%rbp)
movb   $0x65,-0x453(%rbp)
movb   $0x65,-0x452(%rbp)
movb   $0x20,-0x451(%rbp)
movb   $0x73,-0x450(%rbp)
movb   $0x65,-0x44f(%rbp)
movb   $0x63,-0x44e(%rbp)
movb   $0x74,-0x44d(%rbp)
movb   $0x6f,-0x44c(%rbp)
movb   $0x72,-0x44b(%rbp)
movb   $0x73,-0x44a(%rbp)
movb   $0x21,-0x449(%rbp)
movb   $0xd,-0x448(%rbp)
movb   $0xa,-0x447(%rbp)
movb   $0x0,-0x446(%rbp)
lea    -0x460(%rbp),%rdi
call   1060 <printString@plt>
jmp    1528 <writeFile+0x3b8>
mov    -0x424(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x424(%rbp)
jmp    126a <writeFile+0xfa>
movb   $0x4e,-0x460(%rbp)
movb   $0x6f,-0x45f(%rbp)
movb   $0x20,-0x45e(%rbp)
movb   $0x6d,-0x45d(%rbp)
movb   $0x6f,-0x45c(%rbp)
movb   $0x72,-0x45b(%rbp)
movb   $0x65,-0x45a(%rbp)
movb   $0x20,-0x459(%rbp)
movb   $0x66,-0x458(%rbp)
movb   $0x72,-0x457(%rbp)
movb   $0x65,-0x456(%rbp)
movb   $0x65,-0x455(%rbp)
movb   $0x20,-0x454(%rbp)
movb   $0x64,-0x453(%rbp)
movb   $0x69,-0x452(%rbp)
movb   $0x72,-0x451(%rbp)
movb   $0x65,-0x450(%rbp)
movb   $0x63,-0x44f(%rbp)
movb   $0x74,-0x44e(%rbp)
movb   $0x6f,-0x44d(%rbp)
movb   $0x72,-0x44c(%rbp)
movb   $0x79,-0x44b(%rbp)
movb   $0x20,-0x44a(%rbp)
movb   $0x65,-0x449(%rbp)
movb   $0x6e,-0x448(%rbp)
movb   $0x74,-0x447(%rbp)
movb   $0x72,-0x446(%rbp)
movb   $0x69,-0x445(%rbp)
movb   $0x65,-0x444(%rbp)
movb   $0x73,-0x443(%rbp)
movb   $0x21,-0x442(%rbp)
movb   $0xd,-0x441(%rbp)
movb   $0xa,-0x440(%rbp)
movb   $0x0,-0x43f(%rbp)
lea    -0x460(%rbp),%rdi
call   1060 <printString@plt>
add    $0x3880,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3858,%rsp
mov    %edx,%ebx
mov    %rsi,%r13
mov    %rdi,%r15
lea    0x450(%rsp),%rsi
mov    $0x1,%ebp
mov    $0x1,%edx
call   10a0 <readFile@plt>
test   %rax,%rax
je     1300 <writeFile+0x180>
lea    0x3a(%rsp),%rdi
mov    $0x6,%esi
call   1090 <bzero@plt>
lea    0x250(%rsp),%rdi
mov    $0x1,%esi
call   1080 <readSector@plt>
lea    0x50(%rsp),%rdi
mov    $0x2,%esi
call   1080 <readSector@plt>
mov    $0x200,%r12d
sub    %ebx,%r12d
cmp    $0x2,%r12d
cmovb  %ebp,%r12d
mov    $0x6,%r14d
xor    %ebp,%ebp
mov    %rbx,%rcx
mov    %rbx,0x8(%rsp)
jmp    125e <writeFile+0xde>
nopl   0x0(%rax)
movaps 0xde9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x2173726f74636573,%rax
72 73 21
mov    %rax,0x20(%rsp)
movw   $0xa0d,0x28(%rsp)
movb   $0x0,0x2a(%rsp)
lea    0x10(%rsp),%rdi
call   1070 <printString@plt>
mov    0x8(%rsp),%rcx
lea    0x20(%rbp),%rax
add    $0x20,%r14
cmp    $0x1e0,%rbp
mov    %rax,%rbp
jae    1393 <writeFile+0x213>
cmpb   $0x0,0x50(%rsp,%rbp,1)
jne    1246 <writeFile+0xc6>
cmp    $0x200,%ecx
je     1210 <writeFile+0x90>
xor    %ebx,%ebx
nop
cmpb   $0x0,0x250(%rsp,%rbx,1)
je     1285 <writeFile+0x105>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1270 <writeFile+0xf0>
jmp    1210 <writeFile+0x90>
mov    %ebp,%eax
and    $0xffffffe0,%eax
lea    (%rsp,%rax,1),%r12
add    $0x50,%r12
test   %ecx,%ecx
je     1316 <writeFile+0x196>
mov    %r12,0x40(%rsp)
mov    %r15,0x48(%rsp)
mov    %ecx,%r12d
shl    $0x9,%r12
xor    %r15d,%r15d
xchg   %ax,%ax
mov    %r14d,%eax
mov    %bl,0x50(%rsp,%rax,1)
mov    %ebx,%eax
movb   $0xff,0x250(%rsp,%rax,1)
ff
mov    %r15d,%edi
and    $0xfffffe00,%edi
add    %r13,%rdi
mov    %ebx,%esi
call   1050 <writeSector@plt>
add    $0x200,%r15
add    $0x1,%r14
add    $0x1,%ebx
cmp    %r15,%r12
jne    12b0 <writeFile+0x130>
mov    0x8(%rsp),%rcx
lea    0x7(%rcx),%eax
cmp    $0x1f,%eax
mov    0x48(%rsp),%r15
mov    0x40(%rsp),%r12
jbe    131d <writeFile+0x19d>
jmp    1339 <writeFile+0x1b9>
movaps 0xd29(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x20(%rsp)
jmp    13b2 <writeFile+0x232>
xor    %ecx,%ecx
mov    $0x7,%eax
mov    %eax,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x50,%rdi
mov    $0x18,%edx
sub    %ecx,%edx
add    $0x1,%rdx
xor    %esi,%esi
call   1060 <memset@plt>
and    $0xffffffe0,%ebp
mov    0x56(%rsp,%rbp,1),%r14b
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x3a(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncpy@plt>
mov    %r14b,0x56(%rsp,%rbp,1)
lea    0x250(%rsp),%rdi
mov    $0x1,%esi
call   1050 <writeSector@plt>
lea    0x50(%rsp),%rdi
mov    $0x2,%esi
call   1050 <writeSector@plt>
jmp    13bc <writeFile+0x23c>
movaps 0xc76(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xc7a(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movw   $0xa,0x30(%rsp)
lea    0x10(%rsp),%rdi
call   1070 <printString@plt>
add    $0x3858,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @writeFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [6 x i8]
%14 = alloca [34 x i8]
%15 = alloca i8
%16 = alloca [13312 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%17 = load i8*, i8** %4
%18 = getelementptr inbounds [13312 x i8], [13312 x i8]* %16, i64 0, i64 0
%19 = call i64 @readFile(i8* %17, i8* %18, i32 1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %41
21: ; preds = %3
%22 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
store i8 65, i8* %22
%23 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 1
store i8 108, i8* %23
%24 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 2
store i8 114, i8* %24
%25 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 3
store i8 101, i8* %25
%26 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 4
store i8 97, i8* %26
%27 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 5
store i8 100, i8* %27
%28 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 6
store i8 121, i8* %28
%29 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 7
store i8 32, i8* %29
%30 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 8
store i8 101, i8* %30
%31 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 9
store i8 120, i8* %31
%32 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 10
store i8 105, i8* %32
%33 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 11
store i8 115, i8* %33
%34 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 12
store i8 116, i8* %34
%35 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 13
store i8 115, i8* %35
%36 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 14
store i8 13, i8* %36
%37 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 15
store i8 10, i8* %37
%38 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 16
store i8 0, i8* %38
%39 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
%40 = call i32 @printString(i8* %39)
br label %218
41: ; preds = %3
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %13, i64 0, i64 0
%43 = call i32 @bzero(i8* %42, i32 6)
%44 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%45 = call i32 @readSector(i8* %44, i32 1)
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%47 = call i32 @readSector(i8* %46, i32 2)
store i32 0, i32* %9
br label %48
48: ; preds = %178, %41
%49 = load i32, i32* %9
%50 = icmp ult i32 %49, 512
br i1 %50, label %51, label %181
51: ; preds = %48
%52 = load i32, i32* %9
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %177
58: ; preds = %51
store i32 0, i32* %10
br label %59
59: ; preds = %144, %58
%60 = load i32, i32* %10
%61 = load i32, i32* %6
%62 = sub nsw i32 512, %61
%63 = icmp ult i32 %60, %62
br i1 %63, label %64, label %147
64: ; preds = %59
%65 = load i32, i32* %10
%66 = zext i32 %65 to i64
%67 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %143
71: ; preds = %64
store i32 0, i32* %11
br label %72
72: ; preds = %101, %71
%73 = load i32, i32* %11
%74 = load i32, i32* %6
%75 = icmp ult i32 %73, %74
br i1 %75, label %76, label %104
76: ; preds = %72
%77 = load i32, i32* %10
%78 = load i32, i32* %11
%79 = add i32 %77, %78
%80 = trunc i32 %79 to i8
%81 = load i32, i32* %9
%82 = add i32 %81, 6
%83 = load i32, i32* %11
%84 = add i32 %82, %83
%85 = zext i32 %84 to i64
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %85
store i8 %80, i8* %86
%87 = load i32, i32* %10
%88 = load i32, i32* %11
%89 = add i32 %87, %88
%90 = zext i32 %89 to i64
%91 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %90
store i8 -1, i8* %91
%92 = load i8*, i8** %5
%93 = load i32, i32* %11
%94 = mul i32 %93, 512
%95 = zext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %92, i64 %95
%97 = load i32, i32* %10
%98 = load i32, i32* %11
%99 = add i32 %97, %98
%100 = call i32 @writeSector(i8* %96, i32 %99)
br label %101
101: ; preds = %76
%102 = load i32, i32* %11
%103 = add i32 %102, 1
store i32 %103, i32* %11
br label %72
104: ; preds = %72
%105 = load i32, i32* %11
%106 = add i32 7, %105
store i32 %106, i32* %11
br label %107
107: ; preds = %114, %104
%108 = load i32, i32* %11
%109 = icmp ult i32 %108, 32
br i1 %109, label %110, label %117
110: ; preds = %107
%111 = load i32, i32* %11
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %112
store i8 0, i8* %113
br label %114
114: ; preds = %110
%115 = load i32, i32* %11
%116 = add i32 %115, 1
store i32 %116, i32* %11
br label %107
117: ; preds = %107
%118 = load i32, i32* %9
%119 = add i32 %118, 6
%120 = zext i32 %119 to i64
%121 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %120
%122 = load i8, i8* %121
store i8 %122, i8* %15
%123 = getelementptr inbounds [6 x i8], [6 x i8]* %13, i64 0, i64 0
%124 = load i8*, i8** %4
%125 = load i8*, i8** %4
%126 = call i32 @strlen(i8* %125)
%127 = call i32 @strncpy(i8* %123, i8* %124, i32 %126)
%128 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%129 = load i32, i32* %9
%130 = zext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
%132 = getelementptr inbounds [6 x i8], [6 x i8]* %13, i64 0, i64 0
%133 = call i32 @strncpy(i8* %131, i8* %132, i32 6)
%134 = load i8, i8* %15
%135 = load i32, i32* %9
%136 = add i32 %135, 6
%137 = zext i32 %136 to i64
%138 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %137
store i8 %134, i8* %138
%139 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%140 = call i32 @writeSector(i8* %139, i32 1)
%141 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%142 = call i32 @writeSector(i8* %141, i32 2)
br label %218
143: ; preds = %64
br label %144
144: ; preds = %143
%145 = load i32, i32* %10
%146 = add i32 %145, 1
store i32 %146, i32* %10
br label %59
147: ; preds = %59
%148 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
store i8 78, i8* %148
%149 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 1
store i8 111, i8* %149
%150 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 2
store i8 116, i8* %150
%151 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 3
store i8 32, i8* %151
%152 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 4
store i8 101, i8* %152
%153 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 5
store i8 110, i8* %153
%154 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 6
store i8 111, i8* %154
%155 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 7
store i8 117, i8* %155
%156 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 8
store i8 103, i8* %156
%157 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 9
store i8 104, i8* %157
%158 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 10
store i8 32, i8* %158
%159 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 11
store i8 102, i8* %159
%160 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 12
store i8 114, i8* %160
%161 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 13
store i8 101, i8* %161
%162 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 14
store i8 101, i8* %162
%163 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 15
store i8 32, i8* %163
%164 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 16
store i8 115, i8* %164
%165 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 17
store i8 101, i8* %165
%166 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 18
store i8 99, i8* %166
%167 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 19
store i8 116, i8* %167
%168 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 20
store i8 111, i8* %168
%169 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 21
store i8 114, i8* %169
%170 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 22
store i8 115, i8* %170
%171 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 23
store i8 33, i8* %171
%172 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 24
store i8 13, i8* %172
%173 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 25
store i8 10, i8* %173
%174 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 26
store i8 0, i8* %174
%175 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
%176 = call i32 @printString(i8* %175)
br label %177
177: ; preds = %147, %51
br label %178
178: ; preds = %177
%179 = load i32, i32* %9
%180 = add i32 %179, 32
store i32 %180, i32* %9
br label %48
181: ; preds = %48
%182 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
store i8 78, i8* %182
%183 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 1
store i8 111, i8* %183
%184 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 2
store i8 32, i8* %184
%185 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 3
store i8 109, i8* %185
%186 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 4
store i8 111, i8* %186
%187 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 5
store i8 114, i8* %187
%188 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 6
store i8 101, i8* %188
%189 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 7
store i8 32, i8* %189
%190 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 8
store i8 102, i8* %190
%191 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 9
store i8 114, i8* %191
%192 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 10
store i8 101, i8* %192
%193 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 11
store i8 101, i8* %193
%194 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 12
store i8 32, i8* %194
%195 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 13
store i8 100, i8* %195
%196 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 14
store i8 105, i8* %196
%197 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 15
store i8 114, i8* %197
%198 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 16
store i8 101, i8* %198
%199 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 17
store i8 99, i8* %199
%200 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 18
store i8 116, i8* %200
%201 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 19
store i8 111, i8* %201
%202 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 20
store i8 114, i8* %202
%203 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 21
store i8 121, i8* %203
%204 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 22
store i8 32, i8* %204
%205 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 23
store i8 101, i8* %205
%206 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 24
store i8 110, i8* %206
%207 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 25
store i8 116, i8* %207
%208 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 26
store i8 114, i8* %208
%209 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 27
store i8 105, i8* %209
%210 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 28
store i8 101, i8* %210
%211 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 29
store i8 115, i8* %211
%212 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 30
store i8 33, i8* %212
%213 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 31
store i8 13, i8* %213
%214 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 32
store i8 10, i8* %214
%215 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 33
store i8 0, i8* %215
%216 = getelementptr inbounds [34 x i8], [34 x i8]* %14, i64 0, i64 0
%217 = call i32 @printString(i8* %216)
br label %218
218: ; preds = %181, %117, %21
ret void
}

LLVM IR (-O2):
define void @writeFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [6 x i8]
%7 = alloca [34 x i8]
%8 = alloca [13312 x i8]
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [13312 x i8], [13312 x i8]* %8, i64 0, i64 0
%14 = call i64 @readFile(i8* %0, i8* %13, i32 1)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = bitcast [34 x i8]* %7 to <16 x i8>*
store <16 x i8> <i8 65, i8 108, i8 114, i8 101, i8 97, i8 100, i8 121, i8 32, i8 101, i8 120, i8 105, i8 115, i8 116, i8 115, i8 13, i8 10>, <16 x i8>* %17
%18 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 16
store i8 0, i8* %18
%19 = call i32 @printString(i8* %12)
br label %110
20: ; preds = %3
%21 = call i32 @bzero(i8* %11, i32 6)
%22 = call i32 @readSector(i8* %9, i32 1)
%23 = call i32 @readSector(i8* %10, i32 2)
%24 = sub i32 512, %2
%25 = icmp eq i32 %2, 512
%26 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 16
%27 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 17
%28 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 18
%29 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 19
%30 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 20
%31 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 21
%32 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 22
%33 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 23
%34 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 24
%35 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 25
%36 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 26
%37 = call i32 @llvm.umax.i32(i32 %24, i32 1)
%38 = zext i32 %37 to i64
%39 = bitcast [34 x i8]* %7 to <16 x i8>*
br label %40
40: ; preds = %20, %101
%41 = phi i64 [ 0, %20 ], [ %102, %101 ]
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 0
br i1 %44, label %45, label %101
45: ; preds = %40
br i1 %25, label %99, label %46
46: ; preds = %45, %96
%47 = phi i64 [ %97, %96 ], [ 0, %45 ]
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %51, label %96
51: ; preds = %46
%52 = trunc i64 %47 to i32
%53 = and i64 %41, 4294967264
%54 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %53
%55 = icmp eq i32 %2, 0
br i1 %55, label %78, label %56
56: ; preds = %51
%57 = or i64 %41, 6
%58 = zext i32 %2 to i64
br label %59
59: ; preds = %56, %59
%60 = phi i64 [ 0, %56 ], [ %73, %59 ]
%61 = trunc i64 %60 to i32
%62 = add i32 %61, %52
%63 = trunc i32 %62 to i8
%64 = add nuw i64 %57, %60
%65 = and i64 %64, 4294967295
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %65
store i8 %63, i8* %66
%67 = zext i32 %62 to i64
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %67
store i8 -1, i8* %68
%69 = shl i64 %60, 9
%70 = and i64 %69, 4294966784
%71 = getelementptr inbounds i8, i8* %1, i64 %70
%72 = call i32 @writeSector(i8* %71, i32 %62)
%73 = add nuw nsw i64 %60, 1
%74 = icmp eq i64 %73, %58
br i1 %74, label %75, label %59
75: ; preds = %59
%76 = add i32 %2, 7
%77 = icmp ult i32 %76, 32
br i1 %77, label %78, label %86
78: ; preds = %51, %75
%79 = phi i32 [ %76, %75 ], [ 7, %51 ]
%80 = phi i32 [ %2, %75 ], [ 0, %51 ]
%81 = zext i32 %79 to i64
%82 = getelementptr [512 x i8], [512 x i8]* %5, i64 0, i64 %81
%83 = sub nsw i32 24, %80
%84 = zext i32 %83 to i64
%85 = add nuw nsw i64 %84, 1
br label %86
86: ; preds = %78, %75
%87 = and i64 %41, 4294967264
%88 = or i64 %87, 6
%89 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = call i32 @strlen(i8* %0)
%92 = call i32 @strncpy(i8* %11, i8* %0, i32 %91)
%93 = call i32 @strncpy(i8* %54, i8* %11, i32 6)
store i8 %90, i8* %89
%94 = call i32 @writeSector(i8* %9, i32 1)
%95 = call i32 @writeSector(i8* %10, i32 2)
br label %110
96: ; preds = %46
%97 = add nuw nsw i64 %47, 1
%98 = icmp eq i64 %97, %38
br i1 %98, label %99, label %46
99: ; preds = %96, %45
store <16 x i8> <i8 78, i8 111, i8 116, i8 32, i8 101, i8 110, i8 111, i8 117, i8 103, i8 104, i8 32, i8 102, i8 114, i8 101, i8 101, i8 32>, <16 x i8>* %39
store i8 115, i8* %26
store i8 101, i8* %27
store i8 99, i8* %28
store i8 116, i8* %29
store i8 111, i8* %30
store i8 114, i8* %31
store i8 115, i8* %32
store i8 33, i8* %33
store i8 13, i8* %34
store i8 10, i8* %35
store i8 0, i8* %36
%100 = call i32 @printString(i8* %12)
br label %101
101: ; preds = %40, %99
%102 = add nuw nsw i64 %41, 32
%103 = icmp ult i64 %41, 480
br i1 %103, label %40, label %104
104: ; preds = %101
%105 = bitcast [34 x i8]* %7 to <16 x i8>*
store <16 x i8> <i8 78, i8 111, i8 32, i8 109, i8 111, i8 114, i8 101, i8 32, i8 102, i8 114, i8 101, i8 101, i8 32, i8 100, i8 105, i8 114>, <16 x i8>* %105
%106 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> <i8 101, i8 99, i8 116, i8 111, i8 114, i8 121, i8 32, i8 101, i8 110, i8 116, i8 114, i8 105, i8 101, i8 115, i8 33, i8 13>, <16 x i8>* %106
%107 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 32
store i8 10, i8* %107
%108 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 33
store i8 0, i8* %108
%109 = call i32 @printString(i8* %12)
br label %110
110: ; preds = %104, %86, %16
ret void
}