#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ ping_server(int *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ remove_process(char *);
int /*<<< orphan*/ restart_process(char *);
int /*<<< orphan*/ service_clean();
int /*<<< orphan*/ service_start();
int /*<<< orphan*/ show_status();
int /*<<< orphan*/ start_all();
int /*<<< orphan*/ start_process(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stop_all();
int /*<<< orphan*/ stop_process(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int res;
  if (argc == 1) {
    print_usage();
    exit(EXIT_SUCCESS);
  }
  if (argc == 2) {
    if (strcmp(argv[1], "startall") == 0) {
      start_all();
    }
    if (strcmp(argv[1], "stopall") == 0) {
      stop_all();
    }
    if (strcmp(argv[1], "status") == 0) {
      show_status();
    }
    if (strcmp(argv[1], "version") == 0) {
      printf("\x1b[32m"
             "[KB_PM]"
             "\x1b[0m"
             ": %s\n",
             "v0.1.0");
      exit(EXIT_SUCCESS);
    }
    fprintf(stderr, "\x1b[32m"
                    "[KB_PM]"
                    "\x1b[0m"
                    ": Arguments error, see usage.\n");
    exit(EXIT_FAILURE);
  }
  if (argc == 3) {
    if (strcmp(argv[1], "service") == 0) {
      if (strcmp(argv[2], "start") == 0) {
        ping_server(&res);
        if (res != 0) {
          printf("\x1b[32m"
                 "[KB_PM]"
                 "\x1b[0m"
                 ": Starting the server.\n"
                 "\x1b[3m"
                 " Use `kbpm start <file>` to make an app run forever\n"
                 "\x1b[0m");
          service_start();
        } else {
          printf("\x1b[32m"
                 "[KB_PM]"
                 "\x1b[0m"
                 ": Service have been already started.\n"
                 "\x1b[3m"
                 " Use `kbpm status` to get the status of program(s)\n"
                 "\x1b[0m");
          exit(EXIT_SUCCESS);
        }
      }
      if (strcmp(argv[2], "clean") == 0) {
        service_clean();
      }
    }
    if (strcmp(argv[1], "start") == 0) {
      start_process(argv[2]);
    }
    if (strcmp(argv[1], "restart") == 0) {
      restart_process(argv[2]);
    }
    if (strcmp(argv[1], "stop") == 0) {
      stop_process(argv[2]);
    }
    if (strcmp(argv[1], "remove") == 0) {
      remove_process(argv[2]);
    }
    fprintf(stderr, "\x1b[32m"
                    "[KB_PM]"
                    "\x1b[0m"
                    ": Arguments error, see usage.\n");
    exit(EXIT_FAILURE);
  }
  fprintf(stderr, "\x1b[32m"
                  "[KB_PM]"
                  "\x1b[0m"
                  ": Too many arguments, see usage.\n");
  exit(EXIT_FAILURE);
}


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   $0x1,-0x8(%rbp)
jne    1225 <main+0x35>
mov    $0x0,%al
call   10f0 <print_usage@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1302 <main+0x112>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1254 <main+0x64>
mov    $0x0,%al
call   10b0 <start_all@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda6(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1279 <main+0x89>
mov    $0x0,%al
call   1030 <stop_all@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd89(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    129e <main+0xae>
mov    $0x0,%al
call   10a0 <show_status@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd6b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12df <main+0xef>
lea    0xd5d(%rip),%rdi
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd4e(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jne    148f <main+0x29f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd51(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13c0 <main+0x1d0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe18(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1396 <main+0x1a6>
lea    -0x14(%rbp),%rdi
call   1100 <ping_server@plt>
cmpl   $0x0,-0x14(%rbp)
je     1375 <main+0x185>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10c0 <service_start@plt>
jmp    1391 <main+0x1a1>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    1396 <main+0x1a6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xda4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13bb <main+0x1cb>
mov    $0x0,%al
call   10d0 <service_clean@plt>
jmp    13c0 <main+0x1d0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd82(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13eb <main+0x1fb>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <start_process@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd55(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1416 <main+0x226>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <restart_process@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd32(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1441 <main+0x251>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <stop_process@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd0c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    146c <main+0x27c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <remove_process@plt>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
lea    0xbc1(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2b4a(%rip),%rax
mov    (%rax),%edi
lea    0xcc4(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2b2d(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     129f <main+0xaf>
cmp    $0x2,%edi
je     121b <main+0x2b>
cmp    $0x1,%edi
jne    12fa <main+0x10a>
xor    %eax,%eax
call   10f0 <print_usage@plt>
jmp    12ec <main+0xfc>
mov    0x8(%rbx),%rdi
lea    0xdda(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1237 <main+0x47>
xor    %eax,%eax
call   10b0 <start_all@plt>
mov    0x8(%rbx),%rdi
lea    0xdc7(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1253 <main+0x63>
xor    %eax,%eax
call   1030 <stop_all@plt>
mov    0x8(%rbx),%rdi
lea    0xdb3(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    126f <main+0x7f>
xor    %eax,%eax
call   10a0 <show_status@plt>
mov    0x8(%rbx),%rdi
lea    0xd9e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    13b8 <main+0x1c8>
lea    0xd91(%rip),%rdi
lea    0xda0(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12ec <main+0xfc>
mov    0x8(%rbx),%rdi
lea    0xdc2(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1340 <main+0x150>
mov    0x10(%rbx),%rdi
lea    0xe8e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1324 <main+0x134>
lea    0xc(%rsp),%rdi
call   1100 <ping_server@plt>
cmpl   $0x0,0xc(%rsp)
jne    130f <main+0x11f>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
jmp    13c8 <main+0x1d8>
lea    0xd5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <service_start@plt>
mov    0x10(%rbx),%rdi
lea    0xe1a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1340 <main+0x150>
xor    %eax,%eax
call   10d0 <service_clean@plt>
mov    0x8(%rbx),%rdi
lea    0xe06(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    135e <main+0x16e>
mov    0x10(%rbx),%rdi
call   1060 <start_process@plt>
mov    0x8(%rbx),%rdi
lea    0xde6(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    137c <main+0x18c>
mov    0x10(%rbx),%rdi
call   1040 <restart_process@plt>
mov    0x8(%rbx),%rdi
lea    0xdd0(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    139a <main+0x1aa>
mov    0x10(%rbx),%rdi
call   1110 <stop_process@plt>
mov    0x8(%rbx),%rdi
lea    0xdb7(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    13b8 <main+0x1c8>
mov    0x10(%rbx),%rdi
call   1090 <remove_process@plt>
mov    0x2c21(%rip),%rax
mov    (%rax),%edi
lea    0xc75(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2c04(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [9 x i8] c"startall\00"
@.str.1 = [8 x i8] c"stopall\00"
@.str.2 = [7 x i8] c"status\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [22 x i8] c"\1B[32m[KB_PM]\1B[0m: %s\0A\00"
@.str.5 = [7 x i8] c"v0.1.0\00"
@stderr = global i32 0
@.str.6 = [47 x i8] c"\1B[32m[KB_PM]\1B[0m: Arguments error, see usage.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [8 x i8] c"service\00"
@.str.8 = [6 x i8] c"start\00"
@.str.9 = [100 x i8] c"\1B[32m[KB_PM]\1B[0m: Starting the server.\0A\1B[3m Use `kbpm start <file>` to make an app run forever\0A\1B[0m\00"
@.str.10 = [113 x i8] c"\1B[32m[KB_PM]\1B[0m: Service have been already started.\0A\1B[3m Use `kbpm status` to get the status of program(s)\0A\1B[0m\00"
@.str.11 = [6 x i8] c"clean\00"
@.str.12 = [8 x i8] c"restart\00"
@.str.13 = [5 x i8] c"stop\00"
@.str.14 = [7 x i8] c"remove\00"
@.str.15 = [50 x i8] c"\1B[32m[KB_PM]\1B[0m: Too many arguments, see usage.\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 eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = call i32 (...) @print_usage()
%11 = load i32, i32* @EXIT_SUCCESS
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %55
16: ; preds = %13
%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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (...) @start_all()
br label %24
24: ; preds = %22, %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 (...) @stop_all()
br label %32
32: ; preds = %30, %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 (...) @show_status()
br label %40
40: ; preds = %38, %32
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%48 = load i32, i32* @EXIT_SUCCESS
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %40
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %13
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 3
br i1 %57, label %58, label %140
58: ; preds = %55
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %91
64: ; preds = %58
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %82
70: ; preds = %64
%71 = call i32 @ping_server(i32* %6)
%72 = load i32, i32* %6
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0))
%76 = call i32 (...) @service_start()
br label %81
77: ; preds = %70
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.10, i64 0, i64 0))
%79 = load i32, i32* @EXIT_SUCCESS
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %74
br label %82
82: ; preds = %81, %64
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 2
%85 = load i8*, i8** %84
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %82
%89 = call i32 (...) @service_clean()
br label %90
90: ; preds = %88, %82
br label %91
91: ; preds = %90, %58
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 1
%94 = load i8*, i8** %93
%95 = call i64 @strcmp(i8* %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %102
97: ; preds = %91
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 2
%100 = load i8*, i8** %99
%101 = call i32 @start_process(i8* %100)
br label %102
102: ; preds = %97, %91
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 1
%105 = load i8*, i8** %104
%106 = call i64 @strcmp(i8* %105, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %113
108: ; preds = %102
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 2
%111 = load i8*, i8** %110
%112 = call i32 @restart_process(i8* %111)
br label %113
113: ; preds = %108, %102
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 1
%116 = load i8*, i8** %115
%117 = call i64 @strcmp(i8* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %124
119: ; preds = %113
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 2
%122 = load i8*, i8** %121
%123 = call i32 @stop_process(i8* %122)
br label %124
124: ; preds = %119, %113
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %126
%128 = call i64 @strcmp(i8* %127, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%129 = icmp eq i64 %128, 0
br i1 %129, label %130, label %135
130: ; preds = %124
%131 = load i8**, i8*** %5
%132 = getelementptr inbounds i8*, i8** %131, i64 2
%133 = load i8*, i8** %132
%134 = call i32 @remove_process(i8* %133)
br label %135
135: ; preds = %130, %124
%136 = load i32, i32* @stderr
%137 = call i32 @fprintf(i32 %136, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%138 = load i32, i32* @EXIT_FAILURE
%139 = call i32 @exit(i32 %138)
unreachable
140: ; preds = %55
%141 = load i32, i32* @stderr
%142 = call i32 @fprintf(i32 %141, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.15, i64 0, i64 0))
%143 = load i32, i32* @EXIT_FAILURE
%144 = call i32 @exit(i32 %143)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [9 x i8] c"startall\00"
@.str.1 = [8 x i8] c"stopall\00"
@.str.2 = [7 x i8] c"status\00"
@.str.3 = [8 x i8] c"version\00"
@.str.4 = [22 x i8] c"\1B[32m[KB_PM]\1B[0m: %s\0A\00"
@.str.5 = [7 x i8] c"v0.1.0\00"
@stderr = global i32 0
@.str.6 = [47 x i8] c"\1B[32m[KB_PM]\1B[0m: Arguments error, see usage.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.7 = [8 x i8] c"service\00"
@.str.8 = [6 x i8] c"start\00"
@.str.9 = [100 x i8] c"\1B[32m[KB_PM]\1B[0m: Starting the server.\0A\1B[3m Use `kbpm start <file>` to make an app run forever\0A\1B[0m\00"
@.str.10 = [113 x i8] c"\1B[32m[KB_PM]\1B[0m: Service have been already started.\0A\1B[3m Use `kbpm status` to get the status of program(s)\0A\1B[0m\00"
@.str.11 = [6 x i8] c"clean\00"
@.str.12 = [8 x i8] c"restart\00"
@.str.13 = [5 x i8] c"stop\00"
@.str.14 = [7 x i8] c"remove\00"
@.str.15 = [50 x i8] c"\1B[32m[KB_PM]\1B[0m: Too many arguments, see usage.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
switch i32 %0, label %105 [
i32 1, label %5
i32 2, label %9
i32 3, label %41
]
5: ; preds = %2
%6 = tail call i32 (...) @print_usage()
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = tail call i32 (...) @start_all()
br label %16
16: ; preds = %14, %9
%17 = load i8*, i8** %10
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 (...) @stop_all()
br label %22
22: ; preds = %20, %16
%23 = load i8*, i8** %10
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 (...) @show_status()
br label %28
28: ; preds = %26, %22
%29 = load i8*, i8** %10
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* @EXIT_SUCCESS
%35 = tail call i32 @exit(i32 %34)
unreachable
36: ; preds = %28
%37 = load i32, i32* @stderr
%38 = tail call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
%40 = tail call i32 @exit(i32 %39)
unreachable
41: ; preds = %2
%42 = getelementptr inbounds i8*, i8** %1, i64 1
%43 = load i8*, i8** %42
%44 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %68
46: ; preds = %41
%47 = getelementptr inbounds i8*, i8** %1, i64 2
%48 = load i8*, i8** %47
%49 = tail call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %62
51: ; preds = %46
%52 = call i32 @ping_server(i32* %3)
%53 = load i32, i32* %3
%54 = icmp eq i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %51
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.9, i64 0, i64 0))
%57 = call i32 (...) @service_start()
br label %62
58: ; preds = %51
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @.str.10, i64 0, i64 0))
%60 = load i32, i32* @EXIT_SUCCESS
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %55, %46
%63 = load i8*, i8** %47
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (...) @service_clean()
br label %68
68: ; preds = %62, %66, %41
%69 = load i8*, i8** %42
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %68
%73 = getelementptr inbounds i8*, i8** %1, i64 2
%74 = load i8*, i8** %73
%75 = call i32 @start_process(i8* %74)
br label %76
76: ; preds = %72, %68
%77 = load i8*, i8** %42
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %84
80: ; preds = %76
%81 = getelementptr inbounds i8*, i8** %1, i64 2
%82 = load i8*, i8** %81
%83 = call i32 @restart_process(i8* %82)
br label %84
84: ; preds = %80, %76
%85 = load i8*, i8** %42
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %84
%89 = getelementptr inbounds i8*, i8** %1, i64 2
%90 = load i8*, i8** %89
%91 = call i32 @stop_process(i8* %90)
br label %92
92: ; preds = %88, %84
%93 = load i8*, i8** %42
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %92
%97 = getelementptr inbounds i8*, i8** %1, i64 2
%98 = load i8*, i8** %97
%99 = call i32 @remove_process(i8* %98)
br label %100
100: ; preds = %96, %92
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%103 = load i32, i32* @EXIT_FAILURE
%104 = call i32 @exit(i32 %103)
unreachable
105: ; preds = %2
%106 = load i32, i32* @stderr
%107 = tail call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.15, i64 0, i64 0))
%108 = load i32, i32* @EXIT_FAILURE
%109 = tail call i32 @exit(i32 %108)
unreachable
}