#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*/);
int /*<<< orphan*/ chdir(char *);
scalar_t__ dir_empty(char *);
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 *);
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 != NULL)
    chdir(rootdir);
  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    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dd8(%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    0xe4a(%rip),%rdx
call   1100 <getopt@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
je     1345 <main+0x165>
mov    -0x54(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x80(%rbp)
sub    $0x2f,%eax
ja     130f <main+0x12f>
mov    -0x80(%rbp),%rax
lea    0xd59(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x60(%rbp)
jmp    1340 <main+0x160>
movl   $0x1,-0x58(%rbp)
jmp    1340 <main+0x160>
movl   $0x1,-0x5c(%rbp)
jmp    1340 <main+0x160>
mov    0x2d1d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1340 <main+0x160>
mov    0x2d0a(%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    1340 <main+0x160>
mov    0x2cb2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xda2(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    1594 <main+0x3b4>
jmp    1268 <main+0x88>
cmpq   $0x0,-0x48(%rbp)
je     1359 <main+0x179>
mov    -0x48(%rbp),%rdi
call   1070 <chdir@plt>
jmp    135e <main+0x17e>
mov    -0x78(%rbp),%rdi
mov    0x2c6f(%rip),%rax
mov    (%rax),%esi
mov    0x2c6e(%rip),%rax
mov    (%rax),%edx
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     1586 <main+0x3a6>
cmpl   $0x0,-0x5c(%rbp)
je     13c4 <main+0x1e4>
mov    -0x78(%rbp),%rdi
lea    0xd5b(%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    13bf <main+0x1df>
jmp    135e <main+0x17e>
jmp    13cc <main+0x1ec>
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     13ef <main+0x20f>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1404 <main+0x224>
jmp    135e <main+0x17e>
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10b0 <lstat@plt>
cmp    $0x0,%rax
je     1445 <main+0x265>
cmpl   $0x0,-0x60(%rbp)
je     1440 <main+0x260>
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xcbd(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    135e <main+0x17e>
mov    -0x50(%rbp),%edi
call   10a0 <S_ISDIR@plt>
cmp    $0x0,%rax
je     14a3 <main+0x2c3>
cmpl   $0x0,-0x58(%rbp)
jne    149e <main+0x2be>
mov    -0x18(%rbp),%rdi
call   1050 <dir_empty@plt>
cmp    $0x0,%rax
je     149e <main+0x2be>
cmpl   $0x0,-0x60(%rbp)
je     1499 <main+0x2b9>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc81(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    135e <main+0x17e>
jmp    14a3 <main+0x2c3>
mov    -0x18(%rbp),%rdi
call   10e0 <get_realname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1549 <main+0x369>
mov    -0x48(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x48(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1516 <main+0x336>
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    1544 <main+0x364>
cmpl   $0x0,-0x60(%rbp)
je     153f <main+0x35f>
mov    0x2aa1(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xbf6(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    135e <main+0x17e>
jmp    1549 <main+0x369>
cmpq   $0x0,-0x40(%rbp)
jne    156b <main+0x38b>
mov    -0x18(%rbp),%rsi
lea    0xbf2(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1581 <main+0x3a1>
mov    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xbd3(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    135e <main+0x17e>
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    0x2ddb(%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,-0x50(%rbp)
mov    %rcx,%rsp
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
lea    0xdd6(%rip),%r15
movl   $0x0,-0x2c(%rbp)
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x30(%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     1250 <main+0x70>
cmp    $0x6f,%eax
jle    12a0 <main+0xc0>
cmp    $0x73,%eax
je     12b3 <main+0xd3>
cmp    $0x72,%eax
je     12bc <main+0xdc>
cmp    $0x70,%eax
jne    131d <main+0x13d>
mov    0x2d6f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1241 <main+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     12e4 <main+0x104>
cmp    $0x44,%eax
jne    131d <main+0x13d>
movl   $0x1,-0x2c(%rbp)
jmp    1241 <main+0x61>
movl   $0x1,-0x30(%rbp)
jmp    1241 <main+0x61>
mov    0x2d35(%rip),%rax
mov    (%rax),%rdi
call   10e0 <get_realname@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1241 <main+0x61>
mov    -0x38(%rbp),%rdi
test   %rdi,%rdi
je     12f2 <main+0x112>
call   1070 <chdir@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%esi
mov    0x2cde(%rip),%r12
mov    (%r12),%edx
mov    %r14,%rdi
call   10c0 <fgets@plt>
test   %rax,%rax
je     14cf <main+0x2ef>
lea    -0x48(%rbp),%r15
jmp    137e <main+0x19e>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xcd7(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%eax
jmp    14d1 <main+0x2f1>
mov    -0x40(%rbp),%rsi
test   %rsi,%rsi
je     14b9 <main+0x2d9>
lea    0xd37(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x2c71(%rip),%rax
mov    (%rax),%esi
mov    (%r12),%edx
mov    %r14,%rdi
call   10c0 <fgets@plt>
test   %rax,%rax
je     14cf <main+0x2ef>
mov    %r14,%rbx
cmpl   $0x0,-0x30(%rbp)
je     13a2 <main+0x1c2>
mov    %r14,%rdi
lea    0xca2(%rip),%rsi
call   10f0 <strpbrk@plt>
test   %rax,%rax
je     1360 <main+0x180>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     13b7 <main+0x1d7>
movb   $0x0,(%rax)
cmpb   $0x0,(%rbx)
je     1360 <main+0x180>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <lstat@plt>
test   %rax,%rax
je     13f0 <main+0x210>
test   %r13d,%r13d
je     1360 <main+0x180>
mov    0x2bf0(%rip),%rax
mov    (%rax),%edi
lea    0xc55(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1360 <main+0x180>
mov    -0x48(%rbp),%edi
call   10a0 <S_ISDIR@plt>
test   %rax,%rax
je     142b <main+0x24b>
cmpl   $0x0,-0x2c(%rbp)
jne    142b <main+0x24b>
mov    %rbx,%rdi
call   1050 <dir_empty@plt>
test   %rax,%rax
je     142b <main+0x24b>
test   %r13d,%r13d
je     1360 <main+0x180>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
lea    0xc2a(%rip),%rsi
jmp    13e1 <main+0x201>
mov    %rbx,%rdi
call   10e0 <get_realname@plt>
mov    %rax,%rbx
mov    -0x38(%rbp),%rdi
test   %rdi,%rdi
je     1342 <main+0x162>
mov    %r15,%r12
mov    %rdi,%r15
call   1060 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1495 <main+0x2b5>
test   %r13d,%r13d
mov    %r12,%r15
mov    0x2b74(%rip),%r12
je     1360 <main+0x180>
mov    0x2b4f(%rip),%rax
mov    (%rax),%edi
lea    0xbec(%rip),%rsi
mov    -0x38(%rbp),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1360 <main+0x180>
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
add    %rax,%rbx
mov    -0x40(%rbp),%rsi
mov    %r12,%r15
mov    0x2b30(%rip),%r12
test   %rsi,%rsi
jne    134f <main+0x16f>
lea    0xbd1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1360 <main+0x180>
xor    %eax,%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"
@stdin = global i32 0
@.str.2 = [3 x i8] c"\09 \00"
@.str.3 = [29 x i8] c"DEBUG: Can't stat file: %s.\0A\00"
@.str.4 = [27 x i8] c"DEBUG: Non-empty dir: %s.\0A\00"
@.str.5 = [31 x i8] c"DEBUG: Outside root (%s): %s.\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [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 %157
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 %55
52: ; preds = %49
%53 = load i8*, i8** %12
%54 = call i32 @chdir(i8* %53)
br label %55
55: ; preds = %52, %49
br label %56
56: ; preds = %155, %143, %115, %95, %83, %69, %55
%57 = load i32, i32* @FILENAME_MAX
%58 = load i32, i32* @stdin
%59 = call i32* @fgets(i8* %22, i32 %57, i32 %58)
%60 = icmp ne i32* %59, null
br i1 %60, label %61, label %156
61: ; preds = %56
%62 = load i32, i32* %16
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %71
64: ; preds = %61
%65 = call i8* @strpbrk(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %65, i8** %6
%66 = load i8*, i8** %6
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %6
%68 = icmp eq i8* %66, null
br i1 %68, label %69, label %70
69: ; preds = %64
br label %56
70: ; preds = %64
br label %72
71: ; preds = %61
store i8* %22, i8** %6
br label %72
72: ; preds = %71, %70
%73 = load i8*, i8** %6
%74 = call i8* @strchr(i8* %73, i8 signext 10)
store i8* %74, i8** %9
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = load i8*, i8** %9
store i8 0, i8* %77
br label %78
78: ; preds = %76, %72
%79 = load i8*, i8** %6
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %78
br label %56
84: ; preds = %78
%85 = load i8*, i8** %6
%86 = call i64 @lstat(i8* %85, %struct.stat* %13)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %96
88: ; preds = %84
%89 = load i32, i32* %17
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %88
%92 = load i32, i32* @stderr
%93 = load i8*, i8** %6
%94 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %93)
br label %95
95: ; preds = %91, %88
br label %56
96: ; preds = %84
%97 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%98 = load i32, i32* %97
%99 = call i64 @S_ISDIR(i32 %98)
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %117
101: ; preds = %96
%102 = load i32, i32* %15
%103 = icmp ne i32 %102, 0
br i1 %103, label %116, label %104
104: ; preds = %101
%105 = load i8*, i8** %6
%106 = call i64 @dir_empty(i8* %105)
%107 = icmp ne i64 %106, 0
br i1 %107, label %108, label %116
108: ; preds = %104
%109 = load i32, i32* %17
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %115
111: ; preds = %108
%112 = load i32, i32* @stderr
%113 = load i8*, i8** %6
%114 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %113)
br label %115
115: ; preds = %111, %108
br label %56
116: ; preds = %104, %101
br label %117
117: ; preds = %116, %96
%118 = load i8*, i8** %6
%119 = call i8* @get_realname(i8* %118)
store i8* %119, i8** %6
%120 = load i8*, i8** %12
%121 = icmp ne i8* %120, null
br i1 %121, label %122, label %145
122: ; preds = %117
%123 = load i8*, i8** %12
%124 = load i8*, i8** %6
%125 = load i8*, i8** %12
%126 = call i32 @strlen(i8* %125)
%127 = call i32 @strncmp(i8* %123, i8* %124, i32 %126)
%128 = icmp ne i32 %127, 0
br i1 %128, label %135, label %129
129: ; preds = %122
%130 = load i8*, i8** %12
%131 = call i32 @strlen(i8* %130)
%132 = load i8*, i8** %6
%133 = sext i32 %131 to i64
%134 = getelementptr inbounds i8, i8* %132, i64 %133
store i8* %134, i8** %6
br label %144
135: ; preds = %122
%136 = load i32, i32* %17
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %135
%139 = load i32, i32* @stderr
%140 = load i8*, i8** %12
%141 = load i8*, i8** %6
%142 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %140, i8* %141)
br label %143
143: ; preds = %138, %135
br label %56
144: ; preds = %129
br label %145
145: ; preds = %144, %117
%146 = load i8*, i8** %11
%147 = icmp ne i8* %146, null
br i1 %147, label %151, label %148
148: ; preds = %145
%149 = load i8*, i8** %6
%150 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %149)
br label %155
151: ; preds = %145
%152 = load i8*, i8** %11
%153 = load i8*, i8** %6
%154 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %152, i8* %153)
br label %155
155: ; preds = %151, %148
br label %56
156: ; preds = %56
store i32 0, i32* %3
store i32 1, i32* %18
br label %157
157: ; preds = %156, %42
%158 = load i8*, i8** %7
%159 = load i32, i32* %3
ret i32 %159
}

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"
@stdin = global i32 0
@.str.2 = [3 x i8] c"\09 \00"
@.str.3 = [29 x i8] c"DEBUG: Can't stat file: %s.\0A\00"
@.str.4 = [27 x i8] c"DEBUG: Non-empty dir: %s.\0A\00"
@.str.5 = [31 x i8] c"DEBUG: Outside root (%s): %s.\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [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 %112
40: ; preds = %27
%41 = icmp eq i8* %16, null
br i1 %41, label %44, label %42
42: ; preds = %40
%43 = call i32 @chdir(i8* %16)
br label %44
44: ; preds = %42, %40
%45 = load i32, i32* @FILENAME_MAX
%46 = load i32, i32* @stdin
%47 = call i32* @fgets(i8* %6, i32 %45, i32 %46)
%48 = icmp eq i32* %47, null
br i1 %48, label %112, label %49
49: ; preds = %44
%50 = icmp eq i32 %25, 0
%51 = icmp eq i32 %28, 0
%52 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%53 = icmp ne i32 %21, 0
%54 = icmp eq i8* %10, null
br label %55
55: ; preds = %49, %75
br i1 %50, label %60, label %56
56: ; preds = %55
%57 = call i8* @strpbrk(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = icmp eq i8* %57, null
br i1 %59, label %75, label %60
60: ; preds = %55, %56
%61 = phi i8* [ %58, %56 ], [ %6, %55 ]
%62 = call i8* @strchr(i8* %61, i8 signext 10)
%63 = icmp eq i8* %62, null
br i1 %63, label %65, label %64
64: ; preds = %60
store i8 0, i8* %62
br label %65
65: ; preds = %64, %60
%66 = load i8, i8* %61
%67 = icmp eq i8 %66, 0
br i1 %67, label %75, label %68
68: ; preds = %65
%69 = call i64 @lstat(i8* %61, %struct.stat* %3)
%70 = icmp eq i64 %69, 0
br i1 %70, label %80, label %71
71: ; preds = %68
br i1 %51, label %75, label %72
72: ; preds = %71
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %61)
br label %75
75: ; preds = %108, %110, %102, %103, %88, %89, %71, %72, %56, %65
%76 = load i32, i32* @FILENAME_MAX
%77 = load i32, i32* @stdin
%78 = call i32* @fgets(i8* %6, i32 %76, i32 %77)
%79 = icmp eq i32* %78, null
br i1 %79, label %112, label %55
80: ; preds = %68
%81 = load i32, i32* %52
%82 = call i64 @S_ISDIR(i32 %81)
%83 = icmp eq i64 %82, 0
%84 = select i1 %83, i1 true, i1 %53
br i1 %84, label %92, label %85
85: ; preds = %80
%86 = call i64 @dir_empty(i8* %61)
%87 = icmp eq i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %85
br i1 %51, label %75, label %89
89: ; preds = %88
%90 = load i32, i32* @stderr
%91 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %61)
br label %75
92: ; preds = %85, %80
%93 = call i8* @get_realname(i8* %61)
br i1 %41, label %106, label %94
94: ; preds = %92
%95 = call i32 @strlen(i8* %16)
%96 = call i32 @strncmp(i8* %16, i8* %93, i32 %95)
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %102
98: ; preds = %94
%99 = call i32 @strlen(i8* %16)
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %93, i64 %100
br label %106
102: ; preds = %94
br i1 %51, label %75, label %103
103: ; preds = %102
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %16, i8* %93)
br label %75
106: ; preds = %98, %92
%107 = phi i8* [ %101, %98 ], [ %93, %92 ]
br i1 %54, label %108, label %110
108: ; preds = %106
%109 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %107)
br label %75
110: ; preds = %106
%111 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %10, i8* %107)
br label %75
112: ; preds = %75, %44, %36
%113 = phi i32 [ 1, %36 ], [ 0, %44 ], [ 0, %75 ]
ret i32 %113
}