#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*/ SBA_addStatusBarImage(char *);
int SBA_getBluetoothEnabled();
int /*<<< orphan*/ SBA_removeStatusBarImage(char *);
int /*<<< orphan*/ SBA_setBluetoothEnabled(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int usage = 1;
  if (argc > 1) {
    if (argc == 3 && strcmp("add", argv[1]) == 0) {
      SBA_addStatusBarImage(argv[2]);
      usage = 0;
    } else if (argc == 3 && strcmp("remove", argv[1]) == 0) {
      SBA_removeStatusBarImage(argv[2]);
      usage = 0;
    } else if (argc == 2 && strcmp("btstate", argv[1]) == 0) {
      int enabled = SBA_getBluetoothEnabled();
      printf("Bluetoot enabled: %u\n", enabled);
      usage = 0;
    } else if (argc == 2 && strcmp("bton", argv[1]) == 0) {
      SBA_setBluetoothEnabled(1);
      printf("Set Bluetooth enabled: YES\n");
      usage = 0;
    } else if (argc == 2 && strcmp("btoff", argv[1]) == 0) {
      SBA_setBluetoothEnabled(0);
      printf("Set Bluetooth enabled: NO\n");
      usage = 0;
    }
  }
  if (usage) {
    printf("Usage: %s [ btstate | bton | btoff | add StatuBarImageName | "
           "remove StatuBarImageName]\n",
           argv[0]);
    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)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1301 <main+0x1a1>
cmpl   $0x3,-0x8(%rbp)
jne    11c8 <main+0x68>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe60(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11c8 <main+0x68>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <SBA_addStatusBarImage@plt>
movl   $0x0,-0x14(%rbp)
jmp    12fc <main+0x19c>
cmpl   $0x3,-0x8(%rbp)
jne    1209 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe23(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1209 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <SBA_removeStatusBarImage@plt>
movl   $0x0,-0x14(%rbp)
jmp    12f7 <main+0x197>
cmpl   $0x2,-0x8(%rbp)
jne    1258 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xde9(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1258 <main+0xf8>
mov    $0x0,%al
call   1050 <SBA_getBluetoothEnabled@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    12f2 <main+0x192>
cmpl   $0x2,-0x8(%rbp)
jne    12a4 <main+0x144>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdb8(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12a4 <main+0x144>
mov    $0x1,%edi
call   1080 <SBA_setBluetoothEnabled@plt>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    12ed <main+0x18d>
cmpl   $0x2,-0x8(%rbp)
jne    12e8 <main+0x188>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd8d(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12e8 <main+0x188>
xor    %edi,%edi
call   1080 <SBA_setBluetoothEnabled@plt>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    12ed <main+0x18d>
jmp    12f2 <main+0x192>
jmp    12f7 <main+0x197>
jmp    12fc <main+0x19c>
jmp    1301 <main+0x1a1>
cmpl   $0x0,-0x14(%rbp)
je     132c <main+0x1cc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1333 <main+0x1d3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     11f6 <main+0x86>
je     11b7 <main+0x47>
cmp    $0x3,%edi
jne    11f6 <main+0x86>
mov    0x8(%rbx),%rsi
lea    0xe75(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1210 <main+0xa0>
mov    0x8(%rbx),%rsi
lea    0xe64(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    11f6 <main+0x86>
mov    0x10(%rbx),%rdi
call   1040 <SBA_removeStatusBarImage@plt>
xor    %ebx,%ebx
jmp    120c <main+0x9c>
mov    0x8(%rbx),%rsi
lea    0xe49(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     121d <main+0xad>
mov    0x8(%rbx),%rsi
lea    0xe52(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1238 <main+0xc8>
mov    0x8(%rbx),%rsi
lea    0xe42(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1252 <main+0xe2>
mov    (%rbx),%rsi
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
mov    0x10(%rbx),%rdi
call   1080 <SBA_addStatusBarImage@plt>
xor    %ebx,%ebx
jmp    120c <main+0x9c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <SBA_getBluetoothEnabled@plt>
lea    0xde6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    120c <main+0x9c>
mov    $0x1,%edi
call   1090 <SBA_setBluetoothEnabled@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    120c <main+0x9c>
xor    %ebx,%ebx
xor    %edi,%edi
call   1090 <SBA_setBluetoothEnabled@plt>
lea    0xe2a(%rip),%rdi
call   1030 <puts@plt>
jmp    120c <main+0x9c>

LLVM IR (-O0):
@.str = [4 x i8] c"add\00"
@.str.1 = [7 x i8] c"remove\00"
@.str.2 = [8 x i8] c"btstate\00"
@.str.3 = [22 x i8] c"Bluetoot enabled: %u\0A\00"
@.str.4 = [5 x i8] c"bton\00"
@.str.5 = [28 x i8] c"Set Bluetooth enabled: YES\0A\00"
@.str.6 = [6 x i8] c"btoff\00"
@.str.7 = [27 x i8] c"Set Bluetooth enabled: NO\0A\00"
@.str.8 = [88 x i8] c"Usage: %s [ btstate | bton | btoff | add StatuBarImageName | remove StatuBarImageName]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %80
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @SBA_addStatusBarImage(i8* %22)
store i32 0, i32* %6
br label %79
24: ; preds = %13, %10
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 3
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @SBA_removeStatusBarImage(i8* %36)
store i32 0, i32* %6
br label %78
38: ; preds = %27, %24
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 2
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %41
%48 = call i32 (...) @SBA_getBluetoothEnabled()
store i32 %48, i32* %7
%49 = load i32, i32* %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %49)
store i32 0, i32* %6
br label %77
51: ; preds = %41, %38
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 2
br i1 %53, label %54, label %63
54: ; preds = %51
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = call i32 @SBA_setBluetoothEnabled(i32 1)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %6
br label %76
63: ; preds = %54, %51
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 2
br i1 %65, label %66, label %75
66: ; preds = %63
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %69)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %66
%73 = call i32 @SBA_setBluetoothEnabled(i32 0)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %6
br label %75
75: ; preds = %72, %66, %63
br label %76
76: ; preds = %75, %60
br label %77
77: ; preds = %76, %47
br label %78
78: ; preds = %77, %33
br label %79
79: ; preds = %78, %19
br label %80
80: ; preds = %79, %2
%81 = load i32, i32* %6
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 0
%86 = load i8*, i8** %85
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.8, i64 0, i64 0), i8* %86)
store i32 -1, i32* %3
br label %89
88: ; preds = %80
store i32 0, i32* %3
br label %89
89: ; preds = %88, %83
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
@.str.1 = [7 x i8] c"remove\00"
@.str.2 = [8 x i8] c"btstate\00"
@.str.3 = [22 x i8] c"Bluetoot enabled: %u\0A\00"
@.str.4 = [5 x i8] c"bton\00"
@.str.6 = [6 x i8] c"btoff\00"
@.str.8 = [88 x i8] c"Usage: %s [ btstate | bton | btoff | add StatuBarImageName | remove StatuBarImageName]\0A\00"
@str = [26 x i8] c"Set Bluetooth enabled: NO\00"
@str.9 = [27 x i8] c"Set Bluetooth enabled: YES\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %44
4: ; preds = %2
switch i32 %0, label %44 [
i32 3, label %5
i32 2, label %22
]
5: ; preds = %4
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @SBA_addStatusBarImage(i8* %12)
br label %47
14: ; preds = %5
%15 = load i8*, i8** %6
%16 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %44
18: ; preds = %14
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @SBA_removeStatusBarImage(i8* %20)
br label %47
22: ; preds = %4
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = tail call i32 (...) @SBA_getBluetoothEnabled()
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %47
30: ; preds = %22
%31 = load i8*, i8** %23
%32 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = tail call i32 @SBA_setBluetoothEnabled(i32 1)
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
br label %47
37: ; preds = %30
%38 = load i8*, i8** %23
%39 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = tail call i32 @SBA_setBluetoothEnabled(i32 0)
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %47
44: ; preds = %4, %14, %37, %2
%45 = load i8*, i8** %1
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.8, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %10, %27, %41, %34, %18, %44
%48 = phi i32 [ -1, %44 ], [ 0, %18 ], [ 0, %34 ], [ 0, %41 ], [ 0, %27 ], [ 0, %10 ]
ret i32 %48
}