#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 */
scalar_t__ apply_all();
scalar_t__ clear();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ status();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int a;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <action>\n", argv[0]);
    return 1;
  }
  if (!strcmp(argv[1], "apply")) {
    if (apply_all())
      return 1;
  } else if (!strcmp(argv[1], "clear")) {
    if (clear())
      return 1;
  } else if (!strcmp(argv[1], "status")) {
    if (status())
      return 1;
  } else {
    fprintf(stderr, "Uknown action: %s\n", argv[1]);
    return 1;
  }
  return 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)
cmpl   $0x2,-0x8(%rbp)
jge    1198 <main+0x48>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    128f <main+0x13f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d7 <main+0x87>
mov    $0x0,%al
call   1050 <apply_all@plt>
cmp    $0x0,%rax
je     11d2 <main+0x82>
movl   $0x1,-0x4(%rbp)
jmp    128f <main+0x13f>
jmp    1288 <main+0x138>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe34(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1216 <main+0xc6>
mov    $0x0,%al
call   1070 <clear@plt>
cmp    $0x0,%rax
je     1211 <main+0xc1>
movl   $0x1,-0x4(%rbp)
jmp    128f <main+0x13f>
jmp    1283 <main+0x133>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfb(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1255 <main+0x105>
mov    $0x0,%al
call   1060 <status@plt>
cmp    $0x0,%rax
je     1250 <main+0x100>
movl   $0x1,-0x4(%rbp)
jmp    128f <main+0x13f>
jmp    127e <main+0x12e>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdba(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    128f <main+0x13f>
jmp    1283 <main+0x133>
jmp    1288 <main+0x138>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     116b <main+0x1b>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe97(%rip),%rsi
jmp    11bb <main+0x6b>
mov    0x8(%rsi),%rbx
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11c7 <main+0x77>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11d0 <main+0x80>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11d9 <main+0x89>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    11ed <main+0x9d>
xor    %eax,%eax
call   1050 <apply_all@plt>
jmp    11e0 <main+0x90>
xor    %eax,%eax
call   1070 <clear@plt>
jmp    11e0 <main+0x90>
xor    %eax,%eax
call   1060 <status@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     11ef <main+0x9f>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <action>\0A\00"
@.str.1 = [6 x i8] c"apply\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [7 x i8] c"status\00"
@.str.4 = [19 x i8] c"Uknown action: %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
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %15
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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %57
15: ; preds = %2
%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 ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %15
%22 = call i64 (...) @apply_all()
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 1, i32* %3
br label %57
25: ; preds = %21
br label %56
26: ; preds = %15
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %26
%33 = call i64 (...) @clear()
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 1, i32* %3
br label %57
36: ; preds = %32
br label %55
37: ; preds = %26
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @strcmp(i8* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %37
%44 = call i64 (...) @status()
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 1, i32* %3
br label %57
47: ; preds = %43
br label %54
48: ; preds = %37
%49 = load i32, i32* @stderr
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %52)
store i32 1, i32* %3
br label %57
54: ; preds = %47
br label %55
55: ; preds = %54, %36
br label %56
56: ; preds = %55, %25
store i32 0, i32* %3
br label %57
57: ; preds = %56, %48, %46, %35, %24, %9
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <action>\0A\00"
@.str.1 = [6 x i8] c"apply\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [7 x i8] c"status\00"
@.str.4 = [19 x i8] c"Uknown action: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %32
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = tail call i64 (...) @apply_all()
%15 = icmp eq i64 %14, 0
br i1 %15, label %31, label %32
16: ; preds = %8
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = tail call i64 (...) @clear()
%21 = icmp eq i64 %20, 0
br i1 %21, label %31, label %32
22: ; preds = %16
%23 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = tail call i64 (...) @status()
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %32
28: ; preds = %22
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %32
31: ; preds = %19, %25, %13
br label %32
32: ; preds = %25, %19, %13, %31, %28, %4
%33 = phi i32 [ 1, %4 ], [ 1, %28 ], [ 0, %31 ], [ 1, %13 ], [ 1, %19 ], [ 1, %25 ]
ret i32 %33
}