#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
typedef int u_short;
struct stat {
  scalar_t__ st_dev;
  scalar_t__ st_ino;
  int /*<<< orphan*/ st_mode;
  int /*<<< orphan*/ st_nlink;
};
typedef scalar_t__ ino_t;
typedef scalar_t__ dev_t;
struct TYPE_6__ {
  int fts_options;
};
struct TYPE_5__ {
  int fts_errno;
  scalar_t__ fts_dev;
  scalar_t__ fts_ino;
  char *fts_name;
  scalar_t__ fts_level;
  struct TYPE_5__ *fts_cycle;
  struct TYPE_5__ *fts_parent;
  int /*<<< orphan*/ fts_nlink;
  int /*<<< orphan*/ fts_accpath;
  struct stat *fts_statp;
};
typedef TYPE_1__ FTSENT;
typedef TYPE_2__ FTS;

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ S_ISREG(int /*<<< orphan*/);
void *errno;
scalar_t__ lstat(int /*<<< orphan*/, struct stat *);
int /*<<< orphan*/ memset(struct stat *, int /*<<< orphan*/, int);
scalar_t__ stat(int /*<<< orphan*/, struct stat *);
u_short fts_stat(FTS *sp, FTSENT *p, int follow) {
  FTSENT *t;
  dev_t dev;
  ino_t ino;
  struct stat *sbp, sb;
  int saved_errno;
  sbp = (sp->fts_options & (0x0008)) ? &sb : p->fts_statp;
  if ((sp->fts_options & (0x0002)) || follow) {
    if (stat(p->fts_accpath, sbp)) {
      saved_errno = errno;
      if (!lstat(p->fts_accpath, sbp)) {
        errno = 0;
        return (13);
      }
      p->fts_errno = saved_errno;
      goto err;
    }
  } else if (lstat(p->fts_accpath, sbp)) {
    p->fts_errno = errno;
  err:
    memset(sbp, 0, sizeof(struct stat));
    return (10);
  }
  if (S_ISDIR(sbp->st_mode)) {
    dev = p->fts_dev = sbp->st_dev;
    ino = p->fts_ino = sbp->st_ino;
    p->fts_nlink = sbp->st_nlink;
    if ((p->fts_name[0] == '.' &&
         (!p->fts_name[1] || (p->fts_name[1] == '.' && !p->fts_name[2]))))
      return (5);
    for (t = p->fts_parent; t->fts_level >= 0; t = t->fts_parent)
      if (ino == t->fts_ino && dev == t->fts_dev) {
        p->fts_cycle = t;
        return (2);
      }
    return (1);
  }
  if (S_ISLNK(sbp->st_mode))
    return (12);
  if (S_ISREG(sbp->st_mode))
    return (8);
  return (3);
}


x86 assembly (clang, -O0):
<fts_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1192 <fts_stat+0x32>
lea    -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    119e <fts_stat+0x3e>
mov    -0x18(%rbp),%rax
mov    0x40(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    11c2 <fts_stat+0x62>
cmpl   $0x0,-0x1c(%rbp)
je     1230 <fts_stat+0xd0>
mov    -0x18(%rbp),%rax
mov    0x3c(%rax),%edi
mov    -0x40(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
je     122b <fts_stat+0xcb>
mov    0x2dfd(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x3c(%rax),%edi
mov    -0x40(%rbp),%rsi
call   1060 <lstat@plt>
cmp    $0x0,%rax
jne    121d <fts_stat+0xbd>
mov    0x2dd6(%rip),%rax
movq   $0x0,(%rax)
movl   $0xd,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
mov    -0x5c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    125c <fts_stat+0xfc>
jmp    127d <fts_stat+0x11d>
mov    -0x18(%rbp),%rax
mov    0x3c(%rax),%edi
mov    -0x40(%rbp),%rsi
call   1060 <lstat@plt>
cmp    $0x0,%rax
je     1278 <fts_stat+0x118>
mov    0x2d8f(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
movl   $0xa,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
jmp    127d <fts_stat+0x11d>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%edi
call   1040 <S_ISDIR@plt>
cmp    $0x0,%rax
je     139a <fts_stat+0x23a>
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    %rax,0x8(%rcx)
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
mov    %rax,0x10(%rcx)
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x38(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1321 <fts_stat+0x1c1>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
cmpb   $0x0,0x1(%rax)
je     1315 <fts_stat+0x1b5>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    1321 <fts_stat+0x1c1>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
cmpb   $0x0,0x2(%rax)
jne    1321 <fts_stat+0x1c1>
movl   $0x5,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,0x20(%rax)
jl     138e <fts_stat+0x22e>
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmp    0x10(%rcx),%rax
jne    1378 <fts_stat+0x218>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    1378 <fts_stat+0x218>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
movl   $0x2,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
jmp    137d <fts_stat+0x21d>
mov    -0x28(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    132d <fts_stat+0x1cd>
movl   $0x1,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     13bc <fts_stat+0x25c>
movl   $0xc,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%edi
call   1080 <S_ISREG@plt>
cmp    $0x0,%rax
je     13de <fts_stat+0x27e>
movl   $0x8,-0x4(%rbp)
jmp    13e5 <fts_stat+0x285>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts_stat>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    (%rdi),%eax
test   $0x8,%al
jne    117a <fts_stat+0x1a>
mov    0x40(%r14),%rbx
jmp    117d <fts_stat+0x1d>
mov    %rsp,%rbx
and    $0x2,%eax
or     %edx,%eax
mov    0x3c(%r14),%edi
mov    %rbx,%rsi
je     11c0 <fts_stat+0x60>
call   1070 <stat@plt>
test   %rax,%rax
je     11f7 <fts_stat+0x97>
mov    0x2e44(%rip),%r12
mov    (%r12),%r15
mov    0x3c(%r14),%edi
mov    %rbx,%rsi
call   1060 <lstat@plt>
test   %rax,%rax
jne    11d4 <fts_stat+0x74>
movq   $0x0,(%r12)
mov    $0xd,%eax
jmp    11eb <fts_stat+0x8b>
call   1060 <lstat@plt>
test   %rax,%rax
je     11f7 <fts_stat+0x97>
mov    0x2e0f(%rip),%rax
mov    (%rax),%r15
mov    %r15d,(%r14)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
mov    $0xa,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x10(%rbx),%edi
call   1040 <S_ISDIR@plt>
test   %rax,%rax
je     1275 <fts_stat+0x115>
mov    (%rbx),%rcx
mov    %rcx,0x8(%r14)
mov    0x8(%rbx),%rdx
mov    %rdx,0x10(%r14)
mov    0x14(%rbx),%eax
mov    %eax,0x38(%r14)
mov    0x18(%r14),%rsi
cmpb   $0x2e,(%rsi)
jne    123a <fts_stat+0xda>
mov    0x1(%rsi),%bl
mov    $0x5,%eax
test   %bl,%bl
je     11eb <fts_stat+0x8b>
cmp    $0x2e,%bl
jne    123a <fts_stat+0xda>
cmpb   $0x0,0x2(%rsi)
je     11eb <fts_stat+0x8b>
mov    0x30(%r14),%rsi
mov    $0x1,%eax
jmp    1254 <fts_stat+0xf4>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x30(%rsi),%rsi
cmpq   $0x0,0x20(%rsi)
js     11eb <fts_stat+0x8b>
cmp    0x10(%rsi),%rdx
jne    1250 <fts_stat+0xf0>
cmp    0x8(%rsi),%rcx
jne    1250 <fts_stat+0xf0>
mov    %rsi,0x28(%r14)
mov    $0x2,%eax
jmp    11eb <fts_stat+0x8b>
mov    0x10(%rbx),%edi
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
mov    $0xc,%eax
test   %rcx,%rcx
jne    11eb <fts_stat+0x8b>
mov    0x10(%rbx),%edi
call   1080 <S_ISREG@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,4),%eax
add    $0x3,%eax
jmp    11eb <fts_stat+0x8b>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32, i64, i64, i8*, i64, %struct.TYPE_5__*, %struct.TYPE_5__*, i32, i32, %struct.stat* }
%struct.stat = type { i64, i64, i32, i32 }
@errno = global i8* null
define i32 @fts_stat(%struct.TYPE_6__* %0, %struct.TYPE_5__* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_6__*
%6 = alloca %struct.TYPE_5__*
%7 = alloca i32
%8 = alloca %struct.TYPE_5__*
%9 = alloca i64
%10 = alloca i64
%11 = alloca %struct.stat*
%12 = alloca %struct.stat
%13 = alloca i32
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %5
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %6
store i32 %2, i32* %7
%14 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%15 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = and i32 %16, 8
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %3
br label %24
20: ; preds = %3
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 9
%23 = load %struct.stat*, %struct.stat** %22
br label %24
24: ; preds = %20, %19
%25 = phi %struct.stat* [ %12, %19 ], [ %23, %20 ]
store %struct.stat* %25, %struct.stat** %11
%26 = load %struct.TYPE_6__*, %struct.TYPE_6__** %5
%27 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = and i32 %28, 2
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %24
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %56
34: ; preds = %31, %24
%35 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %35, i32 0, i32 8
%37 = load i32, i32* %36
%38 = load %struct.stat*, %struct.stat** %11
%39 = call i64 @stat(i32 %37, %struct.stat* %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %55
41: ; preds = %34
%42 = load i8*, i8** @errno
%43 = ptrtoint i8* %42 to i32
store i32 %43, i32* %13
%44 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%45 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %44, i32 0, i32 8
%46 = load i32, i32* %45
%47 = load %struct.stat*, %struct.stat** %11
%48 = call i64 @lstat(i32 %46, %struct.stat* %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %51, label %50
50: ; preds = %41
store i8* null, i8** @errno
store i32 13, i32* %4
br label %170
51: ; preds = %41
%52 = load i32, i32* %13
%53 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%54 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %53, i32 0, i32 0
store i32 %52, i32* %54
br label %68
55: ; preds = %34
br label %72
56: ; preds = %31
%57 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%58 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %57, i32 0, i32 8
%59 = load i32, i32* %58
%60 = load %struct.stat*, %struct.stat** %11
%61 = call i64 @lstat(i32 %59, %struct.stat* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %71
63: ; preds = %56
%64 = load i8*, i8** @errno
%65 = ptrtoint i8* %64 to i32
%66 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%67 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %66, i32 0, i32 0
store i32 %65, i32* %67
br label %68
68: ; preds = %63, %51
%69 = load %struct.stat*, %struct.stat** %11
%70 = call i32 @memset(%struct.stat* %69, i32 0, i32 24)
store i32 10, i32* %4
br label %170
71: ; preds = %56
br label %72
72: ; preds = %71, %55
%73 = load %struct.stat*, %struct.stat** %11
%74 = getelementptr inbounds %struct.stat, %struct.stat* %73, i32 0, i32 2
%75 = load i32, i32* %74
%76 = call i64 @S_ISDIR(i32 %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %155
78: ; preds = %72
%79 = load %struct.stat*, %struct.stat** %11
%80 = getelementptr inbounds %struct.stat, %struct.stat* %79, i32 0, i32 0
%81 = load i64, i64* %80
%82 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%83 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %82, i32 0, i32 1
store i64 %81, i64* %83
store i64 %81, i64* %9
%84 = load %struct.stat*, %struct.stat** %11
%85 = getelementptr inbounds %struct.stat, %struct.stat* %84, i32 0, i32 1
%86 = load i64, i64* %85
%87 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%88 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %87, i32 0, i32 2
store i64 %86, i64* %88
store i64 %86, i64* %10
%89 = load %struct.stat*, %struct.stat** %11
%90 = getelementptr inbounds %struct.stat, %struct.stat* %89, i32 0, i32 3
%91 = load i32, i32* %90
%92 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%93 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %92, i32 0, i32 7
store i32 %91, i32* %93
%94 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%95 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %94, i32 0, i32 3
%96 = load i8*, i8** %95
%97 = getelementptr inbounds i8, i8* %96, i64 0
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 46
br i1 %100, label %101, label %124
101: ; preds = %78
%102 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%103 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %102, i32 0, i32 3
%104 = load i8*, i8** %103
%105 = getelementptr inbounds i8, i8* %104, i64 1
%106 = load i8, i8* %105
%107 = icmp ne i8 %106, 0
br i1 %107, label %108, label %123
108: ; preds = %101
%109 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%110 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %109, i32 0, i32 3
%111 = load i8*, i8** %110
%112 = getelementptr inbounds i8, i8* %111, i64 1
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 46
br i1 %115, label %116, label %124
116: ; preds = %108
%117 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%118 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %117, i32 0, i32 3
%119 = load i8*, i8** %118
%120 = getelementptr inbounds i8, i8* %119, i64 2
%121 = load i8, i8* %120
%122 = icmp ne i8 %121, 0
br i1 %122, label %124, label %123
123: ; preds = %116, %101
store i32 5, i32* %4
br label %170
124: ; preds = %116, %108, %78
%125 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%126 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %125, i32 0, i32 6
%127 = load %struct.TYPE_5__*, %struct.TYPE_5__** %126
store %struct.TYPE_5__* %127, %struct.TYPE_5__** %8
br label %128
128: ; preds = %150, %124
%129 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%130 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %129, i32 0, i32 4
%131 = load i64, i64* %130
%132 = icmp sge i64 %131, 0
br i1 %132, label %133, label %154
133: ; preds = %128
%134 = load i64, i64* %10
%135 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%136 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %135, i32 0, i32 2
%137 = load i64, i64* %136
%138 = icmp eq i64 %134, %137
br i1 %138, label %139, label %149
139: ; preds = %133
%140 = load i64, i64* %9
%141 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%142 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %141, i32 0, i32 1
%143 = load i64, i64* %142
%144 = icmp eq i64 %140, %143
br i1 %144, label %145, label %149
145: ; preds = %139
%146 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%147 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%148 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %147, i32 0, i32 5
store %struct.TYPE_5__* %146, %struct.TYPE_5__** %148
store i32 2, i32* %4
br label %170
149: ; preds = %139, %133
br label %150
150: ; preds = %149
%151 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%152 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %151, i32 0, i32 6
%153 = load %struct.TYPE_5__*, %struct.TYPE_5__** %152
store %struct.TYPE_5__* %153, %struct.TYPE_5__** %8
br label %128
154: ; preds = %128
store i32 1, i32* %4
br label %170
155: ; preds = %72
%156 = load %struct.stat*, %struct.stat** %11
%157 = getelementptr inbounds %struct.stat, %struct.stat* %156, i32 0, i32 2
%158 = load i32, i32* %157
%159 = call i64 @S_ISLNK(i32 %158)
%160 = icmp ne i64 %159, 0
br i1 %160, label %161, label %162
161: ; preds = %155
store i32 12, i32* %4
br label %170
162: ; preds = %155
%163 = load %struct.stat*, %struct.stat** %11
%164 = getelementptr inbounds %struct.stat, %struct.stat* %163, i32 0, i32 2
%165 = load i32, i32* %164
%166 = call i64 @S_ISREG(i32 %165)
%167 = icmp ne i64 %166, 0
br i1 %167, label %168, label %169
168: ; preds = %162
store i32 8, i32* %4
br label %170
169: ; preds = %162
store i32 3, i32* %4
br label %170
170: ; preds = %169, %168, %161, %154, %145, %123, %68, %50
%171 = load i32, i32* %4
ret i32 %171
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32, i64, i64, i8*, i64, %struct.TYPE_5__*, %struct.TYPE_5__*, i32, i32, %struct.stat* }
%struct.stat = type { i64, i64, i32, i32 }
@errno = global i8* null
define i32 @fts_stat(%struct.TYPE_6__* nocapture %0, %struct.TYPE_5__* nocapture %1, i32 %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = and i32 %7, 8
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 9
%12 = load %struct.stat*, %struct.stat** %11
br label %13
13: ; preds = %3, %10
%14 = phi %struct.stat* [ %12, %10 ], [ %4, %3 ]
%15 = and i32 %7, 2
%16 = or i32 %15, %2
%17 = icmp eq i32 %16, 0
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 8
%19 = load i32, i32* %18
br i1 %17, label %29, label %20
20: ; preds = %13
%21 = call i64 @stat(i32 %19, %struct.stat* %14)
%22 = icmp eq i64 %21, 0
br i1 %22, label %40, label %23
23: ; preds = %20
%24 = load i8*, i8** @errno
%25 = load i32, i32* %18
%26 = call i64 @lstat(i32 %25, %struct.stat* %14)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %23
store i8* null, i8** @errno
br label %98
29: ; preds = %13
%30 = call i64 @lstat(i32 %19, %struct.stat* %14)
%31 = icmp eq i64 %30, 0
br i1 %31, label %40, label %32
32: ; preds = %29
%33 = load i8*, i8** @errno
br label %34
34: ; preds = %23, %32
%35 = phi i8* [ %33, %32 ], [ %24, %23 ]
%36 = ptrtoint i8* %35 to i64
%37 = trunc i64 %36 to i32
%38 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
store i32 %37, i32* %38
%39 = call i32 @memset(%struct.stat* %14, i32 0, i32 24)
br label %98
40: ; preds = %29, %20
%41 = getelementptr inbounds %struct.stat, %struct.stat* %14, i64 0, i32 2
%42 = load i32, i32* %41
%43 = call i64 @S_ISDIR(i32 %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %89, label %45
45: ; preds = %40
%46 = getelementptr inbounds %struct.stat, %struct.stat* %14, i64 0, i32 0
%47 = load i64, i64* %46
%48 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
store i64 %47, i64* %48
%49 = getelementptr inbounds %struct.stat, %struct.stat* %14, i64 0, i32 1
%50 = load i64, i64* %49
%51 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 2
store i64 %50, i64* %51
%52 = getelementptr inbounds %struct.stat, %struct.stat* %14, i64 0, i32 3
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 7
store i32 %53, i32* %54
%55 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 3
%56 = load i8*, i8** %55
%57 = load i8, i8* %56
%58 = icmp eq i8 %57, 46
br i1 %58, label %59, label %66
59: ; preds = %45
%60 = getelementptr inbounds i8, i8* %56, i64 1
%61 = load i8, i8* %60
switch i8 %61, label %66 [
i8 0, label %98
i8 46, label %62
]
62: ; preds = %59
%63 = getelementptr inbounds i8, i8* %56, i64 2
%64 = load i8, i8* %63
%65 = icmp eq i8 %64, 0
br i1 %65, label %98, label %66
66: ; preds = %59, %62, %45
%67 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 6
%68 = load %struct.TYPE_5__*, %struct.TYPE_5__** %67
%69 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %68, i64 0, i32 4
%70 = load i64, i64* %69
%71 = icmp sgt i64 %70, -1
br i1 %71, label %72, label %98
72: ; preds = %66, %83
%73 = phi %struct.TYPE_5__* [ %85, %83 ], [ %68, %66 ]
%74 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %73, i64 0, i32 2
%75 = load i64, i64* %74
%76 = icmp eq i64 %50, %75
br i1 %76, label %77, label %83
77: ; preds = %72
%78 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %73, i64 0, i32 1
%79 = load i64, i64* %78
%80 = icmp eq i64 %47, %79
br i1 %80, label %81, label %83
81: ; preds = %77
%82 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 5
store %struct.TYPE_5__* %73, %struct.TYPE_5__** %82
br label %98
83: ; preds = %72, %77
%84 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %73, i64 0, i32 6
%85 = load %struct.TYPE_5__*, %struct.TYPE_5__** %84
%86 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %85, i64 0, i32 4
%87 = load i64, i64* %86
%88 = icmp sgt i64 %87, -1
br i1 %88, label %72, label %98
89: ; preds = %40
%90 = load i32, i32* %41
%91 = call i64 @S_ISLNK(i32 %90)
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %89
%94 = load i32, i32* %41
%95 = call i64 @S_ISREG(i32 %94)
%96 = icmp eq i64 %95, 0
%97 = select i1 %96, i32 3, i32 8
br label %98
98: ; preds = %83, %66, %93, %89, %62, %59, %81, %34, %28
%99 = phi i32 [ 10, %34 ], [ 13, %28 ], [ 2, %81 ], [ 5, %59 ], [ 5, %62 ], [ 12, %89 ], [ %97, %93 ], [ 1, %66 ], [ 1, %83 ]
ret i32 %99
}