#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 */

/* Variables and functions */
int a_main(int, char **);
int c_main();
int e_main();
int execlp(char *, char *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ getenv(char *);
int i_main(int, char **);
scalar_t__ memcmp(char const *, char *, int);
int q_main(int, char **);
int t_main(int, char **);
int usage(char const *);
int w_main(int, char **);
int main(int ac, char **av) {
  const char *q, *s = *av;
  for (q = s; *s; s++)
    if (*s == '/')
      q = s + 1;
  if (memcmp(q, "lf.", 3))
    return usage(q);
  switch (q[3]) {
  case 'c':
    return c_main();
  case 'e':
    return e_main();
  case 'a':
    return a_main(ac, av);
  case 'i':
    return i_main(ac, av);
  case 'q':
    return q_main(ac, av);
  case 't':
    return t_main(ac, av);
  case 'w':
    return w_main(ac, av);
  case 'l':
    return execlp("less", "less", getenv("LF_LIC"), NULL);
  default:
    return usage(q);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1218 <main+0x68>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1202 <main+0x52>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1207 <main+0x57>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11d9 <main+0x29>
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
mov    $0x3,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     1248 <main+0x98>
mov    -0x18(%rbp),%rdi
call   10b0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x16,%eax
ja     1321 <main+0x171>
mov    -0x28(%rbp),%rax
lea    0xd93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <c_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    $0x0,%al
call   10c0 <e_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <a_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <i_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <q_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <t_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <w_main@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
lea    0xd66(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edx
lea    0xd53(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   10d0 <execlp@plt>
mov    %eax,-0x4(%rbp)
jmp    132d <main+0x17d>
mov    -0x18(%rbp),%rdi
call   10b0 <usage@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    (%rsi),%rbp
lea    0x1(%rbp),%rax
jmp    11d7 <main+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rbp
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x2f,%cl
je     11d0 <main+0x20>
test   %cl,%cl
jne    11d3 <main+0x23>
lea    0xe71(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
je     1209 <main+0x59>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10b0 <usage@plt>
movsbl 0x3(%rbp),%eax
add    $0xffffff9f,%eax
cmp    $0x16,%eax
ja     11fd <main+0x4d>
lea    0xde4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <a_main@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <c_main@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    10c0 <e_main@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10a0 <i_main@plt>
lea    0xe05(%rip),%rdi
call   1030 <getenv@plt>
lea    0xdf4(%rip),%rdi
mov    %rdi,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    10d0 <execlp@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1090 <q_main@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1080 <t_main@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <w_main@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"lf.\00"
@.str.1 = [5 x i8] c"less\00"
@.str.2 = [7 x i8] c"LF_LIC\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
store i8* %9, i8** %7
%10 = load i8*, i8** %7
store i8* %10, i8** %6
br label %11
11: ; preds = %24, %2
%12 = load i8*, i8** %7
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i8*, i8** %7
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 47
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 1
store i8* %22, i8** %6
br label %23
23: ; preds = %20, %15
br label %24
24: ; preds = %23
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %7
br label %11
27: ; preds = %11
%28 = load i8*, i8** %6
%29 = call i64 @memcmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i8*, i8** %6
%33 = call i32 @usage(i8* %32)
store i32 %33, i32* %3
br label %69
34: ; preds = %27
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
switch i32 %38, label %66 [
i32 99, label %39
i32 101, label %41
i32 97, label %43
i32 105, label %47
i32 113, label %51
i32 116, label %55
i32 119, label %59
i32 108, label %63
]
39: ; preds = %34
%40 = call i32 (...) @c_main()
store i32 %40, i32* %3
br label %69
41: ; preds = %34
%42 = call i32 (...) @e_main()
store i32 %42, i32* %3
br label %69
43: ; preds = %34
%44 = load i32, i32* %4
%45 = load i8**, i8*** %5
%46 = call i32 @a_main(i32 %44, i8** %45)
store i32 %46, i32* %3
br label %69
47: ; preds = %34
%48 = load i32, i32* %4
%49 = load i8**, i8*** %5
%50 = call i32 @i_main(i32 %48, i8** %49)
store i32 %50, i32* %3
br label %69
51: ; preds = %34
%52 = load i32, i32* %4
%53 = load i8**, i8*** %5
%54 = call i32 @q_main(i32 %52, i8** %53)
store i32 %54, i32* %3
br label %69
55: ; preds = %34
%56 = load i32, i32* %4
%57 = load i8**, i8*** %5
%58 = call i32 @t_main(i32 %56, i8** %57)
store i32 %58, i32* %3
br label %69
59: ; preds = %34
%60 = load i32, i32* %4
%61 = load i8**, i8*** %5
%62 = call i32 @w_main(i32 %60, i8** %61)
store i32 %62, i32* %3
br label %69
63: ; preds = %34
%64 = call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%65 = call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %64, i32* null)
store i32 %65, i32* %3
br label %69
66: ; preds = %34
%67 = load i8*, i8** %6
%68 = call i32 @usage(i8* %67)
store i32 %68, i32* %3
br label %69
69: ; preds = %66, %63, %59, %55, %51, %47, %43, %41, %39, %31
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@.str = [4 x i8] c"lf.\00"
@.str.1 = [5 x i8] c"less\00"
@.str.2 = [7 x i8] c"LF_LIC\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
br label %4
4: ; preds = %10, %2
%5 = phi i8* [ %3, %2 ], [ %11, %10 ]
%6 = phi i8* [ %3, %2 ], [ %12, %10 ]
%7 = load i8, i8* %6
switch i8 %7, label %10 [
i8 0, label %13
i8 47, label %8
]
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %6, i64 1
br label %10
10: ; preds = %4, %8
%11 = phi i8* [ %9, %8 ], [ %5, %4 ]
%12 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
13: ; preds = %4
%14 = tail call i64 @memcmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @usage(i8* %5)
br label %41
18: ; preds = %13
%19 = getelementptr inbounds i8, i8* %5, i64 3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
switch i32 %21, label %39 [
i32 99, label %22
i32 101, label %24
i32 97, label %26
i32 105, label %28
i32 113, label %30
i32 116, label %32
i32 119, label %34
i32 108, label %36
]
22: ; preds = %18
%23 = tail call i32 (...) @c_main()
br label %41
24: ; preds = %18
%25 = tail call i32 (...) @e_main()
br label %41
26: ; preds = %18
%27 = tail call i32 @a_main(i32 %0, i8** %1)
br label %41
28: ; preds = %18
%29 = tail call i32 @i_main(i32 %0, i8** %1)
br label %41
30: ; preds = %18
%31 = tail call i32 @q_main(i32 %0, i8** %1)
br label %41
32: ; preds = %18
%33 = tail call i32 @t_main(i32 %0, i8** %1)
br label %41
34: ; preds = %18
%35 = tail call i32 @w_main(i32 %0, i8** %1)
br label %41
36: ; preds = %18
%37 = tail call i32 @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%38 = tail call i32 @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32* null)
br label %41
39: ; preds = %18
%40 = tail call i32 @usage(i8* %5)
br label %41
41: ; preds = %39, %36, %34, %32, %30, %28, %26, %24, %22, %16
%42 = phi i32 [ %17, %16 ], [ %40, %39 ], [ %38, %36 ], [ %35, %34 ], [ %33, %32 ], [ %31, %30 ], [ %29, %28 ], [ %27, %26 ], [ %25, %24 ], [ %23, %22 ]
ret i32 %42
}