#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 */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int FILENAME_MAX;
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ chdir(char *);
scalar_t__ dir_empty(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
char *get_realname(char *);
int getopt(int, char **, char *);
scalar_t__ lstat(char *, struct stat *);
char *optarg;
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int /*<<< orphan*/);
char *strpbrk(char *, char *);
int main(int argc, char **argv) {
  char *fn, buf[FILENAME_MAX], *n;
  char realrootdir[FILENAME_MAX];
  char *package = NULL;
  char *rootdir = NULL;
  struct stat st;
  int opt, nodircheck = 0;
  int stripinfo = 0;
  int debug = 0;
  while ((opt = getopt(argc, argv, "dDr:sp:")) != -1) {
    switch (opt) {
    case 'd':
      debug = 1;
      break;
    case 'D':
      nodircheck = 1;
      break;
    case 's':
      stripinfo = 1;
      break;
    case 'p':
      package = optarg;
      break;
    case 'r':
      strcpy(realrootdir, get_realname(optarg));
      rootdir = realrootdir;
      break;
    default:
      fprintf(stderr,
              "Usage: %s [-D] [-r rootdir] [-s] "
              "[-p pkg]\n",
              argv[0]);
      return 1;
    }
  }
  if (rootdir && chdir(rootdir) < 0) {
    fprintf(stderr, "fl_wrapper: rootdir=%s: %s\n", rootdir, strerror(errno));
    return 1;
  }
  while (fgets(buf, FILENAME_MAX, stdin) != NULL) {
    if (stripinfo) {
      fn = strpbrk(buf, "\t ");
      if (fn++ == NULL)
        continue;
    } else
      fn = buf;
    if ((n = strchr(fn, '\n')) != NULL)
      *n = '\0';
    if (*fn == 0)
      continue;
    if (lstat(fn, &st)) {
      if (debug)
        fprintf(stderr, "DEBUG: Can't stat file: %s.\n", fn);
      continue;
    }
    if (S_ISDIR(st.st_mode)) {
      if (!nodircheck && dir_empty(fn)) {
        if (debug)
          fprintf(stderr, "DEBUG: Non-empty dir: %s.\n", fn);
        continue;
      }
    }
    fn = get_realname(fn);
    if (rootdir) {
      if (!strncmp(rootdir, fn, strlen(rootdir))) {
        fn += strlen(rootdir);
      } else {
        if (debug)
          fprintf(stderr,
                  "DEBUG: Outside "
                  "root (%s): %s.\n",
                  rootdir, fn);
        continue;
      }
    }
    if (!package)
      printf("%s\n", fn);
    else
      printf("%s: %s\n", package, fn);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dc8(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x78(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe3a(%rip),%rdx
call   1100 <getopt@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
je     1355 <main+0x165>
mov    -0x54(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x80(%rbp)
sub    $0x2f,%eax
ja     131f <main+0x12f>
mov    -0x80(%rbp),%rax
lea    0xd49(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x60(%rbp)
jmp    1350 <main+0x160>
movl   $0x1,-0x58(%rbp)
jmp    1350 <main+0x160>
movl   $0x1,-0x5c(%rbp)
jmp    1350 <main+0x160>
mov    0x2d0d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1350 <main+0x160>
mov    0x2cfa(%rip),%rax
mov    (%rax),%rdi
call   10e0 <get_realname@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    -0x70(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    1350 <main+0x160>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1607 <main+0x417>
jmp    1278 <main+0x88>
cmpq   $0x0,-0x48(%rbp)
je     13cc <main+0x1dc>
mov    -0x48(%rbp),%rdi
call   1070 <chdir@plt>
cmp    $0x0,%rax
jge    13cc <main+0x1dc>
mov    0x2c4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %rax,%rcx
lea    0xd41(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1607 <main+0x417>
jmp    13d1 <main+0x1e1>
mov    -0x78(%rbp),%rdi
mov    0x2bfc(%rip),%rax
mov    (%rax),%esi
mov    0x2bfb(%rip),%rax
mov    (%rax),%edx
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     15f9 <main+0x409>
cmpl   $0x0,-0x5c(%rbp)
je     1437 <main+0x247>
mov    -0x78(%rbp),%rdi
lea    0xd04(%rip),%rsi
call   10f0 <strpbrk@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
jne    1432 <main+0x242>
jmp    13d1 <main+0x1e1>
jmp    143f <main+0x24f>
mov    -0x78(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1462 <main+0x272>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1477 <main+0x287>
jmp    13d1 <main+0x1e1>
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10b0 <lstat@plt>
cmp    $0x0,%rax
je     14b8 <main+0x2c8>
cmpl   $0x0,-0x60(%rbp)
je     14b3 <main+0x2c3>
mov    0x2b29(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc66(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    13d1 <main+0x1e1>
mov    -0x50(%rbp),%edi
call   10a0 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1516 <main+0x326>
cmpl   $0x0,-0x58(%rbp)
jne    1511 <main+0x321>
mov    -0x18(%rbp),%rdi
call   1050 <dir_empty@plt>
cmp    $0x0,%rax
je     1511 <main+0x321>
cmpl   $0x0,-0x60(%rbp)
je     150c <main+0x31c>
mov    0x2ad0(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc2a(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    13d1 <main+0x1e1>
jmp    1516 <main+0x326>
mov    -0x18(%rbp),%rdi
call   10e0 <get_realname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     15bc <main+0x3cc>
mov    -0x48(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x48(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1589 <main+0x399>
mov    -0x48(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    15b7 <main+0x3c7>
cmpl   $0x0,-0x60(%rbp)
je     15b2 <main+0x3c2>
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xb9f(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    13d1 <main+0x1e1>
jmp    15bc <main+0x3cc>
cmpq   $0x0,-0x40(%rbp)
jne    15de <main+0x3ee>
mov    -0x18(%rbp),%rsi
lea    0xb39(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    15f4 <main+0x404>
mov    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xb1a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    13d1 <main+0x1e1>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r12
mov    %edi,%ebx
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
lea    0xdc6(%rip),%r15
movl   $0x0,-0x3c(%rbp)
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
xor    %r13d,%r13d
mov    %r13d,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%r13d
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r15,%rdx
call   1100 <getopt@plt>
mov    $0x1,%ecx
cmp    $0x64,%eax
je     1260 <main+0x70>
cmp    $0x6f,%eax
jle    12b0 <main+0xc0>
cmp    $0x73,%eax
je     12c7 <main+0xd7>
cmp    $0x72,%eax
je     12d0 <main+0xe0>
cmp    $0x70,%eax
jne    14c1 <main+0x2d1>
mov    0x2d5f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1251 <main+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     12f8 <main+0x108>
cmp    $0x44,%eax
jne    14c1 <main+0x2d1>
movl   $0x1,-0x3c(%rbp)
jmp    1251 <main+0x61>
movl   $0x1,-0x2c(%rbp)
jmp    1251 <main+0x61>
mov    0x2d21(%rip),%rax
mov    (%rax),%rdi
call   10e0 <get_realname@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1251 <main+0x61>
mov    -0x38(%rbp),%rbx
test   %rbx,%rbx
je     1312 <main+0x122>
mov    %rbx,%rdi
call   1070 <chdir@plt>
test   %rax,%rax
js     14e2 <main+0x2f2>
mov    -0x2c(%rbp),%r15d
mov    0x2cbb(%rip),%rax
mov    (%rax),%esi
mov    0x2cba(%rip),%r12
mov    (%r12),%edx
mov    %r14,%rdi
call   10c0 <fgets@plt>
test   %rax,%rax
je     14de <main+0x2ee>
mov    %rbx,-0x38(%rbp)
jmp    1378 <main+0x188>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x2c77(%rip),%rax
mov    (%rax),%esi
mov    (%r12),%edx
mov    %r14,%rdi
call   10c0 <fgets@plt>
test   %rax,%rax
je     14de <main+0x2ee>
mov    %r14,%rbx
test   %r15d,%r15d
je     139b <main+0x1ab>
mov    %r14,%rdi
lea    0xcc5(%rip),%rsi
call   10f0 <strpbrk@plt>
test   %rax,%rax
je     135a <main+0x16a>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     13b0 <main+0x1c0>
movb   $0x0,(%rax)
cmpb   $0x0,(%rbx)
je     135a <main+0x16a>
mov    %rbx,%rdi
lea    -0x40(%rbp),%rsi
call   10b0 <lstat@plt>
test   %rax,%rax
je     13e0 <main+0x1f0>
test   %r13d,%r13d
je     135a <main+0x16a>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xc77(%rip),%rsi
jmp    1350 <main+0x160>
mov    -0x40(%rbp),%edi
call   10a0 <S_ISDIR@plt>
test   %rax,%rax
je     141e <main+0x22e>
cmpl   $0x0,-0x3c(%rbp)
jne    141e <main+0x22e>
mov    %rbx,%rdi
call   1050 <dir_empty@plt>
test   %rax,%rax
je     141e <main+0x22e>
test   %r13d,%r13d
je     135a <main+0x16a>
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
lea    0xc56(%rip),%rsi
jmp    1350 <main+0x160>
mov    %rbx,%rdi
call   10e0 <get_realname@plt>
mov    %rax,%rbx
mov    -0x38(%rbp),%r15
test   %r15,%r15
je     1488 <main+0x298>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     147b <main+0x28b>
test   %r13d,%r13d
mov    -0x2c(%rbp),%r15d
je     135a <main+0x16a>
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
mov    -0x38(%rbp),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    135a <main+0x16a>
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
add    %rax,%rbx
mov    -0x50(%rbp),%rsi
test   %rsi,%rsi
mov    -0x2c(%rbp),%r15d
je     14ab <main+0x2bb>
lea    0xbab(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    135a <main+0x16a>
lea    0xb99(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    135a <main+0x16a>
mov    0x2b00(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xb33(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1511 <main+0x321>
xor    %eax,%eax
jmp    1516 <main+0x326>
mov    0x2adf(%rip),%rax
mov    (%rax),%r14d
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xb32(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@FILENAME_MAX = global i32 0
@.str = [8 x i8] c"dDr:sp:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [43 x i8] c"Usage: %s [-D] [-r rootdir] [-s] [-p pkg]\0A\00"
@.str.2 = [28 x i8] c"fl_wrapper: rootdir=%s: %s\0A\00"
@errno = global i32 0
@stdin = global i32 0
@.str.3 = [3 x i8] c"\09 \00"
@.str.4 = [29 x i8] c"DEBUG: Can't stat file: %s.\0A\00"
@.str.5 = [27 x i8] c"DEBUG: Non-empty dir: %s.\0A\00"
@.str.6 = [31 x i8] c"DEBUG: Outside root (%s): %s.\0A\00"
@.str.7 = [4 x i8] c"%s\0A\00"
@.str.8 = [8 x i8] c"%s: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca %struct.stat
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* @FILENAME_MAX
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %7
%22 = alloca i8, i64 %20
store i64 %20, i64* %8
%23 = load i32, i32* @FILENAME_MAX
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
store i64 %24, i64* %10
store i8* null, i8** %11
store i8* null, i8** %12
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
br label %26
26: ; preds = %48, %2
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @getopt(i32 %27, i8** %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %29, i32* %14
%30 = icmp ne i32 %29, -1
br i1 %30, label %31, label %49
31: ; preds = %26
%32 = load i32, i32* %14
switch i32 %32, label %42 [
i32 100, label %33
i32 68, label %34
i32 115, label %35
i32 112, label %36
i32 114, label %38
]
33: ; preds = %31
store i32 1, i32* %17
br label %48
34: ; preds = %31
store i32 1, i32* %15
br label %48
35: ; preds = %31
store i32 1, i32* %16
br label %48
36: ; preds = %31
%37 = load i8*, i8** @optarg
store i8* %37, i8** %11
br label %48
38: ; preds = %31
%39 = load i8*, i8** @optarg
%40 = call i8* @get_realname(i8* %39)
%41 = call i32 @strcpy(i8* %25, i8* %40)
store i8* %25, i8** %12
br label %48
42: ; preds = %31
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %46)
store i32 1, i32* %3
store i32 1, i32* %18
br label %164
48: ; preds = %38, %36, %35, %34, %33
br label %26
49: ; preds = %26
%50 = load i8*, i8** %12
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %62
52: ; preds = %49
%53 = load i8*, i8** %12
%54 = call i64 @chdir(i8* %53)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %12
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %58, i8* %60)
store i32 1, i32* %3
store i32 1, i32* %18
br label %164
62: ; preds = %52, %49
br label %63
63: ; preds = %162, %150, %122, %102, %90, %76, %62
%64 = load i32, i32* @FILENAME_MAX
%65 = load i32, i32* @stdin
%66 = call i32* @fgets(i8* %22, i32 %64, i32 %65)
%67 = icmp ne i32* %66, null
br i1 %67, label %68, label %163
68: ; preds = %63
%69 = load i32, i32* %16
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %78
71: ; preds = %68
%72 = call i8* @strpbrk(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i8* %72, i8** %6
%73 = load i8*, i8** %6
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %6
%75 = icmp eq i8* %73, null
br i1 %75, label %76, label %77
76: ; preds = %71
br label %63
77: ; preds = %71
br label %79
78: ; preds = %68
store i8* %22, i8** %6
br label %79
79: ; preds = %78, %77
%80 = load i8*, i8** %6
%81 = call i8* @strchr(i8* %80, i8 signext 10)
store i8* %81, i8** %9
%82 = icmp ne i8* %81, null
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = load i8*, i8** %9
store i8 0, i8* %84
br label %85
85: ; preds = %83, %79
%86 = load i8*, i8** %6
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %85
br label %63
91: ; preds = %85
%92 = load i8*, i8** %6
%93 = call i64 @lstat(i8* %92, %struct.stat* %13)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %103
95: ; preds = %91
%96 = load i32, i32* %17
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = load i32, i32* @stderr
%100 = load i8*, i8** %6
%101 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %100)
br label %102
102: ; preds = %98, %95
br label %63
103: ; preds = %91
%104 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%105 = load i32, i32* %104
%106 = call i64 @S_ISDIR(i32 %105)
%107 = icmp ne i64 %106, 0
br i1 %107, label %108, label %124
108: ; preds = %103
%109 = load i32, i32* %15
%110 = icmp ne i32 %109, 0
br i1 %110, label %123, label %111
111: ; preds = %108
%112 = load i8*, i8** %6
%113 = call i64 @dir_empty(i8* %112)
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %123
115: ; preds = %111
%116 = load i32, i32* %17
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %122
118: ; preds = %115
%119 = load i32, i32* @stderr
%120 = load i8*, i8** %6
%121 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %120)
br label %122
122: ; preds = %118, %115
br label %63
123: ; preds = %111, %108
br label %124
124: ; preds = %123, %103
%125 = load i8*, i8** %6
%126 = call i8* @get_realname(i8* %125)
store i8* %126, i8** %6
%127 = load i8*, i8** %12
%128 = icmp ne i8* %127, null
br i1 %128, label %129, label %152
129: ; preds = %124
%130 = load i8*, i8** %12
%131 = load i8*, i8** %6
%132 = load i8*, i8** %12
%133 = call i32 @strlen(i8* %132)
%134 = call i32 @strncmp(i8* %130, i8* %131, i32 %133)
%135 = icmp ne i32 %134, 0
br i1 %135, label %142, label %136
136: ; preds = %129
%137 = load i8*, i8** %12
%138 = call i32 @strlen(i8* %137)
%139 = load i8*, i8** %6
%140 = sext i32 %138 to i64
%141 = getelementptr inbounds i8, i8* %139, i64 %140
store i8* %141, i8** %6
br label %151
142: ; preds = %129
%143 = load i32, i32* %17
%144 = icmp ne i32 %143, 0
br i1 %144, label %145, label %150
145: ; preds = %142
%146 = load i32, i32* @stderr
%147 = load i8*, i8** %12
%148 = load i8*, i8** %6
%149 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %147, i8* %148)
br label %150
150: ; preds = %145, %142
br label %63
151: ; preds = %136
br label %152
152: ; preds = %151, %124
%153 = load i8*, i8** %11
%154 = icmp ne i8* %153, null
br i1 %154, label %158, label %155
155: ; preds = %152
%156 = load i8*, i8** %6
%157 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %156)
br label %162
158: ; preds = %152
%159 = load i8*, i8** %11
%160 = load i8*, i8** %6
%161 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %159, i8* %160)
br label %162
162: ; preds = %158, %155
br label %63
163: ; preds = %63
store i32 0, i32* %3
store i32 1, i32* %18
br label %164
164: ; preds = %163, %56, %42
%165 = load i8*, i8** %7
%166 = load i32, i32* %3
ret i32 %166
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@FILENAME_MAX = global i32 0
@.str = [8 x i8] c"dDr:sp:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [43 x i8] c"Usage: %s [-D] [-r rootdir] [-s] [-p pkg]\0A\00"
@.str.2 = [28 x i8] c"fl_wrapper: rootdir=%s: %s\0A\00"
@errno = global i32 0
@stdin = global i32 0
@.str.3 = [3 x i8] c"\09 \00"
@.str.4 = [29 x i8] c"DEBUG: Can't stat file: %s.\0A\00"
@.str.5 = [27 x i8] c"DEBUG: Non-empty dir: %s.\0A\00"
@.str.6 = [31 x i8] c"DEBUG: Outside root (%s): %s.\0A\00"
@.str.7 = [4 x i8] c"%s\0A\00"
@.str.8 = [8 x i8] c"%s: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = load i32, i32* @FILENAME_MAX
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = alloca i8, i64 %5
%8 = bitcast %struct.stat* %3 to i8*
br label %9
9: ; preds = %30, %2
%10 = phi i8* [ %31, %30 ], [ null, %2 ]
%11 = phi i8* [ %16, %30 ], [ null, %2 ]
%12 = phi i32 [ %21, %30 ], [ 0, %2 ]
%13 = phi i32 [ %25, %30 ], [ 0, %2 ]
%14 = phi i32 [ %28, %30 ], [ 0, %2 ]
br label %15
15: ; preds = %9, %32
%16 = phi i8* [ %11, %9 ], [ %7, %32 ]
%17 = phi i32 [ %12, %9 ], [ %21, %32 ]
%18 = phi i32 [ %13, %9 ], [ %25, %32 ]
%19 = phi i32 [ %14, %9 ], [ %28, %32 ]
br label %20
20: ; preds = %27, %15
%21 = phi i32 [ %17, %15 ], [ 1, %27 ]
%22 = phi i32 [ %18, %15 ], [ %25, %27 ]
%23 = phi i32 [ %19, %15 ], [ %28, %27 ]
br label %24
24: ; preds = %27, %20
%25 = phi i32 [ %22, %20 ], [ 1, %27 ]
%26 = phi i32 [ %23, %20 ], [ %28, %27 ]
br label %27
27: ; preds = %24, %27
%28 = phi i32 [ 1, %27 ], [ %26, %24 ]
%29 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
switch i32 %29, label %36 [
i32 -1, label %40
i32 100, label %27
i32 68, label %20
i32 115, label %24
i32 112, label %30
i32 114, label %32
]
30: ; preds = %27
%31 = load i8*, i8** @optarg
br label %9
32: ; preds = %27
%33 = load i8*, i8** @optarg
%34 = call i8* @get_realname(i8* %33)
%35 = call i32 @strcpy(i8* %7, i8* %34)
br label %15
36: ; preds = %27
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %1
%39 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %38)
br label %118
40: ; preds = %27
%41 = icmp eq i8* %16, null
br i1 %41, label %50, label %42
42: ; preds = %40
%43 = call i64 @chdir(i8* %16)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = load i32, i32* @errno
%48 = call i8* @strerror(i32 %47)
%49 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %48)
br label %118
50: ; preds = %42, %40
%51 = load i32, i32* @FILENAME_MAX
%52 = load i32, i32* @stdin
%53 = call i32* @fgets(i8* %6, i32 %51, i32 %52)
%54 = icmp eq i32* %53, null
br i1 %54, label %118, label %55
55: ; preds = %50
%56 = icmp eq i32 %25, 0
%57 = icmp eq i32 %28, 0
%58 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%59 = icmp ne i32 %21, 0
%60 = icmp eq i8* %10, null
br label %61
61: ; preds = %55, %81
br i1 %56, label %66, label %62
62: ; preds = %61
%63 = call i8* @strpbrk(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = icmp eq i8* %63, null
br i1 %65, label %81, label %66
66: ; preds = %61, %62
%67 = phi i8* [ %64, %62 ], [ %6, %61 ]
%68 = call i8* @strchr(i8* %67, i8 signext 10)
%69 = icmp eq i8* %68, null
br i1 %69, label %71, label %70
70: ; preds = %66
store i8 0, i8* %68
br label %71
71: ; preds = %70, %66
%72 = load i8, i8* %67
%73 = icmp eq i8 %72, 0
br i1 %73, label %81, label %74
74: ; preds = %71
%75 = call i64 @lstat(i8* %67, %struct.stat* %3)
%76 = icmp eq i64 %75, 0
br i1 %76, label %86, label %77
77: ; preds = %74
br i1 %57, label %81, label %78
78: ; preds = %77
%79 = load i32, i32* @stderr
%80 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %67)
br label %81
81: ; preds = %114, %116, %108, %109, %94, %95, %77, %78, %62, %71
%82 = load i32, i32* @FILENAME_MAX
%83 = load i32, i32* @stdin
%84 = call i32* @fgets(i8* %6, i32 %82, i32 %83)
%85 = icmp eq i32* %84, null
br i1 %85, label %118, label %61
86: ; preds = %74
%87 = load i32, i32* %58
%88 = call i64 @S_ISDIR(i32 %87)
%89 = icmp eq i64 %88, 0
%90 = select i1 %89, i1 true, i1 %59
br i1 %90, label %98, label %91
91: ; preds = %86
%92 = call i64 @dir_empty(i8* %67)
%93 = icmp eq i64 %92, 0
br i1 %93, label %98, label %94
94: ; preds = %91
br i1 %57, label %81, label %95
95: ; preds = %94
%96 = load i32, i32* @stderr
%97 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %67)
br label %81
98: ; preds = %91, %86
%99 = call i8* @get_realname(i8* %67)
br i1 %41, label %112, label %100
100: ; preds = %98
%101 = call i32 @strlen(i8* %16)
%102 = call i32 @strncmp(i8* %16, i8* %99, i32 %101)
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %100
%105 = call i32 @strlen(i8* %16)
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %99, i64 %106
br label %112
108: ; preds = %100
br i1 %57, label %81, label %109
109: ; preds = %108
%110 = load i32, i32* @stderr
%111 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %16, i8* %99)
br label %81
112: ; preds = %104, %98
%113 = phi i8* [ %107, %104 ], [ %99, %98 ]
br i1 %60, label %114, label %116
114: ; preds = %112
%115 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %113)
br label %81
116: ; preds = %112
%117 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %10, i8* %113)
br label %81
118: ; preds = %81, %50, %45, %36
%119 = phi i32 [ 1, %36 ], [ 1, %45 ], [ 0, %50 ], [ 0, %81 ]
ret i32 %119
}