#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);
scalar_t__ S_ISREG(int);
scalar_t__ S_ISSOCK(int);
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ putchar(char);
void print_type_indicator(mode_t mode) {
  if (S_ISREG(mode)) {
    if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
      putchar('*');
    }
  } else {
    if (S_ISDIR(mode)) {
      putchar('/');
    } else if (S_ISLNK(mode)) {
      putchar('@');
    } else if (S_ISFIFO(mode)) {
      putchar('|');
    } else if (S_ISSOCK(mode)) {
      putchar('=');
    }
  }
}


x86 assembly (clang, -O0):
<print_type_indicator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <S_ISREG@plt>
cmp    $0x0,%rax
je     11b5 <print_type_indicator+0x55>
mov    -0x4(%rbp),%eax
mov    0x2e59(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e48(%rip),%rdx
or     (%rdx),%ecx
mov    0x2e4f(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11b0 <print_type_indicator+0x50>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    1248 <print_type_indicator+0xe8>
mov    -0x4(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11d6 <print_type_indicator+0x76>
mov    $0x2f,%edi
call   1030 <putchar@plt>
jmp    1243 <print_type_indicator+0xe3>
mov    -0x4(%rbp),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     11f7 <print_type_indicator+0x97>
mov    $0x40,%edi
call   1030 <putchar@plt>
jmp    123e <print_type_indicator+0xde>
mov    -0x4(%rbp),%edi
call   1050 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     1218 <print_type_indicator+0xb8>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    1239 <print_type_indicator+0xd9>
mov    -0x4(%rbp),%edi
call   1060 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     1234 <print_type_indicator+0xd4>
mov    $0x3d,%edi
call   1030 <putchar@plt>
jmp    1239 <print_type_indicator+0xd9>
jmp    123e <print_type_indicator+0xde>
jmp    1243 <print_type_indicator+0xe3>
jmp    1248 <print_type_indicator+0xe8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_type_indicator>:
push   %rbx
mov    %edi,%ebx
call   1080 <S_ISREG@plt>
test   %rax,%rax
je     1190 <print_type_indicator+0x30>
mov    0x2e6c(%rip),%rax
mov    0x2e5d(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e62(%rip),%rax
or     (%rax),%edx
mov    $0x2a,%cl
test   %ebx,%edx
jne    11c8 <print_type_indicator+0x68>
pop    %rbx
ret
mov    %ebx,%edi
call   1070 <S_ISDIR@plt>
mov    $0x2f,%cl
test   %rax,%rax
jne    11c8 <print_type_indicator+0x68>
mov    %ebx,%edi
call   1040 <S_ISLNK@plt>
mov    $0x40,%cl
test   %rax,%rax
jne    11c8 <print_type_indicator+0x68>
mov    %ebx,%edi
call   1050 <S_ISFIFO@plt>
mov    $0x7c,%cl
test   %rax,%rax
jne    11c8 <print_type_indicator+0x68>
mov    %ebx,%edi
call   1060 <S_ISSOCK@plt>
mov    $0x3d,%cl
test   %rax,%rax
je     118e <print_type_indicator+0x2e>
movzbl %cl,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@S_IXUSR = global i32 0
@S_IXGRP = global i32 0
@S_IXOTH = global i32 0
define void @print_type_indicator(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @S_ISREG(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load i32, i32* %2
%8 = load i32, i32* @S_IXUSR
%9 = load i32, i32* @S_IXGRP
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IXOTH
%12 = or i32 %10, %11
%13 = and i32 %7, %12
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = call i32 @putchar(i8 signext 42)
br label %17
17: ; preds = %15, %6
br label %46
18: ; preds = %1
%19 = load i32, i32* %2
%20 = call i64 @S_ISDIR(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @putchar(i8 signext 47)
br label %45
24: ; preds = %18
%25 = load i32, i32* %2
%26 = call i64 @S_ISLNK(i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @putchar(i8 signext 64)
br label %44
30: ; preds = %24
%31 = load i32, i32* %2
%32 = call i64 @S_ISFIFO(i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @putchar(i8 signext 124)
br label %43
36: ; preds = %30
%37 = load i32, i32* %2
%38 = call i64 @S_ISSOCK(i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @putchar(i8 signext 61)
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42, %34
br label %44
44: ; preds = %43, %28
br label %45
45: ; preds = %44, %22
br label %46
46: ; preds = %45, %17
ret void
}

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