#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*/ 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;
  ;
  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)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     11e3 <fts_read+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2d78(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11f0 <fts_read+0x40>
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d6c(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
mov    0x2daf(%rip),%rcx
cmp    (%rcx),%eax
jne    1250 <fts_read+0xa0>
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    1a24 <fts_read+0x874>
mov    -0x24(%rbp),%eax
mov    0x2d9e(%rip),%rcx
cmp    (%rcx),%eax
jne    1355 <fts_read+0x1a5>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d2f(%rip),%rcx
cmp    (%rcx),%rax
je     1292 <fts_read+0xe2>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d0f(%rip),%rcx
cmp    (%rcx),%rax
jne    1355 <fts_read+0x1a5>
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    0x2cd2(%rip),%rcx
cmp    (%rcx),%rax
jne    1348 <fts_read+0x198>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2c94(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1348 <fts_read+0x198>
mov    0x2cc2(%rip),%rax
mov    (%rax),%esi
or     $0x0,%esi
lea    0xd0f(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0xffffffff,%eax
jne    1330 <fts_read+0x180>
mov    0x2c70(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x2c50(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    1343 <fts_read+0x193>
mov    0x2cb1(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
jmp    1348 <fts_read+0x198>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2c2c(%rip),%rcx
cmp    (%rcx),%rax
jne    157d <fts_read+0x3cd>
mov    -0x24(%rbp),%eax
mov    0x2c41(%rip),%rcx
cmp    (%rcx),%eax
je     13ad <fts_read+0x1fd>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2bcc(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1419 <fts_read+0x269>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     1419 <fts_read+0x269>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2c2d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13d2 <fts_read+0x222>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     13fa <fts_read+0x24a>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1080 <fts_lfree@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    0x2baf(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     146d <fts_read+0x2bd>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2b2b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     146d <fts_read+0x2bd>
mov    0x2b19(%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     1509 <fts_read+0x359>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rcx
mov    $0xffffffff,%edx
call   10a0 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     1504 <fts_read+0x354>
mov    0x2ad9(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x2b29(%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     14ff <fts_read+0x34f>
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    14cf <fts_read+0x31f>
jmp    1504 <fts_read+0x354>
jmp    1560 <fts_read+0x3b0>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   10d0 <fts_build@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,0x28(%rcx)
cmp    $0x0,%rax
jne    155b <fts_read+0x3ab>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2a1a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     154e <fts_read+0x39e>
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
jmp    1560 <fts_read+0x3b0>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
jmp    1750 <fts_read+0x5a0>
jmp    1582 <fts_read+0x3d2>
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     17fe <fts_read+0x64e>
mov    -0x20(%rbp),%rdi
call   1070 <fts_free@plt>
mov    -0x18(%rbp),%rax
mov    0x30(%rax),%rax
mov    0x29e3(%rip),%rcx
cmp    (%rcx),%rax
jne    1654 <fts_read+0x4a4>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2975(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1632 <fts_read+0x482>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   1090 <fchdir@plt>
cmp    $0x0,%rax
je     1632 <fts_read+0x482>
mov    0x2935(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
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    1a24 <fts_read+0x874>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x2957(%rip),%rcx
cmp    (%rcx),%eax
jne    166e <fts_read+0x4be>
jmp    1582 <fts_read+0x3d2>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    0x297d(%rip),%rcx
cmp    (%rcx),%eax
jne    174b <fts_read+0x59b>
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    0x28e1(%rip),%rcx
cmp    (%rcx),%rax
jne    1739 <fts_read+0x589>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x28a3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1739 <fts_read+0x589>
mov    0x28d1(%rip),%rax
mov    (%rax),%esi
or     $0x0,%esi
lea    0x91e(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,0x10(%rcx)
cmp    $0xffffffff,%eax
jne    1721 <fts_read+0x571>
mov    0x287f(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    0x285f(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    1734 <fts_read+0x584>
mov    0x28c0(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
jmp    1739 <fts_read+0x589>
mov    0x2838(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1750 <fts_read+0x5a0>
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    179c <fts_read+0x5ec>
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rax
mov    0x40(%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    17aa <fts_read+0x5fa>
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   10b0 <memmove@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x20(%rcx)
mov    %rax,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
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    0x27ce(%rip),%rcx
cmp    (%rcx),%rax
jne    185a <fts_read+0x6aa>
mov    -0x18(%rbp),%rdi
call   1070 <fts_free@plt>
mov    0x2745(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x20(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
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    0x2743(%rip),%rcx
cmp    (%rcx),%rax
jne    18d7 <fts_read+0x727>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x26d5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    18d2 <fts_read+0x722>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
call   1090 <fchdir@plt>
cmp    $0x0,%rax
je     18d2 <fts_read+0x722>
mov    0x2695(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
jmp    19d9 <fts_read+0x829>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2703(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1971 <fts_read+0x7c1>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x266b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1960 <fts_read+0x7b0>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1090 <fchdir@plt>
cmp    $0x0,%rax
je     1960 <fts_read+0x7b0>
mov    0x265b(%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    0x2640(%rip),%rax
mov    %ecx,(%rax)
mov    0x2607(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1050 <close@plt>
jmp    19d4 <fts_read+0x824>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%eax
mov    0x2661(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    19cf <fts_read+0x81f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rsi
mov    $0xffffffff,%edx
lea    0x65e(%rip),%rcx
call   10a0 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     19cf <fts_read+0x81f>
mov    0x2598(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1a24 <fts_read+0x874>
jmp    19d4 <fts_read+0x824>
jmp    19d9 <fts_read+0x829>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x14(%rax)
je     19fa <fts_read+0x84a>
mov    0x2582(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1a08 <fts_read+0x858>
mov    0x25af(%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    0x20(%rdi),%rbx
test   %rbx,%rbx
je     11d5 <fts_read+0x25>
mov    %rdi,%r14
mov    (%rdi),%eax
mov    0x2d80(%rip),%r15
test   %eax,(%r15)
je     11e9 <fts_read+0x39>
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    0x2d86(%rip),%r12
mov    (%r12),%edx
mov    %edx,(%rbx)
mov    0x2dd1(%rip),%rdx
cmp    (%rdx),%ecx
jne    1216 <fts_read+0x66>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
jmp    11d7 <fts_read+0x27>
mov    0x2ddb(%rip),%rsi
mov    0x8(%rbx),%rdx
cmp    (%rsi),%ecx
jne    1245 <fts_read+0x95>
mov    0x2d74(%rip),%rsi
cmp    (%rsi),%rdx
je     1389 <fts_read+0x1d9>
mov    0x2d5c(%rip),%rsi
cmp    (%rsi),%rdx
je     1389 <fts_read+0x1d9>
mov    0x2d44(%rip),%rsi
cmp    (%rsi),%rdx
jne    12d6 <fts_read+0x126>
mov    0x2d5c(%rip),%rdx
cmp    (%rdx),%ecx
je     13f3 <fts_read+0x243>
mov    0x2ced(%rip),%rcx
test   %eax,(%rcx)
je     127d <fts_read+0xcd>
mov    0x20(%rbx),%rcx
cmp    0x8(%r14),%rcx
jne    13f3 <fts_read+0x243>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     12ab <fts_read+0xfb>
mov    0x2cd3(%rip),%rcx
mov    (%rcx),%ecx
test   %eax,%ecx
je     154f <fts_read+0x39f>
not    %ecx
and    %ecx,%eax
mov    %eax,(%r14)
call   1080 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
mov    %r14,%rdi
mov    $0x3,%esi
call   10d0 <fts_build@plt>
mov    %rax,0x28(%r14)
test   %rax,%rax
je     153e <fts_read+0x38e>
mov    0x28(%r14),%rbx
movq   $0x0,0x28(%r14)
jmp    167c <fts_read+0x4cc>
mov    $0x1,%edi
call   1060 <assert@plt>
movq   $0x0,0x20(%r14)
mov    0x60(%rbx),%rax
test   %rax,%rax
je     1345 <fts_read+0x195>
mov    0x2cc8(%rip),%rbp
mov    0x2cb9(%rip),%r13
nop
mov    %rbx,%rdi
mov    %rax,%rbx
call   1070 <fts_free@plt>
mov    0x30(%rbx),%rax
cmp    0x0(%rbp),%rax
je     1472 <fts_read+0x2c2>
mov    (%rbx),%eax
cmp    0x0(%r13),%eax
jne    1494 <fts_read+0x2e4>
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    1300 <fts_read+0x150>
mov    %rbx,%rdi
mov    0x48(%rbx),%rbx
call   1070 <fts_free@plt>
mov    0x30(%rbx),%rax
mov    0x2c94(%rip),%rcx
cmp    (%rcx),%rax
jne    1432 <fts_read+0x282>
mov    %rbx,%rdi
call   1070 <fts_free@plt>
mov    0x2c0c(%rip),%rax
movl   $0x0,(%rax)
movq   $0x0,0x20(%r14)
xor    %ebx,%ebx
jmp    11d7 <fts_read+0x27>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
mov    0x2bec(%rip),%rcx
cmp    %rax,(%rcx)
jne    11d7 <fts_read+0x27>
mov    0x2bb4(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    11d7 <fts_read+0x27>
mov    0x2be2(%rip),%rax
mov    (%rax),%esi
lea    0xc32(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,0x10(%rbx)
cmp    $0xffffffff,%eax
je     160f <fts_read+0x45f>
mov    0x2bff(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
jmp    11d7 <fts_read+0x27>
mov    0x2bee(%rip),%rax
mov    (%rax),%eax
test   %eax,0x18(%rbx)
je     1409 <fts_read+0x259>
mov    0x10(%rbx),%edi
call   1050 <close@plt>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     141f <fts_read+0x26f>
call   1080 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
mov    0x2b8a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
jmp    11d7 <fts_read+0x27>
mov    0x18(%r14),%rax
movslq 0x40(%rbx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x30(%rbx),%rax
mov    0x2b77(%rip),%rcx
cmp    (%rcx),%rax
jne    150d <fts_read+0x35d>
mov    0x2b0f(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    15ed <fts_read+0x43d>
mov    0x10(%r14),%edi
call   1090 <fchdir@plt>
jmp    15e8 <fts_read+0x438>
mov    0x2aef(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
je     15ae <fts_read+0x3fe>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <fts_load@plt>
jmp    16b4 <fts_read+0x504>
mov    0x2b5d(%rip),%rcx
cmp    (%rcx),%eax
jne    167c <fts_read+0x4cc>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <fts_stat@plt>
mov    %rax,0x8(%rbx)
mov    0x2ad2(%rip),%rcx
cmp    %rax,(%rcx)
jne    1676 <fts_read+0x4c6>
mov    0x2a9a(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
jne    1676 <fts_read+0x4c6>
mov    0x2ac8(%rip),%rax
mov    (%rax),%esi
lea    0xb18(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,0x10(%rbx)
cmp    $0xffffffff,%eax
je     165c <fts_read+0x4ac>
mov    0x2ae5(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
jmp    1676 <fts_read+0x4c6>
mov    0x18(%rbx),%eax
mov    0x2ad1(%rip),%rcx
test   %eax,(%rcx)
je     15c5 <fts_read+0x415>
mov    0x2a42(%rip),%rax
mov    (%rax),%eax
test   %eax,(%r14)
je     1627 <fts_read+0x477>
mov    0x10(%rbx),%edi
call   1050 <close@plt>
jmp    15ed <fts_read+0x43d>
mov    (%r15),%eax
xor    %ecx,%ecx
test   %eax,(%r14)
cmovne %rcx,%rbx
jmp    11d7 <fts_read+0x27>
mov    0x28(%rbx),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   10a0 <fts_safe_changedir@plt>
test   %rax,%rax
je     12c5 <fts_read+0x115>
mov    0x2a0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x2a61(%rip),%rax
mov    (%rax),%eax
or     %eax,0x18(%rbx)
mov    0x28(%r14),%rax
test   %rax,%rax
je     12c5 <fts_read+0x115>
mov    0x48(%rax),%rcx
mov    0x60(%rax),%rdx
mov    0x28(%rcx),%rcx
mov    %rcx,0x28(%rax)
mov    %rdx,%rax
test   %rdx,%rdx
jne    1591 <fts_read+0x3e1>
jmp    12c5 <fts_read+0x115>
mov    0x10(%r14),%edi
call   1090 <fchdir@plt>
test   %rax,%rax
jne    164f <fts_read+0x49f>
jmp    1484 <fts_read+0x2d4>
mov    0x2a14(%rip),%rcx
test   %eax,(%rcx)
jne    15ed <fts_read+0x43d>
mov    0x48(%rbx),%rsi
lea    0xa25(%rip),%rcx
mov    %r14,%rdi
mov    $0xffffffff,%edx
call   10a0 <fts_safe_changedir@plt>
test   %rax,%rax
jne    164f <fts_read+0x49f>
cmpl   $0x0,0x14(%rbx)
jne    15fc <fts_read+0x44c>
mov    0x29b6(%rip),%rax
jmp    1603 <fts_read+0x453>
mov    0x296d(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
jmp    16b4 <fts_read+0x504>
mov    0x296a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x294e(%rip),%rax
jmp    1426 <fts_read+0x276>
mov    0x10(%rbx),%edi
call   1090 <fchdir@plt>
test   %rax,%rax
je     1531 <fts_read+0x381>
mov    0x2941(%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    11d7 <fts_read+0x27>
mov    0x291d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rbx)
mov    0x2901(%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   10b0 <memmove@plt>
mov    %rbx,0x20(%r14)
jmp    11d7 <fts_read+0x27>

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

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