#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_16__ TYPE_2__;
typedef struct TYPE_15__ TYPE_1__;

/* Type definitions */
struct TYPE_16__ {
  int fts_options;
  scalar_t__ fts_dev;
  int fts_rfd;
  char *fts_path;
  TYPE_1__ *fts_cur;
  TYPE_1__ *fts_child;
};
struct TYPE_15__ {
  int fts_instr;
  scalar_t__ fts_info;
  int fts_symfd;
  int fts_errno;
  int fts_flags;
  scalar_t__ fts_dev;
  char *fts_accpath;
  scalar_t__ fts_level;
  char *fts_path;
  int fts_pathlen;
  struct TYPE_15__ *fts_parent;
  scalar_t__ fts_namelen;
  int /*<<< orphan*/ fts_name;
  struct TYPE_15__ *fts_link;
};
typedef TYPE_1__ FTSENT;
typedef TYPE_2__ FTS;

/* Variables and functions */
int FTS_AGAIN;
scalar_t__ FTS_D;
int FTS_DONTCHDIR;
void *FTS_DP;
void *FTS_ERR;
int FTS_FOLLOW;
int FTS_NAMEONLY;
int FTS_NOCHDIR;
void *FTS_NOINSTR;
scalar_t__ FTS_ROOTLEVEL;
scalar_t__ FTS_ROOTPARENTLEVEL;
int FTS_SKIP;
scalar_t__ FTS_SL;
scalar_t__ FTS_SLNONE;
int FTS_STOP;
int FTS_SYMFOLLOW;
int FTS_XDEV;
int O_RDONLY;
int /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
int errno;
scalar_t__ fchdir(int);
TYPE_1__ *fts_build(TYPE_2__ *, int);
int /*<<< orphan*/ fts_free(TYPE_1__ *);
int /*<<< orphan*/ fts_lfree(TYPE_1__ *);
int /*<<< orphan*/ fts_load(TYPE_2__ *, TYPE_1__ *);
scalar_t__ fts_safe_changedir(TYPE_2__ *, TYPE_1__ *, int, char *);
void *fts_stat(TYPE_2__ *, TYPE_1__ *, int);
int /*<<< orphan*/ memmove(char *, int /*<<< orphan*/, size_t);
int open(char *, int, int /*<<< orphan*/);
FTSENT *fts_read(FTS *sp) {
  FTSENT *p, *tmp;
  int instr;
  char *t;
  int saved_errno;
  _DIAGASSERT(sp != NULL);
  if (sp->fts_cur == NULL || (sp->fts_options & (FTS_STOP)))
    return (NULL);
  p = sp->fts_cur;
  instr = p->fts_instr;
  p->fts_instr = FTS_NOINSTR;
  if (instr == FTS_AGAIN) {
    p->fts_info = fts_stat(sp, p, 0);
    return (p);
  }
  if (instr == FTS_FOLLOW &&
      (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
    p->fts_info = fts_stat(sp, p, 1);
    if (p->fts_info == FTS_D && !(sp->fts_options & (FTS_NOCHDIR))) {
      if ((p->fts_symfd = open(".", O_RDONLY | 0, 0)) == -1) {
        p->fts_errno = errno;
        p->fts_info = FTS_ERR;
      } else
        p->fts_flags |= FTS_SYMFOLLOW;
    }
    return (p);
  }
  if (p->fts_info == FTS_D) {
    if (instr == FTS_SKIP ||
        ((sp->fts_options & (FTS_XDEV)) && p->fts_dev != sp->fts_dev)) {
      if (p->fts_flags & FTS_SYMFOLLOW)
        (void)close(p->fts_symfd);
      if (sp->fts_child) {
        fts_lfree(sp->fts_child);
        sp->fts_child = NULL;
      }
      p->fts_info = FTS_DP;
      return (p);
    }
    if (sp->fts_child && (sp->fts_options & (FTS_NAMEONLY))) {
      (sp->fts_options &= ~(FTS_NAMEONLY));
      fts_lfree(sp->fts_child);
      sp->fts_child = NULL;
    }
    if (sp->fts_child) {
      if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
        p->fts_errno = errno;
        p->fts_flags |= FTS_DONTCHDIR;
        for (p = sp->fts_child; p; p = p->fts_link)
          p->fts_accpath = p->fts_parent->fts_accpath;
      }
    } else if ((sp->fts_child = fts_build(sp, 3)) == NULL) {
      if ((sp->fts_options & (FTS_STOP)))
        return (NULL);
      return (p);
    }
    p = sp->fts_child;
    sp->fts_child = NULL;
    goto name;
  }
next:
  tmp = p;
  assert(tmp == sp->fts_cur);
  sp->fts_cur = NULL;
  if ((p = p->fts_link) != NULL) {
    fts_free(tmp);
    if (p->fts_level == FTS_ROOTLEVEL) {
      if ((!(sp->fts_options & (FTS_NOCHDIR)) && fchdir(sp->fts_rfd))) {
        (sp->fts_options |= (FTS_STOP));
        return (NULL);
      }
      fts_load(sp, p);
      return (sp->fts_cur = p);
    }
    if (p->fts_instr == FTS_SKIP)
      goto next;
    if (p->fts_instr == FTS_FOLLOW) {
      p->fts_info = fts_stat(sp, p, 1);
      if (p->fts_info == FTS_D && !(sp->fts_options & (FTS_NOCHDIR))) {
        if ((p->fts_symfd = open(".", O_RDONLY | 0, 0)) == -1) {
          p->fts_errno = errno;
          p->fts_info = FTS_ERR;
        } else
          p->fts_flags |= FTS_SYMFOLLOW;
      }
      p->fts_instr = FTS_NOINSTR;
    }
  name:
    t = sp->fts_path +
        (p->fts_parent->fts_path[p->fts_parent->fts_pathlen - 1] == '/'
             ? p->fts_parent->fts_pathlen - 1
             : p->fts_parent->fts_pathlen);
    *t++ = '/';
    memmove(t, p->fts_name, (size_t)(p->fts_namelen + 1));
    return (sp->fts_cur = p);
  }
  p = tmp->fts_parent;
  fts_free(tmp);
  if (p->fts_level == FTS_ROOTPARENTLEVEL) {
    fts_free(p);
    errno = 0;
    return (sp->fts_cur = NULL);
  }
  sp->fts_path[p->fts_pathlen] = '\0';
  if (p->fts_level == FTS_ROOTLEVEL) {
    if ((!(sp->fts_options & (FTS_NOCHDIR)) && fchdir(sp->fts_rfd))) {
      (sp->fts_options |= (FTS_STOP));
      return (NULL);
    }
  } else if (p->fts_flags & FTS_SYMFOLLOW) {
    if ((!(sp->fts_options & (FTS_NOCHDIR)) && fchdir(p->fts_symfd))) {
      saved_errno = errno;
      (void)close(p->fts_symfd);
      errno = saved_errno;
      (sp->fts_options |= (FTS_STOP));
      return (NULL);
    }
    (void)close(p->fts_symfd);
  } else if (!(p->fts_flags & FTS_DONTCHDIR) &&
             fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
    (sp->fts_options |= (FTS_STOP));
    return (NULL);
  }
  p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
  return (sp->fts_cur = p);
}


x86 assembly (clang, -O0):
<fts_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <_DIAGASSERT@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     1205 <fts_read+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2d56(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1212 <fts_read+0x52>
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d4a(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
mov    0x2d8d(%rip),%rcx
cmp    (%rcx),%eax
jne    1272 <fts_read+0xb2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1040 <fts_stat@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x24(%rbp),%eax
mov    0x2d7c(%rip),%rcx
cmp    (%rcx),%eax
jne    1377 <fts_read+0x1b7>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d0d(%rip),%rcx
cmp    (%rcx),%rax
je     12b4 <fts_read+0xf4>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2ced(%rip),%rcx
cmp    (%rcx),%rax
jne    1377 <fts_read+0x1b7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2cb0(%rip),%rcx
cmp    (%rcx),%rax
jne    136a <fts_read+0x1aa>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2c72(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    136a <fts_read+0x1aa>
mov    0x2ca0(%rip),%rax
mov    (%rax),%esi
or     $0x0,%esi
lea    0xced(%rip),%rdi
xor    %edx,%edx
call   10d0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0xffffffff,%eax
jne    1352 <fts_read+0x192>
mov    0x2c4e(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x2c2e(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    1365 <fts_read+0x1a5>
mov    0x2c8f(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
jmp    136a <fts_read+0x1aa>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2c0a(%rip),%rcx
cmp    (%rcx),%rax
jne    159f <fts_read+0x3df>
mov    -0x24(%rbp),%eax
mov    0x2c1f(%rip),%rcx
cmp    (%rcx),%eax
je     13cf <fts_read+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2baa(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     143b <fts_read+0x27b>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     143b <fts_read+0x27b>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2c0b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13f4 <fts_read+0x234>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     141c <fts_read+0x25c>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1080 <fts_lfree@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    0x2b8d(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     148f <fts_read+0x2cf>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2b09(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     148f <fts_read+0x2cf>
mov    0x2af7(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x10(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1080 <fts_lfree@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     152b <fts_read+0x36b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rcx
mov    $0xffffffff,%edx
call   10b0 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     1526 <fts_read+0x366>
mov    0x2ab7(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x2b07(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1521 <fts_read+0x361>
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rax
mov    0x28(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x60(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    14f1 <fts_read+0x331>
jmp    1526 <fts_read+0x366>
jmp    1582 <fts_read+0x3c2>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   10e0 <fts_build@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,0x28(%rcx)
cmp    $0x0,%rax
jne    157d <fts_read+0x3bd>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x29f8(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1570 <fts_read+0x3b0>
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
jmp    1582 <fts_read+0x3c2>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
jmp    1772 <fts_read+0x5b2>
jmp    15a4 <fts_read+0x3e4>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x20(%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    0x60(%rax),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1820 <fts_read+0x660>
mov    -0x20(%rbp),%rdi
call   1070 <fts_free@plt>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%rax
mov    0x29c1(%rip),%rcx
cmp    (%rcx),%rax
jne    1676 <fts_read+0x4b6>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2953(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1654 <fts_read+0x494>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   10a0 <fchdir@plt>
cmp    $0x0,%rax
je     1654 <fts_read+0x494>
mov    0x2913(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fts_load@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x20(%rcx)
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x2935(%rip),%rcx
cmp    (%rcx),%eax
jne    1690 <fts_read+0x4d0>
jmp    15a4 <fts_read+0x3e4>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x295b(%rip),%rcx
cmp    (%rcx),%eax
jne    176d <fts_read+0x5ad>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x28bf(%rip),%rcx
cmp    (%rcx),%rax
jne    175b <fts_read+0x59b>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2881(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    175b <fts_read+0x59b>
mov    0x28af(%rip),%rax
mov    (%rax),%esi
or     $0x0,%esi
lea    0x8fc(%rip),%rdi
xor    %edx,%edx
call   10d0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0xffffffff,%eax
jne    1743 <fts_read+0x583>
mov    0x285d(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x283d(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    1756 <fts_read+0x596>
mov    0x289e(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
jmp    175b <fts_read+0x59b>
mov    0x2816(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1772 <fts_read+0x5b2>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rax
mov    0x38(%rax),%rax
mov    -0x18(%rbp),%rcx
mov    0x48(%rcx),%rcx
mov    0x40(%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    17be <fts_read+0x5fe>
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rax
mov    0x40(%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    17cc <fts_read+0x60c>
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rax
mov    0x40(%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x2f,(%rax)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x58(%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x50(%rax),%rdx
add    $0x1,%rdx
call   10c0 <memmove@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x20(%rcx)
mov    %rax,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x20(%rbp),%rax
mov    0x48(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <fts_free@plt>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%rax
mov    0x27ac(%rip),%rcx
cmp    (%rcx),%rax
jne    187c <fts_read+0x6bc>
mov    -0x18(%rbp),%rdi
call   1070 <fts_free@plt>
mov    0x2723(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x20(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x18(%rbp),%rcx
movslq 0x40(%rcx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%rax
mov    0x2721(%rip),%rcx
cmp    (%rcx),%rax
jne    18f9 <fts_read+0x739>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x26b3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    18f4 <fts_read+0x734>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   10a0 <fchdir@plt>
cmp    $0x0,%rax
je     18f4 <fts_read+0x734>
mov    0x2673(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
jmp    19fb <fts_read+0x83b>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x26e1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1993 <fts_read+0x7d3>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2649(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1982 <fts_read+0x7c2>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   10a0 <fchdir@plt>
cmp    $0x0,%rax
je     1982 <fts_read+0x7c2>
mov    0x2639(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <close@plt>
mov    -0x34(%rbp),%ecx
mov    0x261e(%rip),%rax
mov    %ecx,(%rax)
mov    0x25e5(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <close@plt>
jmp    19f6 <fts_read+0x836>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x263f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    19f1 <fts_read+0x831>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rsi
mov    $0xffffffff,%edx
lea    0x63c(%rip),%rcx
call   10b0 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     19f1 <fts_read+0x831>
mov    0x2576(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a46 <fts_read+0x886>
jmp    19f6 <fts_read+0x836>
jmp    19fb <fts_read+0x83b>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x14(%rax)
je     1a1c <fts_read+0x85c>
mov    0x2560(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1a2a <fts_read+0x86a>
mov    0x258d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x20(%rcx)
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts_read>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1090 <_DIAGASSERT@plt>
mov    0x20(%r14),%rbx
test   %rbx,%rbx
je     11f4 <fts_read+0x34>
mov    (%r14),%eax
mov    0x2d61(%rip),%r15
test   %eax,(%r15)
je     1208 <fts_read+0x48>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%ecx
mov    0x2d67(%rip),%r12
mov    (%r12),%edx
mov    %edx,(%rbx)
mov    0x2db2(%rip),%rdx
cmp    (%rdx),%ecx
jne    1235 <fts_read+0x75>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
jmp    11f6 <fts_read+0x36>
mov    0x2dbc(%rip),%rsi
mov    0x8(%rbx),%rdx
cmp    (%rsi),%ecx
jne    1264 <fts_read+0xa4>
mov    0x2d55(%rip),%rsi
cmp    (%rsi),%rdx
je     13a9 <fts_read+0x1e9>
mov    0x2d3d(%rip),%rsi
cmp    (%rsi),%rdx
je     13a9 <fts_read+0x1e9>
mov    0x2d25(%rip),%rsi
cmp    (%rsi),%rdx
jne    12f5 <fts_read+0x135>
mov    0x2d3d(%rip),%rdx
cmp    (%rdx),%ecx
je     1413 <fts_read+0x253>
mov    0x2cce(%rip),%rcx
test   %eax,(%rcx)
je     129c <fts_read+0xdc>
mov    0x20(%rbx),%rcx
cmp    0x8(%r14),%rcx
jne    1413 <fts_read+0x253>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     12ca <fts_read+0x10a>
mov    0x2cb4(%rip),%rcx
mov    (%rcx),%ecx
test   %eax,%ecx
je     156f <fts_read+0x3af>
not    %ecx
and    %ecx,%eax
mov    %eax,(%r14)
call   1080 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
mov    %r14,%rdi
mov    $0x3,%esi
call   10e0 <fts_build@plt>
mov    %rax,0x28(%r14)
test   %rax,%rax
je     155e <fts_read+0x39e>
mov    0x28(%r14),%rbx
movq   $0x0,0x28(%r14)
jmp    169c <fts_read+0x4dc>
mov    $0x1,%edi
call   1060 <assert@plt>
movq   $0x0,0x20(%r14)
mov    0x60(%rbx),%rax
test   %rax,%rax
je     1365 <fts_read+0x1a5>
mov    0x2ca9(%rip),%rbp
mov    0x2c9a(%rip),%r13
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rax,%rbx
call   1070 <fts_free@plt>
mov    0x30(%rbx),%rax
cmp    0x0(%rbp),%rax
je     1492 <fts_read+0x2d2>
mov    (%rbx),%eax
cmp    0x0(%r13),%eax
jne    14b4 <fts_read+0x2f4>
xor    %edi,%edi
cmp    0x20(%r14),%rbx
sete   %dil
call   1060 <assert@plt>
movq   $0x0,0x20(%r14)
mov    0x60(%rbx),%rax
test   %rax,%rax
jne    1320 <fts_read+0x160>
mov    %rbx,%rdi
mov    0x48(%rbx),%rbx
call   1070 <fts_free@plt>
mov    0x30(%rbx),%rax
mov    0x2c74(%rip),%rcx
cmp    (%rcx),%rax
jne    1452 <fts_read+0x292>
mov    %rbx,%rdi
call   1070 <fts_free@plt>
mov    0x2bec(%rip),%rax
movl   $0x0,(%rax)
movq   $0x0,0x20(%r14)
xor    %ebx,%ebx
jmp    11f6 <fts_read+0x36>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
mov    0x2bcc(%rip),%rcx
cmp    %rax,(%rcx)
jne    11f6 <fts_read+0x36>
mov    0x2b94(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    11f6 <fts_read+0x36>
mov    0x2bc2(%rip),%rax
mov    (%rax),%esi
lea    0xc12(%rip),%rdi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,0x10(%rbx)
cmp    $0xffffffff,%eax
je     162f <fts_read+0x46f>
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
jmp    11f6 <fts_read+0x36>
mov    0x2bce(%rip),%rax
mov    (%rax),%eax
test   %eax,0x18(%rbx)
je     1429 <fts_read+0x269>
mov    0x10(%rbx),%edi
call   1050 <close@plt>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     143f <fts_read+0x27f>
call   1080 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
mov    0x2b6a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
jmp    11f6 <fts_read+0x36>
mov    0x18(%r14),%rax
movslq 0x40(%rbx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x30(%rbx),%rax
mov    0x2b57(%rip),%rcx
cmp    (%rcx),%rax
jne    152d <fts_read+0x36d>
mov    0x2aef(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    160d <fts_read+0x44d>
mov    0x10(%r14),%edi
call   10a0 <fchdir@plt>
jmp    1608 <fts_read+0x448>
mov    0x2acf(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
je     15ce <fts_read+0x40e>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <fts_load@plt>
jmp    16d4 <fts_read+0x514>
mov    0x2b3d(%rip),%rcx
cmp    (%rcx),%eax
jne    169c <fts_read+0x4dc>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
mov    0x2ab2(%rip),%rcx
cmp    %rax,(%rcx)
jne    1696 <fts_read+0x4d6>
mov    0x2a7a(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    1696 <fts_read+0x4d6>
mov    0x2aa8(%rip),%rax
mov    (%rax),%esi
lea    0xaf8(%rip),%rdi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,0x10(%rbx)
cmp    $0xffffffff,%eax
je     167c <fts_read+0x4bc>
mov    0x2ac5(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
jmp    1696 <fts_read+0x4d6>
mov    0x18(%rbx),%eax
mov    0x2ab1(%rip),%rcx
test   %eax,(%rcx)
je     15e5 <fts_read+0x425>
mov    0x2a22(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
je     1647 <fts_read+0x487>
mov    0x10(%rbx),%edi
call   1050 <close@plt>
jmp    160d <fts_read+0x44d>
mov    (%r15),%eax
xor    %ecx,%ecx
test   %eax,(%r14)
cmovne %rcx,%rbx
jmp    11f6 <fts_read+0x36>
mov    0x28(%rbx),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   10b0 <fts_safe_changedir@plt>
test   %rax,%rax
je     12e4 <fts_read+0x124>
mov    0x29ed(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x2a41(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
mov    0x28(%r14),%rax
test   %rax,%rax
je     12e4 <fts_read+0x124>
mov    0x48(%rax),%rcx
mov    0x60(%rax),%rdx
mov    0x28(%rcx),%rcx
mov    %rcx,0x28(%rax)
mov    %rdx,%rax
test   %rdx,%rdx
jne    15b1 <fts_read+0x3f1>
jmp    12e4 <fts_read+0x124>
mov    0x10(%r14),%edi
call   10a0 <fchdir@plt>
test   %rax,%rax
jne    166f <fts_read+0x4af>
jmp    14a4 <fts_read+0x2e4>
mov    0x29f4(%rip),%rcx
test   %eax,(%rcx)
jne    160d <fts_read+0x44d>
mov    0x48(%rbx),%rsi
lea    0xa05(%rip),%rcx
mov    %r14,%rdi
mov    $0xffffffff,%edx
call   10b0 <fts_safe_changedir@plt>
test   %rax,%rax
jne    166f <fts_read+0x4af>
cmpl   $0x0,0x14(%rbx)
jne    161c <fts_read+0x45c>
mov    0x2996(%rip),%rax
jmp    1623 <fts_read+0x463>
mov    0x294d(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
jmp    16d4 <fts_read+0x514>
mov    0x294a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x292e(%rip),%rax
jmp    1446 <fts_read+0x286>
mov    0x10(%rbx),%edi
call   10a0 <fchdir@plt>
test   %rax,%rax
je     1551 <fts_read+0x391>
mov    0x2921(%rip),%r12
mov    (%r12),%ebp
mov    0x10(%rbx),%edi
call   1050 <close@plt>
mov    %ebp,(%r12)
mov    (%r15),%eax
or     %eax,(%r14)
xor    %ebx,%ebx
jmp    11f6 <fts_read+0x36>
mov    0x28fd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x28e1(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
mov    (%r12),%eax
mov    %eax,(%rbx)
mov    0x18(%r14),%rax
mov    0x48(%rbx),%rcx
mov    0x38(%rcx),%rdx
movslq 0x40(%rcx),%rcx
lea    -0x1(%rcx),%rsi
cmpb   $0x2f,-0x1(%rdx,%rcx,1)
cmovne %ecx,%esi
movslq %esi,%rcx
lea    0x1(%rax,%rcx,1),%rdi
movb   $0x2f,(%rax,%rcx,1)
mov    0x58(%rbx),%esi
mov    0x50(%rbx),%rdx
add    $0x1,%rdx
call   10c0 <memmove@plt>
mov    %rbx,0x20(%r14)
jmp    11f6 <fts_read+0x36>

LLVM IR (-O0):
%struct.TYPE_15__ = type { i32, i64, i32, i32, i32, i64, i8*, i64, i8*, i32, %struct.TYPE_15__*, i64, i32, %struct.TYPE_15__* }
%struct.TYPE_16__ = type { i32, i64, i32, i8*, %struct.TYPE_15__*, %struct.TYPE_15__* }
@FTS_STOP = global i32 0
@FTS_NOINSTR = global i8* null
@FTS_AGAIN = global i32 0
@FTS_FOLLOW = global i32 0
@FTS_SL = global i64 0
@FTS_SLNONE = global i64 0
@FTS_D = global i64 0
@FTS_NOCHDIR = global i32 0
@.str = [2 x i8] c".\00"
@O_RDONLY = global i32 0
@errno = global i32 0
@FTS_ERR = global i8* null
@FTS_SYMFOLLOW = global i32 0
@FTS_SKIP = global i32 0
@FTS_XDEV = global i32 0
@FTS_DP = global i8* null
@FTS_NAMEONLY = global i32 0
@FTS_DONTCHDIR = global i32 0
@FTS_ROOTLEVEL = global i64 0
@FTS_ROOTPARENTLEVEL = global i64 0
@.str.1 = [3 x i8] c"..\00"
define %struct.TYPE_15__* @fts_read(%struct.TYPE_16__* %0) {
%2 = alloca %struct.TYPE_15__*
%3 = alloca %struct.TYPE_16__*
%4 = alloca %struct.TYPE_15__*
%5 = alloca %struct.TYPE_15__*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct.TYPE_16__* %0, %struct.TYPE_16__** %3
%9 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%10 = icmp ne %struct.TYPE_16__* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @_DIAGASSERT(i32 %11)
%13 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%14 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %13, i32 0, i32 4
%15 = load %struct.TYPE_15__*, %struct.TYPE_15__** %14
%16 = icmp eq %struct.TYPE_15__* %15, null
br i1 %16, label %24, label %17
17: ; preds = %1
%18 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%19 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = load i32, i32* @FTS_STOP
%22 = and i32 %20, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17, %1
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
25: ; preds = %17
%26 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%27 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %26, i32 0, i32 4
%28 = load %struct.TYPE_15__*, %struct.TYPE_15__** %27
store %struct.TYPE_15__* %28, %struct.TYPE_15__** %4
%29 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%30 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %29, i32 0, i32 0
%31 = load i32, i32* %30
store i32 %31, i32* %6
%32 = load i8*, i8** @FTS_NOINSTR
%33 = ptrtoint i8* %32 to i32
%34 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%35 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %34, i32 0, i32 0
store i32 %33, i32* %35
%36 = load i32, i32* %6
%37 = load i32, i32* @FTS_AGAIN
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %47
39: ; preds = %25
%40 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%41 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%42 = call i8* @fts_stat(%struct.TYPE_16__* %40, %struct.TYPE_15__* %41, i32 0)
%43 = ptrtoint i8* %42 to i64
%44 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%45 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %44, i32 0, i32 1
store i64 %43, i64* %45
%46 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %46, %struct.TYPE_15__** %2
br label %538
47: ; preds = %25
%48 = load i32, i32* %6
%49 = load i32, i32* @FTS_FOLLOW
%50 = icmp eq i32 %48, %49
br i1 %50, label %51, label %106
51: ; preds = %47
%52 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%53 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %52, i32 0, i32 1
%54 = load i64, i64* %53
%55 = load i64, i64* @FTS_SL
%56 = icmp eq i64 %54, %55
br i1 %56, label %63, label %57
57: ; preds = %51
%58 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%59 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %58, i32 0, i32 1
%60 = load i64, i64* %59
%61 = load i64, i64* @FTS_SLNONE
%62 = icmp eq i64 %60, %61
br i1 %62, label %63, label %106
63: ; preds = %57, %51
%64 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%65 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%66 = call i8* @fts_stat(%struct.TYPE_16__* %64, %struct.TYPE_15__* %65, i32 1)
%67 = ptrtoint i8* %66 to i64
%68 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%69 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %68, i32 0, i32 1
store i64 %67, i64* %69
%70 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%71 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %70, i32 0, i32 1
%72 = load i64, i64* %71
%73 = load i64, i64* @FTS_D
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %104
75: ; preds = %63
%76 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%77 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %76, i32 0, i32 0
%78 = load i32, i32* %77
%79 = load i32, i32* @FTS_NOCHDIR
%80 = and i32 %78, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %104, label %82
82: ; preds = %75
%83 = load i32, i32* @O_RDONLY
%84 = or i32 %83, 0
%85 = call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %84, i32 0)
%86 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%87 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %86, i32 0, i32 2
store i32 %85, i32* %87
%88 = icmp eq i32 %85, -1
br i1 %88, label %89, label %97
89: ; preds = %82
%90 = load i32, i32* @errno
%91 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%92 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %91, i32 0, i32 3
store i32 %90, i32* %92
%93 = load i8*, i8** @FTS_ERR
%94 = ptrtoint i8* %93 to i64
%95 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%96 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %95, i32 0, i32 1
store i64 %94, i64* %96
br label %103
97: ; preds = %82
%98 = load i32, i32* @FTS_SYMFOLLOW
%99 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%100 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %99, i32 0, i32 4
%101 = load i32, i32* %100
%102 = or i32 %101, %98
store i32 %102, i32* %100
br label %103
103: ; preds = %97, %89
br label %104
104: ; preds = %103, %75, %63
%105 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %105, %struct.TYPE_15__** %2
br label %538
106: ; preds = %57, %47
%107 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%108 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %107, i32 0, i32 1
%109 = load i64, i64* %108
%110 = load i64, i64* @FTS_D
%111 = icmp eq i64 %109, %110
br i1 %111, label %112, label %251
112: ; preds = %106
%113 = load i32, i32* %6
%114 = load i32, i32* @FTS_SKIP
%115 = icmp eq i32 %113, %114
br i1 %115, label %131, label %116
116: ; preds = %112
%117 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%118 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %117, i32 0, i32 0
%119 = load i32, i32* %118
%120 = load i32, i32* @FTS_XDEV
%121 = and i32 %119, %120
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %161
123: ; preds = %116
%124 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%125 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %124, i32 0, i32 5
%126 = load i64, i64* %125
%127 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%128 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %127, i32 0, i32 1
%129 = load i64, i64* %128
%130 = icmp ne i64 %126, %129
br i1 %130, label %131, label %161
131: ; preds = %123, %112
%132 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%133 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %132, i32 0, i32 4
%134 = load i32, i32* %133
%135 = load i32, i32* @FTS_SYMFOLLOW
%136 = and i32 %134, %135
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %131
%139 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%140 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %139, i32 0, i32 2
%141 = load i32, i32* %140
%142 = call i32 @close(i32 %141)
br label %143
143: ; preds = %138, %131
%144 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%145 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %144, i32 0, i32 5
%146 = load %struct.TYPE_15__*, %struct.TYPE_15__** %145
%147 = icmp ne %struct.TYPE_15__* %146, null
br i1 %147, label %148, label %155
148: ; preds = %143
%149 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%150 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %149, i32 0, i32 5
%151 = load %struct.TYPE_15__*, %struct.TYPE_15__** %150
%152 = call i32 @fts_lfree(%struct.TYPE_15__* %151)
%153 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%154 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %153, i32 0, i32 5
store %struct.TYPE_15__* null, %struct.TYPE_15__** %154
br label %155
155: ; preds = %148, %143
%156 = load i8*, i8** @FTS_DP
%157 = ptrtoint i8* %156 to i64
%158 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%159 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %158, i32 0, i32 1
store i64 %157, i64* %159
%160 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %160, %struct.TYPE_15__** %2
br label %538
161: ; preds = %123, %116
%162 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%163 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %162, i32 0, i32 5
%164 = load %struct.TYPE_15__*, %struct.TYPE_15__** %163
%165 = icmp ne %struct.TYPE_15__* %164, null
br i1 %165, label %166, label %186
166: ; preds = %161
%167 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%168 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %167, i32 0, i32 0
%169 = load i32, i32* %168
%170 = load i32, i32* @FTS_NAMEONLY
%171 = and i32 %169, %170
%172 = icmp ne i32 %171, 0
br i1 %172, label %173, label %186
173: ; preds = %166
%174 = load i32, i32* @FTS_NAMEONLY
%175 = xor i32 %174, -1
%176 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%177 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %176, i32 0, i32 0
%178 = load i32, i32* %177
%179 = and i32 %178, %175
store i32 %179, i32* %177
%180 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%181 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %180, i32 0, i32 5
%182 = load %struct.TYPE_15__*, %struct.TYPE_15__** %181
%183 = call i32 @fts_lfree(%struct.TYPE_15__* %182)
%184 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%185 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %184, i32 0, i32 5
store %struct.TYPE_15__* null, %struct.TYPE_15__** %185
br label %186
186: ; preds = %173, %166, %161
%187 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%188 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %187, i32 0, i32 5
%189 = load %struct.TYPE_15__*, %struct.TYPE_15__** %188
%190 = icmp ne %struct.TYPE_15__* %189, null
br i1 %190, label %191, label %228
191: ; preds = %186
%192 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%193 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%194 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%195 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %194, i32 0, i32 6
%196 = load i8*, i8** %195
%197 = call i64 @fts_safe_changedir(%struct.TYPE_16__* %192, %struct.TYPE_15__* %193, i32 -1, i8* %196)
%198 = icmp ne i64 %197, 0
br i1 %198, label %199, label %227
199: ; preds = %191
%200 = load i32, i32* @errno
%201 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%202 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %201, i32 0, i32 3
store i32 %200, i32* %202
%203 = load i32, i32* @FTS_DONTCHDIR
%204 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%205 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %204, i32 0, i32 4
%206 = load i32, i32* %205
%207 = or i32 %206, %203
store i32 %207, i32* %205
%208 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%209 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %208, i32 0, i32 5
%210 = load %struct.TYPE_15__*, %struct.TYPE_15__** %209
store %struct.TYPE_15__* %210, %struct.TYPE_15__** %4
br label %211
211: ; preds = %222, %199
%212 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%213 = icmp ne %struct.TYPE_15__* %212, null
br i1 %213, label %214, label %226
214: ; preds = %211
%215 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%216 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %215, i32 0, i32 10
%217 = load %struct.TYPE_15__*, %struct.TYPE_15__** %216
%218 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %217, i32 0, i32 6
%219 = load i8*, i8** %218
%220 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%221 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %220, i32 0, i32 6
store i8* %219, i8** %221
br label %222
222: ; preds = %214
%223 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%224 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %223, i32 0, i32 13
%225 = load %struct.TYPE_15__*, %struct.TYPE_15__** %224
store %struct.TYPE_15__* %225, %struct.TYPE_15__** %4
br label %211
226: ; preds = %211
br label %227
227: ; preds = %226, %191
br label %245
228: ; preds = %186
%229 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%230 = call %struct.TYPE_15__* @fts_build(%struct.TYPE_16__* %229, i32 3)
%231 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%232 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %231, i32 0, i32 5
store %struct.TYPE_15__* %230, %struct.TYPE_15__** %232
%233 = icmp eq %struct.TYPE_15__* %230, null
br i1 %233, label %234, label %244
234: ; preds = %228
%235 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%236 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %235, i32 0, i32 0
%237 = load i32, i32* %236
%238 = load i32, i32* @FTS_STOP
%239 = and i32 %237, %238
%240 = icmp ne i32 %239, 0
br i1 %240, label %241, label %242
241: ; preds = %234
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
242: ; preds = %234
%243 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %243, %struct.TYPE_15__** %2
br label %538
244: ; preds = %228
br label %245
245: ; preds = %244, %227
%246 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%247 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %246, i32 0, i32 5
%248 = load %struct.TYPE_15__*, %struct.TYPE_15__** %247
store %struct.TYPE_15__* %248, %struct.TYPE_15__** %4
%249 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%250 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %249, i32 0, i32 5
store %struct.TYPE_15__* null, %struct.TYPE_15__** %250
br label %361
251: ; preds = %106
br label %252
252: ; preds = %307, %251
%253 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %253, %struct.TYPE_15__** %5
%254 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%255 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%256 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %255, i32 0, i32 4
%257 = load %struct.TYPE_15__*, %struct.TYPE_15__** %256
%258 = icmp eq %struct.TYPE_15__* %254, %257
%259 = zext i1 %258 to i32
%260 = call i32 @assert(i32 %259)
%261 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%262 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %261, i32 0, i32 4
store %struct.TYPE_15__* null, %struct.TYPE_15__** %262
%263 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%264 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %263, i32 0, i32 13
%265 = load %struct.TYPE_15__*, %struct.TYPE_15__** %264
store %struct.TYPE_15__* %265, %struct.TYPE_15__** %4
%266 = icmp ne %struct.TYPE_15__* %265, null
br i1 %266, label %267, label %412
267: ; preds = %252
%268 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%269 = call i32 @fts_free(%struct.TYPE_15__* %268)
%270 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%271 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %270, i32 0, i32 7
%272 = load i64, i64* %271
%273 = load i64, i64* @FTS_ROOTLEVEL
%274 = icmp eq i64 %272, %273
br i1 %274, label %275, label %301
275: ; preds = %267
%276 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%277 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %276, i32 0, i32 0
%278 = load i32, i32* %277
%279 = load i32, i32* @FTS_NOCHDIR
%280 = and i32 %278, %279
%281 = icmp ne i32 %280, 0
br i1 %281, label %294, label %282
282: ; preds = %275
%283 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%284 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %283, i32 0, i32 2
%285 = load i32, i32* %284
%286 = call i64 @fchdir(i32 %285)
%287 = icmp ne i64 %286, 0
br i1 %287, label %288, label %294
288: ; preds = %282
%289 = load i32, i32* @FTS_STOP
%290 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%291 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %290, i32 0, i32 0
%292 = load i32, i32* %291
%293 = or i32 %292, %289
store i32 %293, i32* %291
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
294: ; preds = %282, %275
%295 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%296 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%297 = call i32 @fts_load(%struct.TYPE_16__* %295, %struct.TYPE_15__* %296)
%298 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%299 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%300 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %299, i32 0, i32 4
store %struct.TYPE_15__* %298, %struct.TYPE_15__** %300
store %struct.TYPE_15__* %298, %struct.TYPE_15__** %2
br label %538
301: ; preds = %267
%302 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%303 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %302, i32 0, i32 0
%304 = load i32, i32* %303
%305 = load i32, i32* @FTS_SKIP
%306 = icmp eq i32 %304, %305
br i1 %306, label %307, label %308
307: ; preds = %301
br label %252
308: ; preds = %301
%309 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%310 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %309, i32 0, i32 0
%311 = load i32, i32* %310
%312 = load i32, i32* @FTS_FOLLOW
%313 = icmp eq i32 %311, %312
br i1 %313, label %314, label %360
314: ; preds = %308
%315 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%316 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%317 = call i8* @fts_stat(%struct.TYPE_16__* %315, %struct.TYPE_15__* %316, i32 1)
%318 = ptrtoint i8* %317 to i64
%319 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%320 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %319, i32 0, i32 1
store i64 %318, i64* %320
%321 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%322 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %321, i32 0, i32 1
%323 = load i64, i64* %322
%324 = load i64, i64* @FTS_D
%325 = icmp eq i64 %323, %324
br i1 %325, label %326, label %355
326: ; preds = %314
%327 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%328 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %327, i32 0, i32 0
%329 = load i32, i32* %328
%330 = load i32, i32* @FTS_NOCHDIR
%331 = and i32 %329, %330
%332 = icmp ne i32 %331, 0
br i1 %332, label %355, label %333
333: ; preds = %326
%334 = load i32, i32* @O_RDONLY
%335 = or i32 %334, 0
%336 = call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %335, i32 0)
%337 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%338 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %337, i32 0, i32 2
store i32 %336, i32* %338
%339 = icmp eq i32 %336, -1
br i1 %339, label %340, label %348
340: ; preds = %333
%341 = load i32, i32* @errno
%342 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%343 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %342, i32 0, i32 3
store i32 %341, i32* %343
%344 = load i8*, i8** @FTS_ERR
%345 = ptrtoint i8* %344 to i64
%346 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%347 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %346, i32 0, i32 1
store i64 %345, i64* %347
br label %354
348: ; preds = %333
%349 = load i32, i32* @FTS_SYMFOLLOW
%350 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%351 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %350, i32 0, i32 4
%352 = load i32, i32* %351
%353 = or i32 %352, %349
store i32 %353, i32* %351
br label %354
354: ; preds = %348, %340
br label %355
355: ; preds = %354, %326, %314
%356 = load i8*, i8** @FTS_NOINSTR
%357 = ptrtoint i8* %356 to i32
%358 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%359 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %358, i32 0, i32 0
store i32 %357, i32* %359
br label %360
360: ; preds = %355, %308
br label %361
361: ; preds = %360, %245
%362 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%363 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %362, i32 0, i32 3
%364 = load i8*, i8** %363
%365 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%366 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %365, i32 0, i32 10
%367 = load %struct.TYPE_15__*, %struct.TYPE_15__** %366
%368 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %367, i32 0, i32 8
%369 = load i8*, i8** %368
%370 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%371 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %370, i32 0, i32 10
%372 = load %struct.TYPE_15__*, %struct.TYPE_15__** %371
%373 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %372, i32 0, i32 9
%374 = load i32, i32* %373
%375 = sub nsw i32 %374, 1
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds i8, i8* %369, i64 %376
%378 = load i8, i8* %377
%379 = sext i8 %378 to i32
%380 = icmp eq i32 %379, 47
br i1 %380, label %381, label %388
381: ; preds = %361
%382 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%383 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %382, i32 0, i32 10
%384 = load %struct.TYPE_15__*, %struct.TYPE_15__** %383
%385 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %384, i32 0, i32 9
%386 = load i32, i32* %385
%387 = sub nsw i32 %386, 1
br label %394
388: ; preds = %361
%389 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%390 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %389, i32 0, i32 10
%391 = load %struct.TYPE_15__*, %struct.TYPE_15__** %390
%392 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %391, i32 0, i32 9
%393 = load i32, i32* %392
br label %394
394: ; preds = %388, %381
%395 = phi i32 [ %387, %381 ], [ %393, %388 ]
%396 = sext i32 %395 to i64
%397 = getelementptr inbounds i8, i8* %364, i64 %396
store i8* %397, i8** %7
%398 = load i8*, i8** %7
%399 = getelementptr inbounds i8, i8* %398, i32 1
store i8* %399, i8** %7
store i8 47, i8* %398
%400 = load i8*, i8** %7
%401 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%402 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %401, i32 0, i32 12
%403 = load i32, i32* %402
%404 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%405 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %404, i32 0, i32 11
%406 = load i64, i64* %405
%407 = add nsw i64 %406, 1
%408 = call i32 @memmove(i8* %400, i32 %403, i64 %407)
%409 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%410 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%411 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %410, i32 0, i32 4
store %struct.TYPE_15__* %409, %struct.TYPE_15__** %411
store %struct.TYPE_15__* %409, %struct.TYPE_15__** %2
br label %538
412: ; preds = %252
%413 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%414 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %413, i32 0, i32 10
%415 = load %struct.TYPE_15__*, %struct.TYPE_15__** %414
store %struct.TYPE_15__* %415, %struct.TYPE_15__** %4
%416 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%417 = call i32 @fts_free(%struct.TYPE_15__* %416)
%418 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%419 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %418, i32 0, i32 7
%420 = load i64, i64* %419
%421 = load i64, i64* @FTS_ROOTPARENTLEVEL
%422 = icmp eq i64 %420, %421
br i1 %422, label %423, label %428
423: ; preds = %412
%424 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%425 = call i32 @fts_free(%struct.TYPE_15__* %424)
store i32 0, i32* @errno
%426 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%427 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %426, i32 0, i32 4
store %struct.TYPE_15__* null, %struct.TYPE_15__** %427
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
428: ; preds = %412
%429 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%430 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %429, i32 0, i32 3
%431 = load i8*, i8** %430
%432 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%433 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %432, i32 0, i32 9
%434 = load i32, i32* %433
%435 = sext i32 %434 to i64
%436 = getelementptr inbounds i8, i8* %431, i64 %435
store i8 0, i8* %436
%437 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%438 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %437, i32 0, i32 7
%439 = load i64, i64* %438
%440 = load i64, i64* @FTS_ROOTLEVEL
%441 = icmp eq i64 %439, %440
br i1 %441, label %442, label %462
442: ; preds = %428
%443 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%444 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %443, i32 0, i32 0
%445 = load i32, i32* %444
%446 = load i32, i32* @FTS_NOCHDIR
%447 = and i32 %445, %446
%448 = icmp ne i32 %447, 0
br i1 %448, label %461, label %449
449: ; preds = %442
%450 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%451 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %450, i32 0, i32 2
%452 = load i32, i32* %451
%453 = call i64 @fchdir(i32 %452)
%454 = icmp ne i64 %453, 0
br i1 %454, label %455, label %461
455: ; preds = %449
%456 = load i32, i32* @FTS_STOP
%457 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%458 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %457, i32 0, i32 0
%459 = load i32, i32* %458
%460 = or i32 %459, %456
store i32 %460, i32* %458
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
461: ; preds = %449, %442
br label %521
462: ; preds = %428
%463 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%464 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %463, i32 0, i32 4
%465 = load i32, i32* %464
%466 = load i32, i32* @FTS_SYMFOLLOW
%467 = and i32 %465, %466
%468 = icmp ne i32 %467, 0
br i1 %468, label %469, label %499
469: ; preds = %462
%470 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%471 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %470, i32 0, i32 0
%472 = load i32, i32* %471
%473 = load i32, i32* @FTS_NOCHDIR
%474 = and i32 %472, %473
%475 = icmp ne i32 %474, 0
br i1 %475, label %494, label %476
476: ; preds = %469
%477 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%478 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %477, i32 0, i32 2
%479 = load i32, i32* %478
%480 = call i64 @fchdir(i32 %479)
%481 = icmp ne i64 %480, 0
br i1 %481, label %482, label %494
482: ; preds = %476
%483 = load i32, i32* @errno
store i32 %483, i32* %8
%484 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%485 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %484, i32 0, i32 2
%486 = load i32, i32* %485
%487 = call i32 @close(i32 %486)
%488 = load i32, i32* %8
store i32 %488, i32* @errno
%489 = load i32, i32* @FTS_STOP
%490 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%491 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %490, i32 0, i32 0
%492 = load i32, i32* %491
%493 = or i32 %492, %489
store i32 %493, i32* %491
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
494: ; preds = %476, %469
%495 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%496 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %495, i32 0, i32 2
%497 = load i32, i32* %496
%498 = call i32 @close(i32 %497)
br label %520
499: ; preds = %462
%500 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%501 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %500, i32 0, i32 4
%502 = load i32, i32* %501
%503 = load i32, i32* @FTS_DONTCHDIR
%504 = and i32 %502, %503
%505 = icmp ne i32 %504, 0
br i1 %505, label %519, label %506
506: ; preds = %499
%507 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%508 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%509 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %508, i32 0, i32 10
%510 = load %struct.TYPE_15__*, %struct.TYPE_15__** %509
%511 = call i64 @fts_safe_changedir(%struct.TYPE_16__* %507, %struct.TYPE_15__* %510, i32 -1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%512 = icmp ne i64 %511, 0
br i1 %512, label %513, label %519
513: ; preds = %506
%514 = load i32, i32* @FTS_STOP
%515 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%516 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %515, i32 0, i32 0
%517 = load i32, i32* %516
%518 = or i32 %517, %514
store i32 %518, i32* %516
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %538
519: ; preds = %506, %499
br label %520
520: ; preds = %519, %494
br label %521
521: ; preds = %520, %461
%522 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%523 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %522, i32 0, i32 3
%524 = load i32, i32* %523
%525 = icmp ne i32 %524, 0
br i1 %525, label %526, label %528
526: ; preds = %521
%527 = load i8*, i8** @FTS_ERR
br label %530
528: ; preds = %521
%529 = load i8*, i8** @FTS_DP
br label %530
530: ; preds = %528, %526
%531 = phi i8* [ %527, %526 ], [ %529, %528 ]
%532 = ptrtoint i8* %531 to i64
%533 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%534 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %533, i32 0, i32 1
store i64 %532, i64* %534
%535 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%536 = load %struct.TYPE_16__*, %struct.TYPE_16__** %3
%537 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %536, i32 0, i32 4
store %struct.TYPE_15__* %535, %struct.TYPE_15__** %537
store %struct.TYPE_15__* %535, %struct.TYPE_15__** %2
br label %538
538: ; preds = %530, %513, %482, %455, %423, %394, %294, %288, %242, %241, %155, %104, %39, %24
%539 = load %struct.TYPE_15__*, %struct.TYPE_15__** %2
ret %struct.TYPE_15__* %539
}

LLVM IR (-O2):
%struct.TYPE_15__ = type { i32, i64, i32, i32, i32, i64, i8*, i64, i8*, i32, %struct.TYPE_15__*, i64, i32, %struct.TYPE_15__* }
%struct.TYPE_16__ = type { i32, i64, i32, i8*, %struct.TYPE_15__*, %struct.TYPE_15__* }
@FTS_STOP = global i32 0
@FTS_NOINSTR = global i8* null
@FTS_AGAIN = global i32 0
@FTS_FOLLOW = global i32 0
@FTS_SL = global i64 0
@FTS_SLNONE = global i64 0
@FTS_D = global i64 0
@FTS_NOCHDIR = global i32 0
@.str = [2 x i8] c".\00"
@O_RDONLY = global i32 0
@errno = global i32 0
@FTS_ERR = global i8* null
@FTS_SYMFOLLOW = global i32 0
@FTS_SKIP = global i32 0
@FTS_XDEV = global i32 0
@FTS_DP = global i8* null
@FTS_NAMEONLY = global i32 0
@FTS_DONTCHDIR = global i32 0
@FTS_ROOTLEVEL = global i64 0
@FTS_ROOTPARENTLEVEL = global i64 0
@.str.1 = [3 x i8] c"..\00"
define %struct.TYPE_15__* @fts_read(%struct.TYPE_16__* %0) {
%2 = icmp ne %struct.TYPE_16__* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @_DIAGASSERT(i32 %3)
%5 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 4
%6 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%7 = icmp eq %struct.TYPE_15__* %6, null
br i1 %7, label %330, label %8
8: ; preds = %1
%9 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 0
%10 = load i32, i32* %9
%11 = load i32, i32* @FTS_STOP
%12 = and i32 %11, %10
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %330
14: ; preds = %8
%15 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 0
%16 = load i32, i32* %15
%17 = load i8*, i8** @FTS_NOINSTR
%18 = ptrtoint i8* %17 to i64
%19 = trunc i64 %18 to i32
store i32 %19, i32* %15
%20 = load i32, i32* @FTS_AGAIN
%21 = icmp eq i32 %16, %20
br i1 %21, label %22, label %26
22: ; preds = %14
%23 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %6, i32 0)
%24 = ptrtoint i8* %23 to i64
%25 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 1
store i64 %24, i64* %25
br label %330
26: ; preds = %14
%27 = load i32, i32* @FTS_FOLLOW
%28 = icmp eq i32 %16, %27
%29 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 1
%30 = load i64, i64* %29
br i1 %28, label %31, label %62
31: ; preds = %26
%32 = load i64, i64* @FTS_SL
%33 = icmp eq i64 %30, %32
%34 = load i64, i64* @FTS_SLNONE
%35 = icmp eq i64 %30, %34
%36 = select i1 %33, i1 true, i1 %35
br i1 %36, label %37, label %62
37: ; preds = %31
%38 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %6, i32 1)
%39 = ptrtoint i8* %38 to i64
store i64 %39, i64* %29
%40 = load i64, i64* @FTS_D
%41 = icmp eq i64 %40, %39
br i1 %41, label %42, label %330
42: ; preds = %37
%43 = load i32, i32* %9
%44 = load i32, i32* @FTS_NOCHDIR
%45 = and i32 %44, %43
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %330
47: ; preds = %42
%48 = load i32, i32* @O_RDONLY
%49 = tail call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %48, i32 0)
%50 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 2
store i32 %49, i32* %50
%51 = icmp eq i32 %49, -1
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = load i32, i32* @errno
%54 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 3
store i32 %53, i32* %54
%55 = load i8*, i8** @FTS_ERR
%56 = ptrtoint i8* %55 to i64
store i64 %56, i64* %29
br label %330
57: ; preds = %47
%58 = load i32, i32* @FTS_SYMFOLLOW
%59 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 4
%60 = load i32, i32* %59
%61 = or i32 %60, %58
store i32 %61, i32* %59
br label %330
62: ; preds = %26, %31
%63 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 1
%64 = load i64, i64* @FTS_D
%65 = icmp eq i64 %30, %64
br i1 %65, label %71, label %66
66: ; preds = %62
%67 = tail call i32 @assert(i32 1)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %5
%68 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 13
%69 = load %struct.TYPE_15__*, %struct.TYPE_15__** %68
%70 = icmp eq %struct.TYPE_15__* %69, null
br i1 %70, label %246, label %150
71: ; preds = %62
%72 = load i32, i32* @FTS_SKIP
%73 = icmp eq i32 %16, %72
br i1 %73, label %84, label %74
74: ; preds = %71
%75 = load i32, i32* @FTS_XDEV
%76 = and i32 %75, %10
%77 = icmp eq i32 %76, 0
br i1 %77, label %103, label %78
78: ; preds = %74
%79 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 5
%80 = load i64, i64* %79
%81 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 1
%82 = load i64, i64* %81
%83 = icmp eq i64 %80, %82
br i1 %83, label %103, label %84
84: ; preds = %78, %71
%85 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 4
%86 = load i32, i32* %85
%87 = load i32, i32* @FTS_SYMFOLLOW
%88 = and i32 %87, %86
%89 = icmp eq i32 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %84
%91 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 2
%92 = load i32, i32* %91
%93 = tail call i32 @close(i32 %92)
br label %94
94: ; preds = %90, %84
%95 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 5
%96 = load %struct.TYPE_15__*, %struct.TYPE_15__** %95
%97 = icmp eq %struct.TYPE_15__* %96, null
br i1 %97, label %100, label %98
98: ; preds = %94
%99 = tail call i32 @fts_lfree(%struct.TYPE_15__* %96)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %95
br label %100
100: ; preds = %98, %94
%101 = load i8*, i8** @FTS_DP
%102 = ptrtoint i8* %101 to i64
store i64 %102, i64* %63
br label %330
103: ; preds = %78, %74
%104 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 5
%105 = load %struct.TYPE_15__*, %struct.TYPE_15__** %104
%106 = icmp eq %struct.TYPE_15__* %105, null
br i1 %106, label %139, label %107
107: ; preds = %103
%108 = load i32, i32* @FTS_NAMEONLY
%109 = and i32 %108, %10
%110 = icmp eq i32 %109, 0
br i1 %110, label %115, label %111
111: ; preds = %107
%112 = xor i32 %108, -1
%113 = and i32 %10, %112
store i32 %113, i32* %9
%114 = tail call i32 @fts_lfree(%struct.TYPE_15__* %105)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %104
br label %139
115: ; preds = %107
%116 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 6
%117 = load i8*, i8** %116
%118 = tail call i64 @fts_safe_changedir(%struct.TYPE_16__* %0, %struct.TYPE_15__* %6, i32 -1, i8* %117)
%119 = icmp eq i64 %118, 0
br i1 %119, label %148, label %120
120: ; preds = %115
%121 = load i32, i32* @errno
%122 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 3
store i32 %121, i32* %122
%123 = load i32, i32* @FTS_DONTCHDIR
%124 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %6, i64 0, i32 4
%125 = load i32, i32* %124
%126 = or i32 %125, %123
store i32 %126, i32* %124
%127 = load %struct.TYPE_15__*, %struct.TYPE_15__** %104
%128 = icmp eq %struct.TYPE_15__* %127, null
br i1 %128, label %148, label %129
129: ; preds = %120, %129
%130 = phi %struct.TYPE_15__* [ %137, %129 ], [ %127, %120 ]
%131 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %130, i64 0, i32 10
%132 = load %struct.TYPE_15__*, %struct.TYPE_15__** %131
%133 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %132, i64 0, i32 6
%134 = load i8*, i8** %133
%135 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %130, i64 0, i32 6
store i8* %134, i8** %135
%136 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %130, i64 0, i32 13
%137 = load %struct.TYPE_15__*, %struct.TYPE_15__** %136
%138 = icmp eq %struct.TYPE_15__* %137, null
br i1 %138, label %148, label %129
139: ; preds = %103, %111
%140 = tail call %struct.TYPE_15__* @fts_build(%struct.TYPE_16__* %0, i32 3)
store %struct.TYPE_15__* %140, %struct.TYPE_15__** %104
%141 = icmp eq %struct.TYPE_15__* %140, null
br i1 %141, label %142, label %148
142: ; preds = %139
%143 = load i32, i32* %9
%144 = load i32, i32* @FTS_STOP
%145 = and i32 %144, %143
%146 = icmp eq i32 %145, 0
%147 = select i1 %146, %struct.TYPE_15__* %6, %struct.TYPE_15__* null
br label %330
148: ; preds = %129, %120, %139, %115
%149 = load %struct.TYPE_15__*, %struct.TYPE_15__** %104
store %struct.TYPE_15__* null, %struct.TYPE_15__** %104
br label %221
150: ; preds = %66, %179
%151 = phi %struct.TYPE_15__* [ %185, %179 ], [ %69, %66 ]
%152 = phi %struct.TYPE_15__* [ %151, %179 ], [ %6, %66 ]
%153 = tail call i32 @fts_free(%struct.TYPE_15__* %152)
%154 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 7
%155 = load i64, i64* %154
%156 = load i64, i64* @FTS_ROOTLEVEL
%157 = icmp eq i64 %155, %156
br i1 %157, label %158, label %174
158: ; preds = %150
%159 = load i32, i32* %9
%160 = load i32, i32* @FTS_NOCHDIR
%161 = and i32 %160, %159
%162 = icmp eq i32 %161, 0
br i1 %162, label %163, label %172
163: ; preds = %158
%164 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 2
%165 = load i32, i32* %164
%166 = tail call i64 @fchdir(i32 %165)
%167 = icmp eq i64 %166, 0
br i1 %167, label %172, label %168
168: ; preds = %163
%169 = load i32, i32* @FTS_STOP
%170 = load i32, i32* %9
%171 = or i32 %170, %169
store i32 %171, i32* %9
br label %330
172: ; preds = %163, %158
%173 = tail call i32 @fts_load(%struct.TYPE_16__* %0, %struct.TYPE_15__* %151)
store %struct.TYPE_15__* %151, %struct.TYPE_15__** %5
br label %330
174: ; preds = %150
%175 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 0
%176 = load i32, i32* %175
%177 = load i32, i32* @FTS_SKIP
%178 = icmp eq i32 %176, %177
br i1 %178, label %179, label %187
179: ; preds = %174
%180 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%181 = icmp eq %struct.TYPE_15__* %151, %180
%182 = zext i1 %181 to i32
%183 = tail call i32 @assert(i32 %182)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %5
%184 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 13
%185 = load %struct.TYPE_15__*, %struct.TYPE_15__** %184
%186 = icmp eq %struct.TYPE_15__* %185, null
br i1 %186, label %246, label %150
187: ; preds = %174
%188 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 0
%189 = load i32, i32* @FTS_FOLLOW
%190 = icmp eq i32 %176, %189
br i1 %190, label %191, label %221
191: ; preds = %187
%192 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %151, i32 1)
%193 = ptrtoint i8* %192 to i64
%194 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 1
store i64 %193, i64* %194
%195 = load i64, i64* @FTS_D
%196 = icmp eq i64 %195, %193
br i1 %196, label %197, label %217
197: ; preds = %191
%198 = load i32, i32* %9
%199 = load i32, i32* @FTS_NOCHDIR
%200 = and i32 %199, %198
%201 = icmp eq i32 %200, 0
br i1 %201, label %202, label %217
202: ; preds = %197
%203 = load i32, i32* @O_RDONLY
%204 = tail call i32 @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %203, i32 0)
%205 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 2
store i32 %204, i32* %205
%206 = icmp eq i32 %204, -1
br i1 %206, label %207, label %212
207: ; preds = %202
%208 = load i32, i32* @errno
%209 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 3
store i32 %208, i32* %209
%210 = load i8*, i8** @FTS_ERR
%211 = ptrtoint i8* %210 to i64
store i64 %211, i64* %194
br label %217
212: ; preds = %202
%213 = load i32, i32* @FTS_SYMFOLLOW
%214 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %151, i64 0, i32 4
%215 = load i32, i32* %214
%216 = or i32 %215, %213
store i32 %216, i32* %214
br label %217
217: ; preds = %207, %212, %197, %191
%218 = load i8*, i8** @FTS_NOINSTR
%219 = ptrtoint i8* %218 to i64
%220 = trunc i64 %219 to i32
store i32 %220, i32* %188
br label %221
221: ; preds = %187, %217, %148
%222 = phi %struct.TYPE_15__* [ %149, %148 ], [ %151, %217 ], [ %151, %187 ]
%223 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 3
%224 = load i8*, i8** %223
%225 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %222, i64 0, i32 10
%226 = load %struct.TYPE_15__*, %struct.TYPE_15__** %225
%227 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %226, i64 0, i32 8
%228 = load i8*, i8** %227
%229 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %226, i64 0, i32 9
%230 = load i32, i32* %229
%231 = add nsw i32 %230, -1
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8, i8* %228, i64 %232
%234 = load i8, i8* %233
%235 = icmp eq i8 %234, 47
%236 = select i1 %235, i32 %231, i32 %230
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds i8, i8* %224, i64 %237
%239 = getelementptr inbounds i8, i8* %238, i64 1
store i8 47, i8* %238
%240 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %222, i64 0, i32 12
%241 = load i32, i32* %240
%242 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %222, i64 0, i32 11
%243 = load i64, i64* %242
%244 = add nsw i64 %243, 1
%245 = tail call i32 @memmove(i8* %239, i32 %241, i64 %244)
store %struct.TYPE_15__* %222, %struct.TYPE_15__** %5
br label %330
246: ; preds = %179, %66
%247 = phi %struct.TYPE_15__* [ %6, %66 ], [ %151, %179 ]
%248 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %247, i64 0, i32 10
%249 = load %struct.TYPE_15__*, %struct.TYPE_15__** %248
%250 = tail call i32 @fts_free(%struct.TYPE_15__* %247)
%251 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 7
%252 = load i64, i64* %251
%253 = load i64, i64* @FTS_ROOTPARENTLEVEL
%254 = icmp eq i64 %252, %253
br i1 %254, label %255, label %257
255: ; preds = %246
%256 = tail call i32 @fts_free(%struct.TYPE_15__* %249)
store i32 0, i32* @errno
store %struct.TYPE_15__* null, %struct.TYPE_15__** %5
br label %330
257: ; preds = %246
%258 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 3
%259 = load i8*, i8** %258
%260 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 9
%261 = load i32, i32* %260
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds i8, i8* %259, i64 %262
store i8 0, i8* %263
%264 = load i64, i64* %251
%265 = load i64, i64* @FTS_ROOTLEVEL
%266 = icmp eq i64 %264, %265
br i1 %266, label %267, label %281
267: ; preds = %257
%268 = load i32, i32* %9
%269 = load i32, i32* @FTS_NOCHDIR
%270 = and i32 %269, %268
%271 = icmp eq i32 %270, 0
br i1 %271, label %272, label %321
272: ; preds = %267
%273 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 2
%274 = load i32, i32* %273
%275 = tail call i64 @fchdir(i32 %274)
%276 = icmp eq i64 %275, 0
br i1 %276, label %321, label %277
277: ; preds = %272
%278 = load i32, i32* @FTS_STOP
%279 = load i32, i32* %9
%280 = or i32 %279, %278
store i32 %280, i32* %9
br label %330
281: ; preds = %257
%282 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 4
%283 = load i32, i32* %282
%284 = load i32, i32* @FTS_SYMFOLLOW
%285 = and i32 %284, %283
%286 = icmp eq i32 %285, 0
br i1 %286, label %308, label %287
287: ; preds = %281
%288 = load i32, i32* %9
%289 = load i32, i32* @FTS_NOCHDIR
%290 = and i32 %289, %288
%291 = icmp eq i32 %290, 0
br i1 %291, label %292, label %304
292: ; preds = %287
%293 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 2
%294 = load i32, i32* %293
%295 = tail call i64 @fchdir(i32 %294)
%296 = icmp eq i64 %295, 0
br i1 %296, label %304, label %297
297: ; preds = %292
%298 = load i32, i32* @errno
%299 = load i32, i32* %293
%300 = tail call i32 @close(i32 %299)
store i32 %298, i32* @errno
%301 = load i32, i32* @FTS_STOP
%302 = load i32, i32* %9
%303 = or i32 %302, %301
store i32 %303, i32* %9
br label %330
304: ; preds = %292, %287
%305 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 2
%306 = load i32, i32* %305
%307 = tail call i32 @close(i32 %306)
br label %321
308: ; preds = %281
%309 = load i32, i32* @FTS_DONTCHDIR
%310 = and i32 %309, %283
%311 = icmp eq i32 %310, 0
br i1 %311, label %312, label %321
312: ; preds = %308
%313 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 10
%314 = load %struct.TYPE_15__*, %struct.TYPE_15__** %313
%315 = tail call i64 @fts_safe_changedir(%struct.TYPE_16__* %0, %struct.TYPE_15__* %314, i32 -1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%316 = icmp eq i64 %315, 0
br i1 %316, label %321, label %317
317: ; preds = %312
%318 = load i32, i32* @FTS_STOP
%319 = load i32, i32* %9
%320 = or i32 %319, %318
store i32 %320, i32* %9
br label %330
321: ; preds = %304, %312, %308, %267, %272
%322 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 3
%323 = load i32, i32* %322
%324 = icmp eq i32 %323, 0
%325 = load i8*, i8** @FTS_ERR
%326 = load i8*, i8** @FTS_DP
%327 = select i1 %324, i8* %326, i8* %325
%328 = ptrtoint i8* %327 to i64
%329 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %249, i64 0, i32 1
store i64 %328, i64* %329
store %struct.TYPE_15__* %249, %struct.TYPE_15__** %5
br label %330
330: ; preds = %142, %37, %42, %57, %52, %1, %8, %321, %317, %297, %277, %255, %221, %172, %168, %100, %22
%331 = phi %struct.TYPE_15__* [ %6, %22 ], [ %6, %100 ], [ %222, %221 ], [ %151, %172 ], [ null, %168 ], [ null, %255 ], [ %249, %321 ], [ null, %277 ], [ null, %297 ], [ null, %317 ], [ null, %8 ], [ null, %1 ], [ %6, %52 ], [ %6, %57 ], [ %6, %42 ], [ %6, %37 ], [ %147, %142 ]
ret %struct.TYPE_15__* %331
}