#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 */
int /*<<< orphan*/ strcpy(char *, char *);
char *dispPerm2Mode(char c, char *out) {
  strcpy(out, "---");
  if (c == '7') {
    strcpy(out, "rwx");
  }
  if (c == '6') {
    strcpy(out, "rw-");
  }
  if (c == '5') {
    strcpy(out, "r-x");
  }
  if (c == '4') {
    strcpy(out, "r--");
  }
  if (c == '3') {
    strcpy(out, "-wx");
  }
  if (c == '2') {
    strcpy(out, "-w-");
  }
  if (c == '1') {
    strcpy(out, "--x");
  }
  return out;
}


x86 assembly (clang, -O0):
<dispPerm2Mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed3(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x37,%eax
jne    114f <dispPerm2Mode+0x3f>
mov    -0x10(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x36,%eax
jne    116c <dispPerm2Mode+0x5c>
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x35,%eax
jne    1189 <dispPerm2Mode+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x34,%eax
jne    11a6 <dispPerm2Mode+0x96>
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x33,%eax
jne    11c3 <dispPerm2Mode+0xb3>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x32,%eax
jne    11e0 <dispPerm2Mode+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1030 <strcpy@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x31,%eax
jne    11fd <dispPerm2Mode+0xed>
mov    -0x10(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispPerm2Mode>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0xcf,%bpl
cmp    $0x6,%bpl
ja     114b <dispPerm2Mode+0x3b>
movsbq %bpl,%rax
lea    0xee4(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"---\00"
@.str.1 = [4 x i8] c"rwx\00"
@.str.2 = [4 x i8] c"rw-\00"
@.str.3 = [4 x i8] c"r-x\00"
@.str.4 = [4 x i8] c"r--\00"
@.str.5 = [4 x i8] c"-wx\00"
@.str.6 = [4 x i8] c"-w-\00"
@.str.7 = [4 x i8] c"--x\00"
define i8* @dispPerm2Mode(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 55
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %2
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 54
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %17, %13
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 53
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %24, %20
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 52
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i8*, i8** %4
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %31, %27
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 51
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i8*, i8** %4
%40 = call i32 @strcpy(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %38, %34
%42 = load i8, i8* %3
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 50
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i8*, i8** %4
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %48
48: ; preds = %45, %41
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 49
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i8*, i8** %4
%54 = call i32 @strcpy(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %55
55: ; preds = %52, %48
%56 = load i8*, i8** %4
ret i8* %56
}

LLVM IR (-O2):
@.str = [4 x i8] c"---\00"
@.str.1 = [4 x i8] c"rwx\00"
@.str.2 = [4 x i8] c"rw-\00"
@.str.3 = [4 x i8] c"r-x\00"
@.str.4 = [4 x i8] c"r--\00"
@.str.5 = [4 x i8] c"-wx\00"
@.str.6 = [4 x i8] c"-w-\00"
@.str.7 = [4 x i8] c"--x\00"
@reltable.dispPerm2Mode = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.dispPerm2Mode to i64)) to i32)]
define i8* @dispPerm2Mode(i8 signext %0, i8* returned %1) {
%3 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = add i8 %0, -49
%5 = icmp ult i8 %4, 7
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = sext i8 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.dispPerm2Mode to i8*), i64 %8)
%10 = tail call i32 @strcpy(i8* %1, i8* %9)
br label %11
11: ; preds = %2, %6
ret i8* %1
}