#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_ISSOCK(int);
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
char classify(mode_t mode) {
  if (S_ISDIR(mode)) {
    return '/';
  }
  if (S_ISLNK(mode)) {
    return '@';
  }
  if (S_ISFIFO(mode)) {
    return '|';
  }
  if (S_ISSOCK(mode)) {
    return '=';
  }
  if (mode & S_IXUSR || mode & S_IXGRP || mode & S_IXOTH) {
    return '*';
  }
  return '\0';
}


x86 assembly (clang, -O0):
<classify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1166 <classify+0x26>
movb   $0x2f,-0x1(%rbp)
jmp    1203 <classify+0xc3>
mov    -0x8(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1181 <classify+0x41>
movb   $0x40,-0x1(%rbp)
jmp    1203 <classify+0xc3>
mov    -0x8(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     119c <classify+0x5c>
movb   $0x7c,-0x1(%rbp)
jmp    1203 <classify+0xc3>
mov    -0x8(%rbp),%edi
call   1050 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     11b7 <classify+0x77>
movb   $0x3d,-0x1(%rbp)
jmp    1203 <classify+0xc3>
mov    -0x8(%rbp),%eax
mov    0x2e1f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    11f6 <classify+0xb6>
mov    -0x8(%rbp),%eax
mov    0x2e02(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    11f6 <classify+0xb6>
mov    -0x8(%rbp),%eax
mov    0x2dfd(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11ff <classify+0xbf>
movb   $0x2a,-0x1(%rbp)
jmp    1203 <classify+0xc3>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<classify>:
push   %rbx
mov    %edi,%ebx
call   1060 <S_ISDIR@plt>
mov    %rax,%rcx
mov    $0x2f,%al
test   %rcx,%rcx
je     1154 <classify+0x14>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
mov    $0x40,%al
test   %rcx,%rcx
jne    1152 <classify+0x12>
mov    %ebx,%edi
call   1040 <S_ISFIFO@plt>
mov    %rax,%rcx
mov    $0x7c,%al
test   %rcx,%rcx
jne    1152 <classify+0x12>
mov    %ebx,%edi
call   1050 <S_ISSOCK@plt>
mov    %rax,%rcx
mov    $0x3d,%al
test   %rcx,%rcx
jne    1152 <classify+0x12>
mov    0x2e52(%rip),%rcx
mov    $0x2a,%al
test   %ebx,(%rcx)
jne    1152 <classify+0x12>
mov    0x2e3d(%rip),%rcx
test   %ebx,(%rcx)
jne    1152 <classify+0x12>
mov    0x2e42(%rip),%rax
and    (%rax),%ebx
mov    $0x2a,%eax
cmove  %ebx,%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 @classify(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @S_ISDIR(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 47, i8* %2
br label %40
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i64 @S_ISLNK(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 64, i8* %2
br label %40
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 %40
18: ; preds = %13
%19 = load i32, i32* %3
%20 = call i64 @S_ISSOCK(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 61, i8* %2
br label %40
23: ; preds = %18
%24 = load i32, i32* %3
%25 = load i32, i32* @S_IXUSR
%26 = and i32 %24, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %38, label %28
28: ; preds = %23
%29 = load i32, i32* %3
%30 = load i32, i32* @S_IXGRP
%31 = and i32 %29, %30
%32 = icmp ne i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %28
%34 = load i32, i32* %3
%35 = load i32, i32* @S_IXOTH
%36 = and i32 %34, %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33, %28, %23
store i8 42, i8* %2
br label %40
39: ; preds = %33
store i8 0, i8* %2
br label %40
40: ; preds = %39, %38, %22, %17, %12, %7
%41 = load i8, i8* %2
ret i8 %41
}

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