#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;
  char *fts_path;
  TYPE_1__ *fts_cur;
  void *fts_rfd;
  TYPE_1__ *fts_child;
};
struct TYPE_15__ {
  int fts_instr;
  int fts_info;
  int fts_errno;
  int fts_flags;
  scalar_t__ fts_dev;
  char *fts_accpath;
  int fts_level;
  char *fts_path;
  int fts_pathlen;
  struct TYPE_15__ *fts_parent;
  void *fts_symfd;
  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 /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(void *);
int errno;
scalar_t__ fchdir(void *);
int /*<<< orphan*/ free(TYPE_1__ *);
TYPE_1__ *fts_build(TYPE_2__ *, int);
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*/, scalar_t__);
void *open(char *, int /*<<< orphan*/, 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 & (0x2000)))
    return (NULL);
  p = sp->fts_cur;
  instr = p->fts_instr;
  p->fts_instr = 3;
  if (instr == 1) {
    p->fts_info = fts_stat(sp, p, 0);
    return (p);
  }
  if (instr == 2 && (p->fts_info == 12 || p->fts_info == 13)) {
    p->fts_info = fts_stat(sp, p, 1);
    if (p->fts_info == 1 && !(sp->fts_options & (0x0004))) {
      if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
        p->fts_errno = errno;
        p->fts_info = 7;
      } else
        p->fts_flags |= 0x02;
    }
    return (p);
  }
  if (p->fts_info == 1) {
    if (instr == 4 ||
        ((sp->fts_options & (0x0040)) && p->fts_dev != sp->fts_dev)) {
      if (p->fts_flags & 0x02)
        (void)close(p->fts_symfd);
      if (sp->fts_child) {
        fts_lfree(sp->fts_child);
        sp->fts_child = NULL;
      }
      p->fts_info = 6;
      return (p);
    }
    if (sp->fts_child && (sp->fts_options & (0x1000))) {
      (sp->fts_options &= ~(0x1000));
      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 |= 0x01;
        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 & (0x2000)))
        return (NULL);
      return (p);
    }
    p = sp->fts_child;
    sp->fts_child = NULL;
    goto name;
  }
next:
  tmp = p;
  if ((p = p->fts_link)) {
    free(tmp);
    if (p->fts_level == 0) {
      if ((!(sp->fts_options & (0x0004)) && fchdir(sp->fts_rfd))) {
        (sp->fts_options |= (0x2000));
        return (NULL);
      }
      fts_load(sp, p);
      return (sp->fts_cur = p);
    }
    if (p->fts_instr == 4)
      goto next;
    if (p->fts_instr == 2) {
      p->fts_info = fts_stat(sp, p, 1);
      if (p->fts_info == 1 && !(sp->fts_options & (0x0004))) {
        if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
          p->fts_errno = errno;
          p->fts_info = 7;
        } else
          p->fts_flags |= 0x02;
      }
      p->fts_instr = 3;
    }
  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, p->fts_namelen + 1);
    return (sp->fts_cur = p);
  }
  p = tmp->fts_parent;
  free(tmp);
  if (p->fts_level == -1) {
    free(p);
    errno = 0;
    return (sp->fts_cur = NULL);
  }
  sp->fts_path[p->fts_pathlen] = '\0';
  if (p->fts_level == 0) {
    if ((!(sp->fts_options & (0x0004)) && fchdir(sp->fts_rfd))) {
      (sp->fts_options |= (0x2000));
      sp->fts_cur = p;
      return (NULL);
    }
  } else if (p->fts_flags & 0x02) {
    if ((!(sp->fts_options & (0x0004)) && fchdir(p->fts_symfd))) {
      saved_errno = errno;
      (void)close(p->fts_symfd);
      errno = saved_errno;
      (sp->fts_options |= (0x2000));
      sp->fts_cur = p;
      return (NULL);
    }
    (void)close(p->fts_symfd);
  } else if (!(p->fts_flags & 0x01) &&
             fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
    (sp->fts_options |= (0x2000));
    sp->fts_cur = p;
    return (NULL);
  }
  p->fts_info = p->fts_errno ? 7 : 6;
  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,0x18(%rax)
je     11cf <fts_read+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     11dc <fts_read+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
cmpl   $0x1,-0x24(%rbp)
jne    122a <fts_read+0x8a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1050 <fts_stat@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
cmpl   $0x2,-0x24(%rbp)
jne    12f3 <fts_read+0x153>
mov    -0x18(%rbp),%rax
cmpl   $0xc,0x4(%rax)
je     1250 <fts_read+0xb0>
mov    -0x18(%rbp),%rax
cmpl   $0xd,0x4(%rax)
jne    12f3 <fts_read+0x153>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1050 <fts_stat@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x1,0x4(%rax)
jne    12e6 <fts_read+0x146>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    12e6 <fts_read+0x146>
mov    0x2d56(%rip),%rax
mov    (%rax),%esi
lea    0xd66(%rip),%rdi
xor    %edx,%edx
call   10b0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,0x40(%rcx)
cmp    $0x0,%rax
jae    12d4 <fts_read+0x134>
mov    0x2d1d(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x7,0x4(%rax)
jmp    12e1 <fts_read+0x141>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
or     $0x2,%ecx
mov    %ecx,0xc(%rax)
jmp    12e6 <fts_read+0x146>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x18(%rbp),%rax
cmpl   $0x1,0x4(%rax)
jne    14e3 <fts_read+0x343>
cmpl   $0x4,-0x24(%rbp)
je     1333 <fts_read+0x193>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1393 <fts_read+0x1f3>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     1393 <fts_read+0x1f3>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1353 <fts_read+0x1b3>
mov    -0x18(%rbp),%rax
mov    0x40(%rax),%rdi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     137b <fts_read+0x1db>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1070 <fts_lfree@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    -0x18(%rbp),%rax
movl   $0x6,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     13dd <fts_read+0x23d>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x1000,%eax
cmp    $0x0,%eax
je     13dd <fts_read+0x23d>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffffefff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1070 <fts_lfree@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     1473 <fts_read+0x2d3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rcx
mov    $0xffffffff,%edx
call   1090 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     146e <fts_read+0x2ce>
mov    0x2bc1(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
or     $0x1,%ecx
mov    %ecx,0xc(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1469 <fts_read+0x2c9>
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%rax
mov    0x18(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x18(%rbp),%rax
mov    0x58(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1439 <fts_read+0x299>
jmp    146e <fts_read+0x2ce>
jmp    14c6 <fts_read+0x326>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   10c0 <fts_build@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,0x28(%rcx)
cmp    $0x0,%rax
jne    14c1 <fts_read+0x321>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     14b4 <fts_read+0x314>
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
jmp    14c6 <fts_read+0x326>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
jmp    1647 <fts_read+0x4a7>
jmp    14e8 <fts_read+0x348>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x58(%rax),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     16f5 <fts_read+0x555>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x20(%rax)
jne    1583 <fts_read+0x3e3>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1561 <fts_read+0x3c1>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <fchdir@plt>
cmp    $0x0,%rax
je     1561 <fts_read+0x3c1>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fts_load@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x18(%rcx)
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x18(%rbp),%rax
cmpl   $0x4,(%rax)
jne    1595 <fts_read+0x3f5>
jmp    14e8 <fts_read+0x348>
mov    -0x18(%rbp),%rax
cmpl   $0x2,(%rax)
jne    1642 <fts_read+0x4a2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1050 <fts_stat@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x1,0x4(%rax)
jne    1638 <fts_read+0x498>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1638 <fts_read+0x498>
mov    0x2a04(%rip),%rax
mov    (%rax),%esi
lea    0xa14(%rip),%rdi
xor    %edx,%edx
call   10b0 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,0x40(%rcx)
cmp    $0x0,%rax
jae    1626 <fts_read+0x486>
mov    0x29cb(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x7,0x4(%rax)
jmp    1633 <fts_read+0x493>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
or     $0x2,%ecx
mov    %ecx,0xc(%rax)
jmp    1638 <fts_read+0x498>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    1647 <fts_read+0x4a7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%rax
mov    0x28(%rax),%rax
mov    -0x18(%rbp),%rcx
mov    0x38(%rcx),%rcx
mov    0x30(%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1693 <fts_read+0x4f3>
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%rax
mov    0x30(%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    16a1 <fts_read+0x501>
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%rax
mov    0x30(%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    0x50(%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x48(%rax),%rdx
add    $0x1,%rdx
call   10a0 <memmove@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x18(%rcx)
mov    %rax,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x20(%rbp),%rax
mov    0x38(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,0x20(%rax)
jne    1747 <fts_read+0x5a7>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x28b0(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x18(%rax)
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x18(%rbp),%rcx
movslq 0x30(%rcx),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x20(%rax)
jne    17be <fts_read+0x61e>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    17b9 <fts_read+0x619>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <fchdir@plt>
cmp    $0x0,%rax
je     17b9 <fts_read+0x619>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
jmp    18c3 <fts_read+0x723>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1858 <fts_read+0x6b8>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1846 <fts_read+0x6a6>
mov    -0x18(%rbp),%rax
mov    0x40(%rax),%rdi
call   1080 <fchdir@plt>
cmp    $0x0,%rax
je     1846 <fts_read+0x6a6>
mov    0x27d7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    0x40(%rax),%rdi
call   1060 <close@plt>
mov    -0x34(%rbp),%ecx
mov    0x27bb(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
mov    -0x18(%rbp),%rax
mov    0x40(%rax),%rdi
call   1060 <close@plt>
jmp    18be <fts_read+0x71e>
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    18b9 <fts_read+0x719>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x38(%rax),%rsi
mov    $0xffffffff,%edx
lea    0x77d(%rip),%rcx
call   1090 <fts_safe_changedir@plt>
cmp    $0x0,%rax
je     18b9 <fts_read+0x719>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
movq   $0x0,-0x8(%rbp)
jmp    18f1 <fts_read+0x751>
jmp    18be <fts_read+0x71e>
jmp    18c3 <fts_read+0x723>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
mov    $0x6,%ecx
mov    $0x7,%eax
cmp    $0x0,%edx
cmovne %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rax,0x18(%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   %rbx
push   %rax
mov    0x18(%rdi),%rbx
test   %rbx,%rbx
je     11e0 <fts_read+0x40>
mov    %rdi,%r14
mov    (%rdi),%eax
test   $0x2000,%eax
jne    11e0 <fts_read+0x40>
mov    (%rbx),%ecx
movl   $0x3,(%rbx)
cmp    $0x2,%ecx
je     11f0 <fts_read+0x50>
cmp    $0x1,%ecx
jne    123c <fts_read+0x9c>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <fts_stat@plt>
mov    %eax,0x4(%rbx)
jmp    11e2 <fts_read+0x42>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x4(%rbx),%ecx
mov    %ecx,%edx
and    $0xfffffffe,%edx
cmp    $0xc,%edx
jne    1259 <fts_read+0xb9>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <fts_stat@plt>
mov    %eax,0x4(%rbx)
cmp    $0x1,%eax
jne    11e2 <fts_read+0x42>
testb  $0x4,(%r14)
jne    11e2 <fts_read+0x42>
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
lea    0xdd6(%rip),%rdi
xor    %edx,%edx
call   10b0 <open@plt>
mov    %rax,0x40(%rbx)
orb    $0x2,0xc(%rbx)
jmp    11e2 <fts_read+0x42>
cmpl   $0x1,0x4(%rbx)
jne    12e7 <fts_read+0x147>
lea    0x4(%rbx),%r15
cmp    $0x4,%ecx
je     1367 <fts_read+0x1c7>
test   $0x40,%al
jne    126a <fts_read+0xca>
jmp    1278 <fts_read+0xd8>
cmp    $0x1,%ecx
jne    12e7 <fts_read+0x147>
lea    0x4(%rbx),%r15
test   $0x40,%al
je     1278 <fts_read+0xd8>
mov    0x10(%rbx),%rcx
cmp    0x8(%r14),%rcx
jne    1367 <fts_read+0x1c7>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     1433 <fts_read+0x293>
test   $0x1000,%eax
jne    141e <fts_read+0x27e>
mov    0x18(%rbx),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   1090 <fts_safe_changedir@plt>
test   %rax,%rax
je     1449 <fts_read+0x2a9>
mov    0x2d24(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rbx)
orb    $0x1,0xc(%rbx)
mov    0x28(%r14),%rax
test   %rax,%rax
je     1449 <fts_read+0x2a9>
mov    0x38(%rax),%rcx
mov    0x58(%rax),%rdx
mov    0x18(%rcx),%rcx
mov    %rcx,0x18(%rax)
mov    %rdx,%rax
test   %rdx,%rdx
jne    12ca <fts_read+0x12a>
jmp    1449 <fts_read+0x2a9>
mov    %rbx,%rdi
nopw   0x0(%rax,%rax,1)
mov    0x58(%rdi),%rbx
test   %rbx,%rbx
je     1398 <fts_read+0x1f8>
call   1030 <free@plt>
cmpl   $0x0,0x20(%rbx)
je     13f1 <fts_read+0x251>
mov    (%rbx),%eax
mov    %rbx,%rdi
cmp    $0x4,%eax
je     12f0 <fts_read+0x150>
cmp    $0x2,%eax
jne    1455 <fts_read+0x2b5>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <fts_stat@plt>
mov    %eax,0x4(%rbx)
cmp    $0x1,%eax
jne    135c <fts_read+0x1bc>
testb  $0x4,(%r14)
jne    135c <fts_read+0x1bc>
mov    0x2ca4(%rip),%rax
mov    (%rax),%esi
lea    0xcb4(%rip),%rdi
xor    %edx,%edx
call   10b0 <open@plt>
mov    %rax,0x40(%rbx)
orb    $0x2,0xc(%rbx)
movl   $0x3,(%rbx)
jmp    1455 <fts_read+0x2b5>
testb  $0x2,0xc(%rbx)
je     1376 <fts_read+0x1d6>
mov    0x40(%rbx),%rdi
call   1060 <close@plt>
mov    0x28(%r14),%rdi
test   %rdi,%rdi
je     138c <fts_read+0x1ec>
call   1070 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
movl   $0x6,(%r15)
jmp    11e2 <fts_read+0x42>
mov    0x38(%rdi),%rbx
call   1030 <free@plt>
cmpl   $0xffffffff,0x20(%rbx)
je     14a6 <fts_read+0x306>
mov    0x10(%r14),%rax
movslq 0x30(%rbx),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,0x20(%rbx)
je     14ca <fts_read+0x32a>
mov    0xc(%rbx),%eax
test   $0x2,%al
jne    14e0 <fts_read+0x340>
test   $0x1,%al
jne    1523 <fts_read+0x383>
mov    0x38(%rbx),%rsi
lea    0xc21(%rip),%rcx
mov    %r14,%rdi
mov    $0xffffffff,%edx
call   1090 <fts_safe_changedir@plt>
jmp    14d9 <fts_read+0x339>
testb  $0x4,(%r14)
jne    1411 <fts_read+0x271>
mov    0x20(%r14),%rdi
call   1080 <fchdir@plt>
test   %rax,%rax
je     1411 <fts_read+0x271>
orb    $0x20,0x1(%r14)
xor    %ebx,%ebx
jmp    11e2 <fts_read+0x42>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <fts_load@plt>
jmp    148d <fts_read+0x2ed>
and    $0xffffefff,%eax
mov    %eax,(%r14)
call   1070 <fts_lfree@plt>
movq   $0x0,0x28(%r14)
mov    %r14,%rdi
mov    $0x3,%esi
call   10c0 <fts_build@plt>
mov    %rax,0x28(%r14)
test   %rax,%rax
je     1496 <fts_read+0x2f6>
mov    0x28(%r14),%rbx
movq   $0x0,0x28(%r14)
mov    0x10(%r14),%rax
mov    0x38(%rbx),%rcx
mov    0x28(%rcx),%rdx
movslq 0x30(%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    0x50(%rbx),%esi
mov    0x48(%rbx),%rdx
add    $0x1,%rdx
call   10a0 <memmove@plt>
mov    %rbx,0x18(%r14)
jmp    11e2 <fts_read+0x42>
xor    %eax,%eax
testb  $0x20,0x1(%r14)
cmovne %rax,%rbx
jmp    11e2 <fts_read+0x42>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2b23(%rip),%rax
movl   $0x0,(%rax)
movq   $0x0,0x18(%r14)
xor    %ebx,%ebx
jmp    11e2 <fts_read+0x42>
testb  $0x4,(%r14)
jne    1523 <fts_read+0x383>
mov    0x20(%r14),%rdi
call   1080 <fchdir@plt>
test   %rax,%rax
jne    150a <fts_read+0x36a>
jmp    1523 <fts_read+0x383>
testb  $0x4,(%r14)
jne    151a <fts_read+0x37a>
mov    0x40(%rbx),%rdi
call   1080 <fchdir@plt>
test   %rax,%rax
je     151a <fts_read+0x37a>
mov    0x2add(%rip),%r15
mov    (%r15),%ebp
mov    0x40(%rbx),%rdi
call   1060 <close@plt>
mov    %ebp,(%r15)
orb    $0x20,0x1(%r14)
mov    %rbx,0x18(%r14)
xor    %ebx,%ebx
jmp    11e2 <fts_read+0x42>
mov    0x40(%rbx),%rdi
call   1060 <close@plt>
cmpl   $0x1,0x8(%rbx)
mov    $0x7,%eax
sbb    $0x0,%eax
mov    %eax,0x4(%rbx)
jmp    148d <fts_read+0x2ed>

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

LLVM IR (-O2):
%struct.TYPE_15__ = type { i32, i32, i32, i32, i64, i8*, i32, i8*, i32, %struct.TYPE_15__*, i8*, i64, i32, %struct.TYPE_15__* }
%struct.TYPE_16__ = type { i32, i64, i8*, %struct.TYPE_15__*, i8*, %struct.TYPE_15__* }
@.str = [2 x i8] c".\00"
@O_RDONLY = global i32 0
@errno = global i32 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 3
%3 = load %struct.TYPE_15__*, %struct.TYPE_15__** %2
%4 = icmp eq %struct.TYPE_15__* %3, null
br i1 %4, label %260, 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 = and i32 %7, 8192
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %260
10: ; preds = %5
%11 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 0
%12 = load i32, i32* %11
store i32 3, i32* %11
switch i32 %12, label %39 [
i32 1, label %13
i32 2, label %18
]
13: ; preds = %10
%14 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %3, i32 0)
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 1
store i32 %16, i32* %17
br label %260
18: ; preds = %10
%19 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 1
%20 = load i32, i32* %19
%21 = and i32 %20, -2
%22 = icmp eq i32 %21, 12
br i1 %22, label %23, label %43
23: ; preds = %18
%24 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %3, i32 1)
%25 = ptrtoint i8* %24 to i64
%26 = trunc i64 %25 to i32
store i32 %26, i32* %19
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %260
28: ; preds = %23
%29 = load i32, i32* %6
%30 = and i32 %29, 4
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %260
32: ; preds = %28
%33 = load i32, i32* @O_RDONLY
%34 = tail call i8* @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %33, i32 0)
%35 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 10
store i8* %34, i8** %35
%36 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 3
%37 = load i32, i32* %36
%38 = or i32 %37, 2
store i32 %38, i32* %36
br label %260
39: ; preds = %10
%40 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 1
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 1
br i1 %42, label %46, label %45
43: ; preds = %18
%44 = icmp eq i32 %20, 1
br i1 %44, label %48, label %45
45: ; preds = %39, %43
br label %118
46: ; preds = %39
%47 = icmp eq i32 %12, 4
br i1 %47, label %58, label %48
48: ; preds = %43, %46
%49 = phi i32* [ %40, %46 ], [ %19, %43 ]
%50 = and i32 %7, 64
%51 = icmp eq i32 %50, 0
br i1 %51, label %75, label %52
52: ; preds = %48
%53 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 4
%54 = load i64, i64* %53
%55 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 1
%56 = load i64, i64* %55
%57 = icmp eq i64 %54, %56
br i1 %57, label %75, label %58
58: ; preds = %52, %46
%59 = phi i32* [ %49, %52 ], [ %40, %46 ]
%60 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 3
%61 = load i32, i32* %60
%62 = and i32 %61, 2
%63 = icmp eq i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %58
%65 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 10
%66 = load i8*, i8** %65
%67 = tail call i32 @close(i8* %66)
br label %68
68: ; preds = %64, %58
%69 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 5
%70 = load %struct.TYPE_15__*, %struct.TYPE_15__** %69
%71 = icmp eq %struct.TYPE_15__* %70, null
br i1 %71, label %74, label %72
72: ; preds = %68
%73 = tail call i32 @fts_lfree(%struct.TYPE_15__* %70)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %69
br label %74
74: ; preds = %72, %68
store i32 6, i32* %59
br label %260
75: ; preds = %52, %48
%76 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 5
%77 = load %struct.TYPE_15__*, %struct.TYPE_15__** %76
%78 = icmp eq %struct.TYPE_15__* %77, null
br i1 %78, label %108, label %79
79: ; preds = %75
%80 = and i32 %7, 4096
%81 = icmp eq i32 %80, 0
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = and i32 %7, -4097
store i32 %83, i32* %6
%84 = tail call i32 @fts_lfree(%struct.TYPE_15__* %77)
store %struct.TYPE_15__* null, %struct.TYPE_15__** %76
br label %108
85: ; preds = %79
%86 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 5
%87 = load i8*, i8** %86
%88 = tail call i64 @fts_safe_changedir(%struct.TYPE_16__* %0, %struct.TYPE_15__* %3, i32 -1, i8* %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %116, label %90
90: ; preds = %85
%91 = load i32, i32* @errno
%92 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 2
store i32 %91, i32* %92
%93 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %3, i64 0, i32 3
%94 = load i32, i32* %93
%95 = or i32 %94, 1
store i32 %95, i32* %93
%96 = load %struct.TYPE_15__*, %struct.TYPE_15__** %76
%97 = icmp eq %struct.TYPE_15__* %96, null
br i1 %97, label %116, label %98
98: ; preds = %90, %98
%99 = phi %struct.TYPE_15__* [ %106, %98 ], [ %96, %90 ]
%100 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %99, i64 0, i32 9
%101 = load %struct.TYPE_15__*, %struct.TYPE_15__** %100
%102 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %101, i64 0, i32 5
%103 = load i8*, i8** %102
%104 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %99, i64 0, i32 5
store i8* %103, i8** %104
%105 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %99, i64 0, i32 13
%106 = load %struct.TYPE_15__*, %struct.TYPE_15__** %105
%107 = icmp eq %struct.TYPE_15__* %106, null
br i1 %107, label %116, label %98
108: ; preds = %82, %75
%109 = tail call %struct.TYPE_15__* @fts_build(%struct.TYPE_16__* %0, i32 3)
store %struct.TYPE_15__* %109, %struct.TYPE_15__** %76
%110 = icmp eq %struct.TYPE_15__* %109, null
br i1 %110, label %111, label %116
111: ; preds = %108
%112 = load i32, i32* %6
%113 = and i32 %112, 8192
%114 = icmp eq i32 %113, 0
%115 = select i1 %114, %struct.TYPE_15__* %3, %struct.TYPE_15__* null
br label %260
116: ; preds = %98, %90, %108, %85
%117 = load %struct.TYPE_15__*, %struct.TYPE_15__** %76
store %struct.TYPE_15__* null, %struct.TYPE_15__** %76
br label %164
118: ; preds = %45, %142
%119 = phi %struct.TYPE_15__* [ %121, %142 ], [ %3, %45 ]
%120 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %119, i64 0, i32 13
%121 = load %struct.TYPE_15__*, %struct.TYPE_15__** %120
%122 = icmp eq %struct.TYPE_15__* %121, null
br i1 %122, label %189, label %123
123: ; preds = %118
%124 = tail call i32 @free(%struct.TYPE_15__* %119)
%125 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 6
%126 = load i32, i32* %125
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %142
128: ; preds = %123
%129 = load i32, i32* %6
%130 = and i32 %129, 4
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %140
132: ; preds = %128
%133 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 4
%134 = load i8*, i8** %133
%135 = tail call i64 @fchdir(i8* %134)
%136 = icmp eq i64 %135, 0
br i1 %136, label %140, label %137
137: ; preds = %132
%138 = load i32, i32* %6
%139 = or i32 %138, 8192
store i32 %139, i32* %6
br label %260
140: ; preds = %132, %128
%141 = tail call i32 @fts_load(%struct.TYPE_16__* %0, %struct.TYPE_15__* %121)
store %struct.TYPE_15__* %121, %struct.TYPE_15__** %2
br label %260
142: ; preds = %123
%143 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 0
%144 = load i32, i32* %143
switch i32 %144, label %164 [
i32 4, label %118
i32 2, label %145
]
145: ; preds = %142
%146 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 0
%147 = tail call i8* @fts_stat(%struct.TYPE_16__* %0, %struct.TYPE_15__* %121, i32 1)
%148 = ptrtoint i8* %147 to i64
%149 = trunc i64 %148 to i32
%150 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 1
store i32 %149, i32* %150
%151 = icmp eq i32 %149, 1
br i1 %151, label %152, label %163
152: ; preds = %145
%153 = load i32, i32* %6
%154 = and i32 %153, 4
%155 = icmp eq i32 %154, 0
br i1 %155, label %156, label %163
156: ; preds = %152
%157 = load i32, i32* @O_RDONLY
%158 = tail call i8* @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %157, i32 0)
%159 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 10
store i8* %158, i8** %159
%160 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %121, i64 0, i32 3
%161 = load i32, i32* %160
%162 = or i32 %161, 2
store i32 %162, i32* %160
br label %163
163: ; preds = %156, %152, %145
store i32 3, i32* %146
br label %164
164: ; preds = %142, %163, %116
%165 = phi %struct.TYPE_15__* [ %117, %116 ], [ %121, %163 ], [ %121, %142 ]
%166 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 2
%167 = load i8*, i8** %166
%168 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %165, i64 0, i32 9
%169 = load %struct.TYPE_15__*, %struct.TYPE_15__** %168
%170 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %169, i64 0, i32 7
%171 = load i8*, i8** %170
%172 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %169, i64 0, i32 8
%173 = load i32, i32* %172
%174 = add nsw i32 %173, -1
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i8, i8* %171, i64 %175
%177 = load i8, i8* %176
%178 = icmp eq i8 %177, 47
%179 = select i1 %178, i32 %174, i32 %173
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8, i8* %167, i64 %180
%182 = getelementptr inbounds i8, i8* %181, i64 1
store i8 47, i8* %181
%183 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %165, i64 0, i32 12
%184 = load i32, i32* %183
%185 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %165, i64 0, i32 11
%186 = load i64, i64* %185
%187 = add nsw i64 %186, 1
%188 = tail call i32 @memmove(i8* %182, i32 %184, i64 %187)
store %struct.TYPE_15__* %165, %struct.TYPE_15__** %2
br label %260
189: ; preds = %118
%190 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %119, i64 0, i32 9
%191 = load %struct.TYPE_15__*, %struct.TYPE_15__** %190
%192 = tail call i32 @free(%struct.TYPE_15__* %119)
%193 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 6
%194 = load i32, i32* %193
%195 = icmp eq i32 %194, -1
br i1 %195, label %196, label %198
196: ; preds = %189
%197 = tail call i32 @free(%struct.TYPE_15__* %191)
store i32 0, i32* @errno
store %struct.TYPE_15__* null, %struct.TYPE_15__** %2
br label %260
198: ; preds = %189
%199 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 2
%200 = load i8*, i8** %199
%201 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 8
%202 = load i32, i32* %201
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %200, i64 %203
store i8 0, i8* %204
%205 = load i32, i32* %193
%206 = icmp eq i32 %205, 0
br i1 %206, label %207, label %219
207: ; preds = %198
%208 = load i32, i32* %6
%209 = and i32 %208, 4
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %254
211: ; preds = %207
%212 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %0, i64 0, i32 4
%213 = load i8*, i8** %212
%214 = tail call i64 @fchdir(i8* %213)
%215 = icmp eq i64 %214, 0
br i1 %215, label %254, label %216
216: ; preds = %211
%217 = load i32, i32* %6
%218 = or i32 %217, 8192
store i32 %218, i32* %6
store %struct.TYPE_15__* %191, %struct.TYPE_15__** %2
br label %260
219: ; preds = %198
%220 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 3
%221 = load i32, i32* %220
%222 = and i32 %221, 2
%223 = icmp eq i32 %222, 0
br i1 %223, label %243, label %224
224: ; preds = %219
%225 = load i32, i32* %6
%226 = and i32 %225, 4
%227 = icmp eq i32 %226, 0
br i1 %227, label %228, label %239
228: ; preds = %224
%229 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 10
%230 = load i8*, i8** %229
%231 = tail call i64 @fchdir(i8* %230)
%232 = icmp eq i64 %231, 0
br i1 %232, label %239, label %233
233: ; preds = %228
%234 = load i32, i32* @errno
%235 = load i8*, i8** %229
%236 = tail call i32 @close(i8* %235)
store i32 %234, i32* @errno
%237 = load i32, i32* %6
%238 = or i32 %237, 8192
store i32 %238, i32* %6
store %struct.TYPE_15__* %191, %struct.TYPE_15__** %2
br label %260
239: ; preds = %228, %224
%240 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 10
%241 = load i8*, i8** %240
%242 = tail call i32 @close(i8* %241)
br label %254
243: ; preds = %219
%244 = and i32 %221, 1
%245 = icmp eq i32 %244, 0
br i1 %245, label %246, label %254
246: ; preds = %243
%247 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 9
%248 = load %struct.TYPE_15__*, %struct.TYPE_15__** %247
%249 = tail call i64 @fts_safe_changedir(%struct.TYPE_16__* %0, %struct.TYPE_15__* %248, i32 -1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%250 = icmp eq i64 %249, 0
br i1 %250, label %254, label %251
251: ; preds = %246
%252 = load i32, i32* %6
%253 = or i32 %252, 8192
store i32 %253, i32* %6
store %struct.TYPE_15__* %191, %struct.TYPE_15__** %2
br label %260
254: ; preds = %239, %246, %243, %207, %211
%255 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 2
%256 = load i32, i32* %255
%257 = icmp eq i32 %256, 0
%258 = select i1 %257, i32 6, i32 7
%259 = getelementptr inbounds %struct.TYPE_15__, %struct.TYPE_15__* %191, i64 0, i32 1
store i32 %258, i32* %259
store %struct.TYPE_15__* %191, %struct.TYPE_15__** %2
br label %260
260: ; preds = %111, %23, %28, %32, %1, %5, %254, %251, %233, %216, %196, %164, %140, %137, %74, %13
%261 = phi %struct.TYPE_15__* [ %3, %13 ], [ %3, %74 ], [ %165, %164 ], [ %121, %140 ], [ null, %137 ], [ null, %196 ], [ %191, %254 ], [ null, %216 ], [ null, %233 ], [ null, %251 ], [ null, %5 ], [ null, %1 ], [ %3, %32 ], [ %3, %28 ], [ %3, %23 ], [ %115, %111 ]
ret %struct.TYPE_15__* %261
}