#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 tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
};
struct stat {
  int st_mode;
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_size;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
  int /*<<< orphan*/ st_nlink;
};
struct passwd {
  char *pw_name;
};
struct group {
  char *gr_name;
};

/* Variables and functions */
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 /*<<< orphan*/ bzero(char *, int);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
struct group *getgrgid(int /*<<< orphan*/);
struct passwd *getpwuid(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int lstat(char const *, struct stat *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int display_attr(char *buf, size_t buf_size, const char *file) {
  struct stat st;
  int ret;
  char *m;
  errno = 0;
  ret = lstat(file, &st);
  if (ret == -1) {
    fprintf(stderr, "%s ", file);
    perror("lstat error");
    return -1;
  }
  if (S_ISREG(st.st_mode))
    m = "-";
  else if (S_ISDIR(st.st_mode))
    m = "d";
  else if (S_ISCHR(st.st_mode))
    m = "c";
  else if (S_ISBLK(st.st_mode))
    m = "b";
  else if (S_ISFIFO(st.st_mode))
    m = "f";
  else if (S_ISLNK(st.st_mode))
    m = "l";
  else if (S_ISSOCK(st.st_mode))
    m = "s";
  else
    m = "-";
  strcat(buf, m);
  int n;
  int temp;
  int tmp;
  for (n = 8; n >= 0; n--) {
    temp = 1 << n;
    tmp = st.st_mode & temp;
    if (tmp) {
      switch (n % 3) {
      case 2:
        strcat(buf, "r");
        break;
      case 1:
        strcat(buf, "w");
        break;
      case 0:
        strcat(buf, "x");
        break;
      }
    } else
      strcat(buf, "-");
  }
  char temp_str[32];
  bzero(temp_str, 32);
  sprintf(temp_str, "%3ld ", st.st_nlink);
  strcat(buf, temp_str);
  bzero(temp_str, 32);
  struct passwd *pw = getpwuid(st.st_uid);
  sprintf(temp_str, "%8s ", pw->pw_name);
  strcat(buf, temp_str);
  bzero(temp_str, 32);
  struct group *grp = getgrgid(st.st_gid);
  sprintf(temp_str, "%8s ", grp->gr_name);
  strcat(buf, temp_str);
  bzero(temp_str, 32);
  sprintf(temp_str, "%11ld ", st.st_size);
  strcat(buf, temp_str);
  bzero(temp_str, 32);
  struct tm *t;
  t = localtime(&(st.st_mtime));
  sprintf(temp_str, "%4d.%02d.%02d %02d:%02d ", t->tm_year + 1900,
          t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min);
  strcat(buf, temp_str);
  strcat(buf, file);
  strcat(buf, "\r\n");
  return 0;
}


x86 assembly (clang, -O0):
<display_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2dba(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10a0 <lstat@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1270 <display_attr+0x70>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdad(%rip),%rsi
call   10b0 <fprintf@plt>
lea    0xda5(%rip),%rdi
call   10f0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1611 <display_attr+0x411>
mov    -0x38(%rbp),%edi
call   10c0 <S_ISREG@plt>
cmp    $0x0,%rax
je     1292 <display_attr+0x92>
lea    0xd87(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1387 <display_attr+0x187>
mov    -0x38(%rbp),%edi
call   1080 <S_ISDIR@plt>
cmp    $0x0,%rax
je     12b4 <display_attr+0xb4>
lea    0xd67(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1382 <display_attr+0x182>
mov    -0x38(%rbp),%edi
call   10d0 <S_ISCHR@plt>
cmp    $0x0,%rax
je     12d6 <display_attr+0xd6>
lea    0xd47(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    137d <display_attr+0x17d>
mov    -0x38(%rbp),%edi
call   10e0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     12f8 <display_attr+0xf8>
lea    0xd27(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1378 <display_attr+0x178>
mov    -0x38(%rbp),%edi
call   1060 <S_ISFIFO@plt>
cmp    $0x0,%rax
je     131a <display_attr+0x11a>
lea    0xd07(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1373 <display_attr+0x173>
mov    -0x38(%rbp),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     133c <display_attr+0x13c>
lea    0xce7(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    136e <display_attr+0x16e>
mov    -0x38(%rbp),%edi
call   1070 <S_ISSOCK@plt>
cmp    $0x0,%rax
je     135e <display_attr+0x15e>
lea    0xcc7(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1369 <display_attr+0x169>
lea    0xcab(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    136e <display_attr+0x16e>
jmp    1373 <display_attr+0x173>
jmp    1378 <display_attr+0x178>
jmp    137d <display_attr+0x17d>
jmp    1382 <display_attr+0x182>
jmp    1387 <display_attr+0x187>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1110 <strcat@plt>
movl   $0x8,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jl     1481 <display_attr+0x281>
mov    -0x4c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x50(%rbp)
mov    -0x38(%rbp),%eax
and    -0x50(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     145e <display_attr+0x25e>
movslq -0x4c(%rbp),%rcx
mov    %ecx,%eax
imul   $0x55555556,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0x9c(%rbp)
je     1449 <display_attr+0x249>
jmp    13f7 <display_attr+0x1f7>
mov    -0x9c(%rbp),%eax
sub    $0x1,%eax
je     1434 <display_attr+0x234>
jmp    140b <display_attr+0x20b>
mov    -0x9c(%rbp),%eax
sub    $0x2,%eax
jne    1459 <display_attr+0x259>
jmp    141f <display_attr+0x21f>
mov    -0x10(%rbp),%rdi
lea    0xbe4(%rip),%rsi
call   1110 <strcat@plt>
jmp    1459 <display_attr+0x259>
mov    -0x10(%rbp),%rdi
lea    0xbdf(%rip),%rsi
call   1110 <strcat@plt>
jmp    1459 <display_attr+0x259>
mov    -0x10(%rbp),%rdi
lea    0xbcc(%rip),%rsi
call   1110 <strcat@plt>
jmp    146e <display_attr+0x26e>
mov    -0x10(%rbp),%rdi
lea    0xba7(%rip),%rsi
call   1110 <strcat@plt>
jmp    1473 <display_attr+0x273>
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
jmp    139b <display_attr+0x19b>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
lea    -0x80(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xb85(%rip),%rsi
mov    $0x0,%al
call   1120 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1110 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    -0x28(%rbp),%edi
call   1050 <getpwuid@plt>
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rax
mov    (%rax),%rdx
lea    0xb45(%rip),%rsi
mov    $0x0,%al
call   1120 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1110 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    -0x2c(%rbp),%edi
call   1090 <getgrgid@plt>
mov    %rax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x90(%rbp),%rax
mov    (%rax),%rdx
lea    0xaff(%rip),%rsi
mov    $0x0,%al
call   1120 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1110 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
lea    -0x80(%rbp),%rdi
mov    -0x30(%rbp),%edx
lea    0xad4(%rip),%rsi
mov    $0x0,%al
call   1120 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1110 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
lea    -0x38(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x98(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x98(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x98(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x98(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x98(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x98(%rbp),%rax
mov    0x10(%rax),%eax
lea    0xa5e(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1120 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1110 <strcat@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1110 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xa48(%rip),%rsi
call   1110 <strcat@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_attr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%rbx
mov    %rdi,%r12
mov    0x2dbd(%rip),%rax
movq   $0x0,(%rax)
lea    0x10(%rsp),%rsi
mov    %rdx,%rdi
call   10a0 <lstat@plt>
cmp    $0xffffffff,%eax
je     1283 <display_attr+0x83>
mov    0x10(%rsp),%r13d
mov    %r13d,%edi
call   10c0 <S_ISREG@plt>
lea    0xdc8(%rip),%rsi
test   %rax,%rax
jne    1311 <display_attr+0x111>
mov    %r13d,%edi
call   1080 <S_ISDIR@plt>
test   %rax,%rax
je     126a <display_attr+0x6a>
lea    0xdad(%rip),%rsi
jmp    1311 <display_attr+0x111>
mov    %r13d,%edi
call   10d0 <S_ISCHR@plt>
test   %rax,%rax
je     12b2 <display_attr+0xb2>
lea    0xd96(%rip),%rsi
jmp    1311 <display_attr+0x111>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xd6d(%rip),%rsi
mov    %rbx,%rdx
call   10b0 <fprintf@plt>
lea    0xd62(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%r15d
jmp    14b6 <display_attr+0x2b6>
mov    %r13d,%edi
call   10e0 <S_ISBLK@plt>
test   %rax,%rax
je     12c8 <display_attr+0xc8>
lea    0xd50(%rip),%rsi
jmp    1311 <display_attr+0x111>
mov    %r13d,%edi
call   1060 <S_ISFIFO@plt>
test   %rax,%rax
je     12de <display_attr+0xde>
lea    0xd3c(%rip),%rsi
jmp    1311 <display_attr+0x111>
mov    %r13d,%edi
call   1040 <S_ISLNK@plt>
test   %rax,%rax
je     12f4 <display_attr+0xf4>
lea    0xd28(%rip),%rsi
jmp    1311 <display_attr+0x111>
mov    %r13d,%edi
call   1070 <S_ISSOCK@plt>
test   %rax,%rax
lea    0xd0a(%rip),%rax
lea    0xd0f(%rip),%rsi
cmove  %rax,%rsi
mov    %rbx,0x28(%rsp)
mov    %r12,%rdi
call   1110 <strcat@plt>
lea    0xd4b(%rip),%rbp
mov    $0x8,%ebx
movabs $0xaaaaaaaaaaaaaaab,%r14
aa aa aa
lea    0xd15(%rip),%r15
jmp    1355 <display_attr+0x155>
nopl   (%rax)
mov    %r12,%rdi
call   1110 <strcat@plt>
add    $0xffffffffffffffff,%rbx
add    $0xfffffffffffffffc,%rbp
cmp    $0xffffffff,%ebx
je     1381 <display_attr+0x181>
mov    %rbx,%rax
mul    %r14
bt     %ebx,%r13d
lea    0xcaa(%rip),%rsi
jae    1340 <display_attr+0x140>
add    %rdx,%rdx
and    $0xfffffffffffffffc,%rdx
lea    (%rdx,%rdx,2),%rax
mov    %rbp,%rcx
sub    %rax,%rcx
movslq (%rcx),%rsi
add    %r15,%rsi
jmp    1340 <display_attr+0x140>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    0x24(%rsp),%edx
lea    0xc84(%rip),%rsi
xor    %r15d,%r15d
mov    %rbp,%rdi
xor    %eax,%eax
call   1120 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1110 <strcat@plt>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    0x20(%rsp),%edi
call   1050 <getpwuid@plt>
mov    (%rax),%rdx
lea    0xc52(%rip),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1120 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1110 <strcat@plt>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    0x1c(%rsp),%edi
call   1090 <getgrgid@plt>
mov    (%rax),%rdx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1120 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1110 <strcat@plt>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
mov    0x18(%rsp),%edx
lea    0xbf6(%rip),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1120 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1110 <strcat@plt>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1100 <bzero@plt>
lea    0x14(%rsp),%rdi
call   1030 <localtime@plt>
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
add    $0x1,%ecx
mov    0xc(%rax),%r9d
mov    0x10(%rax),%eax
mov    %eax,(%rsp)
lea    0xbaf(%rip),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1120 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1110 <strcat@plt>
mov    %r12,%rdi
mov    0x28(%rsp),%rsi
call   1110 <strcat@plt>
lea    0xb9f(%rip),%rsi
mov    %r12,%rdi
call   1110 <strcat@plt>
mov    %r15d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32, i32 }
%struct.passwd = type { i8* }
%struct.group = type { i8* }
%struct.tm = type { i32, i32, i32, i32, i32 }
@errno = global i64 0
@stderr = global i32 0
@.str = [4 x i8] c"%s \00"
@.str.1 = [12 x i8] c"lstat error\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"c\00"
@.str.5 = [2 x i8] c"b\00"
@.str.6 = [2 x i8] c"f\00"
@.str.7 = [2 x i8] c"l\00"
@.str.8 = [2 x i8] c"s\00"
@.str.9 = [2 x i8] c"r\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [2 x i8] c"x\00"
@.str.12 = [6 x i8] c"%3ld \00"
@.str.13 = [5 x i8] c"%8s \00"
@.str.14 = [7 x i8] c"%11ld \00"
@.str.15 = [25 x i8] c"%4d.%02d.%02d %02d:%02d \00"
@.str.16 = [3 x i8] c"\0D\0A\00"
@reltable.display_attr = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.11 to i64), i64 ptrtoint ([3 x i32]* @reltable.display_attr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.10 to i64), i64 ptrtoint ([3 x i32]* @reltable.display_attr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([3 x i32]* @reltable.display_attr to i64)) to i32)]
define i32 @display_attr(i8* %0, i64 %1, i8* %2) {
%4 = alloca %struct.stat
%5 = alloca [32 x i8]
%6 = bitcast %struct.stat* %4 to i8*
store i64 0, i64* @errno
%7 = call i32 @lstat(i8* %2, %struct.stat* %4)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %102
13: ; preds = %3
%14 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%15 = load i32, i32* %14
%16 = tail call i64 @S_ISREG(i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %37
18: ; preds = %13
%19 = tail call i64 @S_ISDIR(i32 %15)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %37
21: ; preds = %18
%22 = tail call i64 @S_ISCHR(i32 %15)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = tail call i64 @S_ISBLK(i32 %15)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = tail call i64 @S_ISFIFO(i32 %15)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = tail call i64 @S_ISLNK(i32 %15)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = tail call i64 @S_ISSOCK(i32 %15)
%35 = icmp eq i64 %34, 0
%36 = select i1 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
br label %37
37: ; preds = %33, %30, %27, %24, %21, %18, %13
%38 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %13 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %18 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %21 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %24 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %27 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %30 ], [ %36, %33 ]
%39 = tail call i32 @strcat(i8* %0, i8* %38)
br label %40
40: ; preds = %37, %50
%41 = phi i32 [ 8, %37 ], [ %53, %50 ]
%42 = shl nuw i32 1, %41
%43 = and i32 %15, %42
%44 = icmp eq i32 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %40
%46 = urem i32 %41, 3
%47 = zext i32 %46 to i64
%48 = shl i64 %47, 2
%49 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.display_attr to i8*), i64 %48)
br label %50
50: ; preds = %45, %40
%51 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %40 ], [ %49, %45 ]
%52 = tail call i32 @strcat(i8* %0, i8* %51)
%53 = add nsw i32 %41, -1
%54 = icmp eq i32 %41, 0
br i1 %54, label %55, label %40
55: ; preds = %50
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%57 = call i32 @bzero(i8* %56, i32 32)
%58 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 5
%59 = load i32, i32* %58
%60 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %59)
%61 = call i32 @strcat(i8* %0, i8* %56)
%62 = call i32 @bzero(i8* %56, i32 32)
%63 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 4
%64 = load i32, i32* %63
%65 = call %struct.passwd* @getpwuid(i32 %64)
%66 = getelementptr inbounds %struct.passwd, %struct.passwd* %65, i64 0, i32 0
%67 = load i8*, i8** %66
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %67)
%69 = call i32 @strcat(i8* %0, i8* %56)
%70 = call i32 @bzero(i8* %56, i32 32)
%71 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 3
%72 = load i32, i32* %71
%73 = call %struct.group* @getgrgid(i32 %72)
%74 = getelementptr inbounds %struct.group, %struct.group* %73, i64 0, i32 0
%75 = load i8*, i8** %74
%76 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* %75)
%77 = call i32 @strcat(i8* %0, i8* %56)
%78 = call i32 @bzero(i8* %56, i32 32)
%79 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 2
%80 = load i32, i32* %79
%81 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32 %80)
%82 = call i32 @strcat(i8* %0, i8* %56)
%83 = call i32 @bzero(i8* %56, i32 32)
%84 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%85 = call %struct.tm* @localtime(i32* %84)
%86 = getelementptr inbounds %struct.tm, %struct.tm* %85, i64 0, i32 0
%87 = load i32, i32* %86
%88 = add nsw i32 %87, 1900
%89 = getelementptr inbounds %struct.tm, %struct.tm* %85, i64 0, i32 1
%90 = load i32, i32* %89
%91 = add nsw i32 %90, 1
%92 = getelementptr inbounds %struct.tm, %struct.tm* %85, i64 0, i32 2
%93 = load i32, i32* %92
%94 = getelementptr inbounds %struct.tm, %struct.tm* %85, i64 0, i32 3
%95 = load i32, i32* %94
%96 = getelementptr inbounds %struct.tm, %struct.tm* %85, i64 0, i32 4
%97 = load i32, i32* %96
%98 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), i32 %88, i32 %91, i32 %93, i32 %95, i32 %97)
%99 = call i32 @strcat(i8* %0, i8* %56)
%100 = call i32 @strcat(i8* %0, i8* %2)
%101 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
br label %102
102: ; preds = %55, %9
%103 = phi i32 [ -1, %9 ], [ 0, %55 ]
ret i32 %103
}