#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 */
scalar_t__ S_ISBLK(int);
scalar_t__ S_ISCHR(int);
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 /*<<< orphan*/ printf(char *);
void print_file_type(int mode) {
  if (S_ISREG(mode)) {
    printf("-");
  }
  if (S_ISDIR(mode)) {
    printf("d");
  }
  if (S_ISCHR(mode)) {
    printf("b");
  }
  if (S_ISBLK(mode)) {
    printf("c");
  }
  if (S_ISFIFO(mode)) {
    printf("p");
  }
  if (S_ISLNK(mode)) {
    printf("l");
  }
  if (S_ISSOCK(mode)) {
    printf("s");
  }
}


x86 assembly (clang, -O0):
<print_file_type>:
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     11a9 <print_file_type+0x29>
lea    0xe5c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11c7 <print_file_type+0x47>
lea    0xe40(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1090 <S_ISCHR@plt>
cmp    $0x0,%rax
je     11e5 <print_file_type+0x65>
lea    0xe24(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     1203 <print_file_type+0x83>
lea    0xe08(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     1221 <print_file_type+0xa1>
lea    0xdec(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     123f <print_file_type+0xbf>
lea    0xdd0(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     125d <print_file_type+0xdd>
lea    0xdb4(%rip),%rdi
call   1060 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_file_type>:
push   %rbx
mov    %edi,%ebx
call   1080 <S_ISREG@plt>
test   %rax,%rax
je     1197 <print_file_type+0x17>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1070 <S_ISDIR@plt>
test   %rax,%rax
je     11ad <print_file_type+0x2d>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1090 <S_ISCHR@plt>
test   %rax,%rax
je     11c3 <print_file_type+0x43>
mov    $0x62,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   10a0 <S_ISBLK@plt>
test   %rax,%rax
je     11d9 <print_file_type+0x59>
mov    $0x63,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1050 <S_ISFIFO@plt>
test   %rax,%rax
je     11ef <print_file_type+0x6f>
mov    $0x70,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1040 <S_ISLNK@plt>
test   %rax,%rax
je     1205 <print_file_type+0x85>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1060 <S_ISSOCK@plt>
test   %rax,%rax
je     121c <print_file_type+0x9c>
mov    $0x73,%edi
pop    %rbx
jmp    1030 <putchar@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [2 x i8] c"b\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [2 x i8] c"p\00"
@.str.5 = [2 x i8] c"l\00"
@.str.6 = [2 x i8] c"s\00"
define void @print_file_type(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 %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = call i64 @S_ISDIR(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* %2
%16 = call i64 @S_ISCHR(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %2
%22 = call i64 @S_ISBLK(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %2
%28 = call i64 @S_ISFIFO(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = load i32, i32* %2
%34 = call i64 @S_ISLNK(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = load i32, i32* %2
%40 = call i64 @S_ISSOCK(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
ret void
}

LLVM IR (-O2):
define void @print_file_type(i32 %0) {
%2 = tail call i64 @S_ISREG(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @putchar(i32 45)
br label %6
6: ; preds = %4, %1
%7 = tail call i64 @S_ISDIR(i32 %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @putchar(i32 100)
br label %11
11: ; preds = %9, %6
%12 = tail call i64 @S_ISCHR(i32 %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @putchar(i32 98)
br label %16
16: ; preds = %14, %11
%17 = tail call i64 @S_ISBLK(i32 %0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @putchar(i32 99)
br label %21
21: ; preds = %19, %16
%22 = tail call i64 @S_ISFIFO(i32 %0)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @putchar(i32 112)
br label %26
26: ; preds = %24, %21
%27 = tail call i64 @S_ISLNK(i32 %0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = tail call i32 @putchar(i32 108)
br label %31
31: ; preds = %29, %26
%32 = tail call i64 @S_ISSOCK(i32 %0)
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = tail call i32 @putchar(i32 115)
br label %36
36: ; preds = %34, %31
ret void
}