#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 const *_long_mode(mode_t mode) {
  static char str[11];
  int i;
  for (i = 0; i < 10; i++)
    str[i] = '-';
  if (mode & S_IRUSR)
    str[1] = 'r';
  if (mode & S_IWUSR)
    str[2] = 'w';
  if (mode & S_IXUSR)
    str[3] = 'x';
  if (mode & S_IRGRP)
    str[4] = 'r';
  if (mode & S_IWGRP)
    str[5] = 'w';
  if (mode & S_IXGRP)
    str[6] = 'x';
  if (mode & S_IROTH)
    str[7] = 'r';
  if (mode & S_IWOTH)
    str[8] = 'w';
  if (mode & S_IXOTH)
    str[9] = 'x';
  str[10] = '\0';
  return str;
}


x86 assembly (clang, -O0):
<_long_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1135 <_long_mode+0x35>
movslq -0x8(%rbp),%rcx
lea    0x2f01(%rip),%rax
movb   $0x2d,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <_long_mode+0xe>
mov    -0x4(%rbp),%eax
mov    0x2e69(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1151 <_long_mode+0x51>
movb   $0x72,0x2ed4(%rip)
mov    -0x4(%rbp),%eax
mov    0x2e75(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     116d <_long_mode+0x6d>
movb   $0x77,0x2eb9(%rip)
mov    -0x4(%rbp),%eax
mov    0x2e69(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1189 <_long_mode+0x89>
movb   $0x78,0x2e9e(%rip)
mov    -0x4(%rbp),%eax
mov    0x2e25(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11a5 <_long_mode+0xa5>
movb   $0x72,0x2e83(%rip)
mov    -0x4(%rbp),%eax
mov    0x2e29(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11c1 <_long_mode+0xc1>
movb   $0x77,0x2e68(%rip)
mov    -0x4(%rbp),%eax
mov    0x2dfd(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11dd <_long_mode+0xdd>
movb   $0x78,0x2e4d(%rip)
mov    -0x4(%rbp),%eax
mov    0x2dc9(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11f9 <_long_mode+0xf9>
movb   $0x72,0x2e32(%rip)
mov    -0x4(%rbp),%eax
mov    0x2d95(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1215 <_long_mode+0x115>
movb   $0x77,0x2e17(%rip)
mov    -0x4(%rbp),%eax
mov    0x2dc9(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1231 <_long_mode+0x131>
movb   $0x78,0x2dfc(%rip)
movb   $0x0,0x2df6(%rip)
lea    0x2de5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_long_mode>:
movabs $0x2d2d2d2d2d2d2d2d,%rax
2d 2d 2d
mov    %rax,0x2f13(%rip)
movw   $0x2d2d,0x2f12(%rip)
2d 2d
mov    0x2e87(%rip),%rax
test   %edi,(%rax)
je     112c <_long_mode+0x2c>
movb   $0x72,0x2ef9(%rip)
mov    0x2e9d(%rip),%rax
test   %edi,(%rax)
je     113e <_long_mode+0x3e>
movb   $0x77,0x2ee8(%rip)
mov    0x2e9b(%rip),%rax
test   %edi,(%rax)
je     1150 <_long_mode+0x50>
movb   $0x78,0x2ed7(%rip)
mov    0x2e61(%rip),%rax
test   %edi,(%rax)
je     1162 <_long_mode+0x62>
movb   $0x72,0x2ec6(%rip)
mov    0x2e6f(%rip),%rax
test   %edi,(%rax)
je     1174 <_long_mode+0x74>
movb   $0x77,0x2eb5(%rip)
mov    0x2e4d(%rip),%rax
test   %edi,(%rax)
je     1186 <_long_mode+0x86>
movb   $0x78,0x2ea4(%rip)
mov    0x2e23(%rip),%rax
test   %edi,(%rax)
je     1198 <_long_mode+0x98>
movb   $0x72,0x2e93(%rip)
mov    0x2df9(%rip),%rax
test   %edi,(%rax)
je     11aa <_long_mode+0xaa>
movb   $0x77,0x2e82(%rip)
mov    0x2e37(%rip),%rax
test   %edi,(%rax)
je     11bc <_long_mode+0xbc>
movb   $0x78,0x2e71(%rip)
movb   $0x0,0x2e6b(%rip)
lea    0x2e5a(%rip),%rax
ret

LLVM IR (-O0):
@_long_mode.str = internal global [11 x i8] zeroinitializer
@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
define i8* @_long_mode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 %9
store i8 45, i8* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %2
%16 = load i32, i32* @S_IRUSR
%17 = and i32 %15, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 1)
br label %20
20: ; preds = %19, %14
%21 = load i32, i32* %2
%22 = load i32, i32* @S_IWUSR
%23 = and i32 %21, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 2)
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %2
%28 = load i32, i32* @S_IXUSR
%29 = and i32 %27, %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 3)
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %2
%34 = load i32, i32* @S_IRGRP
%35 = and i32 %33, %34
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %32
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 4)
br label %38
38: ; preds = %37, %32
%39 = load i32, i32* %2
%40 = load i32, i32* @S_IWGRP
%41 = and i32 %39, %40
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %38
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 5)
br label %44
44: ; preds = %43, %38
%45 = load i32, i32* %2
%46 = load i32, i32* @S_IXGRP
%47 = and i32 %45, %46
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %44
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 6)
br label %50
50: ; preds = %49, %44
%51 = load i32, i32* %2
%52 = load i32, i32* @S_IROTH
%53 = and i32 %51, %52
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %50
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 7)
br label %56
56: ; preds = %55, %50
%57 = load i32, i32* %2
%58 = load i32, i32* @S_IWOTH
%59 = and i32 %57, %58
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %56
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 8)
br label %62
62: ; preds = %61, %56
%63 = load i32, i32* %2
%64 = load i32, i32* @S_IXOTH
%65 = and i32 %63, %64
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %62
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 9)
br label %68
68: ; preds = %67, %62
store i8 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 10)
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 0)
}

LLVM IR (-O2):
@_long_mode.str = internal global [11 x i8] zeroinitializer
@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
define i8* @_long_mode(i32 %0) {
%2 = load i32, i32* @S_IRUSR
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 1)
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* @S_IWUSR
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %6
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 2)
br label %11
11: ; preds = %10, %6
%12 = load i32, i32* @S_IXUSR
%13 = and i32 %12, %0
%14 = icmp eq i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 3)
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* @S_IRGRP
%18 = and i32 %17, %0
%19 = icmp eq i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 4)
br label %21
21: ; preds = %20, %16
%22 = load i32, i32* @S_IWGRP
%23 = and i32 %22, %0
%24 = icmp eq i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 5)
br label %26
26: ; preds = %25, %21
%27 = load i32, i32* @S_IXGRP
%28 = and i32 %27, %0
%29 = icmp eq i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %26
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 6)
br label %31
31: ; preds = %30, %26
%32 = load i32, i32* @S_IROTH
%33 = and i32 %32, %0
%34 = icmp eq i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31
store i8 114, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 7)
br label %36
36: ; preds = %35, %31
%37 = load i32, i32* @S_IWOTH
%38 = and i32 %37, %0
%39 = icmp eq i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
store i8 119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 8)
br label %41
41: ; preds = %40, %36
%42 = load i32, i32* @S_IXOTH
%43 = and i32 %42, %0
%44 = icmp eq i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %41
store i8 120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 9)
br label %46
46: ; preds = %45, %41
store i8 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 10)
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_long_mode.str, i64 0, i64 0)
}