#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ timebuf;
struct tm {
  int dummy;
};
struct stat {
  int st_mode;
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_size;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
};
struct passwd {
  char *pw_name;
};
struct group {
  char *gr_name;
};
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int BUFSIZ;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
scalar_t__ S_ISDIR(int);
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ cuftpd_debug(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
struct group *getgrgid(int /*<<< orphan*/);
struct passwd *getpwuid(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ snprintf(char *, int, char *, ...);
scalar_t__ stat(char *, struct stat *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int strftime(char *, int, char *, struct tm *);
int cuftpd_get_list(char buf[], int len) {
  DIR *dir;
  struct dirent *ent;
  int off = 0;
  if ((dir = opendir(".")) < 0) {
    cuftpd_debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/easion/os_sdk/refs/heads/"
                 "master/system/ftpd.c",
                 493, "opendir() failed:%s\n", strerror(errno));
    return (-1);
  }
  buf[0] = '\0';
  while ((ent = readdir(dir)) != NULL) {
    char *filename = ent->d_name;
    struct stat st;
    char mode[] = "----------";
    struct passwd *pwd;
    struct group *grp;
    struct tm *ptm;
    char timebuf[BUFSIZ];
    int timelen;
    if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
      continue;
    if (stat(filename, &st) < 0) {
      closedir(dir);
      cuftpd_debug("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/easion/os_sdk/refs/heads/"
                   "master/system/ftpd.c",
                   515, "stat() failed:%s\n", strerror(errno));
      return (-1);
    }
    if (S_ISDIR(st.st_mode))
      mode[0] = 'd';
    if (st.st_mode & S_IRUSR)
      mode[1] = 'r';
    if (st.st_mode & S_IWUSR)
      mode[2] = 'w';
    if (st.st_mode & S_IXUSR)
      mode[3] = 'x';
    if (st.st_mode & S_IRGRP)
      mode[4] = 'r';
    if (st.st_mode & S_IWGRP)
      mode[5] = 'w';
    if (st.st_mode & S_IXGRP)
      mode[6] = 'x';
    if (st.st_mode & S_IROTH)
      mode[7] = 'r';
    if (st.st_mode & S_IWOTH)
      mode[8] = 'w';
    if (st.st_mode & S_IXOTH)
      mode[9] = 'x';
    mode[10] = '\0';
    off += snprintf(buf + off, len - off, "%s ", mode);
    off += snprintf(buf + off, len - off, "%d ", 1);
    if ((pwd = getpwuid(st.st_uid)) == NULL) {
      closedir(dir);
      return (-1);
    }
    off += snprintf(buf + off, len - off, "%s ", pwd->pw_name);
    if ((grp = getgrgid(st.st_gid)) == NULL) {
      closedir(dir);
      return (-1);
    }
    off += snprintf(buf + off, len - off, "%s ", grp->gr_name);
    off += snprintf(buf + off, len - off, "%*d ", 10, st.st_size);
    ptm = localtime(&st.st_mtime);
    if (ptm && (timelen = strftime(timebuf, sizeof(timebuf), "%b %d %H:%S",
                                   ptm)) > 0) {
      timebuf[timelen] = '\0';
      off += snprintf(buf + off, len - off, "%s ", timebuf);
    } else {
      closedir(dir);
      return (-1);
    }
    off += snprintf(buf + off, len - off, "%s\r\n", filename);
  }
  return off;
}


x86 assembly (clang, -O0):
<cuftpd_get_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xeb9(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jae    1237 <cuftpd_get_list+0x67>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %eax,%ecx
lea    0xde6(%rip),%rdi
mov    $0x1ed,%esi
lea    0xe62(%rip),%rdx
call   1040 <cuftpd_debug@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16db <cuftpd_get_list+0x50b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     16d5 <cuftpd_get_list+0x505>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movabs $0x2d2d2d2d2d2d2d2d,%rax
2d 2d 2d
mov    %rax,-0x60(%rbp)
movl   $0x2d2d2d,-0x59(%rbp)
mov    0x2d3c(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xa0(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     12e2 <cuftpd_get_list+0x112>
mov    -0x38(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    12f1 <cuftpd_get_list+0x121>
movl   $0x2,-0x90(%rbp)
jmp    1697 <cuftpd_get_list+0x4c7>
mov    -0x38(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
jge    134f <cuftpd_get_list+0x17f>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %eax,%ecx
lea    0xcd8(%rip),%rdi
mov    $0x203,%esi
lea    0xd77(%rip),%rdx
call   1040 <cuftpd_debug@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x90(%rbp)
jmp    1697 <cuftpd_get_list+0x4c7>
mov    -0x50(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1365 <cuftpd_get_list+0x195>
movb   $0x64,-0x60(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2c29(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     137e <cuftpd_get_list+0x1ae>
movb   $0x72,-0x5f(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2c48(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1397 <cuftpd_get_list+0x1c7>
movb   $0x77,-0x5e(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2c3f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13b0 <cuftpd_get_list+0x1e0>
movb   $0x78,-0x5d(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2bee(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13c9 <cuftpd_get_list+0x1f9>
movb   $0x72,-0x5c(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2c05(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13e2 <cuftpd_get_list+0x212>
movb   $0x77,-0x5b(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2bdc(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13fb <cuftpd_get_list+0x22b>
movb   $0x78,-0x5a(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2b9b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1414 <cuftpd_get_list+0x244>
movb   $0x72,-0x59(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2b6a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     142d <cuftpd_get_list+0x25d>
movb   $0x77,-0x58(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2bb1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1446 <cuftpd_get_list+0x276>
movb   $0x78,-0x57(%rbp)
movb   $0x0,-0x56(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
lea    -0x60(%rbp),%rcx
lea    0xc57(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
lea    0xc2f(%rip),%rdx
mov    $0x1,%ecx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x40(%rbp),%edi
call   1060 <getpwuid@plt>
mov    %rax,-0x68(%rbp)
cmp    $0x0,%rax
jne    14e0 <cuftpd_get_list+0x310>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x90(%rbp)
jmp    1697 <cuftpd_get_list+0x4c7>
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x68(%rbp),%rax
mov    (%rax),%rcx
lea    0xbbe(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x44(%rbp),%edi
call   1080 <getgrgid@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
jne    1548 <cuftpd_get_list+0x378>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x90(%rbp)
jmp    1697 <cuftpd_get_list+0x4c7>
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x70(%rbp),%rax
mov    (%rax),%rcx
lea    0xb56(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x48(%rbp),%r8d
lea    0xb2e(%rip),%rdx
mov    $0xa,%ecx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
lea    -0x50(%rbp),%rdi
add    $0x4,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     163e <cuftpd_get_list+0x46e>
mov    -0x98(%rbp),%rdi
mov    -0xa0(%rbp),%rax
mov    %eax,%esi
mov    -0x78(%rbp),%rcx
lea    0xae3(%rip),%rdx
call   10e0 <strftime@plt>
mov    %eax,-0x8c(%rbp)
cmp    $0x0,%eax
jle    163e <cuftpd_get_list+0x46e>
mov    -0x98(%rbp),%rcx
movslq -0x8c(%rbp),%rax
movb   $0x0,(%rcx,%rax,1)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
lea    0xa98(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
jmp    165d <cuftpd_get_list+0x48d>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x90(%rbp)
jmp    1697 <cuftpd_get_list+0x4c7>
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rcx
lea    0xa5d(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x90(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,%rsp
mov    -0x90(%rbp),%eax
mov    %eax,-0xa4(%rbp)
test   %eax,%eax
je     16d0 <cuftpd_get_list+0x500>
jmp    16b7 <cuftpd_get_list+0x4e7>
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
je     16db <cuftpd_get_list+0x50b>
jmp    16cb <cuftpd_get_list+0x4fb>
jmp    123e <cuftpd_get_list+0x6e>
jmp    123e <cuftpd_get_list+0x6e>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cuftpd_get_list>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xea6(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,%r13
movb   $0x0,(%r15)
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     14e7 <cuftpd_get_list+0x317>
mov    %r15,-0x60(%rbp)
mov    %r14d,-0x4c(%rbp)
movabs $0x2d2d2d2d2d2d2d2d,%r14
2d 2d 2d
mov    0x2d94(%rip),%rbx
xor    %ecx,%ecx
mov    %rcx,-0x48(%rbp)
mov    %r13,-0x58(%rbp)
jmp    12c2 <cuftpd_get_list+0xf2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %r15d,%ebx
mov    %eax,%eax
movb   $0x0,(%r12,%rax,1)
movslq %ebx,%rbx
mov    -0x60(%rbp),%r15
lea    (%r15,%rbx,1),%rdi
mov    -0x4c(%rbp),%r14d
mov    %r14d,%esi
sub    %ebx,%esi
lea    0xe43(%rip),%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1090 <snprintf@plt>
add    %ebx,%eax
movslq %eax,%rbx
lea    (%r15,%rbx,1),%rdi
mov    %r14d,%esi
sub    %ebx,%esi
lea    0xe3d(%rip),%rdx
mov    -0x80(%rbp),%rcx
xor    %eax,%eax
call   1090 <snprintf@plt>
add    %ebx,%eax
mov    %rax,-0x48(%rbp)
mov    -0x58(%rbp),%r13
movabs $0x2d2d2d2d2d2d2d2d,%r14
2d 2d 2d
mov    0x2d0e(%rip),%rbx
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %r13,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     152b <cuftpd_get_list+0x35b>
mov    %rsp,-0x40(%rbp)
mov    (%rax),%r15
mov    %r14,-0x38(%rbp)
movl   $0x2d2d2d,-0x31(%rbp)
mov    (%rbx),%eax
mov    %rsp,%r12
mov    %rax,-0x88(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %r15,%rdi
lea    0xd9c(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12aa <cuftpd_get_list+0xda>
mov    %r15,%rdi
lea    0xd87(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12aa <cuftpd_get_list+0xda>
mov    %r15,%rdi
lea    -0x78(%rbp),%rsi
call   10c0 <stat@plt>
test   %rax,%rax
js     14eb <cuftpd_get_list+0x31b>
mov    -0x78(%rbp),%edi
call   1070 <S_ISDIR@plt>
test   %rax,%rax
je     133c <cuftpd_get_list+0x16c>
movb   $0x64,-0x38(%rbp)
mov    -0x78(%rbp),%eax
mov    0x2c52(%rip),%rcx
test   %eax,(%rcx)
lea    0xd59(%rip),%rdx
je     1355 <cuftpd_get_list+0x185>
movb   $0x72,-0x37(%rbp)
mov    0x2c74(%rip),%rcx
test   %eax,(%rcx)
je     1364 <cuftpd_get_list+0x194>
movb   $0x77,-0x36(%rbp)
mov    0x2c75(%rip),%rcx
test   %eax,(%rcx)
je     1373 <cuftpd_get_list+0x1a3>
movb   $0x78,-0x35(%rbp)
mov    0x2c2e(%rip),%rcx
test   %eax,(%rcx)
je     1382 <cuftpd_get_list+0x1b2>
movb   $0x72,-0x34(%rbp)
mov    0x2c4f(%rip),%rcx
test   %eax,(%rcx)
je     1391 <cuftpd_get_list+0x1c1>
movb   $0x77,-0x33(%rbp)
mov    0x2c30(%rip),%rcx
test   %eax,(%rcx)
je     13a0 <cuftpd_get_list+0x1d0>
movb   $0x78,-0x32(%rbp)
mov    0x2bf9(%rip),%rcx
test   %eax,(%rcx)
je     13af <cuftpd_get_list+0x1df>
movb   $0x72,-0x31(%rbp)
mov    0x2bd2(%rip),%rcx
test   %eax,(%rcx)
je     13be <cuftpd_get_list+0x1ee>
movb   $0x77,-0x30(%rbp)
mov    %r15,-0x80(%rbp)
mov    0x2c1f(%rip),%rcx
test   %eax,(%rcx)
je     13d1 <cuftpd_get_list+0x201>
movb   $0x78,-0x2f(%rbp)
movb   $0x0,-0x2e(%rbp)
movslq -0x48(%rbp),%r15
mov    -0x60(%rbp),%r13
lea    (%r15,%r13,1),%rdi
mov    -0x4c(%rbp),%r14d
mov    %r14d,%esi
sub    %r15d,%esi
lea    -0x38(%rbp),%rcx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rax,%rbx
add    %r15d,%ebx
movslq %ebx,%rax
lea    (%rax,%r13,1),%rdi
mov    %r14d,%esi
sub    %eax,%esi
lea    0xc9d(%rip),%rdx
mov    $0x1,%ecx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rax,%r15
mov    -0x68(%rbp),%edi
call   1060 <getpwuid@plt>
test   %rax,%rax
je     14dc <cuftpd_get_list+0x30c>
add    %r15d,%ebx
movslq %ebx,%rcx
lea    (%rcx,%r13,1),%rdi
mov    %r14d,%esi
sub    %ecx,%esi
mov    (%rax),%rcx
lea    0xc60(%rip),%rdx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rax,%r15
mov    -0x6c(%rbp),%edi
call   1080 <getgrgid@plt>
test   %rax,%rax
je     14dc <cuftpd_get_list+0x30c>
add    %r15d,%ebx
movslq %ebx,%r15
lea    (%r15,%r13,1),%rdi
mov    %r14d,%esi
sub    %r15d,%esi
mov    (%rax),%rcx
lea    0xc2f(%rip),%rdx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rax,%rbx
add    %r15d,%ebx
movslq %ebx,%rax
lea    (%rax,%r13,1),%rdi
sub    %eax,%r14d
mov    -0x70(%rbp),%r8d
mov    %r14d,%esi
lea    0xc12(%rip),%rdx
mov    $0xa,%ecx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rax,%r15
lea    -0x74(%rbp),%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     14dc <cuftpd_get_list+0x30c>
mov    %r12,%rdi
mov    -0x88(%rbp),%rsi
lea    0xbe9(%rip),%rdx
mov    %rax,%rcx
call   10e0 <strftime@plt>
test   %eax,%eax
jg     1240 <cuftpd_get_list+0x70>
mov    -0x58(%rbp),%rdi
call   10a0 <closedir@plt>
jmp    151b <cuftpd_get_list+0x34b>
xor    %eax,%eax
jmp    1527 <cuftpd_get_list+0x357>
mov    %r13,%rdi
call   10a0 <closedir@plt>
mov    0x2ab6(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xaf8(%rip),%rdi
lea    0xb87(%rip),%rdx
mov    $0x203,%esi
mov    %eax,%ecx
call   1040 <cuftpd_debug@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    $0xffffffff,%eax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.stat = type { i32, i32, i32, i32, i32 }
%struct.passwd = type { i8* }
%struct.group = type { i8* }
%struct.tm = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/easion/os_sdk/refs/heads/master/system/ftpd.c\00"
@.str.2 = [21 x i8] c"opendir() failed:%s\0A\00"
@errno = global i32 0
@__const.cuftpd_get_list.mode = [11 x i8] c"----------\00"
@BUFSIZ = global i32 0
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [18 x i8] c"stat() failed:%s\0A\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@.str.5 = [4 x i8] c"%s \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [5 x i8] c"%*d \00"
@.str.8 = [12 x i8] c"%b %d %H:%S\00"
@.str.9 = [5 x i8] c"%s\0D\0A\00"
define i32 @cuftpd_get_list(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.dirent*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca %struct.stat
%11 = alloca [11 x i8]
%12 = alloca %struct.passwd*
%13 = alloca %struct.group*
%14 = alloca %struct.tm*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %8
%19 = call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %6
%20 = icmp ult i32* %19, null
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = load i32, i32* @errno
%23 = call i32 @strerror(i32 %22)
%24 = call i32 @cuftpd_debug(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 493, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %23)
store i32 -1, i32* %3
br label %273
25: ; preds = %2
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 0
store i8 0, i8* %27
br label %28
28: ; preds = %270, %267, %25
%29 = load i32*, i32** %6
%30 = call %struct.dirent* @readdir(i32* %29)
store %struct.dirent* %30, %struct.dirent** %7
%31 = icmp ne %struct.dirent* %30, null
br i1 %31, label %32, label %271
32: ; preds = %28
%33 = load %struct.dirent*, %struct.dirent** %7
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i32 0, i32 0
%35 = load i8*, i8** %34
store i8* %35, i8** %9
%36 = bitcast [11 x i8]* %11 to i8*
%37 = load i32, i32* @BUFSIZ
%38 = zext i32 %37 to i64
%39 = call i8* @llvm.stacksave()
store i8* %39, i8** %15
%40 = alloca i8, i64 %38
store i64 %38, i64* %16
%41 = load i8*, i8** %9
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %32
%45 = load i8*, i8** %9
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44, %32
store i32 2, i32* %18
br label %267
49: ; preds = %44
%50 = load i8*, i8** %9
%51 = call i64 @stat(i8* %50, %struct.stat* %10)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %49
%54 = load i32*, i32** %6
%55 = call i32 @closedir(i32* %54)
%56 = load i32, i32* @errno
%57 = call i32 @strerror(i32 %56)
%58 = call i32 @cuftpd_debug(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %57)
store i32 -1, i32* %3
store i32 1, i32* %18
br label %267
59: ; preds = %49
%60 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i64 @S_ISDIR(i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 0
store i8 100, i8* %65
br label %66
66: ; preds = %64, %59
%67 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%68 = load i32, i32* %67
%69 = load i32, i32* @S_IRUSR
%70 = and i32 %68, %69
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %66
%73 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 1
store i8 114, i8* %73
br label %74
74: ; preds = %72, %66
%75 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%76 = load i32, i32* %75
%77 = load i32, i32* @S_IWUSR
%78 = and i32 %76, %77
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %74
%81 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 2
store i8 119, i8* %81
br label %82
82: ; preds = %80, %74
%83 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%84 = load i32, i32* %83
%85 = load i32, i32* @S_IXUSR
%86 = and i32 %84, %85
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %82
%89 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 3
store i8 120, i8* %89
br label %90
90: ; preds = %88, %82
%91 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%92 = load i32, i32* %91
%93 = load i32, i32* @S_IRGRP
%94 = and i32 %92, %93
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %90
%97 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 4
store i8 114, i8* %97
br label %98
98: ; preds = %96, %90
%99 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%100 = load i32, i32* %99
%101 = load i32, i32* @S_IWGRP
%102 = and i32 %100, %101
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %98
%105 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 5
store i8 119, i8* %105
br label %106
106: ; preds = %104, %98
%107 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%108 = load i32, i32* %107
%109 = load i32, i32* @S_IXGRP
%110 = and i32 %108, %109
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %106
%113 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 6
store i8 120, i8* %113
br label %114
114: ; preds = %112, %106
%115 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%116 = load i32, i32* %115
%117 = load i32, i32* @S_IROTH
%118 = and i32 %116, %117
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %114
%121 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 7
store i8 114, i8* %121
br label %122
122: ; preds = %120, %114
%123 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%124 = load i32, i32* %123
%125 = load i32, i32* @S_IWOTH
%126 = and i32 %124, %125
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %122
%129 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 8
store i8 119, i8* %129
br label %130
130: ; preds = %128, %122
%131 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%132 = load i32, i32* %131
%133 = load i32, i32* @S_IXOTH
%134 = and i32 %132, %133
%135 = icmp ne i32 %134, 0
br i1 %135, label %136, label %138
136: ; preds = %130
%137 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 9
store i8 120, i8* %137
br label %138
138: ; preds = %136, %130
%139 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 10
store i8 0, i8* %139
%140 = load i8*, i8** %4
%141 = load i32, i32* %8
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8, i8* %140, i64 %142
%144 = load i32, i32* %5
%145 = load i32, i32* %8
%146 = sub nsw i32 %144, %145
%147 = getelementptr inbounds [11 x i8], [11 x i8]* %11, i64 0, i64 0
%148 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %143, i32 %146, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %147)
%149 = load i32, i32* %8
%150 = sext i32 %149 to i64
%151 = add nsw i64 %150, %148
%152 = trunc i64 %151 to i32
store i32 %152, i32* %8
%153 = load i8*, i8** %4
%154 = load i32, i32* %8
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i8, i8* %153, i64 %155
%157 = load i32, i32* %5
%158 = load i32, i32* %8
%159 = sub nsw i32 %157, %158
%160 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %156, i32 %159, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%161 = load i32, i32* %8
%162 = sext i32 %161 to i64
%163 = add nsw i64 %162, %160
%164 = trunc i64 %163 to i32
store i32 %164, i32* %8
%165 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 4
%166 = load i32, i32* %165
%167 = call %struct.passwd* @getpwuid(i32 %166)
store %struct.passwd* %167, %struct.passwd** %12
%168 = icmp eq %struct.passwd* %167, null
br i1 %168, label %169, label %172
169: ; preds = %138
%170 = load i32*, i32** %6
%171 = call i32 @closedir(i32* %170)
store i32 -1, i32* %3
store i32 1, i32* %18
br label %267
172: ; preds = %138
%173 = load i8*, i8** %4
%174 = load i32, i32* %8
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i8, i8* %173, i64 %175
%177 = load i32, i32* %5
%178 = load i32, i32* %8
%179 = sub nsw i32 %177, %178
%180 = load %struct.passwd*, %struct.passwd** %12
%181 = getelementptr inbounds %struct.passwd, %struct.passwd* %180, i32 0, i32 0
%182 = load i8*, i8** %181
%183 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %176, i32 %179, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %182)
%184 = load i32, i32* %8
%185 = sext i32 %184 to i64
%186 = add nsw i64 %185, %183
%187 = trunc i64 %186 to i32
store i32 %187, i32* %8
%188 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 3
%189 = load i32, i32* %188
%190 = call %struct.group* @getgrgid(i32 %189)
store %struct.group* %190, %struct.group** %13
%191 = icmp eq %struct.group* %190, null
br i1 %191, label %192, label %195
192: ; preds = %172
%193 = load i32*, i32** %6
%194 = call i32 @closedir(i32* %193)
store i32 -1, i32* %3
store i32 1, i32* %18
br label %267
195: ; preds = %172
%196 = load i8*, i8** %4
%197 = load i32, i32* %8
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i8, i8* %196, i64 %198
%200 = load i32, i32* %5
%201 = load i32, i32* %8
%202 = sub nsw i32 %200, %201
%203 = load %struct.group*, %struct.group** %13
%204 = getelementptr inbounds %struct.group, %struct.group* %203, i32 0, i32 0
%205 = load i8*, i8** %204
%206 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %199, i32 %202, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %205)
%207 = load i32, i32* %8
%208 = sext i32 %207 to i64
%209 = add nsw i64 %208, %206
%210 = trunc i64 %209 to i32
store i32 %210, i32* %8
%211 = load i8*, i8** %4
%212 = load i32, i32* %8
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i8, i8* %211, i64 %213
%215 = load i32, i32* %5
%216 = load i32, i32* %8
%217 = sub nsw i32 %215, %216
%218 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 2
%219 = load i32, i32* %218
%220 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %214, i32 %217, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 10, i32 %219)
%221 = load i32, i32* %8
%222 = sext i32 %221 to i64
%223 = add nsw i64 %222, %220
%224 = trunc i64 %223 to i32
store i32 %224, i32* %8
%225 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%226 = call %struct.tm* @localtime(i32* %225)
store %struct.tm* %226, %struct.tm** %14
%227 = load %struct.tm*, %struct.tm** %14
%228 = icmp ne %struct.tm* %227, null
br i1 %228, label %229, label %250
229: ; preds = %195
%230 = trunc i64 %38 to i32
%231 = load %struct.tm*, %struct.tm** %14
%232 = call i32 @strftime(i8* %40, i32 %230, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %231)
store i32 %232, i32* %17
%233 = icmp sgt i32 %232, 0
br i1 %233, label %234, label %250
234: ; preds = %229
%235 = load i32, i32* %17
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i8, i8* %40, i64 %236
store i8 0, i8* %237
%238 = load i8*, i8** %4
%239 = load i32, i32* %8
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds i8, i8* %238, i64 %240
%242 = load i32, i32* %5
%243 = load i32, i32* %8
%244 = sub nsw i32 %242, %243
%245 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %241, i32 %244, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %40)
%246 = load i32, i32* %8
%247 = sext i32 %246 to i64
%248 = add nsw i64 %247, %245
%249 = trunc i64 %248 to i32
store i32 %249, i32* %8
br label %253
250: ; preds = %229, %195
%251 = load i32*, i32** %6
%252 = call i32 @closedir(i32* %251)
store i32 -1, i32* %3
store i32 1, i32* %18
br label %267
253: ; preds = %234
%254 = load i8*, i8** %4
%255 = load i32, i32* %8
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds i8, i8* %254, i64 %256
%258 = load i32, i32* %5
%259 = load i32, i32* %8
%260 = sub nsw i32 %258, %259
%261 = load i8*, i8** %9
%262 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %257, i32 %260, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %261)
%263 = load i32, i32* %8
%264 = sext i32 %263 to i64
%265 = add nsw i64 %264, %262
%266 = trunc i64 %265 to i32
store i32 %266, i32* %8
store i32 0, i32* %18
br label %267
267: ; preds = %253, %250, %192, %169, %53, %48
%268 = load i8*, i8** %15
%269 = load i32, i32* %18
switch i32 %269, label %275 [
i32 0, label %270
i32 2, label %28
i32 1, label %273
]
270: ; preds = %267
br label %28
271: ; preds = %28
%272 = load i32, i32* %8
store i32 %272, i32* %3
br label %273
273: ; preds = %271, %267, %21
%274 = load i32, i32* %3
ret i32 %274
275: ; preds = %267
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32, i32 }
%struct.dirent = type { i8* }
%struct.passwd = type { i8* }
%struct.group = type { i8* }
%struct.tm = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/easion/os_sdk/refs/heads/master/system/ftpd.c\00"
@errno = global i32 0
@__const.cuftpd_get_list.mode = [11 x i8] c"----------\00"
@BUFSIZ = global i32 0
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [18 x i8] c"stat() failed:%s\0A\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@S_IXOTH = global i32 0
@.str.5 = [4 x i8] c"%s \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [5 x i8] c"%*d \00"
@.str.8 = [12 x i8] c"%b %d %H:%S\00"
@.str.9 = [5 x i8] c"%s\0D\0A\00"
define i32 @cuftpd_get_list(i8* %0, i32 %1) {
%3 = alloca %struct.stat
%4 = alloca [11 x i8]
%5 = tail call i32* @opendir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %0
%6 = call %struct.dirent* @readdir(i32* %5)
%7 = icmp eq %struct.dirent* %6, null
br i1 %7, label %174, label %8
8: ; preds = %2
%9 = bitcast %struct.stat* %3 to i8*
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 1
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 2
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 3
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 4
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 5
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 6
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 7
%19 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 8
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 9
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 10
%22 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 4
%23 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 3
%24 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%25 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
br label %26
26: ; preds = %8, %170
%27 = phi %struct.dirent* [ %6, %8 ], [ %172, %170 ]
%28 = phi i32 [ 0, %8 ], [ %171, %170 ]
%29 = getelementptr inbounds %struct.dirent, %struct.dirent* %27, i64 0, i32 0
%30 = load i8*, i8** %29
%31 = load i32, i32* @BUFSIZ
%32 = zext i32 %31 to i64
%33 = call i8* @llvm.stacksave()
%34 = alloca i8, i64 %32
%35 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %170, label %37
37: ; preds = %26
%38 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %170, label %40
40: ; preds = %37
%41 = call i64 @stat(i8* %30, %struct.stat* %3)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = call i32 @closedir(i32* %5)
%45 = load i32, i32* @errno
%46 = call i32 @strerror(i32 %45)
%47 = call i32 @cuftpd_debug(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 515, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %169
48: ; preds = %40
%49 = load i32, i32* %11
%50 = call i64 @S_ISDIR(i32 %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %53, label %52
52: ; preds = %48
store i8 100, i8* %10
br label %53
53: ; preds = %52, %48
%54 = load i32, i32* %11
%55 = load i32, i32* @S_IRUSR
%56 = and i32 %55, %54
%57 = icmp eq i32 %56, 0
br i1 %57, label %59, label %58
58: ; preds = %53
store i8 114, i8* %12
br label %59
59: ; preds = %58, %53
%60 = load i32, i32* @S_IWUSR
%61 = and i32 %60, %54
%62 = icmp eq i32 %61, 0
br i1 %62, label %64, label %63
63: ; preds = %59
store i8 119, i8* %13
br label %64
64: ; preds = %63, %59
%65 = load i32, i32* @S_IXUSR
%66 = and i32 %65, %54
%67 = icmp eq i32 %66, 0
br i1 %67, label %69, label %68
68: ; preds = %64
store i8 120, i8* %14
br label %69
69: ; preds = %68, %64
%70 = load i32, i32* @S_IRGRP
%71 = and i32 %70, %54
%72 = icmp eq i32 %71, 0
br i1 %72, label %74, label %73
73: ; preds = %69
store i8 114, i8* %15
br label %74
74: ; preds = %73, %69
%75 = load i32, i32* @S_IWGRP
%76 = and i32 %75, %54
%77 = icmp eq i32 %76, 0
br i1 %77, label %79, label %78
78: ; preds = %74
store i8 119, i8* %16
br label %79
79: ; preds = %78, %74
%80 = load i32, i32* @S_IXGRP
%81 = and i32 %80, %54
%82 = icmp eq i32 %81, 0
br i1 %82, label %84, label %83
83: ; preds = %79
store i8 120, i8* %17
br label %84
84: ; preds = %83, %79
%85 = load i32, i32* @S_IROTH
%86 = and i32 %85, %54
%87 = icmp eq i32 %86, 0
br i1 %87, label %89, label %88
88: ; preds = %84
store i8 114, i8* %18
br label %89
89: ; preds = %88, %84
%90 = load i32, i32* @S_IWOTH
%91 = and i32 %90, %54
%92 = icmp eq i32 %91, 0
br i1 %92, label %94, label %93
93: ; preds = %89
store i8 119, i8* %19
br label %94
94: ; preds = %93, %89
%95 = load i32, i32* @S_IXOTH
%96 = and i32 %95, %54
%97 = icmp eq i32 %96, 0
br i1 %97, label %99, label %98
98: ; preds = %94
store i8 120, i8* %20
br label %99
99: ; preds = %98, %94
store i8 0, i8* %21
%100 = sext i32 %28 to i64
%101 = getelementptr inbounds i8, i8* %0, i64 %100
%102 = sub nsw i32 %1, %28
%103 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %101, i32 %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%104 = trunc i64 %103 to i32
%105 = add i32 %28, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %0, i64 %106
%108 = sub nsw i32 %1, %105
%109 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %107, i32 %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%110 = trunc i64 %109 to i32
%111 = add i32 %105, %110
%112 = load i32, i32* %22
%113 = call %struct.passwd* @getpwuid(i32 %112)
%114 = icmp eq %struct.passwd* %113, null
br i1 %114, label %115, label %117
115: ; preds = %99
%116 = call i32 @closedir(i32* %5)
br label %169
117: ; preds = %99
%118 = sext i32 %111 to i64
%119 = getelementptr inbounds i8, i8* %0, i64 %118
%120 = sub nsw i32 %1, %111
%121 = getelementptr inbounds %struct.passwd, %struct.passwd* %113, i64 0, i32 0
%122 = load i8*, i8** %121
%123 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %119, i32 %120, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %122)
%124 = trunc i64 %123 to i32
%125 = add i32 %111, %124
%126 = load i32, i32* %23
%127 = call %struct.group* @getgrgid(i32 %126)
%128 = icmp eq %struct.group* %127, null
br i1 %128, label %129, label %131
129: ; preds = %117
%130 = call i32 @closedir(i32* %5)
br label %169
131: ; preds = %117
%132 = sext i32 %125 to i64
%133 = getelementptr inbounds i8, i8* %0, i64 %132
%134 = sub nsw i32 %1, %125
%135 = getelementptr inbounds %struct.group, %struct.group* %127, i64 0, i32 0
%136 = load i8*, i8** %135
%137 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %133, i32 %134, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %136)
%138 = trunc i64 %137 to i32
%139 = add i32 %125, %138
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %0, i64 %140
%142 = sub nsw i32 %1, %139
%143 = load i32, i32* %24
%144 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %141, i32 %142, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 10, i32 %143)
%145 = trunc i64 %144 to i32
%146 = add i32 %139, %145
%147 = call %struct.tm* @localtime(i32* %25)
%148 = icmp eq %struct.tm* %147, null
br i1 %148, label %167, label %149
149: ; preds = %131
%150 = call i32 @strftime(i8* %34, i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %147)
%151 = icmp sgt i32 %150, 0
br i1 %151, label %152, label %167
152: ; preds = %149
%153 = zext i32 %150 to i64
%154 = getelementptr inbounds i8, i8* %34, i64 %153
store i8 0, i8* %154
%155 = sext i32 %146 to i64
%156 = getelementptr inbounds i8, i8* %0, i64 %155
%157 = sub nsw i32 %1, %146
%158 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %156, i32 %157, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%159 = trunc i64 %158 to i32
%160 = add i32 %146, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i8, i8* %0, i64 %161
%163 = sub nsw i32 %1, %160
%164 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %162, i32 %163, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %30)
%165 = trunc i64 %164 to i32
%166 = add i32 %160, %165
br label %170
167: ; preds = %149, %131
%168 = call i32 @closedir(i32* %5)
br label %169
169: ; preds = %43, %115, %129, %167
br label %174
170: ; preds = %26, %37, %152
%171 = phi i32 [ %166, %152 ], [ %28, %37 ], [ %28, %26 ]
%172 = call %struct.dirent* @readdir(i32* %5)
%173 = icmp eq %struct.dirent* %172, null
br i1 %173, label %174, label %26
174: ; preds = %170, %2, %169
%175 = phi i32 [ -1, %169 ], [ 0, %2 ], [ %171, %170 ]
ret i32 %175
}