#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 */
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
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 S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void printMode(mode_t mode) {
  char buffer[11];
  buffer[0] = S_ISBLK(mode)    ? 'b'
              : S_ISCHR(mode)  ? 'c'
              : S_ISDIR(mode)  ? 'd'
              : S_ISLNK(mode)  ? 'l'
              : S_ISFIFO(mode) ? 'p'
              : S_ISSOCK(mode) ? 's'
              : S_ISREG(mode)  ? '-'
                               : '?';
  buffer[1] = mode & S_IRUSR ? 'r' : '-';
  buffer[2] = mode & S_IWUSR ? 'w' : '-';
  buffer[3] = mode & S_IXUSR ? 'x' : '-';
  buffer[4] = mode & S_IRGRP ? 'r' : '-';
  buffer[5] = mode & S_IWGRP ? 'w' : '-';
  buffer[6] = mode & S_IXGRP ? 'x' : '-';
  buffer[7] = mode & S_IROTH ? 'r' : '-';
  buffer[8] = mode & S_IWOTH ? 'w' : '-';
  buffer[9] = mode & S_IXOTH ? 'x' : '-';
  buffer[10] = '\0';
  fputs(buffer, stdout);
}


x86 assembly (clang, -O0):
<printMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   10a0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     11aa <printMode+0x2a>
mov    $0x62,%eax
mov    %eax,-0x14(%rbp)
jmp    1282 <printMode+0x102>
mov    -0x4(%rbp),%edi
call   1090 <S_ISCHR@plt>
cmp    $0x0,%rax
je     11c9 <printMode+0x49>
mov    $0x63,%eax
mov    %eax,-0x18(%rbp)
jmp    127c <printMode+0xfc>
mov    -0x4(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11e8 <printMode+0x68>
mov    $0x64,%eax
mov    %eax,-0x1c(%rbp)
jmp    1276 <printMode+0xf6>
mov    -0x4(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1207 <printMode+0x87>
mov    $0x6c,%eax
mov    %eax,-0x20(%rbp)
jmp    1270 <printMode+0xf0>
mov    -0x4(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     1226 <printMode+0xa6>
mov    $0x70,%eax
mov    %eax,-0x24(%rbp)
jmp    126a <printMode+0xea>
mov    -0x4(%rbp),%edi
call   1050 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     1245 <printMode+0xc5>
mov    $0x73,%eax
mov    %eax,-0x28(%rbp)
jmp    1264 <printMode+0xe4>
mov    -0x4(%rbp),%edi
call   1080 <S_ISREG@plt>
mov    %rax,%rdx
mov    $0x3f,%eax
mov    $0x2d,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,-0xf(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2d16(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xe(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2d1f(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2d10(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2cc9(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2cca(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xa(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2c9b(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2c64(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2c25(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2c5e(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
lea    -0xf(%rbp),%rdi
mov    0x2bf2(%rip),%rax
mov    (%rax),%esi
call   1070 <fputs@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMode>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   10a0 <S_ISBLK@plt>
mov    $0x62,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1090 <S_ISCHR@plt>
mov    $0x63,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1060 <S_ISDIR@plt>
mov    $0x64,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1030 <S_ISLNK@plt>
mov    $0x6c,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1040 <S_ISFIFO@plt>
mov    $0x70,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1050 <S_ISSOCK@plt>
mov    $0x73,%cl
test   %rax,%rax
jne    11f0 <printMode+0x70>
mov    %ebx,%edi
call   1080 <S_ISREG@plt>
test   %rax,%rax
mov    $0x3f,%eax
mov    $0x2d,%ecx
cmove  %eax,%ecx
mov    %cl,0x5(%rsp)
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
and    %ebx,%eax
mov    $0x2d,%eax
mov    $0x72,%edx
cmove  %eax,%edx
mov    $0x72,%ecx
mov    %dl,0x6(%rsp)
mov    0x2db4(%rip),%rdx
mov    (%rdx),%edx
and    %ebx,%edx
mov    $0x77,%esi
cmove  %eax,%esi
mov    $0x77,%edx
mov    %sil,0x7(%rsp)
mov    0x2da7(%rip),%rsi
mov    (%rsi),%esi
and    %ebx,%esi
mov    $0x78,%edi
cmove  %eax,%edi
mov    $0x78,%esi
mov    %dil,0x8(%rsp)
mov    0x2d62(%rip),%rdi
mov    (%rdi),%edi
and    %ebx,%edi
mov    $0x72,%edi
cmove  %eax,%edi
mov    %dil,0x9(%rsp)
mov    0x2d6a(%rip),%rdi
mov    (%rdi),%edi
and    %ebx,%edi
mov    $0x77,%edi
cmove  %eax,%edi
mov    %dil,0xa(%rsp)
mov    0x2d42(%rip),%rdi
mov    (%rdi),%edi
and    %ebx,%edi
mov    $0x78,%edi
cmove  %eax,%edi
mov    %dil,0xb(%rsp)
mov    0x2d12(%rip),%rdi
mov    (%rdi),%edi
and    %ebx,%edi
cmove  %eax,%ecx
mov    %cl,0xc(%rsp)
mov    0x2ce0(%rip),%rcx
mov    (%rcx),%ecx
and    %ebx,%ecx
cmove  %eax,%edx
mov    %dl,0xd(%rsp)
mov    0x2d26(%rip),%rcx
and    (%rcx),%ebx
cmove  %eax,%esi
mov    %sil,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    0x2cc8(%rip),%rax
mov    (%rax),%esi
lea    0x5(%rsp),%rdi
call   1070 <fputs@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@stdout = global i32 0
define void @printMode(i32 %0) {
%2 = alloca i32
%3 = alloca [11 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @S_ISBLK(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %49
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i64 @S_ISCHR(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %47
13: ; preds = %8
%14 = load i32, i32* %2
%15 = call i64 @S_ISDIR(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
br label %45
18: ; preds = %13
%19 = load i32, i32* %2
%20 = call i64 @S_ISLNK(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %43
23: ; preds = %18
%24 = load i32, i32* %2
%25 = call i64 @S_ISFIFO(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %41
28: ; preds = %23
%29 = load i32, i32* %2
%30 = call i64 @S_ISSOCK(i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
br label %39
33: ; preds = %28
%34 = load i32, i32* %2
%35 = call i64 @S_ISREG(i32 %34)
%36 = icmp ne i64 %35, 0
%37 = zext i1 %36 to i64
%38 = select i1 %36, i32 45, i32 63
br label %39
39: ; preds = %33, %32
%40 = phi i32 [ 115, %32 ], [ %38, %33 ]
br label %41
41: ; preds = %39, %27
%42 = phi i32 [ 112, %27 ], [ %40, %39 ]
br label %43
43: ; preds = %41, %22
%44 = phi i32 [ 108, %22 ], [ %42, %41 ]
br label %45
45: ; preds = %43, %17
%46 = phi i32 [ 100, %17 ], [ %44, %43 ]
br label %47
47: ; preds = %45, %12
%48 = phi i32 [ 99, %12 ], [ %46, %45 ]
br label %49
49: ; preds = %47, %7
%50 = phi i32 [ 98, %7 ], [ %48, %47 ]
%51 = trunc i32 %50 to i8
%52 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
store i8 %51, i8* %52
%53 = load i32, i32* %2
%54 = load i32, i32* @S_IRUSR
%55 = and i32 %53, %54
%56 = icmp ne i32 %55, 0
%57 = zext i1 %56 to i64
%58 = select i1 %56, i32 114, i32 45
%59 = trunc i32 %58 to i8
%60 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 1
store i8 %59, i8* %60
%61 = load i32, i32* %2
%62 = load i32, i32* @S_IWUSR
%63 = and i32 %61, %62
%64 = icmp ne i32 %63, 0
%65 = zext i1 %64 to i64
%66 = select i1 %64, i32 119, i32 45
%67 = trunc i32 %66 to i8
%68 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 2
store i8 %67, i8* %68
%69 = load i32, i32* %2
%70 = load i32, i32* @S_IXUSR
%71 = and i32 %69, %70
%72 = icmp ne i32 %71, 0
%73 = zext i1 %72 to i64
%74 = select i1 %72, i32 120, i32 45
%75 = trunc i32 %74 to i8
%76 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 3
store i8 %75, i8* %76
%77 = load i32, i32* %2
%78 = load i32, i32* @S_IRGRP
%79 = and i32 %77, %78
%80 = icmp ne i32 %79, 0
%81 = zext i1 %80 to i64
%82 = select i1 %80, i32 114, i32 45
%83 = trunc i32 %82 to i8
%84 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 4
store i8 %83, i8* %84
%85 = load i32, i32* %2
%86 = load i32, i32* @S_IWGRP
%87 = and i32 %85, %86
%88 = icmp ne i32 %87, 0
%89 = zext i1 %88 to i64
%90 = select i1 %88, i32 119, i32 45
%91 = trunc i32 %90 to i8
%92 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 5
store i8 %91, i8* %92
%93 = load i32, i32* %2
%94 = load i32, i32* @S_IXGRP
%95 = and i32 %93, %94
%96 = icmp ne i32 %95, 0
%97 = zext i1 %96 to i64
%98 = select i1 %96, i32 120, i32 45
%99 = trunc i32 %98 to i8
%100 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 6
store i8 %99, i8* %100
%101 = load i32, i32* %2
%102 = load i32, i32* @S_IROTH
%103 = and i32 %101, %102
%104 = icmp ne i32 %103, 0
%105 = zext i1 %104 to i64
%106 = select i1 %104, i32 114, i32 45
%107 = trunc i32 %106 to i8
%108 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 7
store i8 %107, i8* %108
%109 = load i32, i32* %2
%110 = load i32, i32* @S_IWOTH
%111 = and i32 %109, %110
%112 = icmp ne i32 %111, 0
%113 = zext i1 %112 to i64
%114 = select i1 %112, i32 119, i32 45
%115 = trunc i32 %114 to i8
%116 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 8
store i8 %115, i8* %116
%117 = load i32, i32* %2
%118 = load i32, i32* @S_IXOTH
%119 = and i32 %117, %118
%120 = icmp ne i32 %119, 0
%121 = zext i1 %120 to i64
%122 = select i1 %120, i32 120, i32 45
%123 = trunc i32 %122 to i8
%124 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 9
store i8 %123, i8* %124
%125 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
store i8 0, i8* %125
%126 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%127 = load i32, i32* @stdout
%128 = call i32 @fputs(i8* %126, i32 %127)
ret void
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@stdout = global i32 0
define void @printMode(i32 %0) {
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @S_ISBLK(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %25
6: ; preds = %1
%7 = tail call i64 @S_ISCHR(i32 %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = tail call i64 @S_ISDIR(i32 %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = tail call i64 @S_ISLNK(i32 %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = tail call i64 @S_ISFIFO(i32 %0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = tail call i64 @S_ISSOCK(i32 %0)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = tail call i64 @S_ISREG(i32 %0)
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, i8 63, i8 45
br label %25
25: ; preds = %6, %12, %21, %18, %15, %9, %1
%26 = phi i8 [ 98, %1 ], [ 99, %6 ], [ 100, %9 ], [ 108, %12 ], [ 112, %15 ], [ %24, %21 ], [ 115, %18 ]
store i8 %26, i8* %3
%27 = load i32, i32* @S_IRUSR
%28 = and i32 %27, %0
%29 = icmp eq i32 %28, 0
%30 = select i1 %29, i8 45, i8 114
%31 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 1
store i8 %30, i8* %31
%32 = load i32, i32* @S_IWUSR
%33 = and i32 %32, %0
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i8 45, i8 119
%36 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 2
store i8 %35, i8* %36
%37 = load i32, i32* @S_IXUSR
%38 = and i32 %37, %0
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i8 45, i8 120
%41 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 3
store i8 %40, i8* %41
%42 = load i32, i32* @S_IRGRP
%43 = and i32 %42, %0
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i8 45, i8 114
%46 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 4
store i8 %45, i8* %46
%47 = load i32, i32* @S_IWGRP
%48 = and i32 %47, %0
%49 = icmp eq i32 %48, 0
%50 = select i1 %49, i8 45, i8 119
%51 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 5
store i8 %50, i8* %51
%52 = load i32, i32* @S_IXGRP
%53 = and i32 %52, %0
%54 = icmp eq i32 %53, 0
%55 = select i1 %54, i8 45, i8 120
%56 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 6
store i8 %55, i8* %56
%57 = load i32, i32* @S_IROTH
%58 = and i32 %57, %0
%59 = icmp eq i32 %58, 0
%60 = select i1 %59, i8 45, i8 114
%61 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 7
store i8 %60, i8* %61
%62 = load i32, i32* @S_IWOTH
%63 = and i32 %62, %0
%64 = icmp eq i32 %63, 0
%65 = select i1 %64, i8 45, i8 119
%66 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 8
store i8 %65, i8* %66
%67 = load i32, i32* @S_IXOTH
%68 = and i32 %67, %0
%69 = icmp eq i32 %68, 0
%70 = select i1 %69, i8 45, i8 120
%71 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 9
store i8 %70, i8* %71
%72 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
store i8 0, i8* %72
%73 = load i32, i32* @stdout
%74 = call i32 @fputs(i8* %3, i32 %73)
ret void
}