#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 /*<<< orphan*/ dump();
int /*<<< orphan*/ get();
int /*<<< orphan*/ init(char *);
int /*<<< orphan*/ length();
int /*<<< orphan*/ put(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  switch (argc) {
  case 2:
    if (!strcmp(argv[1], "get"))
      get();
    else if (!strcmp(argv[1], "length"))
      length();
    else if (!strcmp(argv[1], "dump"))
      dump();
    else
      usage(argv[0]);
    break;
  case 3:
    if (!strcmp(argv[1], "init"))
      init(argv[2]);
    else if (!strcmp(argv[1], "put"))
      put(argv[2]);
    else
      usage(argv[0]);
    break;
  default:
    usage(argv[0]);
  }
}


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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2,%eax
je     11ab <main+0x3b>
jmp    119a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1241 <main+0xd1>
jmp    12b5 <main+0x145>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe46(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11d4 <main+0x64>
mov    $0x0,%al
call   1080 <get@plt>
jmp    123c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe21(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11fd <main+0x8d>
mov    $0x0,%al
call   1030 <length@plt>
jmp    1237 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdff(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1226 <main+0xb6>
mov    $0x0,%al
call   1050 <dump@plt>
jmp    1232 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
jmp    1237 <main+0xc7>
jmp    123c <main+0xcc>
jmp    12c1 <main+0x151>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1270 <main+0x100>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <init@plt>
jmp    12b0 <main+0x140>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd96(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    129f <main+0x12f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <put@plt>
jmp    12ab <main+0x13b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
jmp    12b0 <main+0x140>
jmp    12c1 <main+0x151>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     11c7 <main+0x57>
cmp    $0x2,%edi
jne    11f1 <main+0x81>
mov    0x8(%rbx),%r14
lea    0xe74(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1203 <main+0x93>
lea    0xe65(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1217 <main+0xa7>
lea    0xe59(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    11f1 <main+0x81>
xor    %eax,%eax
call   1050 <dump@plt>
jmp    11f9 <main+0x89>
mov    0x8(%rbx),%r14
lea    0xe3e(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     120c <main+0x9c>
lea    0xe30(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1220 <main+0xb0>
mov    (%rbx),%rdi
call   1090 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1080 <get@plt>
jmp    11f9 <main+0x89>
mov    0x10(%rbx),%rdi
call   1070 <init@plt>
jmp    11f9 <main+0x89>
xor    %eax,%eax
call   1030 <length@plt>
jmp    11f9 <main+0x89>
mov    0x10(%rbx),%rdi
call   1040 <put@plt>
jmp    11f9 <main+0x89>

LLVM IR (-O0):
@.str = [4 x i8] c"get\00"
@.str.1 = [7 x i8] c"length\00"
@.str.2 = [5 x i8] c"dump\00"
@.str.3 = [5 x i8] c"init\00"
@.str.4 = [4 x i8] c"put\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
switch i32 %6, label %68 [
i32 2, label %7
i32 3, label %39
]
7: ; preds = %2
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %7
%14 = call i32 (...) @get()
br label %38
15: ; preds = %7
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %15
%22 = call i32 (...) @length()
br label %37
23: ; preds = %15
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %23
%30 = call i32 (...) @dump()
br label %36
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @usage(i8* %34)
br label %36
36: ; preds = %31, %29
br label %37
37: ; preds = %36, %21
br label %38
38: ; preds = %37, %13
br label %73
39: ; preds = %2
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%44 = icmp ne i32 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %39
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @init(i8* %48)
br label %67
50: ; preds = %39
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @strcmp(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %61, label %56
56: ; preds = %50
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = call i32 @put(i8* %59)
br label %66
61: ; preds = %50
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 0
%64 = load i8*, i8** %63
%65 = call i32 @usage(i8* %64)
br label %66
66: ; preds = %61, %56
br label %67
67: ; preds = %66, %45
br label %73
68: ; preds = %2
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 0
%71 = load i8*, i8** %70
%72 = call i32 @usage(i8* %71)
br label %73
73: ; preds = %68, %67, %38
%74 = load i32, i32* %3
ret i32 %74
}

LLVM IR (-O2):
@.str = [4 x i8] c"get\00"
@.str.1 = [7 x i8] c"length\00"
@.str.2 = [5 x i8] c"dump\00"
@.str.3 = [5 x i8] c"init\00"
@.str.4 = [4 x i8] c"put\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %42 [
i32 2, label %3
i32 3, label %23
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 (...) @get()
br label %45
10: ; preds = %3
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (...) @length()
br label %45
15: ; preds = %10
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 (...) @dump()
br label %45
20: ; preds = %15
%21 = load i8*, i8** %1
%22 = tail call i32 @usage(i8* %21)
br label %45
23: ; preds = %2
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = tail call i32 @strcmp(i8* dereferenceable(1) %25, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32 @init(i8* %30)
br label %45
32: ; preds = %23
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %25, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = tail call i32 @put(i8* %37)
br label %45
39: ; preds = %32
%40 = load i8*, i8** %1
%41 = tail call i32 @usage(i8* %40)
br label %45
42: ; preds = %2
%43 = load i8*, i8** %1
%44 = tail call i32 @usage(i8* %43)
br label %45
45: ; preds = %28, %39, %35, %8, %18, %20, %13, %42
ret i32 0
}