#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 option {
  char *member_0;
  int member_1;
  char member_3;
  int /*<<< orphan*/ *member_2;
};

/* Variables and functions */
int /*<<< orphan*/ Imp_executeFile(char *, int, char **);
int /*<<< orphan*/ Imp_index(char *, char *);
int /*<<< orphan*/ Imp_launchREPL();
int /*<<< orphan*/ Imp_printEnvironment();
int /*<<< orphan*/ Imp_printUsage();
int /*<<< orphan*/ Imp_remove(char *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ iargs(char *);
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
scalar_t__ optind;
int optopt;
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strdup(int /*<<< orphan*/);
int main(int argc, char **argv) {
  static struct option lopts[] = {
      {"index", 1, 0, 'i'},     {"unindex", 1, 0, 'u'},     {"help", 0, 0, 'h'},
      {"version", 0, 0, 'v'},   {"destination", 1, 0, 'd'}, {"root", 1, 0, 'r'},
      {"from-root", 0, 0, 'f'}, {NULL, 0, NULL, 0}};
  char *root = "/usr/local/imp";
  int c;
  opterr = 0;
  int opti = 0;
  char *opt_i = NULL;
  char *opt_u = NULL;
  bool opt_h = false;
  bool opt_v = false;
  char *opt_d = NULL;
  bool opt_f = false;
  while ((c = getopt_long(argc, argv, "i:u:hvd:r:f", lopts, &opti)) != -1) {
    switch (c) {
    case 'i':
      opt_i = strdup(optarg);
      break;
    case 'u':
      opt_u = strdup(optarg);
      break;
    case 'h':
      opt_h = true;
      break;
    case 'v':
      opt_v = true;
      break;
    case 'd':
      opt_d = strdup(optarg);
      break;
    case 'r':
      root = strdup(optarg);
      break;
    case 'f':
      opt_f = true;
      break;
    case '?':
      if (isprint(optopt)) {
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      } else {
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      }
      return 1;
    default:
      abort();
    }
  }
  argc -= optind;
  argv += optind;
  if (((opt_i ? 1 : 0) + (opt_u ? 1 : 0) + opt_h + opt_v > 1) ||
      (opt_d && !opt_i)) {
    iargs("invalid option combination");
  } else if (opt_i) {
    char *d = opt_d ? opt_d : opt_i;
    Imp_index(d, opt_i);
  } else if (opt_u) {
    Imp_remove(opt_u);
  } else if (opt_h) {
    Imp_printUsage();
  } else if (opt_v) {
    Imp_printEnvironment();
  } else if (argc == 0) {
    Imp_launchREPL();
  } else {
    if (opt_f) {
      char fp[256];
      sprintf(fp, "%s/index/%s", root, argv[0]);
      Imp_executeFile(fp, argc - 1, argv + 1);
    } else {
      Imp_executeFile(argv[0], argc - 1, argv + 1);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xf1b(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2dc5(%rip),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdx
lea    0x2e45(%rip),%rcx
lea    -0x20(%rbp),%r8
call   1050 <getopt_long@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     137f <main+0x1af>
mov    -0x1c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x158(%rbp)
sub    $0x37,%eax
ja     1373 <main+0x1a3>
mov    -0x158(%rbp),%rax
lea    0xd7a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,-0x28(%rbp)
jmp    137a <main+0x1aa>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    137a <main+0x1aa>
movl   $0x1,-0x34(%rbp)
jmp    137a <main+0x1aa>
movl   $0x1,-0x38(%rbp)
jmp    137a <main+0x1aa>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,-0x40(%rbp)
jmp    137a <main+0x1aa>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,-0x18(%rbp)
jmp    137a <main+0x1aa>
movl   $0x1,-0x44(%rbp)
jmp    137a <main+0x1aa>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
call   10b0 <isprint@plt>
cmp    $0x0,%eax
je     1349 <main+0x179>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
mov    0x2caa(%rip),%rax
mov    (%rax),%edx
lea    0xde7(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1367 <main+0x197>
mov    0x2c78(%rip),%rax
mov    (%rax),%edi
mov    0x2c87(%rip),%rax
mov    (%rax),%edx
lea    0xddb(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    152d <main+0x35d>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1236 <main+0x66>
mov    0x2c52(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2c3e(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    -0x30(%rbp),%rsi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
add    %ecx,%eax
add    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
cmp    $0x1,%eax
jg     13f4 <main+0x224>
cmpq   $0x0,-0x40(%rbp)
je     1405 <main+0x235>
cmpq   $0x0,-0x28(%rbp)
jne    1405 <main+0x235>
lea    0xd64(%rip),%rdi
call   10e0 <iargs@plt>
jmp    152d <main+0x35d>
cmpq   $0x0,-0x28(%rbp)
je     1453 <main+0x283>
cmpq   $0x0,-0x40(%rbp)
je     142b <main+0x25b>
mov    -0x40(%rbp),%rax
mov    %rax,-0x160(%rbp)
jmp    1436 <main+0x266>
mov    -0x28(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x160(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <Imp_index@plt>
jmp    1528 <main+0x358>
cmpq   $0x0,-0x30(%rbp)
je     146c <main+0x29c>
mov    -0x30(%rbp),%rdi
call   1040 <Imp_remove@plt>
jmp    1523 <main+0x353>
cmpl   $0x0,-0x34(%rbp)
je     1482 <main+0x2b2>
mov    $0x0,%al
call   1070 <Imp_printUsage@plt>
jmp    151e <main+0x34e>
cmpl   $0x0,-0x38(%rbp)
je     1498 <main+0x2c8>
mov    $0x0,%al
call   1060 <Imp_printEnvironment@plt>
jmp    1519 <main+0x349>
cmpl   $0x0,-0x8(%rbp)
jne    14ae <main+0x2de>
mov    $0x0,%al
call   10c0 <Imp_launchREPL@plt>
jmp    1514 <main+0x344>
cmpl   $0x0,-0x44(%rbp)
je     14f5 <main+0x325>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xca9(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
call   1090 <Imp_executeFile@plt>
jmp    150f <main+0x33f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
call   1090 <Imp_executeFile@plt>
jmp    1514 <main+0x344>
jmp    1519 <main+0x349>
jmp    151e <main+0x34e>
jmp    1523 <main+0x353>
jmp    1528 <main+0x358>
jmp    152d <main+0x35d>
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2dd3(%rip),%rax
movq   $0x0,(%rax)
movl   $0x0,0x14(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
lea    0xf01(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xf04(%rip),%r14
lea    0x2e73(%rip),%r12
lea    0x14(%rsp),%r13
movl   $0x0,(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r15d,%r15d
mov    %r15d,%ecx
mov    %ecx,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1050 <getopt_long@plt>
mov    $0x1,%ecx
cmp    $0x66,%eax
je     1245 <main+0x75>
lea    -0x3f(%rax),%ecx
cmp    $0x37,%ecx
ja     12f1 <main+0x121>
lea    0xd88(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,0x8(%rsp)
jmp    1242 <main+0x72>
movl   $0x1,(%rsp)
jmp    1242 <main+0x72>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,0x28(%rsp)
jmp    1242 <main+0x72>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,0x18(%rsp)
jmp    1242 <main+0x72>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
call   10f0 <strdup@plt>
mov    %rax,0x20(%rsp)
jmp    1242 <main+0x72>
movl   $0x1,0x4(%rsp)
jmp    1242 <main+0x72>
cmp    $0xffffffff,%eax
jne    1434 <main+0x264>
mov    0x28(%rsp),%rsi
cmp    $0x1,%rsi
mov    (%rsp),%edx
mov    %edx,%eax
sbb    $0xffffffff,%eax
mov    0x20(%rsp),%rdi
cmp    $0x1,%rdi
sbb    $0xffffffff,%eax
mov    0x4(%rsp),%ecx
add    %ecx,%eax
cmp    $0x1,%eax
ja     1339 <main+0x169>
mov    0x2caf(%rip),%rax
mov    (%rax),%rax
cmpq   $0x0,0x8(%rsp)
je     1396 <main+0x1c6>
test   %rsi,%rsi
jne    1396 <main+0x1c6>
lea    0xe1f(%rip),%rdi
call   10e0 <iargs@plt>
xor    %ebx,%ebx
jmp    1382 <main+0x1b2>
mov    0x2c90(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10b0 <isprint@plt>
mov    0x2c68(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
je     136f <main+0x19f>
lea    0xdb9(%rip),%rsi
jmp    1376 <main+0x1a6>
lea    0xdc7(%rip),%rsi
mov    %ebx,%edx
call   1080 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %rsi,%rsi
je     13ae <main+0x1de>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
cmove  %rsi,%rdi
call   10a0 <Imp_index@plt>
jmp    1345 <main+0x175>
test   %rdi,%rdi
je     13ba <main+0x1ea>
call   1040 <Imp_remove@plt>
jmp    1345 <main+0x175>
test   %edx,%edx
je     13c9 <main+0x1f9>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <Imp_printUsage@plt>
jmp    1382 <main+0x1b2>
test   %ecx,%ecx
je     13d8 <main+0x208>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <Imp_printEnvironment@plt>
jmp    1382 <main+0x1b2>
sub    %eax,%ebp
je     140d <main+0x23d>
lea    (%rbx,%rax,8),%rbx
test   %r15d,%r15d
je     141b <main+0x24b>
mov    (%rbx),%rcx
lea    0xd8b(%rip),%rsi
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    0x18(%rsp),%rdx
call   10d0 <sprintf@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %r14,%rdi
jmp    1425 <main+0x255>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <Imp_launchREPL@plt>
jmp    1382 <main+0x1b2>
mov    (%rbx),%rdi
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%esi
mov    %rbx,%rdx
call   1090 <Imp_executeFile@plt>
jmp    1345 <main+0x175>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i32, i8, i32* }
@main.lopts = internal global [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 105 to i32*) }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 117 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 104 to i32*) }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 118 to i32*) }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 100 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 114 to i32*) }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 102 to i32*) }, %struct.option zeroinitializer]
@.str = [6 x i8] c"index\00"
@.str.1 = [8 x i8] c"unindex\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [12 x i8] c"destination\00"
@.str.5 = [5 x i8] c"root\00"
@.str.6 = [10 x i8] c"from-root\00"
@.str.7 = [15 x i8] c"/usr/local/imp\00"
@opterr = global i64 0
@.str.8 = [12 x i8] c"i:u:hvd:r:f\00"
@optarg = global i32 0
@optopt = global i32 0
@stderr = global i32 0
@.str.9 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.10 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i64 0
@.str.11 = [27 x i8] c"invalid option combination\00"
@.str.12 = [12 x i8] c"%s/index/%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8** %6
store i64 0, i64* @opterr
store i32 0, i32* %8
store i8* null, i8** %9
store i8* null, i8** %10
store i32 0, i32* %11
store i32 0, i32* %12
store i8* null, i8** %13
store i32 0, i32* %14
br label %17
17: ; preds = %54, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt_long(i32 %18, i8** %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), %struct.option* getelementptr inbounds ([8 x %struct.option], [8 x %struct.option]* @main.lopts, i64 0, i64 0), i32* %8)
store i32 %20, i32* %7
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %55
22: ; preds = %17
%23 = load i32, i32* %7
switch i32 %23, label %52 [
i32 105, label %24
i32 117, label %27
i32 104, label %30
i32 118, label %31
i32 100, label %32
i32 114, label %35
i32 102, label %38
i32 63, label %39
]
24: ; preds = %22
%25 = load i32, i32* @optarg
%26 = call i8* @strdup(i32 %25)
store i8* %26, i8** %9
br label %54
27: ; preds = %22
%28 = load i32, i32* @optarg
%29 = call i8* @strdup(i32 %28)
store i8* %29, i8** %10
br label %54
30: ; preds = %22
store i32 1, i32* %11
br label %54
31: ; preds = %22
store i32 1, i32* %12
br label %54
32: ; preds = %22
%33 = load i32, i32* @optarg
%34 = call i8* @strdup(i32 %33)
store i8* %34, i8** %13
br label %54
35: ; preds = %22
%36 = load i32, i32* @optarg
%37 = call i8* @strdup(i32 %36)
store i8* %37, i8** %6
br label %54
38: ; preds = %22
store i32 1, i32* %14
br label %54
39: ; preds = %22
%40 = load i32, i32* @optopt
%41 = call i32 @isprint(i32 %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i32, i32* @optopt
%46 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %45)
br label %51
47: ; preds = %39
%48 = load i32, i32* @stderr
%49 = load i32, i32* @optopt
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %47, %43
store i32 1, i32* %3
br label %153
52: ; preds = %22
%53 = call i32 (...) @abort()
unreachable
54: ; preds = %38, %35, %32, %31, %30, %27, %24
br label %17
55: ; preds = %17
%56 = load i64, i64* @optind
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = sub nsw i64 %58, %56
%60 = trunc i64 %59 to i32
store i32 %60, i32* %4
%61 = load i64, i64* @optind
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 %61
store i8** %63, i8*** %5
%64 = load i8*, i8** %9
%65 = icmp ne i8* %64, null
%66 = zext i1 %65 to i64
%67 = select i1 %65, i32 1, i32 0
%68 = load i8*, i8** %10
%69 = icmp ne i8* %68, null
%70 = zext i1 %69 to i64
%71 = select i1 %69, i32 1, i32 0
%72 = add nsw i32 %67, %71
%73 = load i32, i32* %11
%74 = add nsw i32 %72, %73
%75 = load i32, i32* %12
%76 = add nsw i32 %74, %75
%77 = icmp sgt i32 %76, 1
br i1 %77, label %84, label %78
78: ; preds = %55
%79 = load i8*, i8** %13
%80 = icmp ne i8* %79, null
br i1 %80, label %81, label %86
81: ; preds = %78
%82 = load i8*, i8** %9
%83 = icmp ne i8* %82, null
br i1 %83, label %86, label %84
84: ; preds = %81, %55
%85 = call i32 @iargs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %153
86: ; preds = %81, %78
%87 = load i8*, i8** %9
%88 = icmp ne i8* %87, null
br i1 %88, label %89, label %101
89: ; preds = %86
%90 = load i8*, i8** %13
%91 = icmp ne i8* %90, null
br i1 %91, label %92, label %94
92: ; preds = %89
%93 = load i8*, i8** %13
br label %96
94: ; preds = %89
%95 = load i8*, i8** %9
br label %96
96: ; preds = %94, %92
%97 = phi i8* [ %93, %92 ], [ %95, %94 ]
store i8* %97, i8** %15
%98 = load i8*, i8** %15
%99 = load i8*, i8** %9
%100 = call i32 @Imp_index(i8* %98, i8* %99)
br label %152
101: ; preds = %86
%102 = load i8*, i8** %10
%103 = icmp ne i8* %102, null
br i1 %103, label %104, label %107
104: ; preds = %101
%105 = load i8*, i8** %10
%106 = call i32 @Imp_remove(i8* %105)
br label %151
107: ; preds = %101
%108 = load i32, i32* %11
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %107
%111 = call i32 (...) @Imp_printUsage()
br label %150
112: ; preds = %107
%113 = load i32, i32* %12
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = call i32 (...) @Imp_printEnvironment()
br label %149
117: ; preds = %112
%118 = load i32, i32* %4
%119 = icmp eq i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %117
%121 = call i32 (...) @Imp_launchREPL()
br label %148
122: ; preds = %117
%123 = load i32, i32* %14
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %138
125: ; preds = %122
%126 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%127 = load i8*, i8** %6
%128 = load i8**, i8*** %5
%129 = getelementptr inbounds i8*, i8** %128, i64 0
%130 = load i8*, i8** %129
%131 = call i32 @sprintf(i8* %126, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %127, i8* %130)
%132 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%133 = load i32, i32* %4
%134 = sub nsw i32 %133, 1
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 1
%137 = call i32 @Imp_executeFile(i8* %132, i32 %134, i8** %136)
br label %147
138: ; preds = %122
%139 = load i8**, i8*** %5
%140 = getelementptr inbounds i8*, i8** %139, i64 0
%141 = load i8*, i8** %140
%142 = load i32, i32* %4
%143 = sub nsw i32 %142, 1
%144 = load i8**, i8*** %5
%145 = getelementptr inbounds i8*, i8** %144, i64 1
%146 = call i32 @Imp_executeFile(i8* %141, i32 %143, i8** %145)
br label %147
147: ; preds = %138, %125
br label %148
148: ; preds = %147, %120
br label %149
149: ; preds = %148, %115
br label %150
150: ; preds = %149, %110
br label %151
151: ; preds = %150, %104
br label %152
152: ; preds = %151, %96
br label %153
153: ; preds = %51, %152, %84
%154 = load i32, i32* %3
ret i32 %154
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i8, i32* }
@main.lopts = internal global [8 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 105 to i32*) }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 117 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 104 to i32*) }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 118 to i32*) }, %struct.option { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 100 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 114 to i32*) }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 102 to i32*) }, %struct.option zeroinitializer]
@.str = [6 x i8] c"index\00"
@.str.1 = [8 x i8] c"unindex\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [12 x i8] c"destination\00"
@.str.5 = [5 x i8] c"root\00"
@.str.6 = [10 x i8] c"from-root\00"
@.str.7 = [15 x i8] c"/usr/local/imp\00"
@opterr = global i64 0
@.str.8 = [12 x i8] c"i:u:hvd:r:f\00"
@optarg = global i32 0
@optopt = global i32 0
@stderr = global i32 0
@.str.9 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.10 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i64 0
@.str.11 = [27 x i8] c"invalid option combination\00"
@.str.12 = [12 x i8] c"%s/index/%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
store i64 0, i64* @opterr
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %51, %2
%7 = phi i8* [ %53, %51 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), %2 ]
%8 = phi i8* [ %15, %51 ], [ null, %2 ]
%9 = phi i8* [ %22, %51 ], [ null, %2 ]
%10 = phi i32 [ %28, %51 ], [ 0, %2 ]
%11 = phi i32 [ %33, %51 ], [ 0, %2 ]
%12 = phi i8* [ %37, %51 ], [ null, %2 ]
%13 = phi i32 [ %40, %51 ], [ 0, %2 ]
br label %14
14: ; preds = %6, %42
%15 = phi i8* [ %8, %6 ], [ %44, %42 ]
%16 = phi i8* [ %9, %6 ], [ %22, %42 ]
%17 = phi i32 [ %10, %6 ], [ %28, %42 ]
%18 = phi i32 [ %11, %6 ], [ %33, %42 ]
%19 = phi i8* [ %12, %6 ], [ %37, %42 ]
%20 = phi i32 [ %13, %6 ], [ %40, %42 ]
br label %21
21: ; preds = %14, %45
%22 = phi i8* [ %16, %14 ], [ %47, %45 ]
%23 = phi i32 [ %17, %14 ], [ %28, %45 ]
%24 = phi i32 [ %18, %14 ], [ %33, %45 ]
%25 = phi i8* [ %19, %14 ], [ %37, %45 ]
%26 = phi i32 [ %20, %14 ], [ %40, %45 ]
br label %27
27: ; preds = %39, %21
%28 = phi i32 [ %23, %21 ], [ 1, %39 ]
%29 = phi i32 [ %24, %21 ], [ %33, %39 ]
%30 = phi i8* [ %25, %21 ], [ %37, %39 ]
%31 = phi i32 [ %26, %21 ], [ %40, %39 ]
br label %32
32: ; preds = %39, %27
%33 = phi i32 [ %29, %27 ], [ 1, %39 ]
%34 = phi i8* [ %30, %27 ], [ %37, %39 ]
%35 = phi i32 [ %31, %27 ], [ %40, %39 ]
br label %36
36: ; preds = %32, %48
%37 = phi i8* [ %34, %32 ], [ %50, %48 ]
%38 = phi i32 [ %35, %32 ], [ %40, %48 ]
br label %39
39: ; preds = %39, %36
%40 = phi i32 [ %38, %36 ], [ 1, %39 ]
%41 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), %struct.option* getelementptr inbounds ([8 x %struct.option], [8 x %struct.option]* @main.lopts, i64 0, i64 0), i32* %3)
switch i32 %41, label %63 [
i32 -1, label %65
i32 105, label %42
i32 117, label %45
i32 104, label %27
i32 118, label %32
i32 100, label %48
i32 114, label %51
i32 102, label %39
i32 63, label %54
]
42: ; preds = %39
%43 = load i32, i32* @optarg
%44 = call i8* @strdup(i32 %43)
br label %14
45: ; preds = %39
%46 = load i32, i32* @optarg
%47 = call i8* @strdup(i32 %46)
br label %21
48: ; preds = %39
%49 = load i32, i32* @optarg
%50 = call i8* @strdup(i32 %49)
br label %36
51: ; preds = %39
%52 = load i32, i32* @optarg
%53 = call i8* @strdup(i32 %52)
br label %6
54: ; preds = %39
%55 = load i32, i32* @optopt
%56 = call i32 @isprint(i32 %55)
%57 = icmp eq i32 %56, 0
%58 = load i32, i32* @stderr
br i1 %57, label %61, label %59
59: ; preds = %54
%60 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %55)
br label %117
61: ; preds = %54
%62 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i32 %55)
br label %117
63: ; preds = %39
%64 = call i32 (...) @abort()
unreachable
65: ; preds = %39
%66 = load i64, i64* @optind
%67 = trunc i64 %66 to i32
%68 = sub i32 %0, %67
%69 = getelementptr inbounds i8*, i8** %1, i64 %66
%70 = icmp ne i8* %15, null
%71 = zext i1 %70 to i32
%72 = icmp eq i8* %22, null
%73 = xor i1 %72, true
%74 = zext i1 %73 to i32
%75 = add nuw nsw i32 %28, %71
%76 = add nuw nsw i32 %75, %74
%77 = add nuw nsw i32 %76, %33
%78 = icmp ugt i32 %77, 1
br i1 %78, label %82, label %79
79: ; preds = %65
%80 = icmp eq i8* %37, null
%81 = select i1 %80, i1 true, i1 %70
br i1 %81, label %84, label %82
82: ; preds = %79, %65
%83 = call i32 @iargs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %117
84: ; preds = %79
br i1 %70, label %85, label %88
85: ; preds = %84
%86 = select i1 %80, i8* %15, i8* %37
%87 = call i32 @Imp_index(i8* %86, i8* %15)
br label %117
88: ; preds = %84
br i1 %72, label %91, label %89
89: ; preds = %88
%90 = call i32 @Imp_remove(i8* %22)
br label %117
91: ; preds = %88
%92 = icmp eq i32 %28, 0
br i1 %92, label %95, label %93
93: ; preds = %91
%94 = call i32 (...) @Imp_printUsage()
br label %117
95: ; preds = %91
%96 = icmp eq i32 %33, 0
br i1 %96, label %99, label %97
97: ; preds = %95
%98 = call i32 (...) @Imp_printEnvironment()
br label %117
99: ; preds = %95
%100 = icmp eq i32 %68, 0
br i1 %100, label %101, label %103
101: ; preds = %99
%102 = call i32 (...) @Imp_launchREPL()
br label %117
103: ; preds = %99
%104 = icmp eq i32 %40, 0
br i1 %104, label %112, label %105
105: ; preds = %103
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%107 = load i8*, i8** %69
%108 = call i32 @sprintf(i8* %106, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %7, i8* %107)
%109 = add nsw i32 %68, -1
%110 = getelementptr inbounds i8*, i8** %69, i64 1
%111 = call i32 @Imp_executeFile(i8* %106, i32 %109, i8** %110)
br label %117
112: ; preds = %103
%113 = load i8*, i8** %69
%114 = add nsw i32 %68, -1
%115 = getelementptr inbounds i8*, i8** %69, i64 1
%116 = call i32 @Imp_executeFile(i8* %113, i32 %114, i8** %115)
br label %117
117: ; preds = %82, %89, %97, %105, %112, %101, %93, %85, %59, %61
%118 = phi i32 [ 1, %61 ], [ 1, %59 ], [ 0, %85 ], [ 0, %93 ], [ 0, %101 ], [ 0, %112 ], [ 0, %105 ], [ 0, %97 ], [ 0, %89 ], [ 0, %82 ]
ret i32 %118
}