#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*/ readSector(char *, int);
void loadFileSectors(char *buffer, char *dir) {
  int sector, curSector;
  for (sector = 0; sector < (32 - 6); sector++) {
    curSector = *(dir + 6 + sector);
    if (curSector != 0x00) {
      readSector(buffer + 512 * sector, curSector);
    } else {
      return;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<loadFileSectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1a,-0x14(%rbp)
jge    117f <loadFileSectors+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl 0x6(%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1167 <loadFileSectors+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x9,%eax
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%esi
call   1030 <readSector@plt>
jmp    116c <loadFileSectors+0x5c>
jmp    1184 <loadFileSectors+0x74>
jmp    1171 <loadFileSectors+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <loadFileSectors+0x17>
jmp    1184 <loadFileSectors+0x74>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadFileSectors>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x6,%ebx
movsbl (%r14,%rbx,1),%esi
test   %esi,%esi
je     1142 <loadFileSectors+0x32>
mov    %r15,%rdi
call   1030 <readSector@plt>
add    $0x1,%rbx
add    $0x200,%r15
cmp    $0x20,%rbx
jne    1120 <loadFileSectors+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @loadFileSectors(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %30, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 26
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 6
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %10
%21 = load i8*, i8** %3
%22 = load i32, i32* %5
%23 = mul nsw i32 512, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i32, i32* %6
%27 = call i32 @readSector(i8* %25, i32 %26)
br label %29
28: ; preds = %10
br label %34
29: ; preds = %20
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %7
33: ; preds = %7
br label %34
34: ; preds = %33, %28
ret void
}

LLVM IR (-O2):
define void @loadFileSectors(i8* %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 6
br label %4
4: ; preds = %2, %9
%5 = phi i64 [ 0, %2 ], [ %14, %9 ]
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = sext i8 %7 to i32
%11 = shl nuw nsw i64 %5, 9
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = tail call i32 @readSector(i8* %12, i32 %10)
%14 = add nuw nsw i64 %5, 1
%15 = icmp eq i64 %14, 26
br i1 %15, label %16, label %4
16: ; preds = %9, %4
ret void
}