#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 /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ compare(char *, char *);
int /*<<< orphan*/ execvp(char *, char **);
char **malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stat(char *, struct stat *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
int main(int argc, char **argv) {
  struct stat buf;
  char **args;
  int i, len;
  char *dot, *lastarg, *start;
  lastarg = argv[argc - 1];
  dot = strrchr(lastarg, '.');
  if (dot == NULL) {
    len = strlen(lastarg);
    if (len < strlen("orbit-idl-2"))
      goto install;
    start = lastarg + len - strlen("orbit-idl-2");
    if (strcmp(start, "orbit-idl-2") != 0)
      goto install;
  } else if (dot[1] != 'h' && dot[1] != 'c' && strcmp(dot + 1, "idl") != 0)
    goto install;
  if ((argc == 4) && (strcmp(argv[1], "-c") == 0) &&
      (strcmp(argv[2], "-d") != 0) && !stat(argv[3], &buf) &&
      !S_ISDIR(buf.st_mode))
    compare(argv[2], argv[3]);
  else if ((argc == 3) && (strcmp(argv[1], "-d") != 0) &&
           !stat(argv[2], &buf) && !S_ISDIR(buf.st_mode))
    compare(argv[1], argv[2]);
  else if ((argc == 6) && (strcmp(argv[1], "-c") == 0) &&
           (strcmp(argv[2], "-m") == 0) && !stat(argv[5], &buf) &&
           !S_ISDIR(buf.st_mode))
    compare(argv[4], argv[5]);
  else if ((argc == 5) && (strcmp(argv[1], "-m") == 0) &&
           !stat(argv[4], &buf) && !S_ISDIR(buf.st_mode))
    compare(argv[3], argv[4]);
install:
  args = malloc(sizeof(char *) * (argc + 1));
  args[0] = "install";
  for (i = 1; i < argc; i++)
    args[i] = argv[i];
  args[argc] = NULL;
  execvp(args[0], args);
  perror("executing 'install' failed");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    125c <main+0xcc>
mov    -0x38(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    0xe0f(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    1208 <main+0x78>
jmp    14a5 <main+0x315>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
lea    0xde2(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xdbd(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1257 <main+0xc7>
jmp    14a5 <main+0x315>
jmp    12a6 <main+0x116>
mov    -0x30(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x68,%eax
je     12a1 <main+0x111>
mov    -0x30(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x63,%eax
je     12a1 <main+0x111>
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
lea    0xd7f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12a1 <main+0x111>
jmp    14a5 <main+0x315>
jmp    12a6 <main+0x116>
cmpl   $0x4,-0x8(%rbp)
jne    1331 <main+0x1a1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd51(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1331 <main+0x1a1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1331 <main+0x1a1>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
jne    1331 <main+0x1a1>
mov    -0x18(%rbp),%edi
call   1040 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1331 <main+0x1a1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   10b0 <compare@plt>
jmp    14a0 <main+0x310>
cmpl   $0x3,-0x8(%rbp)
jne    139e <main+0x20e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcc9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     139e <main+0x20e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
jne    139e <main+0x20e>
mov    -0x18(%rbp),%edi
call   1040 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    139e <main+0x20e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   10b0 <compare@plt>
jmp    149b <main+0x30b>
cmpl   $0x6,-0x8(%rbp)
jne    1429 <main+0x299>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc59(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1429 <main+0x299>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xc41(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1429 <main+0x299>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
jne    1429 <main+0x299>
mov    -0x18(%rbp),%edi
call   1040 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1429 <main+0x299>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rsi
call   10b0 <compare@plt>
jmp    1496 <main+0x306>
cmpl   $0x5,-0x8(%rbp)
jne    1491 <main+0x301>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xbd4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1491 <main+0x301>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%eax
jne    1491 <main+0x301>
mov    -0x18(%rbp),%edi
call   1040 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1491 <main+0x301>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   10b0 <compare@plt>
jmp    1496 <main+0x306>
jmp    149b <main+0x30b>
jmp    14a0 <main+0x310>
jmp    14a5 <main+0x315>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
lea    0xb52(%rip),%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1503 <main+0x373>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14d1 <main+0x341>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <execvp@plt>
lea    0xaf7(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
lea    -0x1(%r15),%r12d
movslq %r12d,%rax
mov    (%rsi,%rax,8),%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
jne    120f <main+0x6f>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe30(%rip),%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jl     13a6 <main+0x206>
movslq %ebp,%rax
add    %rax,%rbx
lea    0xe16(%rip),%rbp
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
sub    %rax,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
jmp    122a <main+0x8a>
mov    0x1(%rax),%cl
cmp    $0x63,%cl
je     1238 <main+0x98>
cmp    $0x68,%cl
je     1238 <main+0x98>
add    $0x1,%rax
lea    0xdf5(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    13a6 <main+0x206>
lea    -0x3(%r15),%eax
cmp    $0x3,%eax
ja     13a6 <main+0x206>
lea    0xdb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x8(%r14),%rdi
lea    0xdc3(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13a6 <main+0x206>
mov    0x10(%r14),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
mov    0x8(%rsp),%edi
call   1040 <S_ISDIR@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
lea    0x8(%r14),%rcx
lea    0x10(%r14),%rax
jmp    139b <main+0x1fb>
mov    0x8(%r14),%rdi
lea    0xd79(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    13a6 <main+0x206>
mov    0x20(%r14),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
mov    0x8(%rsp),%edi
call   1040 <S_ISDIR@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
lea    0x20(%r14),%rax
lea    0x18(%r14),%rcx
jmp    139b <main+0x1fb>
mov    0x8(%r14),%rdi
lea    0xd26(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    13a6 <main+0x206>
mov    0x10(%r14),%rdi
lea    0xd13(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    13a6 <main+0x206>
mov    0x28(%r14),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
mov    0x8(%rsp),%edi
call   1040 <S_ISDIR@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
lea    0x28(%r14),%rax
lea    0x20(%r14),%rcx
jmp    139b <main+0x1fb>
mov    0x8(%r14),%rdi
lea    0xccb(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    13a6 <main+0x206>
mov    0x10(%r14),%rdi
lea    0xcb9(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13a6 <main+0x206>
mov    0x18(%r14),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
mov    0x8(%rsp),%edi
call   1040 <S_ISDIR@plt>
test   %eax,%eax
jne    13a6 <main+0x206>
lea    0x10(%r14),%rcx
lea    0x18(%r14),%rax
mov    (%rcx),%rdi
mov    (%rax),%rsi
call   10c0 <compare@plt>
lea    0x8(,%r15,8),%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0xc6c(%rip),%rax
mov    %rax,(%rbx)
cmp    $0x2,%r15d
jl     13e0 <main+0x240>
mov    %rbx,%rdi
add    $0x8,%rdi
add    $0x8,%r14
mov    %r12d,%edx
shl    $0x3,%rdx
mov    %r14,%rsi
call   1080 <memcpy@plt>
movslq %r15d,%rax
movq   $0x0,(%rbx,%rax,8)
mov    (%rbx),%rdi
mov    %rbx,%rsi
call   10b0 <execvp@plt>
lea    0xc34(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [12 x i8] c"orbit-idl-2\00"
@.str.1 = [4 x i8] c"idl\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [3 x i8] c"-m\00"
@.str.5 = [8 x i8] c"install\00"
@.str.6 = [27 x i8] c"executing 'install' failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %13, i64 %16
%18 = load i8*, i8** %17
store i8* %18, i8** %11
%19 = load i8*, i8** %11
%20 = call i8* @strrchr(i8* %19, i8 signext 46)
store i8* %20, i8** %10
%21 = load i8*, i8** %10
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %44
23: ; preds = %2
%24 = load i8*, i8** %11
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %9
%26 = load i32, i32* %9
%27 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %23
br label %191
30: ; preds = %23
%31 = load i8*, i8** %11
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%36 = sext i32 %35 to i64
%37 = sub i64 0, %36
%38 = getelementptr inbounds i8, i8* %34, i64 %37
store i8* %38, i8** %12
%39 = load i8*, i8** %12
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %30
br label %191
43: ; preds = %30
br label %63
44: ; preds = %2
%45 = load i8*, i8** %10
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 104
br i1 %49, label %50, label %62
50: ; preds = %44
%51 = load i8*, i8** %10
%52 = getelementptr inbounds i8, i8* %51, i64 1
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 99
br i1 %55, label %56, label %62
56: ; preds = %50
%57 = load i8*, i8** %10
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %56
br label %191
62: ; preds = %56, %50, %44
br label %63
63: ; preds = %62, %43
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 4
br i1 %65, label %66, label %97
66: ; preds = %63
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %97
72: ; preds = %66
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 2
%75 = load i8*, i8** %74
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %97
78: ; preds = %72
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 3
%81 = load i8*, i8** %80
%82 = call i32 @stat(i8* %81, %struct.stat* %6)
%83 = icmp ne i32 %82, 0
br i1 %83, label %97, label %84
84: ; preds = %78
%85 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%86 = load i32, i32* %85
%87 = call i32 @S_ISDIR(i32 %86)
%88 = icmp ne i32 %87, 0
br i1 %88, label %97, label %89
89: ; preds = %84
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 2
%92 = load i8*, i8** %91
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 3
%95 = load i8*, i8** %94
%96 = call i32 @compare(i8* %92, i8* %95)
br label %190
97: ; preds = %84, %78, %72, %66, %63
%98 = load i32, i32* %4
%99 = icmp eq i32 %98, 3
br i1 %99, label %100, label %125
100: ; preds = %97
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 1
%103 = load i8*, i8** %102
%104 = call i64 @strcmp(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %125
106: ; preds = %100
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
%110 = call i32 @stat(i8* %109, %struct.stat* %6)
%111 = icmp ne i32 %110, 0
br i1 %111, label %125, label %112
112: ; preds = %106
%113 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @S_ISDIR(i32 %114)
%116 = icmp ne i32 %115, 0
br i1 %116, label %125, label %117
117: ; preds = %112
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 1
%120 = load i8*, i8** %119
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 2
%123 = load i8*, i8** %122
%124 = call i32 @compare(i8* %120, i8* %123)
br label %189
125: ; preds = %112, %106, %100, %97
%126 = load i32, i32* %4
%127 = icmp eq i32 %126, 6
br i1 %127, label %128, label %159
128: ; preds = %125
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = call i64 @strcmp(i8* %131, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %159
134: ; preds = %128
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 2
%137 = load i8*, i8** %136
%138 = call i64 @strcmp(i8* %137, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%139 = icmp eq i64 %138, 0
br i1 %139, label %140, label %159
140: ; preds = %134
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 5
%143 = load i8*, i8** %142
%144 = call i32 @stat(i8* %143, %struct.stat* %6)
%145 = icmp ne i32 %144, 0
br i1 %145, label %159, label %146
146: ; preds = %140
%147 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%148 = load i32, i32* %147
%149 = call i32 @S_ISDIR(i32 %148)
%150 = icmp ne i32 %149, 0
br i1 %150, label %159, label %151
151: ; preds = %146
%152 = load i8**, i8*** %5
%153 = getelementptr inbounds i8*, i8** %152, i64 4
%154 = load i8*, i8** %153
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 5
%157 = load i8*, i8** %156
%158 = call i32 @compare(i8* %154, i8* %157)
br label %188
159: ; preds = %146, %140, %134, %128, %125
%160 = load i32, i32* %4
%161 = icmp eq i32 %160, 5
br i1 %161, label %162, label %187
162: ; preds = %159
%163 = load i8**, i8*** %5
%164 = getelementptr inbounds i8*, i8** %163, i64 1
%165 = load i8*, i8** %164
%166 = call i64 @strcmp(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%167 = icmp eq i64 %166, 0
br i1 %167, label %168, label %187
168: ; preds = %162
%169 = load i8**, i8*** %5
%170 = getelementptr inbounds i8*, i8** %169, i64 4
%171 = load i8*, i8** %170
%172 = call i32 @stat(i8* %171, %struct.stat* %6)
%173 = icmp ne i32 %172, 0
br i1 %173, label %187, label %174
174: ; preds = %168
%175 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%176 = load i32, i32* %175
%177 = call i32 @S_ISDIR(i32 %176)
%178 = icmp ne i32 %177, 0
br i1 %178, label %187, label %179
179: ; preds = %174
%180 = load i8**, i8*** %5
%181 = getelementptr inbounds i8*, i8** %180, i64 3
%182 = load i8*, i8** %181
%183 = load i8**, i8*** %5
%184 = getelementptr inbounds i8*, i8** %183, i64 4
%185 = load i8*, i8** %184
%186 = call i32 @compare(i8* %182, i8* %185)
br label %187
187: ; preds = %179, %174, %168, %162, %159
br label %188
188: ; preds = %187, %151
br label %189
189: ; preds = %188, %117
br label %190
190: ; preds = %189, %89
br label %191
191: ; preds = %190, %61, %42, %29
%192 = load i32, i32* %4
%193 = add nsw i32 %192, 1
%194 = sext i32 %193 to i64
%195 = mul i64 8, %194
%196 = trunc i64 %195 to i32
%197 = call i8** @malloc(i32 %196)
store i8** %197, i8*** %7
%198 = load i8**, i8*** %7
%199 = getelementptr inbounds i8*, i8** %198, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %199
store i32 1, i32* %8
br label %200
200: ; preds = %214, %191
%201 = load i32, i32* %8
%202 = load i32, i32* %4
%203 = icmp slt i32 %201, %202
br i1 %203, label %204, label %217
204: ; preds = %200
%205 = load i8**, i8*** %5
%206 = load i32, i32* %8
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i8*, i8** %205, i64 %207
%209 = load i8*, i8** %208
%210 = load i8**, i8*** %7
%211 = load i32, i32* %8
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8*, i8** %210, i64 %212
store i8* %209, i8** %213
br label %214
214: ; preds = %204
%215 = load i32, i32* %8
%216 = add nsw i32 %215, 1
store i32 %216, i32* %8
br label %200
217: ; preds = %200
%218 = load i8**, i8*** %7
%219 = load i32, i32* %4
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds i8*, i8** %218, i64 %220
store i8* null, i8** %221
%222 = load i8**, i8*** %7
%223 = getelementptr inbounds i8*, i8** %222, i64 0
%224 = load i8*, i8** %223
%225 = load i8**, i8*** %7
%226 = call i32 @execvp(i8* %224, i8** %225)
%227 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [12 x i8] c"orbit-idl-2\00"
@.str.1 = [4 x i8] c"idl\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [3 x i8] c"-d\00"
@.str.4 = [3 x i8] c"-m\00"
@.str.5 = [8 x i8] c"install\00"
@.str.6 = [27 x i8] c"executing 'install' failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = add i32 %0, -1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i8* @strrchr(i8* dereferenceable(1) %8, i8 signext 46)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %24
11: ; preds = %2
%12 = tail call i32 @strlen(i8* %8)
%13 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = icmp slt i32 %12, %13
br i1 %14, label %111, label %15
15: ; preds = %11
%16 = sext i32 %12 to i64
%17 = getelementptr inbounds i8, i8* %8, i64 %16
%18 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%19 = sext i32 %18 to i64
%20 = sub nsw i64 0, %19
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %30, label %111
24: ; preds = %2
%25 = getelementptr inbounds i8, i8* %9, i64 1
%26 = load i8, i8* %25
switch i8 %26, label %27 [
i8 104, label %30
i8 99, label %30
]
27: ; preds = %24
%28 = tail call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %111
30: ; preds = %24, %24, %27, %15
switch i32 %0, label %111 [
i32 4, label %31
i32 3, label %51
i32 6, label %66
i32 5, label %88
]
31: ; preds = %30
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = load i8*, i8** %32
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %111
36: ; preds = %31
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = tail call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %111, label %41
41: ; preds = %36
%42 = getelementptr inbounds i8*, i8** %1, i64 3
%43 = load i8*, i8** %42
%44 = call i32 @stat(i8* %43, %struct.stat* %3)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %111
46: ; preds = %41
%47 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%48 = load i32, i32* %47
%49 = tail call i32 @S_ISDIR(i32 %48)
%50 = icmp eq i32 %49, 0
br i1 %50, label %105, label %111
51: ; preds = %30
%52 = getelementptr inbounds i8*, i8** %1, i64 1
%53 = load i8*, i8** %52
%54 = tail call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %111, label %56
56: ; preds = %51
%57 = getelementptr inbounds i8*, i8** %1, i64 2
%58 = load i8*, i8** %57
%59 = call i32 @stat(i8* %58, %struct.stat* %3)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %111
61: ; preds = %56
%62 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%63 = load i32, i32* %62
%64 = tail call i32 @S_ISDIR(i32 %63)
%65 = icmp eq i32 %64, 0
br i1 %65, label %105, label %111
66: ; preds = %30
%67 = getelementptr inbounds i8*, i8** %1, i64 1
%68 = load i8*, i8** %67
%69 = tail call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %111
71: ; preds = %66
%72 = getelementptr inbounds i8*, i8** %1, i64 2
%73 = load i8*, i8** %72
%74 = tail call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %111
76: ; preds = %71
%77 = getelementptr inbounds i8*, i8** %1, i64 5
%78 = load i8*, i8** %77
%79 = call i32 @stat(i8* %78, %struct.stat* %3)
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %111
81: ; preds = %76
%82 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%83 = load i32, i32* %82
%84 = tail call i32 @S_ISDIR(i32 %83)
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %111
86: ; preds = %81
%87 = getelementptr inbounds i8*, i8** %1, i64 4
br label %105
88: ; preds = %30
%89 = getelementptr inbounds i8*, i8** %1, i64 1
%90 = load i8*, i8** %89
%91 = tail call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %111
93: ; preds = %88
%94 = getelementptr inbounds i8*, i8** %1, i64 4
%95 = load i8*, i8** %94
%96 = call i32 @stat(i8* %95, %struct.stat* %3)
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %111
98: ; preds = %93
%99 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%100 = load i32, i32* %99
%101 = tail call i32 @S_ISDIR(i32 %100)
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %111
103: ; preds = %98
%104 = getelementptr inbounds i8*, i8** %1, i64 3
br label %105
105: ; preds = %61, %46, %103, %86
%106 = phi i8** [ %87, %86 ], [ %104, %103 ], [ %37, %46 ], [ %52, %61 ]
%107 = phi i8** [ %77, %86 ], [ %94, %103 ], [ %42, %46 ], [ %57, %61 ]
%108 = load i8*, i8** %106
%109 = load i8*, i8** %107
%110 = tail call i32 @compare(i8* %108, i8* %109)
br label %111
111: ; preds = %105, %66, %71, %76, %81, %51, %56, %61, %31, %36, %41, %46, %30, %98, %93, %88, %27, %15, %11
%112 = shl i32 %0, 3
%113 = add i32 %112, 8
%114 = tail call i8** @malloc(i32 %113)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %114
%115 = icmp sgt i32 %0, 1
br i1 %115, label %116, label %123
116: ; preds = %111
%117 = getelementptr i8*, i8** %114, i64 1
%118 = bitcast i8** %117 to i8*
%119 = getelementptr i8*, i8** %1, i64 1
%120 = bitcast i8** %119 to i8*
%121 = zext i32 %5 to i64
%122 = shl nuw nsw i64 %121, 3
br label %123
123: ; preds = %116, %111
%124 = sext i32 %0 to i64
%125 = getelementptr inbounds i8*, i8** %114, i64 %124
store i8* null, i8** %125
%126 = load i8*, i8** %114
%127 = tail call i32 @execvp(i8* %126, i8** %114)
%128 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
ret i32 1
}