#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int main_ccd(int, char **);
int main_delete(int, char **);
int main_list(int, char **);
int main_save(int, char **);
int main_setcd(int, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ret = 0;
  if (argc < 2) {
    fprintf(stderr, "usage: %s [ccd|list|save|delete|setcd]\n", argv[0]);
    exit(1);
  }
  if (strcmp(argv[1], "list") == 0) {
    ret = main_list(argc, argv);
  } else if (strcmp(argv[1], "ccd") == 0) {
    ret = main_ccd(argc, argv);
  } else if (strcmp(argv[1], "save") == 0) {
    ret = main_save(argc, argv);
  } else if (strcmp(argv[1], "delete") == 0) {
    ret = main_delete(argc, argv);
  } else if (strcmp(argv[1], "setcd") == 0) {
    ret = main_setcd(argc, argv);
  } else {
    fprintf(stderr, "Unknown sub command: %s\n", argv[1]);
    exit(1);
  }
  exit(ret);
}


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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11cd <main+0x4d>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe42(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ff <main+0x7f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <main_list@plt>
mov    %eax,-0x14(%rbp)
jmp    1302 <main+0x182>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1231 <main+0xb1>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <main_ccd@plt>
mov    %eax,-0x14(%rbp)
jmp    12fd <main+0x17d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <main+0xe3>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <main_save@plt>
mov    %eax,-0x14(%rbp)
jmp    12f8 <main+0x178>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1295 <main+0x115>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <main_delete@plt>
mov    %eax,-0x14(%rbp)
jmp    12f3 <main+0x173>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd99(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12c7 <main+0x147>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <main_setcd@plt>
mov    %eax,-0x14(%rbp)
jmp    12ee <main+0x16e>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd64(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    12f3 <main+0x173>
jmp    12f8 <main+0x178>
jmp    12fd <main+0x17d>
jmp    1302 <main+0x182>
mov    -0x14(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     11ad <main+0x2d>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe62(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %edi,%ebp
mov    0x8(%rbx),%rdi
lea    0xe6e(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11d5 <main+0x55>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <main_list@plt>
mov    %eax,%edi
call   1090 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xe4d(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11fb <main+0x7b>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <main_ccd@plt>
mov    %eax,%edi
call   1090 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xe2b(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1221 <main+0xa1>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <main_save@plt>
mov    %eax,%edi
call   1090 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xe0a(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1247 <main+0xc7>
mov    %ebp,%edi
mov    %rbx,%rsi
call   10a0 <main_delete@plt>
mov    %eax,%edi
call   1090 <exit@plt>
mov    0x8(%rbx),%rdi
lea    0xdeb(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    126d <main+0xed>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <main_setcd@plt>
mov    %eax,%edi
call   1090 <exit@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xdc2(%rip),%rsi
jmp    119e <main+0x1e>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"usage: %s [ccd|list|save|delete|setcd]\0A\00"
@.str.1 = [5 x i8] c"list\00"
@.str.2 = [4 x i8] c"ccd\00"
@.str.3 = [5 x i8] c"save\00"
@.str.4 = [7 x i8] c"delete\00"
@.str.5 = [6 x i8] c"setcd\00"
@.str.6 = [25 x i8] c"Unknown sub command: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @main_list(i32 %23, i8** %24)
store i32 %25, i32* %6
br label %77
26: ; preds = %16
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load i32, i32* %4
%34 = load i8**, i8*** %5
%35 = call i32 @main_ccd(i32 %33, i8** %34)
store i32 %35, i32* %6
br label %76
36: ; preds = %26
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = load i32, i32* %4
%44 = load i8**, i8*** %5
%45 = call i32 @main_save(i32 %43, i8** %44)
store i32 %45, i32* %6
br label %75
46: ; preds = %36
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %46
%53 = load i32, i32* %4
%54 = load i8**, i8*** %5
%55 = call i32 @main_delete(i32 %53, i8** %54)
store i32 %55, i32* %6
br label %74
56: ; preds = %46
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load i32, i32* %4
%64 = load i8**, i8*** %5
%65 = call i32 @main_setcd(i32 %63, i8** %64)
store i32 %65, i32* %6
br label %73
66: ; preds = %56
%67 = load i32, i32* @stderr
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %70)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %62
br label %74
74: ; preds = %73, %52
br label %75
75: ; preds = %74, %42
br label %76
76: ; preds = %75, %32
br label %77
77: ; preds = %76, %22
%78 = load i32, i32* %6
%79 = call i32 @exit(i32 %78)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"usage: %s [ccd|list|save|delete|setcd]\0A\00"
@.str.1 = [5 x i8] c"list\00"
@.str.2 = [4 x i8] c"ccd\00"
@.str.3 = [5 x i8] c"save\00"
@.str.4 = [7 x i8] c"delete\00"
@.str.5 = [6 x i8] c"setcd\00"
@.str.6 = [25 x i8] c"Unknown sub command: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = tail call i32 @main_list(i32 %0, i8** %1)
br label %45
16: ; preds = %9
%17 = load i8*, i8** %10
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @main_ccd(i32 %0, i8** %1)
br label %45
22: ; preds = %16
%23 = load i8*, i8** %10
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 @main_save(i32 %0, i8** %1)
br label %45
28: ; preds = %22
%29 = load i8*, i8** %10
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = tail call i32 @main_delete(i32 %0, i8** %1)
br label %45
34: ; preds = %28
%35 = load i8*, i8** %10
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = tail call i32 @main_setcd(i32 %0, i8** %1)
br label %45
40: ; preds = %34
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %10
%43 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %42)
%44 = tail call i32 @exit(i32 1)
unreachable
45: ; preds = %20, %32, %38, %26, %14
%46 = phi i32 [ %15, %14 ], [ %21, %20 ], [ %27, %26 ], [ %33, %32 ], [ %39, %38 ]
%47 = tail call i32 @exit(i32 %46)
unreachable
}