#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*/ printf(char *, ...);
int dir_print_entry(unsigned char *buffer) {
  int j;
  if (buffer[0] != 0xff && buffer[3] != 0) {
    printf(" ");
    if (buffer[2] & 0x80)
      printf("*");
    else
      printf(" ");
    switch (buffer[2] & 0x7f) {
    case 0x00:
      printf("T");
      break;
    case 0x01:
      printf("I");
      break;
    case 0x02:
      printf("A");
      break;
    case 0x04:
      printf("B");
      break;
    case 0x08:
      printf("S");
      break;
    case 0x10:
      printf("R");
      break;
    case 0x20:
      printf("X");
      break;
    case 0x40:
      printf("Y");
      break;
    default:
      printf("?");
    }
    printf(" %03u ", buffer[33] + buffer[34] * 256u);
    for (j = 3; j < 33; j++)
      printf("%c", (buffer[j] & 0x7f));
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<dir_print_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xff,%eax
je     12c5 <dir_print_entry+0x1b5>
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x0,%eax
je     12c5 <dir_print_entry+0x1b5>
lea    0xfd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1176 <dir_print_entry+0x66>
lea    0xf9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1184 <dir_print_entry+0x74>
lea    0xfa0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
and    $0x7f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x40,%eax
ja     124a <dir_print_entry+0x13a>
mov    -0x18(%rbp),%rax
lea    0xe57(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xf3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xf2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <dir_print_entry+0x148>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x21(%rax),%esi
mov    -0x8(%rbp),%rax
movzbl 0x22(%rax),%eax
shl    $0x8,%eax
add    %eax,%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3,-0xc(%rbp)
cmpl   $0x21,-0xc(%rbp)
jge    12b7 <dir_print_entry+0x1a7>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
and    $0x7f,%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1282 <dir_print_entry+0x172>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_print_entry>:
push   %r14
push   %rbx
push   %rax
cmpb   $0xff,(%rdi)
je     11f2 <dir_print_entry+0xd2>
mov    %rdi,%r14
cmpb   $0x0,0x3(%rdi)
je     11f2 <dir_print_entry+0xd2>
mov    $0x20,%ebx
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpb   $0x0,0x2(%r14)
mov    $0x2a,%edi
cmovns %ebx,%edi
call   1030 <putchar@plt>
movzbl 0x2(%r14),%eax
and    $0x7f,%eax
cmp    $0x40,%eax
ja     118b <dir_print_entry+0x6b>
mov    $0x54,%edi
lea    0xe8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x49,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x41,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x3f,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x42,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x53,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x52,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x58,%edi
jmp    11b3 <dir_print_entry+0x93>
mov    $0x59,%edi
call   1030 <putchar@plt>
movzwl 0x21(%r14),%esi
lea    0xf40(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
nopl   (%rax)
movzbl 0x3(%r14,%rbx,1),%edi
and    $0x7f,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x1e,%rbx
jne    11d0 <dir_print_entry+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"T\00"
@.str.3 = [2 x i8] c"I\00"
@.str.4 = [2 x i8] c"A\00"
@.str.5 = [2 x i8] c"B\00"
@.str.6 = [2 x i8] c"S\00"
@.str.7 = [2 x i8] c"R\00"
@.str.8 = [2 x i8] c"X\00"
@.str.9 = [2 x i8] c"Y\00"
@.str.10 = [2 x i8] c"?\00"
@.str.11 = [7 x i8] c" %03u \00"
@.str.12 = [3 x i8] c"%c\00"
@.str.13 = [2 x i8] c"\0A\00"
define i32 @dir_print_entry(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp ne i32 %7, 255
br i1 %8, label %9, label %80
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 3
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %80
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = and i32 %20, 128
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
25: ; preds = %15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
%28 = load i8*, i8** %2
%29 = getelementptr inbounds i8, i8* %28, i64 2
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, 127
switch i32 %32, label %49 [
i32 0, label %33
i32 1, label %35
i32 2, label %37
i32 4, label %39
i32 8, label %41
i32 16, label %43
i32 32, label %45
i32 64, label %47
]
33: ; preds = %27
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %51
37: ; preds = %27
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %51
39: ; preds = %27
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %51
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %51
43: ; preds = %27
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %51
45: ; preds = %27
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %51
47: ; preds = %27
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %51
49: ; preds = %27
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %51
51: ; preds = %49, %47, %45, %43, %41, %39, %37, %35, %33
%52 = load i8*, i8** %2
%53 = getelementptr inbounds i8, i8* %52, i64 33
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = load i8*, i8** %2
%57 = getelementptr inbounds i8, i8* %56, i64 34
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = mul i32 %59, 256
%61 = add i32 %55, %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %61)
store i32 3, i32* %3
br label %63
63: ; preds = %75, %51
%64 = load i32, i32* %3
%65 = icmp slt i32 %64, 33
br i1 %65, label %66, label %78
66: ; preds = %63
%67 = load i8*, i8** %2
%68 = load i32, i32* %3
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = and i32 %72, 127
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %66
%76 = load i32, i32* %3
%77 = add nsw i32 %76, 1
store i32 %77, i32* %3
br label %63
78: ; preds = %63
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %80
80: ; preds = %78, %9, %1
ret i32 0
}

LLVM IR (-O2):
@.str.11 = [7 x i8] c" %03u \00"
define i32 @dir_print_entry(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, -1
br i1 %3, label %49, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %49, label %8
8: ; preds = %4
%9 = tail call i32 @putchar(i32 32)
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = icmp sgt i8 %11, -1
%13 = select i1 %12, i32 32, i32 42
%14 = tail call i32 @putchar(i32 %13)
%15 = load i8, i8* %10
%16 = and i8 %15, 127
%17 = zext i8 %16 to i32
switch i32 %17, label %25 [
i32 0, label %26
i32 1, label %18
i32 2, label %19
i32 4, label %20
i32 8, label %21
i32 16, label %22
i32 32, label %23
i32 64, label %24
]
18: ; preds = %8
br label %26
19: ; preds = %8
br label %26
20: ; preds = %8
br label %26
21: ; preds = %8
br label %26
22: ; preds = %8
br label %26
23: ; preds = %8
br label %26
24: ; preds = %8
br label %26
25: ; preds = %8
br label %26
26: ; preds = %8, %25, %24, %23, %22, %21, %20, %19, %18
%27 = phi i32 [ 63, %25 ], [ 89, %24 ], [ 88, %23 ], [ 82, %22 ], [ 83, %21 ], [ 66, %20 ], [ 65, %19 ], [ 73, %18 ], [ 84, %8 ]
%28 = tail call i32 @putchar(i32 %27)
%29 = getelementptr inbounds i8, i8* %0, i64 33
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = getelementptr inbounds i8, i8* %0, i64 34
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = shl nuw nsw i32 %34, 8
%36 = or i32 %35, %31
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %26, %38
%39 = phi i64 [ 3, %26 ], [ %45, %38 ]
%40 = getelementptr inbounds i8, i8* %0, i64 %39
%41 = load i8, i8* %40
%42 = and i8 %41, 127
%43 = zext i8 %42 to i32
%44 = tail call i32 @putchar(i32 %43)
%45 = add nuw nsw i64 %39, 1
%46 = icmp eq i64 %45, 33
br i1 %46, label %47, label %38
47: ; preds = %38
%48 = tail call i32 @putchar(i32 10)
br label %49
49: ; preds = %47, %4, %1
ret i32 0
}