#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 */
typedef int mode_t;

/* Variables and functions */
scalar_t__ S_ISDIR(int);
scalar_t__ S_ISFIFO(int);
scalar_t__ S_ISLNK(int);
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
char _file_mode_letter(mode_t mode) {
  if (S_ISLNK(mode))
    return '@';
  if (S_ISDIR(mode))
    return '/';
  if (S_ISFIFO(mode))
    return '|';
  if (mode & (S_IXUSR | S_IXGRP | S_IXOTH))
    return '*';
  return ' ';
}


x86 assembly (clang, -O0):
<_file_mode_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1156 <_file_mode_letter+0x26>
movb   $0x40,-0x1(%rbp)
jmp    11c2 <_file_mode_letter+0x92>
mov    -0x8(%rbp),%edi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1171 <_file_mode_letter+0x41>
movb   $0x2f,-0x1(%rbp)
jmp    11c2 <_file_mode_letter+0x92>
mov    -0x8(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     118c <_file_mode_letter+0x5c>
movb   $0x7c,-0x1(%rbp)
jmp    11c2 <_file_mode_letter+0x92>
mov    -0x8(%rbp),%eax
mov    0x2e4a(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e39(%rip),%rdx
or     (%rdx),%ecx
mov    0x2e40(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11be <_file_mode_letter+0x8e>
movb   $0x2a,-0x1(%rbp)
jmp    11c2 <_file_mode_letter+0x92>
movb   $0x20,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_file_mode_letter>:
push   %rbx
mov    %edi,%ebx
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
mov    $0x40,%al
test   %rcx,%rcx
je     1144 <_file_mode_letter+0x14>
pop    %rbx
ret
mov    %ebx,%edi
call   1050 <S_ISDIR@plt>
mov    %rax,%rcx
mov    $0x2f,%al
test   %rcx,%rcx
jne    1142 <_file_mode_letter+0x12>
mov    %ebx,%edi
call   1040 <S_ISFIFO@plt>
mov    %rax,%rcx
mov    $0x7c,%al
test   %rcx,%rcx
jne    1142 <_file_mode_letter+0x12>
mov    0x2e73(%rip),%rax
mov    0x2e64(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2e69(%rip),%rax
or     (%rax),%ecx
test   %ebx,%ecx
mov    $0x20,%ecx
mov    $0x2a,%eax
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@S_IXUSR = global i32 0
@S_IXGRP = global i32 0
@S_IXOTH = global i32 0
define signext i8 @_file_mode_letter(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @S_ISLNK(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 64, i8* %2
br label %29
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i64 @S_ISDIR(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 47, i8* %2
br label %29
13: ; preds = %8
%14 = load i32, i32* %3
%15 = call i64 @S_ISFIFO(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 124, i8* %2
br label %29
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* @S_IXUSR
%21 = load i32, i32* @S_IXGRP
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IXOTH
%24 = or i32 %22, %23
%25 = and i32 %19, %24
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %18
store i8 42, i8* %2
br label %29
28: ; preds = %18
store i8 32, i8* %2
br label %29
29: ; preds = %28, %27, %17, %12, %7
%30 = load i8, i8* %2
ret i8 %30
}

LLVM IR (-O2):
@S_IXUSR = global i32 0
@S_IXGRP = global i32 0
@S_IXOTH = global i32 0
define signext i8 @_file_mode_letter(i32 %0) {
%2 = tail call i64 @S_ISLNK(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %19
4: ; preds = %1
%5 = tail call i64 @S_ISDIR(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = tail call i64 @S_ISFIFO(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* @S_IXUSR
%12 = load i32, i32* @S_IXGRP
%13 = or i32 %12, %11
%14 = load i32, i32* @S_IXOTH
%15 = or i32 %13, %14
%16 = and i32 %15, %0
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8 32, i8 42
br label %19
19: ; preds = %10, %7, %4, %1
%20 = phi i8 [ 64, %1 ], [ 47, %4 ], [ 124, %7 ], [ %18, %10 ]
ret i8 %20
}