#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 getFname(char *buffer, int file) {
  char buf[512];
  int i;
  readSector(buf, file);
  for (i = 0; i < 8 && (buf[i] & 0x7F); i++) {
    buffer[i] = buf[i] & 0x7F;
  }
  buffer[i] = '\0';
}


x86 assembly (clang, -O0):
<getFname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <readSector@plt>
movl   $0x0,-0x214(%rbp)
xor    %eax,%eax
cmpl   $0x8,-0x214(%rbp)
mov    %al,-0x215(%rbp)
jge    116e <getFname+0x5e>
movslq -0x214(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
and    $0x7f,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x215(%rbp)
mov    -0x215(%rbp),%al
test   $0x1,%al
jne    1181 <getFname+0x71>
jmp    11b7 <getFname+0xa7>
movslq -0x214(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
and    $0x7f,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x214(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    113b <getFname+0x2b>
mov    -0x8(%rbp),%rax
movslq -0x214(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFname>:
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
call   1030 <readSector@plt>
mov    (%rsp),%al
and    $0x7f,%al
je     1180 <getFname+0x70>
mov    %al,(%rbx)
mov    0x1(%rsp),%al
and    $0x7f,%al
je     1184 <getFname+0x74>
mov    %al,0x1(%rbx)
mov    0x2(%rsp),%al
and    $0x7f,%al
je     118b <getFname+0x7b>
mov    %al,0x2(%rbx)
mov    0x3(%rsp),%al
and    $0x7f,%al
je     1192 <getFname+0x82>
mov    %al,0x3(%rbx)
mov    0x4(%rsp),%al
and    $0x7f,%al
je     1199 <getFname+0x89>
mov    %al,0x4(%rbx)
mov    0x5(%rsp),%al
and    $0x7f,%al
je     11a0 <getFname+0x90>
mov    %al,0x5(%rbx)
mov    0x6(%rsp),%al
and    $0x7f,%al
je     11a7 <getFname+0x97>
mov    %al,0x6(%rbx)
mov    0x7(%rsp),%al
and    $0x7f,%al
je     11ae <getFname+0x9e>
mov    %al,0x7(%rbx)
mov    $0x8,%eax
jmp    11b3 <getFname+0xa3>
xor    %eax,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x1,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x2,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x3,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x4,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x5,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x6,%eax
jmp    11b3 <getFname+0xa3>
mov    $0x7,%eax
movb   $0x0,(%rbx,%rax,1)
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @getFname(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [512 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @readSector(i8* %7, i32 %8)
store i32 0, i32* %6
br label %10
10: ; preds = %35, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = and i32 %18, 127
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %13, %10
%22 = phi i1 [ false, %10 ], [ %20, %13 ]
br i1 %22, label %23, label %38
23: ; preds = %21
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = and i32 %28, 127
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %3
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 %30, i8* %34
br label %35
35: ; preds = %23
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %10
38: ; preds = %21
%39 = load i8*, i8** %3
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
ret void
}

LLVM IR (-O2):
define void @getFname(i8* nocapture writeonly %0, i32 %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @readSector(i8* %4, i32 %1)
%6 = load i8, i8* %4
%7 = and i8 %6, 127
%8 = icmp eq i8 %7, 0
br i1 %8, label %52, label %9
9: ; preds = %2
store i8 %7, i8* %0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 1
%11 = load i8, i8* %10
%12 = and i8 %11, 127
%13 = icmp eq i8 %12, 0
br i1 %13, label %52, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %12, i8* %15
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 2
%17 = load i8, i8* %16
%18 = and i8 %17, 127
%19 = icmp eq i8 %18, 0
br i1 %19, label %52, label %20
20: ; preds = %14
%21 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %18, i8* %21
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 3
%23 = load i8, i8* %22
%24 = and i8 %23, 127
%25 = icmp eq i8 %24, 0
br i1 %25, label %52, label %26
26: ; preds = %20
%27 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %24, i8* %27
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 4
%29 = load i8, i8* %28
%30 = and i8 %29, 127
%31 = icmp eq i8 %30, 0
br i1 %31, label %52, label %32
32: ; preds = %26
%33 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %30, i8* %33
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 5
%35 = load i8, i8* %34
%36 = and i8 %35, 127
%37 = icmp eq i8 %36, 0
br i1 %37, label %52, label %38
38: ; preds = %32
%39 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %36, i8* %39
%40 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 6
%41 = load i8, i8* %40
%42 = and i8 %41, 127
%43 = icmp eq i8 %42, 0
br i1 %43, label %52, label %44
44: ; preds = %38
%45 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %42, i8* %45
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 7
%47 = load i8, i8* %46
%48 = and i8 %47, 127
%49 = icmp eq i8 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %44
%51 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %48, i8* %51
br label %52
52: ; preds = %50, %44, %38, %32, %26, %20, %14, %9, %2
%53 = phi i64 [ 0, %2 ], [ 1, %9 ], [ 2, %14 ], [ 3, %20 ], [ 4, %26 ], [ 5, %32 ], [ 6, %38 ], [ 7, %44 ], [ 8, %50 ]
%54 = getelementptr inbounds i8, i8* %0, i64 %53
store i8 0, i8* %54
ret void
}