#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_data(char *, char **);
int /*<<< orphan*/ get_data(char *, char **);
int /*<<< orphan*/ mw_create(char *, char **, int);
int /*<<< orphan*/ print_stats(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ update_meta(char *, char **);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char *cmd;
  char *fname;
  if (argc < 3) {
    usage();
    return 0;
  }
  argv++;
  cmd = *(argv++);
  fname = *(argv++);
  switch (*cmd) {
  case 'c':
    if (mw_create(fname, argv, argc)) {
      usage();
    }
    break;
  case 's':
    print_stats(fname);
    break;
  case 'f':
    get_data(fname, argv);
    break;
  case 'd':
    dump_data(fname, argv);
    break;
  case 'u':
    update_meta(fname, argv);
    break;
  default:
    printf("Error: Unrecognized command: %s\n", cmd);
  }
  return 0;
}


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)
cmpl   $0x3,-0x8(%rbp)
jge    11a3 <main+0x33>
mov    $0x0,%al
call   1070 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1288 <main+0x118>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x12,%eax
ja     1271 <main+0x101>
mov    -0x28(%rbp),%rax
lea    0xe01(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1030 <mw_create@plt>
cmp    $0x0,%eax
je     1228 <main+0xb8>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    1281 <main+0x111>
mov    -0x20(%rbp),%rdi
call   1040 <print_stats@plt>
jmp    1281 <main+0x111>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <get_data@plt>
jmp    1281 <main+0x111>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dump_data@plt>
jmp    1281 <main+0x111>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <update_meta@plt>
jmp    1281 <main+0x111>
mov    -0x18(%rbp),%rsi
lea    0xdd0(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jg     1181 <main+0x11>
xor    %eax,%eax
call   1070 <usage@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x8(%rsi),%r8
movsbl (%r8),%ecx
add    $0xffffff9d,%ecx
cmp    $0x12,%ecx
ja     11bd <main+0x4d>
mov    %edi,%edx
mov    0x10(%rsi),%rdi
add    $0x18,%rsi
lea    0xe5e(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
call   1030 <mw_create@plt>
test   %eax,%eax
jne    1176 <main+0x6>
jmp    117d <main+0xd>
call   1060 <dump_data@plt>
jmp    117d <main+0xd>
lea    0xe88(%rip),%rdi
mov    %r8,%rsi
call   1050 <printf@plt>
jmp    117d <main+0xd>
call   1080 <get_data@plt>
jmp    117d <main+0xd>
call   1040 <print_stats@plt>
jmp    117d <main+0xd>
call   1090 <update_meta@plt>
jmp    117d <main+0xd>

LLVM IR (-O0):
@.str = [33 x i8] c"Error: Unrecognized command: %s\0A\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 i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @usage()
store i32 0, i32* %3
br label %52
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %5
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i8*, i8** %15
store i8* %17, i8** %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %5
%20 = load i8*, i8** %18
store i8* %20, i8** %7
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
switch i32 %23, label %48 [
i32 99, label %24
i32 115, label %33
i32 102, label %36
i32 100, label %40
i32 117, label %44
]
24: ; preds = %12
%25 = load i8*, i8** %7
%26 = load i8**, i8*** %5
%27 = load i32, i32* %4
%28 = call i32 @mw_create(i8* %25, i8** %26, i32 %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 (...) @usage()
br label %32
32: ; preds = %30, %24
br label %51
33: ; preds = %12
%34 = load i8*, i8** %7
%35 = call i32 @print_stats(i8* %34)
br label %51
36: ; preds = %12
%37 = load i8*, i8** %7
%38 = load i8**, i8*** %5
%39 = call i32 @get_data(i8* %37, i8** %38)
br label %51
40: ; preds = %12
%41 = load i8*, i8** %7
%42 = load i8**, i8*** %5
%43 = call i32 @dump_data(i8* %41, i8** %42)
br label %51
44: ; preds = %12
%45 = load i8*, i8** %7
%46 = load i8**, i8*** %5
%47 = call i32 @update_meta(i8* %45, i8** %46)
br label %51
48: ; preds = %12
%49 = load i8*, i8** %6
%50 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %49)
br label %51
51: ; preds = %48, %44, %40, %36, %33, %32
store i32 0, i32* %3
br label %52
52: ; preds = %51, %10
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [33 x i8] c"Error: Unrecognized command: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %29
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %7
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %8
%12 = load i8, i8* %9
%13 = sext i8 %12 to i32
switch i32 %13, label %27 [
i32 99, label %14
i32 115, label %19
i32 102, label %21
i32 100, label %23
i32 117, label %25
]
14: ; preds = %6
%15 = tail call i32 @mw_create(i8* %11, i8** %10, i32 %0)
%16 = icmp eq i32 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %14
%18 = tail call i32 (...) @usage()
br label %29
19: ; preds = %6
%20 = tail call i32 @print_stats(i8* %11)
br label %29
21: ; preds = %6
%22 = tail call i32 @get_data(i8* %11, i8** %10)
br label %29
23: ; preds = %6
%24 = tail call i32 @dump_data(i8* %11, i8** %10)
br label %29
25: ; preds = %6
%26 = tail call i32 @update_meta(i8* %11, i8** %10)
br label %29
27: ; preds = %6
%28 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %29
29: ; preds = %19, %21, %23, %25, %27, %17, %14, %4
ret i32 0
}