#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 */
struct stat {
  int st_mode;
};
typedef int mode_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
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);
int S_ISGID;
scalar_t__ S_ISLNK(int);
scalar_t__ S_ISREG(int);
scalar_t__ S_ISSOCK(int);
int S_ISUID;
int S_ISVTX;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
char *calloc(int, int);
int /*<<< orphan*/ strcat(char *, char *);
int myls_get_permission(struct stat *filename_stat, char **result_str) {
  mode_t filemode;
  char *str = calloc(11, sizeof(char));
  if (str == NULL)
    return EXIT_FAILURE;
  filemode = filename_stat->st_mode;
  str[0] = '\0';
  if (S_ISREG(filemode))
    strcat(str, "-");
  if (S_ISDIR(filemode))
    strcat(str, "d");
  if (S_ISCHR(filemode))
    strcat(str, "c");
  if (S_ISBLK(filemode))
    strcat(str, "b");
  if (S_ISFIFO(filemode))
    strcat(str, "p");
  if (S_ISLNK(filemode))
    strcat(str, "l");
  if (S_ISSOCK(filemode))
    strcat(str, "s");
  if (S_IRUSR & filemode)
    strcat(str, "r");
  else
    strcat(str, "-");
  if (S_IWUSR & filemode)
    strcat(str, "w");
  else
    strcat(str, "-");
  if (S_ISUID & filemode)
    strcat(str, "s");
  else if (S_IXUSR & filemode)
    strcat(str, "x");
  else
    strcat(str, "-");
  if (S_IRGRP & filemode)
    strcat(str, "r");
  else
    strcat(str, "-");
  if (S_IWGRP & filemode)
    strcat(str, "w");
  else
    strcat(str, "-");
  if (S_ISGID & filemode)
    strcat(str, "s");
  else if (S_IXGRP & filemode)
    strcat(str, "x");
  else
    strcat(str, "-");
  if (S_IROTH & filemode)
    strcat(str, "r");
  else
    strcat(str, "-");
  if (S_IWOTH & filemode)
    strcat(str, "w");
  else
    strcat(str, "-");
  if (S_ISVTX & filemode)
    strcat(str, "s");
  else if (S_IXOTH & filemode)
    strcat(str, "x");
  else
    strcat(str, "-");
  *result_str = str;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<myls_get_permission>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0xb,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11cf <myls_get_permission+0x3f>
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    157b <myls_get_permission+0x3eb>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1c(%rbp),%edi
call   1080 <S_ISREG@plt>
cmp    $0x0,%rax
je     1201 <myls_get_permission+0x71>
mov    -0x28(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1223 <myls_get_permission+0x93>
mov    -0x28(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   1090 <S_ISCHR@plt>
cmp    $0x0,%rax
je     1245 <myls_get_permission+0xb5>
mov    -0x28(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     1267 <myls_get_permission+0xd7>
mov    -0x28(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     1289 <myls_get_permission+0xf9>
mov    -0x28(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     12ab <myls_get_permission+0x11b>
mov    -0x28(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1c(%rbp),%edi
call   1050 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     12cd <myls_get_permission+0x13d>
mov    -0x28(%rbp),%rdi
lea    0xd44(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2cb4(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     12f7 <myls_get_permission+0x167>
mov    -0x28(%rbp),%rdi
lea    0xd21(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1307 <myls_get_permission+0x177>
mov    -0x28(%rbp),%rdi
lea    0xcfe(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     1331 <myls_get_permission+0x1a1>
mov    -0x28(%rbp),%rdi
lea    0xce9(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1341 <myls_get_permission+0x1b1>
mov    -0x28(%rbp),%rdi
lea    0xcc4(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2c88(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     136b <myls_get_permission+0x1db>
mov    -0x28(%rbp),%rdi
lea    0xcab(%rip),%rsi
call   10b0 <strcat@plt>
jmp    13aa <myls_get_permission+0x21a>
mov    0x2c66(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     1395 <myls_get_permission+0x205>
mov    -0x28(%rbp),%rdi
lea    0xc87(%rip),%rsi
call   10b0 <strcat@plt>
jmp    13a5 <myls_get_permission+0x215>
mov    -0x28(%rbp),%rdi
lea    0xc60(%rip),%rsi
call   10b0 <strcat@plt>
jmp    13aa <myls_get_permission+0x21a>
mov    0x2bef(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     13d4 <myls_get_permission+0x244>
mov    -0x28(%rbp),%rdi
lea    0xc44(%rip),%rsi
call   10b0 <strcat@plt>
jmp    13e4 <myls_get_permission+0x254>
mov    -0x28(%rbp),%rdi
lea    0xc21(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2bdd(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     140e <myls_get_permission+0x27e>
mov    -0x28(%rbp),%rdi
lea    0xc0c(%rip),%rsi
call   10b0 <strcat@plt>
jmp    141e <myls_get_permission+0x28e>
mov    -0x28(%rbp),%rdi
lea    0xbe7(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2b83(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     1448 <myls_get_permission+0x2b8>
mov    -0x28(%rbp),%rdi
lea    0xbce(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1487 <myls_get_permission+0x2f7>
mov    0x2b69(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     1472 <myls_get_permission+0x2e2>
mov    -0x28(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1482 <myls_get_permission+0x2f2>
mov    -0x28(%rbp),%rdi
lea    0xb83(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1487 <myls_get_permission+0x2f7>
mov    0x2b0a(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     14b1 <myls_get_permission+0x321>
mov    -0x28(%rbp),%rdi
lea    0xb67(%rip),%rsi
call   10b0 <strcat@plt>
jmp    14c1 <myls_get_permission+0x331>
mov    -0x28(%rbp),%rdi
lea    0xb44(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2aa8(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     14eb <myls_get_permission+0x35b>
mov    -0x28(%rbp),%rdi
lea    0xb2f(%rip),%rsi
call   10b0 <strcat@plt>
jmp    14fb <myls_get_permission+0x36b>
mov    -0x28(%rbp),%rdi
lea    0xb0a(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2ae6(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     1525 <myls_get_permission+0x395>
mov    -0x28(%rbp),%rdi
lea    0xaf1(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1564 <myls_get_permission+0x3d4>
mov    0x2ab4(%rip),%rax
mov    (%rax),%eax
and    -0x1c(%rbp),%eax
cmp    $0x0,%eax
je     154f <myls_get_permission+0x3bf>
mov    -0x28(%rbp),%rdi
lea    0xacd(%rip),%rsi
call   10b0 <strcat@plt>
jmp    155f <myls_get_permission+0x3cf>
mov    -0x28(%rbp),%rdi
lea    0xaa6(%rip),%rsi
call   10b0 <strcat@plt>
jmp    1564 <myls_get_permission+0x3d4>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2a0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myls_get_permission>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xb,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
test   %rax,%rax
je     13db <myls_get_permission+0x24b>
mov    %rax,%r12
mov    (%rbx),%ebp
mov    %ebp,%edi
call   1080 <S_ISREG@plt>
test   %rax,%rax
je     11d9 <myls_get_permission+0x49>
lea    0xe2f(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %ebp,%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
je     11f4 <myls_get_permission+0x64>
lea    0xe16(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %ebp,%edi
call   1090 <S_ISCHR@plt>
test   %rax,%rax
je     120f <myls_get_permission+0x7f>
lea    0xdfd(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %ebp,%edi
call   10a0 <S_ISBLK@plt>
test   %rax,%rax
je     122a <myls_get_permission+0x9a>
lea    0xde4(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %ebp,%edi
call   1040 <S_ISFIFO@plt>
test   %rax,%rax
je     1245 <myls_get_permission+0xb5>
lea    0xdcb(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %ebp,%edi
call   1030 <S_ISLNK@plt>
test   %rax,%rax
je     1260 <myls_get_permission+0xd0>
lea    0xdb2(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %r14,(%rsp)
mov    %ebp,%edi
call   1050 <S_ISSOCK@plt>
test   %rax,%rax
je     127f <myls_get_permission+0xef>
lea    0xd95(%rip),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2d02(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
lea    0xd6f(%rip),%r14
lea    0xd76(%rip),%r15
mov    %r15,%rsi
cmove  %r14,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
lea    0xd57(%rip),%r13
mov    %r13,%rsi
cmove  %r14,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2d01(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    0x2cfe(%rip),%rcx
mov    (%rcx),%ecx
and    %ebp,%ecx
lea    0xd2d(%rip),%rbx
mov    %rbx,%rsi
cmove  %r14,%rsi
test   %eax,%eax
lea    0xd17(%rip),%rax
cmovne %rax,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    %r15,%rsi
cmove  %r14,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    %r13,%rsi
cmove  %r14,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2c6c(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    0x2c71(%rip),%rcx
mov    (%rcx),%ecx
and    %ebp,%ecx
mov    %rbx,%rsi
cmove  %r14,%rsi
test   %eax,%eax
lea    0xcb1(%rip),%rax
cmovne %rax,%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    0x2c2a(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
cmove  %r14,%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   10b0 <strcat@plt>
mov    0x2be8(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
cmove  %r14,%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <strcat@plt>
mov    0x2c46(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    0x2c33(%rip),%rcx
and    (%rcx),%ebp
cmove  %r14,%rbx
test   %eax,%eax
lea    0xc50(%rip),%rax
cmovne %rax,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   10b0 <strcat@plt>
mov    (%rsp),%rax
mov    %r12,(%rax)
mov    0x2ba7(%rip),%rax
jmp    13e2 <myls_get_permission+0x252>
mov    0x2bae(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [2 x i8] c"b\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"
@S_IRUSR = global i32 0
@.str.7 = [2 x i8] c"r\00"
@S_IWUSR = global i32 0
@.str.8 = [2 x i8] c"w\00"
@S_ISUID = global i32 0
@S_IXUSR = global i32 0
@.str.9 = [2 x i8] c"x\00"
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_ISGID = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_ISVTX = global i32 0
@S_IXOTH = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @myls_get_permission(%struct.stat* %0, i8** %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store %struct.stat* %0, %struct.stat** %4
store i8** %1, i8*** %5
%8 = call i8* @calloc(i32 11, i32 1)
store i8* %8, i8** %7
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %197
13: ; preds = %2
%14 = load %struct.stat*, %struct.stat** %4
%15 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%16 = load i32, i32* %15
store i32 %16, i32* %6
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 0, i8* %18
%19 = load i32, i32* %6
%20 = call i64 @S_ISREG(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = load i8*, i8** %7
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %22, %13
%26 = load i32, i32* %6
%27 = call i64 @S_ISDIR(i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i8*, i8** %7
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %29, %25
%33 = load i32, i32* %6
%34 = call i64 @S_ISCHR(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %7
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %36, %32
%40 = load i32, i32* %6
%41 = call i64 @S_ISBLK(i32 %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i8*, i8** %7
%45 = call i32 @strcat(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %43, %39
%47 = load i32, i32* %6
%48 = call i64 @S_ISFIFO(i32 %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i8*, i8** %7
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %50, %46
%54 = load i32, i32* %6
%55 = call i64 @S_ISLNK(i32 %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load i8*, i8** %7
%59 = call i32 @strcat(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %57, %53
%61 = load i32, i32* %6
%62 = call i64 @S_ISSOCK(i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i8*, i8** %7
%66 = call i32 @strcat(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %64, %60
%68 = load i32, i32* @S_IRUSR
%69 = load i32, i32* %6
%70 = and i32 %68, %69
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %67
%73 = load i8*, i8** %7
%74 = call i32 @strcat(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %78
75: ; preds = %67
%76 = load i8*, i8** %7
%77 = call i32 @strcat(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %78
78: ; preds = %75, %72
%79 = load i32, i32* @S_IWUSR
%80 = load i32, i32* %6
%81 = and i32 %79, %80
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %78
%84 = load i8*, i8** %7
%85 = call i32 @strcat(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %89
86: ; preds = %78
%87 = load i8*, i8** %7
%88 = call i32 @strcat(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %89
89: ; preds = %86, %83
%90 = load i32, i32* @S_ISUID
%91 = load i32, i32* %6
%92 = and i32 %90, %91
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %89
%95 = load i8*, i8** %7
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %109
97: ; preds = %89
%98 = load i32, i32* @S_IXUSR
%99 = load i32, i32* %6
%100 = and i32 %98, %99
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %97
%103 = load i8*, i8** %7
%104 = call i32 @strcat(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %108
105: ; preds = %97
%106 = load i8*, i8** %7
%107 = call i32 @strcat(i8* %106, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %108
108: ; preds = %105, %102
br label %109
109: ; preds = %108, %94
%110 = load i32, i32* @S_IRGRP
%111 = load i32, i32* %6
%112 = and i32 %110, %111
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %109
%115 = load i8*, i8** %7
%116 = call i32 @strcat(i8* %115, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %120
117: ; preds = %109
%118 = load i8*, i8** %7
%119 = call i32 @strcat(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %120
120: ; preds = %117, %114
%121 = load i32, i32* @S_IWGRP
%122 = load i32, i32* %6
%123 = and i32 %121, %122
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %128
125: ; preds = %120
%126 = load i8*, i8** %7
%127 = call i32 @strcat(i8* %126, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %131
128: ; preds = %120
%129 = load i8*, i8** %7
%130 = call i32 @strcat(i8* %129, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %131
131: ; preds = %128, %125
%132 = load i32, i32* @S_ISGID
%133 = load i32, i32* %6
%134 = and i32 %132, %133
%135 = icmp ne i32 %134, 0
br i1 %135, label %136, label %139
136: ; preds = %131
%137 = load i8*, i8** %7
%138 = call i32 @strcat(i8* %137, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %151
139: ; preds = %131
%140 = load i32, i32* @S_IXGRP
%141 = load i32, i32* %6
%142 = and i32 %140, %141
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %139
%145 = load i8*, i8** %7
%146 = call i32 @strcat(i8* %145, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %150
147: ; preds = %139
%148 = load i8*, i8** %7
%149 = call i32 @strcat(i8* %148, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %150
150: ; preds = %147, %144
br label %151
151: ; preds = %150, %136
%152 = load i32, i32* @S_IROTH
%153 = load i32, i32* %6
%154 = and i32 %152, %153
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %159
156: ; preds = %151
%157 = load i8*, i8** %7
%158 = call i32 @strcat(i8* %157, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %162
159: ; preds = %151
%160 = load i8*, i8** %7
%161 = call i32 @strcat(i8* %160, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %162
162: ; preds = %159, %156
%163 = load i32, i32* @S_IWOTH
%164 = load i32, i32* %6
%165 = and i32 %163, %164
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %170
167: ; preds = %162
%168 = load i8*, i8** %7
%169 = call i32 @strcat(i8* %168, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %173
170: ; preds = %162
%171 = load i8*, i8** %7
%172 = call i32 @strcat(i8* %171, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %173
173: ; preds = %170, %167
%174 = load i32, i32* @S_ISVTX
%175 = load i32, i32* %6
%176 = and i32 %174, %175
%177 = icmp ne i32 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %173
%179 = load i8*, i8** %7
%180 = call i32 @strcat(i8* %179, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %193
181: ; preds = %173
%182 = load i32, i32* @S_IXOTH
%183 = load i32, i32* %6
%184 = and i32 %182, %183
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %189
186: ; preds = %181
%187 = load i8*, i8** %7
%188 = call i32 @strcat(i8* %187, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %192
189: ; preds = %181
%190 = load i8*, i8** %7
%191 = call i32 @strcat(i8* %190, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %192
192: ; preds = %189, %186
br label %193
193: ; preds = %192, %178
%194 = load i8*, i8** %7
%195 = load i8**, i8*** %5
store i8* %194, i8** %195
%196 = load i32, i32* @EXIT_SUCCESS
store i32 %196, i32* %3
br label %197
197: ; preds = %193, %11
%198 = load i32, i32* %3
ret i32 %198
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"d\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [2 x i8] c"b\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"
@S_IRUSR = global i32 0
@.str.7 = [2 x i8] c"r\00"
@S_IWUSR = global i32 0
@.str.8 = [2 x i8] c"w\00"
@S_ISUID = global i32 0
@S_IXUSR = global i32 0
@.str.9 = [2 x i8] c"x\00"
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_ISGID = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_ISVTX = global i32 0
@S_IXOTH = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @myls_get_permission(%struct.stat* nocapture %0, i8** nocapture writeonly %1) {
%3 = tail call dereferenceable_or_null(11) i8* @calloc(i32 11, i32 1)
%4 = icmp eq i8* %3, null
br i1 %4, label %100, label %5
5: ; preds = %2
%6 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i64 @S_ISREG(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %5
%13 = tail call i64 @S_ISDIR(i32 %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = tail call i64 @S_ISCHR(i32 %7)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = tail call i64 @S_ISBLK(i32 %7)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = tail call i64 @S_ISFIFO(i32 %7)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i64 @S_ISLNK(i32 %7)
%34 = icmp eq i64 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35, %32
%38 = tail call i64 @S_ISSOCK(i32 %7)
%39 = icmp eq i64 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
%43 = load i32, i32* @S_IRUSR
%44 = and i32 %43, %7
%45 = icmp eq i32 %44, 0
%46 = select i1 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%47 = tail call i32 @strcat(i8* %3, i8* %46)
%48 = load i32, i32* @S_IWUSR
%49 = and i32 %48, %7
%50 = icmp eq i32 %49, 0
%51 = select i1 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%52 = tail call i32 @strcat(i8* %3, i8* %51)
%53 = load i32, i32* @S_ISUID
%54 = and i32 %53, %7
%55 = icmp eq i32 %54, 0
%56 = load i32, i32* @S_IXUSR
%57 = and i32 %56, %7
%58 = icmp eq i32 %57, 0
%59 = select i1 %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0)
%60 = select i1 %55, i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%61 = tail call i32 @strcat(i8* %3, i8* %60)
%62 = load i32, i32* @S_IRGRP
%63 = and i32 %62, %7
%64 = icmp eq i32 %63, 0
%65 = select i1 %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%66 = tail call i32 @strcat(i8* %3, i8* %65)
%67 = load i32, i32* @S_IWGRP
%68 = and i32 %67, %7
%69 = icmp eq i32 %68, 0
%70 = select i1 %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%71 = tail call i32 @strcat(i8* %3, i8* %70)
%72 = load i32, i32* @S_ISGID
%73 = and i32 %72, %7
%74 = icmp eq i32 %73, 0
%75 = load i32, i32* @S_IXGRP
%76 = and i32 %75, %7
%77 = icmp eq i32 %76, 0
%78 = select i1 %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0)
%79 = select i1 %74, i8* %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%80 = tail call i32 @strcat(i8* %3, i8* %79)
%81 = load i32, i32* @S_IROTH
%82 = and i32 %81, %7
%83 = icmp eq i32 %82, 0
%84 = select i1 %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%85 = tail call i32 @strcat(i8* %3, i8* %84)
%86 = load i32, i32* @S_IWOTH
%87 = and i32 %86, %7
%88 = icmp eq i32 %87, 0
%89 = select i1 %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
%90 = tail call i32 @strcat(i8* %3, i8* %89)
%91 = load i32, i32* @S_ISVTX
%92 = and i32 %91, %7
%93 = icmp eq i32 %92, 0
%94 = load i32, i32* @S_IXOTH
%95 = and i32 %94, %7
%96 = icmp eq i32 %95, 0
%97 = select i1 %96, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0)
%98 = select i1 %93, i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%99 = tail call i32 @strcat(i8* %3, i8* %98)
store i8* %3, i8** %1
br label %100
100: ; preds = %2, %42
%101 = phi i32* [ @EXIT_SUCCESS, %42 ], [ @EXIT_FAILURE, %2 ]
%102 = load i32, i32* %101
ret i32 %102
}