#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_size;
};
struct dirent {
  char *d_name;
  scalar_t__ d_type;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
scalar_t__ DT_LNK;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int lstat(char *, struct stat *);
char *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ readlink(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
void filesize_linktarget(struct dirent *d, const char *name, char d_type,
                         char d_name, char path[1024], int lflag, int eflag,
                         int iflag, int sflag) {
  struct stat sb;
  char *linkname;
  ssize_t r;
  int size;
  strcpy(path, name);
  strcat(path, "/");
  strcat(path, d->d_name);
  lstat(path, &sb);
  size = sb.st_size;
  if (lstat(path, &sb) == -1) {
    perror("lstat");
    exit(EXIT_FAILURE);
  }
  if (d->d_type == DT_LNK && lflag && !iflag) {
    linkname = malloc(sb.st_size + 1);
    if (linkname == NULL) {
      fprintf(stderr, "insufficient memory\n");
      exit(EXIT_FAILURE);
    }
    r = readlink(path, linkname, sb.st_size + 1);
    if (r == (ssize_t)-1) {
      free(linkname);
      perror("readlink");
      exit(EXIT_FAILURE);
    }
    if (r > (ssize_t)sb.st_size) {
      fprintf(stderr, "symlink increased in size");
      printf("between lstat() and readlink()\n");
      exit(EXIT_FAILURE);
    }
    linkname[sb.st_size] = '\0';
    printf("\x1B[33m"
           " -> '%s'"
           "\033[0m",
           linkname);
    free(linkname);
  }
  printf("%s", (size == 0 && eflag && !iflag)    ? "\x1B[31m"
                                                   " (empty)"
                                                   "\033[0m"
               : (size == -1 && eflag && !iflag) ? "\x1B[31m"
                                                   "Error checking file size!"
                                                   "\033[0m"
                                                 : "");
  if (sflag == 1) {
    if (size >= 1024)
      printf("\x1B[35m"
             " [%3dK]"
             "\033[0m",
             size / 1024);
    else
      printf("\x1B[35m"
             " [%4d]"
             "\033[0m",
             size);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<filesize_linktarget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    0x20(%rbp),%edx
mov    0x18(%rbp),%edx
mov    0x10(%rbp),%edx
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   10b0 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <lstat@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <lstat@plt>
cmp    $0xffffffff,%eax
jne    123b <filesize_linktarget+0x9b>
lea    0xdda(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d86(%rip),%rcx
cmp    (%rcx),%rax
jne    134b <filesize_linktarget+0x1ab>
cmpl   $0x0,-0x24(%rbp)
je     134b <filesize_linktarget+0x1ab>
cmpl   $0x0,0x18(%rbp)
jne    134b <filesize_linktarget+0x1ab>
mov    -0x28(%rbp),%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12a4 <filesize_linktarget+0x104>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xd77(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%edx
add    $0x1,%edx
call   1050 <readlink@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    12e7 <filesize_linktarget+0x147>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xd49(%rip),%rdi
call   10a0 <perror@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    1324 <filesize_linktarget+0x184>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xd31(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rsi
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x38(%rbp)
jne    1379 <filesize_linktarget+0x1d9>
cmpl   $0x0,0x10(%rbp)
je     1379 <filesize_linktarget+0x1d9>
cmpl   $0x0,0x18(%rbp)
jne    1379 <filesize_linktarget+0x1d9>
lea    0xd05(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    13bf <filesize_linktarget+0x21f>
xor    %eax,%eax
cmpl   $0xffffffff,-0x38(%rbp)
mov    %al,-0x41(%rbp)
jne    13a3 <filesize_linktarget+0x203>
xor    %eax,%eax
cmpl   $0x0,0x10(%rbp)
mov    %al,-0x41(%rbp)
je     13a3 <filesize_linktarget+0x203>
cmpl   $0x0,0x18(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%dl
lea    0xcb2(%rip),%rax
lea    0xcd3(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x1,0x20(%rbp)
jne    141e <filesize_linktarget+0x27e>
cmpl   $0x400,-0x38(%rbp)
jl     1408 <filesize_linktarget+0x268>
mov    -0x38(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1419 <filesize_linktarget+0x279>
mov    -0x38(%rbp),%esi
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    141e <filesize_linktarget+0x27e>
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize_linktarget>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r15d
mov    %r8,%rbx
mov    %rdi,%r12
mov    0x60(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x58(%rsp),%r13d
mov    0x50(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %r8,%rdi
call   1050 <strcpy@plt>
lea    0xe05(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
mov    (%r12),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
lea    0x8(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <lstat@plt>
mov    0x8(%rsp),%r14d
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <lstat@plt>
cmp    $0xffffffff,%eax
je     1342 <filesize_linktarget+0x182>
test   %r13d,%r13d
jne    12b0 <filesize_linktarget+0xf0>
test   %r15d,%r15d
je     12b0 <filesize_linktarget+0xf0>
mov    0x2d87(%rip),%rax
mov    (%rax),%rax
cmp    %rax,0x8(%r12)
jne    12b0 <filesize_linktarget+0xf0>
movslq 0x8(%rsp),%r12
lea    0x1(%r12),%r15d
mov    %r15d,%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     134b <filesize_linktarget+0x18b>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r15d,%edx
call   1070 <readlink@plt>
cmp    $0xffffffff,%eax
je     1362 <filesize_linktarget+0x1a2>
cmp    %r12d,%eax
jg     1378 <filesize_linktarget+0x1b8>
movb   $0x0,0x0(%rbp,%r12,1)
lea    0xda2(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
test   %r13d,%r13d
mov    0x10(%rsp),%ecx
jne    12cb <filesize_linktarget+0x10b>
test   %ecx,%ecx
je     12cb <filesize_linktarget+0x10b>
test   %r14d,%r14d
jne    12cb <filesize_linktarget+0x10b>
lea    0xd8c(%rip),%rsi
jmp    12ee <filesize_linktarget+0x12e>
test   %r13d,%r13d
lea    0xd47(%rip),%rax
lea    0xd8b(%rip),%rsi
cmovne %rax,%rsi
cmp    $0xffffffff,%r14d
cmovne %rax,%rsi
test   %ecx,%ecx
cmove  %rax,%rsi
lea    0xd5d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x1,0x14(%rsp)
jne    132a <filesize_linktarget+0x16a>
cmp    $0x400,%r14d
jl     1319 <filesize_linktarget+0x159>
shr    $0xa,%r14d
lea    0xd73(%rip),%rdi
jmp    1320 <filesize_linktarget+0x160>
lea    0xd7b(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putchar@plt>
lea    0xcb9(%rip),%rdi
jmp    1371 <filesize_linktarget+0x1b1>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
lea    0xcad(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1399 <filesize_linktarget+0x1d9>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0xcac(%rip),%rdi
call   10c0 <perror@plt>
jmp    1399 <filesize_linktarget+0x1d9>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
call   10a0 <fprintf@plt>
lea    0xd17(%rip),%rdi
call   1060 <puts@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8*, i64 }
%struct.stat = type { i32 }
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"lstat\00"
@EXIT_FAILURE = global i32 0
@DT_LNK = global i64 0
@stderr = global i32 0
@.str.2 = [21 x i8] c"insufficient memory\0A\00"
@.str.3 = [9 x i8] c"readlink\00"
@.str.4 = [26 x i8] c"symlink increased in size\00"
@.str.5 = [32 x i8] c"between lstat() and readlink()\0A\00"
@.str.6 = [18 x i8] c"\1B[33m -> '%s'\1B[0m\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [18 x i8] c"\1B[31m (empty)\1B[0m\00"
@.str.9 = [35 x i8] c"\1B[31mError checking file size!\1B[0m\00"
@.str.10 = [1 x i8] zeroinitializer
@.str.11 = [17 x i8] c"\1B[35m [%3dK]\1B[0m\00"
@.str.12 = [16 x i8] c"\1B[35m [%4d]\1B[0m\00"
@.str.13 = [2 x i8] c"\0A\00"
define void @filesize_linktarget(%struct.dirent* %0, i8* %1, i8 signext %2, i8 signext %3, i8* %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca %struct.dirent*
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.stat
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
store %struct.dirent* %0, %struct.dirent** %10
store i8* %1, i8** %11
store i8 %2, i8* %12
store i8 %3, i8* %13
store i8* %4, i8** %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%23 = load i8*, i8** %14
%24 = load i8*, i8** %11
%25 = call i32 @strcpy(i8* %23, i8* %24)
%26 = load i8*, i8** %14
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = load i8*, i8** %14
%29 = load %struct.dirent*, %struct.dirent** %10
%30 = getelementptr inbounds %struct.dirent, %struct.dirent* %29, i32 0, i32 0
%31 = load i8*, i8** %30
%32 = call i32 @strcat(i8* %28, i8* %31)
%33 = load i8*, i8** %14
%34 = call i32 @lstat(i8* %33, %struct.stat* %19)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%36 = load i32, i32* %35
store i32 %36, i32* %22
%37 = load i8*, i8** %14
%38 = call i32 @lstat(i8* %37, %struct.stat* %19)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %44
40: ; preds = %9
%41 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %9
%45 = load %struct.dirent*, %struct.dirent** %10
%46 = getelementptr inbounds %struct.dirent, %struct.dirent* %45, i32 0, i32 1
%47 = load i64, i64* %46
%48 = load i64, i64* @DT_LNK
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %104
50: ; preds = %44
%51 = load i32, i32* %15
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %104
53: ; preds = %50
%54 = load i32, i32* %17
%55 = icmp ne i32 %54, 0
br i1 %55, label %104, label %56
56: ; preds = %53
%57 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 1
%60 = call i8* @malloc(i32 %59)
store i8* %60, i8** %20
%61 = load i8*, i8** %20
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %68
63: ; preds = %56
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %56
%69 = load i8*, i8** %14
%70 = load i8*, i8** %20
%71 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%72 = load i32, i32* %71
%73 = add nsw i32 %72, 1
%74 = call i32 @readlink(i8* %69, i8* %70, i32 %73)
store i32 %74, i32* %21
%75 = load i32, i32* %21
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %83
77: ; preds = %68
%78 = load i8*, i8** %20
%79 = call i32 @free(i8* %78)
%80 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%81 = load i32, i32* @EXIT_FAILURE
%82 = call i32 @exit(i32 %81)
unreachable
83: ; preds = %68
%84 = load i32, i32* %21
%85 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%86 = load i32, i32* %85
%87 = icmp sgt i32 %84, %86
br i1 %87, label %88, label %94
88: ; preds = %83
%89 = load i32, i32* @stderr
%90 = call i32 @fprintf(i32 %89, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%92 = load i32, i32* @EXIT_FAILURE
%93 = call i32 @exit(i32 %92)
unreachable
94: ; preds = %83
%95 = load i8*, i8** %20
%96 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%97 = load i32, i32* %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %95, i64 %98
store i8 0, i8* %99
%100 = load i8*, i8** %20
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %100)
%102 = load i8*, i8** %20
%103 = call i32 @free(i8* %102)
br label %104
104: ; preds = %94, %53, %50, %44
%105 = load i32, i32* %22
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %114
107: ; preds = %104
%108 = load i32, i32* %16
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %107
%111 = load i32, i32* %17
%112 = icmp ne i32 %111, 0
br i1 %112, label %114, label %113
113: ; preds = %110
br label %128
114: ; preds = %110, %107, %104
%115 = load i32, i32* %22
%116 = icmp eq i32 %115, -1
br i1 %116, label %117, label %124
117: ; preds = %114
%118 = load i32, i32* %16
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %124
120: ; preds = %117
%121 = load i32, i32* %17
%122 = icmp ne i32 %121, 0
%123 = xor i1 %122, true
br label %124
124: ; preds = %120, %117, %114
%125 = phi i1 [ false, %117 ], [ false, %114 ], [ %123, %120 ]
%126 = zext i1 %125 to i64
%127 = select i1 %125, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.10, i64 0, i64 0)
br label %128
128: ; preds = %124, %113
%129 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), %113 ], [ %127, %124 ]
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %129)
%131 = load i32, i32* %18
%132 = icmp eq i32 %131, 1
br i1 %132, label %133, label %144
133: ; preds = %128
%134 = load i32, i32* %22
%135 = icmp sge i32 %134, 1024
br i1 %135, label %136, label %140
136: ; preds = %133
%137 = load i32, i32* %22
%138 = sdiv i32 %137, 1024
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %138)
br label %143
140: ; preds = %133
%141 = load i32, i32* %22
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 %141)
br label %143
143: ; preds = %140, %136
br label %144
144: ; preds = %143, %128
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i8*, i64 }
%struct.stat = type { i32 }
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"lstat\00"
@EXIT_FAILURE = global i32 0
@DT_LNK = global i64 0
@stderr = global i32 0
@.str.2 = [21 x i8] c"insufficient memory\0A\00"
@.str.3 = [9 x i8] c"readlink\00"
@.str.4 = [26 x i8] c"symlink increased in size\00"
@.str.6 = [18 x i8] c"\1B[33m -> '%s'\1B[0m\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [18 x i8] c"\1B[31m (empty)\1B[0m\00"
@.str.9 = [35 x i8] c"\1B[31mError checking file size!\1B[0m\00"
@.str.10 = [1 x i8] zeroinitializer
@.str.11 = [17 x i8] c"\1B[35m [%3dK]\1B[0m\00"
@.str.12 = [16 x i8] c"\1B[35m [%4d]\1B[0m\00"
@str = [31 x i8] c"between lstat() and readlink()\00"
define void @filesize_linktarget(%struct.dirent* nocapture %0, i8* %1, i8 signext %2, i8 signext %3, i8* %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca %struct.stat
%11 = bitcast %struct.stat* %10 to i8*
%12 = tail call i32 @strcpy(i8* %4, i8* %1)
%13 = tail call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%15 = load i8*, i8** %14
%16 = tail call i32 @strcat(i8* %4, i8* %15)
%17 = call i32 @lstat(i8* %4, %struct.stat* %10)
%18 = getelementptr inbounds %struct.stat, %struct.stat* %10, i64 0, i32 0
%19 = load i32, i32* %18
%20 = call i32 @lstat(i8* %4, %struct.stat* %10)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %9
%23 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %9
%27 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 1
%28 = load i64, i64* %27
%29 = load i64, i64* @DT_LNK
%30 = icmp ne i64 %28, %29
%31 = icmp eq i32 %5, 0
%32 = or i1 %31, %30
%33 = icmp ne i32 %7, 0
%34 = or i1 %33, %32
br i1 %34, label %66, label %35
35: ; preds = %26
%36 = load i32, i32* %18
%37 = add nsw i32 %36, 1
%38 = tail call i8* @malloc(i32 %37)
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = tail call i32 @exit(i32 %43)
unreachable
45: ; preds = %35
%46 = tail call i32 @readlink(i8* %4, i8* %38, i32 %37)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = tail call i32 @free(i8* %38)
%50 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%51 = load i32, i32* @EXIT_FAILURE
%52 = tail call i32 @exit(i32 %51)
unreachable
53: ; preds = %45
%54 = icmp sgt i32 %46, %36
br i1 %54, label %55, label %61
55: ; preds = %53
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%59 = load i32, i32* @EXIT_FAILURE
%60 = tail call i32 @exit(i32 %59)
unreachable
61: ; preds = %53
%62 = sext i32 %36 to i64
%63 = getelementptr inbounds i8, i8* %38, i64 %62
store i8 0, i8* %63
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%65 = tail call i32 @free(i8* %38)
br label %66
66: ; preds = %61, %26
%67 = icmp eq i32 %19, 0
%68 = icmp ne i32 %6, 0
%69 = and i1 %68, %67
%70 = xor i1 %69, true
%71 = or i1 %33, %70
br i1 %71, label %72, label %78
72: ; preds = %66
%73 = icmp eq i32 %19, -1
%74 = and i1 %68, %73
%75 = xor i1 %33, true
%76 = and i1 %74, %75
%77 = select i1 %76, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.10, i64 0, i64 0)
br label %78
78: ; preds = %66, %72
%79 = phi i8* [ %77, %72 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), %66 ]
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %79)
%81 = icmp eq i32 %8, 1
br i1 %81, label %82, label %89
82: ; preds = %78
%83 = icmp sgt i32 %19, 1023
br i1 %83, label %84, label %87
84: ; preds = %82
%85 = lshr i32 %19, 10
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %85)
br label %89
87: ; preds = %82
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 %19)
br label %89
89: ; preds = %84, %87, %78
%90 = tail call i32 @putchar(i32 10)
ret void
}