#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 enum_children(int, char **);
int extract_item(int, char **);
int stat_item(int, char **);
char tolower(char);
int usage();
int main(int argc, char **argv) {
  if (argc < 2)
    return usage();
  if ((argv[1][0] == '-' || argv[1][0] == '/') && argv[1][1] && !argv[1][2]) {
    char letter = tolower(argv[1][1]);
    switch (letter) {
    case 'l':
      return enum_children(argc, argv);
    case 't':
      return stat_item(argc, argv);
    case 'b':
      return extract_item(argc, argv);
    default:
      return usage();
    }
  } else
    return usage();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117f <main+0x2f>
mov    $0x0,%al
call   1040 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    126e <main+0x11e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     11a7 <main+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1264 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1264 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmpb   $0x0,0x2(%rax)
jne    1264 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%edi
call   1030 <tolower@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x62,%eax
je     1241 <main+0xf1>
jmp    11f7 <main+0xa7>
mov    -0x18(%rbp),%eax
sub    $0x6c,%eax
je     1219 <main+0xc9>
jmp    1208 <main+0xb8>
mov    -0x18(%rbp),%eax
sub    $0x74,%eax
je     122d <main+0xdd>
jmp    1255 <main+0x105>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <enum_children@plt>
mov    %eax,-0x4(%rbp)
jmp    126e <main+0x11e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <stat_item@plt>
mov    %eax,-0x4(%rbp)
jmp    126e <main+0x11e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <extract_item@plt>
mov    %eax,-0x4(%rbp)
jmp    126e <main+0x11e>
mov    $0x0,%al
call   1040 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    126e <main+0x11e>
mov    $0x0,%al
call   1040 <usage@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    1176 <main+0x26>
mov    %rsi,%rbx
mov    0x8(%rsi),%rax
mov    (%rax),%cl
or     $0x2,%cl
cmp    $0x2f,%cl
jne    1176 <main+0x26>
mov    0x1(%rax),%cl
test   %cl,%cl
je     1176 <main+0x26>
cmpb   $0x0,0x2(%rax)
je     1183 <main+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <usage@plt>
mov    %edi,%ebp
movsbl %cl,%edi
call   1030 <tolower@plt>
movsbl %al,%eax
cmp    $0x62,%eax
je     11af <main+0x5f>
cmp    $0x74,%eax
je     11bf <main+0x6f>
cmp    $0x6c,%eax
jne    1176 <main+0x26>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <enum_children@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <extract_item@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <stat_item@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @usage()
store i32 %10, i32* %3
br label %67
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 45
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 47
br i1 %26, label %27, label %65
27: ; preds = %19, %11
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %65
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 2
%40 = load i8, i8* %39
%41 = icmp ne i8 %40, 0
br i1 %41, label %65, label %42
42: ; preds = %35
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = call signext i8 @tolower(i8 signext %47)
store i8 %48, i8* %6
%49 = load i8, i8* %6
%50 = sext i8 %49 to i32
switch i32 %50, label %63 [
i32 108, label %51
i32 116, label %55
i32 98, label %59
]
51: ; preds = %42
%52 = load i32, i32* %4
%53 = load i8**, i8*** %5
%54 = call i32 @enum_children(i32 %52, i8** %53)
store i32 %54, i32* %3
br label %67
55: ; preds = %42
%56 = load i32, i32* %4
%57 = load i8**, i8*** %5
%58 = call i32 @stat_item(i32 %56, i8** %57)
store i32 %58, i32* %3
br label %67
59: ; preds = %42
%60 = load i32, i32* %4
%61 = load i8**, i8*** %5
%62 = call i32 @extract_item(i32 %60, i8** %61)
store i32 %62, i32* %3
br label %67
63: ; preds = %42
%64 = call i32 (...) @usage()
store i32 %64, i32* %3
br label %67
65: ; preds = %35, %27, %19
%66 = call i32 (...) @usage()
store i32 %66, i32* %3
br label %67
67: ; preds = %65, %63, %59, %55, %51, %9
%68 = load i32, i32* %3
ret i32 %68
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %31
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
switch i8 %9, label %29 [
i8 45, label %10
i8 47, label %10
]
10: ; preds = %6, %6
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %8, i64 2
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = tail call signext i8 @tolower(i8 signext %12)
%20 = sext i8 %19 to i32
switch i32 %20, label %27 [
i32 108, label %21
i32 116, label %23
i32 98, label %25
]
21: ; preds = %18
%22 = tail call i32 @enum_children(i32 %0, i8** %1)
br label %31
23: ; preds = %18
%24 = tail call i32 @stat_item(i32 %0, i8** %1)
br label %31
25: ; preds = %18
%26 = tail call i32 @extract_item(i32 %0, i8** %1)
br label %31
27: ; preds = %18
%28 = tail call i32 (...) @usage()
br label %31
29: ; preds = %6, %14, %10
%30 = tail call i32 (...) @usage()
br label %31
31: ; preds = %21, %23, %25, %27, %29, %4
%32 = phi i32 [ %5, %4 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ]
ret i32 %32
}