#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 EXIT_FAILURE;
int execlp(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printUsage();
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printUsage();
    return EXIT_FAILURE;
  }
  char *serviceName;
  if (strcmp(argv[1], "journalspy") == 0) {
    serviceName = "crash-reporter-journalspy.service";
  } else if (strcmp(argv[1], "endurance") == 0) {
    serviceName = "crash-reporter-endurance.service";
  } else {
    printUsage();
    return EXIT_FAILURE;
  }
  bool start;
  if (strcmp(argv[2], "start") == 0) {
    start = true;
  } else if (strcmp(argv[2], "stop") == 0) {
    start = false;
  } else {
    printUsage();
    return EXIT_FAILURE;
  }
  return execlp("systemctl", "systemctl", (start ? "start" : "stop"),
                serviceName, NULL);
}


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   $0x3,-0x8(%rbp)
je     1168 <main+0x38>
mov    $0x0,%al
call   1040 <printUsage@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <main+0x155>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1196 <main+0x66>
lea    0xe7e(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c4 <main+0x94>
lea    0xe7c(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11dc <main+0xac>
mov    $0x0,%al
call   1040 <printUsage@plt>
mov    0x2e0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <main+0x155>
jmp    11e1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    120b <main+0xdb>
movl   $0x1,-0x1c(%rbp)
jmp    1252 <main+0x122>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe44(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1235 <main+0x105>
movl   $0x0,-0x1c(%rbp)
jmp    124d <main+0x11d>
mov    $0x0,%al
call   1040 <printUsage@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <main+0x155>
jmp    1252 <main+0x122>
mov    -0x1c(%rbp),%ecx
lea    0xe02(%rip),%rdx
lea    0xdf5(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x18(%rbp),%rcx
lea    0xdee(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1050 <execlp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    11a7 <main+0x77>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1170 <main+0x40>
mov    0x8(%rbx),%rdi
lea    0xed0(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11a7 <main+0x77>
lea    0xec9(%rip),%r14
jmp    1177 <main+0x47>
lea    0xe94(%rip),%r14
mov    0x10(%rbx),%rdi
lea    0xed6(%rip),%r15
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bd <main+0x8d>
mov    0x10(%rbx),%rdi
lea    0xec4(%rip),%r15
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bd <main+0x8d>
xor    %eax,%eax
call   1040 <printUsage@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe9f(%rip),%rdi
mov    %rdi,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <execlp@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [11 x i8] c"journalspy\00"
@.str.1 = [34 x i8] c"crash-reporter-journalspy.service\00"
@.str.2 = [10 x i8] c"endurance\00"
@.str.3 = [33 x i8] c"crash-reporter-endurance.service\00"
@.str.4 = [6 x i8] c"start\00"
@.str.5 = [5 x i8] c"stop\00"
@.str.6 = [10 x i8] c"systemctl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 (...) @printUsage()
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %56
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %31
20: ; preds = %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %30
27: ; preds = %20
%28 = call i32 (...) @printUsage()
%29 = load i32, i32* @EXIT_FAILURE
store i32 %29, i32* %3
br label %56
30: ; preds = %26
br label %31
31: ; preds = %30, %19
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 1, i32* %7
br label %49
38: ; preds = %31
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 0, i32* %7
br label %48
45: ; preds = %38
%46 = call i32 (...) @printUsage()
%47 = load i32, i32* @EXIT_FAILURE
store i32 %47, i32* %3
br label %56
48: ; preds = %44
br label %49
49: ; preds = %48, %37
%50 = load i32, i32* %7
%51 = icmp ne i32 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%54 = load i8*, i8** %6
%55 = call i32 @execlp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %53, i8* %54, i32* null)
store i32 %55, i32* %3
br label %56
56: ; preds = %49, %45, %27, %10
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [11 x i8] c"journalspy\00"
@.str.1 = [34 x i8] c"crash-reporter-journalspy.service\00"
@.str.2 = [10 x i8] c"endurance\00"
@.str.3 = [33 x i8] c"crash-reporter-endurance.service\00"
@.str.4 = [6 x i8] c"start\00"
@.str.5 = [5 x i8] c"stop\00"
@.str.6 = [10 x i8] c"systemctl\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 (...) @printUsage()
%6 = load i32, i32* @EXIT_FAILURE
br label %35
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %7
%13 = load i8*, i8** %8
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = tail call i32 (...) @printUsage()
%18 = load i32, i32* @EXIT_FAILURE
br label %35
19: ; preds = %12, %7
%20 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %7 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), %12 ]
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %32, label %25
25: ; preds = %19
%26 = load i8*, i8** %21
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = tail call i32 (...) @printUsage()
%31 = load i32, i32* @EXIT_FAILURE
br label %35
32: ; preds = %25, %19
%33 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %25 ]
%34 = tail call i32 @execlp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %33, i8* %20, i32* null)
br label %35
35: ; preds = %16, %32, %29, %4
%36 = phi i32 [ %6, %4 ], [ %18, %16 ], [ %34, %32 ], [ %31, %29 ]
ret i32 %36
}