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

/* Variables and functions */
scalar_t__ S_ISBLK(int /*<<< orphan*/);
scalar_t__ S_ISCHR(int /*<<< orphan*/);
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISFIFO(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
int /*<<< orphan*/ S_ISREG(int /*<<< orphan*/);
scalar_t__ S_ISSOCK(int /*<<< orphan*/);
int getFType(mode_t m) {
  int out = 0;
  if (!S_ISREG(m)) {
    if (S_ISBLK(m)) {
      out = -1;
    } else if (S_ISCHR(m)) {
      out = -2;
    } else if (S_ISDIR(m)) {
      out = -3;
    } else if (S_ISFIFO(m)) {
      out = -4;
    } else if (S_ISLNK(m)) {
      out = -5;
    } else if (S_ISSOCK(m)) {
      out = -6;
    }
  }
  return out;
}


x86 assembly (clang, -O0):
<getFType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <S_ISREG@plt>
cmp    $0x0,%eax
jne    1260 <getFType+0xf0>
mov    -0x4(%rbp),%edi
call   1090 <S_ISBLK@plt>
cmp    $0x0,%rax
je     11b1 <getFType+0x41>
movl   $0xffffffff,-0x8(%rbp)
jmp    125b <getFType+0xeb>
mov    -0x4(%rbp),%edi
call   1080 <S_ISCHR@plt>
cmp    $0x0,%rax
je     11cf <getFType+0x5f>
movl   $0xfffffffe,-0x8(%rbp)
jmp    1256 <getFType+0xe6>
mov    -0x4(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11ed <getFType+0x7d>
movl   $0xfffffffd,-0x8(%rbp)
jmp    1251 <getFType+0xe1>
mov    -0x4(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     120b <getFType+0x9b>
movl   $0xfffffffc,-0x8(%rbp)
jmp    124c <getFType+0xdc>
mov    -0x4(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1229 <getFType+0xb9>
movl   $0xfffffffb,-0x8(%rbp)
jmp    1247 <getFType+0xd7>
mov    -0x4(%rbp),%edi
call   1050 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     1242 <getFType+0xd2>
movl   $0xfffffffa,-0x8(%rbp)
jmp    1247 <getFType+0xd7>
jmp    124c <getFType+0xdc>
jmp    1251 <getFType+0xe1>
jmp    1256 <getFType+0xe6>
jmp    125b <getFType+0xeb>
jmp    1260 <getFType+0xf0>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFType>:
push   %rbx
mov    %edi,%ebx
call   1070 <S_ISREG@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1182 <getFType+0x12>
pop    %rbx
ret
mov    %ebx,%edi
call   1090 <S_ISBLK@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1180 <getFType+0x10>
mov    %ebx,%edi
call   1080 <S_ISCHR@plt>
mov    %rax,%rcx
mov    $0xfffffffe,%eax
test   %rcx,%rcx
jne    1180 <getFType+0x10>
mov    %ebx,%edi
call   1060 <S_ISDIR@plt>
mov    %rax,%rcx
mov    $0xfffffffd,%eax
test   %rcx,%rcx
jne    1180 <getFType+0x10>
mov    %ebx,%edi
call   1040 <S_ISFIFO@plt>
mov    %rax,%rcx
mov    $0xfffffffc,%eax
test   %rcx,%rcx
jne    1180 <getFType+0x10>
mov    %ebx,%edi
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
mov    $0xfffffffb,%eax
test   %rcx,%rcx
jne    1180 <getFType+0x10>
mov    %ebx,%edi
call   1050 <S_ISSOCK@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0xfffffffa,%eax
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getFType(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @S_ISREG(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %43, label %7
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i64 @S_ISBLK(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 -1, i32* %3
br label %42
12: ; preds = %7
%13 = load i32, i32* %2
%14 = call i64 @S_ISCHR(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 -2, i32* %3
br label %41
17: ; preds = %12
%18 = load i32, i32* %2
%19 = call i64 @S_ISDIR(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 -3, i32* %3
br label %40
22: ; preds = %17
%23 = load i32, i32* %2
%24 = call i64 @S_ISFIFO(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 -4, i32* %3
br label %39
27: ; preds = %22
%28 = load i32, i32* %2
%29 = call i64 @S_ISLNK(i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 -5, i32* %3
br label %38
32: ; preds = %27
%33 = load i32, i32* %2
%34 = call i64 @S_ISSOCK(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 -6, i32* %3
br label %37
37: ; preds = %36, %32
br label %38
38: ; preds = %37, %31
br label %39
39: ; preds = %38, %26
br label %40
40: ; preds = %39, %21
br label %41
41: ; preds = %40, %16
br label %42
42: ; preds = %41, %11
br label %43
43: ; preds = %42, %1
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @getFType(i32 %0) {
%2 = tail call i32 @S_ISREG(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %23
4: ; preds = %1
%5 = tail call i64 @S_ISBLK(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = tail call i64 @S_ISCHR(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = tail call i64 @S_ISDIR(i32 %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = tail call i64 @S_ISFIFO(i32 %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = tail call i64 @S_ISLNK(i32 %0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = tail call i64 @S_ISSOCK(i32 %0)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i32 0, i32 -6
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i32 [ 0, %1 ], [ -1, %4 ], [ -2, %7 ], [ -3, %10 ], [ -4, %13 ], [ -5, %16 ], [ %22, %19 ]
ret i32 %24
}