#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;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
char *fileacc(mode_t mode) {
  static char acess[10] = "---------";
  acess[0] = (mode & S_IROTH) ? 'r' : '-';
  acess[1] = (mode & S_IWOTH) ? 'w' : '-';
  acess[2] = (mode & S_IXOTH) ? 'x' : '-';
  acess[3] = (mode & S_IRGRP) ? 'r' : '-';
  acess[4] = (mode & S_IWGRP) ? 'w' : '-';
  acess[5] = (mode & S_IXGRP) ? 'x' : '-';
  acess[6] = (mode & S_IRUSR) ? 'r' : '-';
  acess[7] = (mode & S_IWUSR) ? 'w' : '-';
  acess[8] = (mode & S_IXUSR) ? 'x' : '-';
  return (acess);
}


x86 assembly (clang, -O0):
<fileacc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2e9f(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2ef7(%rip)
mov    -0x4(%rbp),%edx
mov    0x2e65(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2ed6(%rip)
mov    -0x4(%rbp),%edx
mov    0x2e93(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2eb5(%rip)
mov    -0x4(%rbp),%edx
mov    0x2e41(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2e94(%rip)
mov    -0x4(%rbp),%edx
mov    0x2e3f(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2e73(%rip)
mov    -0x4(%rbp),%edx
mov    0x2e0d(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2e52(%rip)
mov    -0x4(%rbp),%edx
mov    0x2dcb(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2e31(%rip)
mov    -0x4(%rbp),%edx
mov    0x2dd1(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2e10(%rip)
mov    -0x4(%rbp),%edx
mov    0x2dbf(%rip),%rax
and    (%rax),%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,0x2def(%rip)
lea    0x2de0(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileacc>:
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
and    %edi,%eax
mov    $0x2d,%ecx
mov    $0x72,%r8d
mov    $0x72,%eax
cmove  %ecx,%eax
mov    %al,0x2efc(%rip)
lea    0x2ef5(%rip),%rax
mov    0x2e66(%rip),%rsi
mov    (%rsi),%esi
and    %edi,%esi
mov    $0x77,%r9d
mov    $0x77,%edx
cmove  %ecx,%edx
mov    %dl,0x2ed7(%rip)
mov    0x2e97(%rip),%rdx
mov    (%rdx),%edx
and    %edi,%edx
mov    $0x78,%edx
cmove  %ecx,%edx
mov    %dl,0x2ebf(%rip)
mov    0x2e4e(%rip),%rdx
mov    (%rdx),%edx
and    %edi,%edx
mov    $0x72,%edx
cmove  %ecx,%edx
mov    0x2e5b(%rip),%rsi
mov    (%rsi),%esi
and    %edi,%esi
mov    $0x77,%esi
cmove  %ecx,%esi
mov    %dl,0x2e94(%rip)
mov    %sil,0x2e8e(%rip)
mov    0x2e2b(%rip),%rdx
mov    (%rdx),%edx
and    %edi,%edx
mov    $0x78,%edx
cmove  %ecx,%edx
mov    $0x78,%esi
mov    %dl,0x2e71(%rip)
mov    0x2ded(%rip),%rdx
mov    (%rdx),%edx
and    %edi,%edx
cmove  %ecx,%r8d
mov    0x2e06(%rip),%rdx
mov    (%rdx),%edx
and    %edi,%edx
cmove  %ecx,%r9d
mov    %r8b,0x2e4d(%rip)
mov    0x2e00(%rip),%rdx
and    (%rdx),%edi
mov    %r9b,0x2e3e(%rip)
cmove  %ecx,%esi
mov    %sil,0x2e35(%rip)
ret

LLVM IR (-O0):
@fileacc.acess = internal global [10 x i8] c"---------\00"
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
define i8* @fileacc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @S_IROTH
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 114, i32 45
%9 = trunc i32 %8 to i8
store i8 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 0)
%10 = load i32, i32* %2
%11 = load i32, i32* @S_IWOTH
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 119, i32 45
%16 = trunc i32 %15 to i8
store i8 %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 1)
%17 = load i32, i32* %2
%18 = load i32, i32* @S_IXOTH
%19 = and i32 %17, %18
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 120, i32 45
%23 = trunc i32 %22 to i8
store i8 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 2)
%24 = load i32, i32* %2
%25 = load i32, i32* @S_IRGRP
%26 = and i32 %24, %25
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 114, i32 45
%30 = trunc i32 %29 to i8
store i8 %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 3)
%31 = load i32, i32* %2
%32 = load i32, i32* @S_IWGRP
%33 = and i32 %31, %32
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i32 119, i32 45
%37 = trunc i32 %36 to i8
store i8 %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 4)
%38 = load i32, i32* %2
%39 = load i32, i32* @S_IXGRP
%40 = and i32 %38, %39
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i64
%43 = select i1 %41, i32 120, i32 45
%44 = trunc i32 %43 to i8
store i8 %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 5)
%45 = load i32, i32* %2
%46 = load i32, i32* @S_IRUSR
%47 = and i32 %45, %46
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 114, i32 45
%51 = trunc i32 %50 to i8
store i8 %51, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 6)
%52 = load i32, i32* %2
%53 = load i32, i32* @S_IWUSR
%54 = and i32 %52, %53
%55 = icmp ne i32 %54, 0
%56 = zext i1 %55 to i64
%57 = select i1 %55, i32 119, i32 45
%58 = trunc i32 %57 to i8
store i8 %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 7)
%59 = load i32, i32* %2
%60 = load i32, i32* @S_IXUSR
%61 = and i32 %59, %60
%62 = icmp ne i32 %61, 0
%63 = zext i1 %62 to i64
%64 = select i1 %62, i32 120, i32 45
%65 = trunc i32 %64 to i8
store i8 %65, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 8)
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 0)
}

LLVM IR (-O2):
@fileacc.acess = internal global [10 x i8] c"---------\00"
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
define i8* @fileacc(i32 %0) {
%2 = load i32, i32* @S_IROTH
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8 45, i8 114
store i8 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 0)
%6 = load i32, i32* @S_IWOTH
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8 45, i8 119
store i8 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 1)
%10 = load i32, i32* @S_IXOTH
%11 = and i32 %10, %0
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8 45, i8 120
store i8 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 2)
%14 = load i32, i32* @S_IRGRP
%15 = and i32 %14, %0
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8 45, i8 114
store i8 %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 3)
%18 = load i32, i32* @S_IWGRP
%19 = and i32 %18, %0
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8 45, i8 119
store i8 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 4)
%22 = load i32, i32* @S_IXGRP
%23 = and i32 %22, %0
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i8 45, i8 120
store i8 %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 5)
%26 = load i32, i32* @S_IRUSR
%27 = and i32 %26, %0
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i8 45, i8 114
store i8 %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 6)
%30 = load i32, i32* @S_IWUSR
%31 = and i32 %30, %0
%32 = icmp eq i32 %31, 0
%33 = select i1 %32, i8 45, i8 119
store i8 %33, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 7)
%34 = load i32, i32* @S_IXUSR
%35 = and i32 %34, %0
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i8 45, i8 120
store i8 %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 8)
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @fileacc.acess, i64 0, i64 0)
}