#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*/ printf(char *);
int send_cli_message(char *);
int start(int);
scalar_t__ strcmp(char *, char *);
main(int args, char *argv[]) {
  if (args < 2 || args > 3) {
    printf("You should use one or two arguments. No action taken.\n");
    return 1;
  }
  if (strcmp(argv[1], "start") == 0) {
    return start(args >= 3 && strcmp(argv[2], "-v") == 0);
  } else if (strcmp(argv[1], "stop") == 0) {
    return send_cli_message("stop");
  } else if (strcmp(argv[1], "server") == 0 && args == 3) {
    return send_cli_message(argv[2]);
  } else {
    printf("Invalid argument.\n");
    return 1;
  }
}


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)
jl     116a <main+0x2a>
cmpl   $0x3,-0x8(%rbp)
jle    1182 <main+0x42>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1264 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e2 <main+0xa2>
xor    %eax,%eax
cmpl   $0x3,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     11cd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe7f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <start@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1214 <main+0xd4>
lea    0xe39(%rip),%rdi
call   1060 <send_cli_message@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe22(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1251 <main+0x111>
cmpl   $0x3,-0x8(%rbp)
jne    1251 <main+0x111>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <send_cli_message@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <main+0x124>
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x4(%rbx),%eax
cmp    $0xfffffffd,%eax
ja     1167 <main+0x27>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe8b(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b4 <main+0x74>
mov    0x8(%r14),%rdi
lea    0xe7f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0xa0>
mov    0x8(%r14),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x3,%ebx
jne    11f3 <main+0xb3>
test   %rax,%rax
jne    11f3 <main+0xb3>
mov    0x10(%r14),%rdi
jmp    11e7 <main+0xa7>
xor    %edi,%edi
cmp    $0x3,%ebx
jb     11d4 <main+0x94>
mov    0x10(%r14),%rdi
lea    0xe40(%rip),%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <start@plt>
lea    0xe22(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <send_cli_message@plt>
lea    0xe1b(%rip),%rdi
jmp    1155 <main+0x15>

LLVM IR (-O0):
@.str = [55 x i8] c"You should use one or two arguments. No action taken.\0A\00"
@.str.1 = [6 x i8] c"start\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [5 x i8] c"stop\00"
@.str.4 = [7 x i8] c"server\00"
@.str.5 = [19 x i8] c"Invalid argument.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %56
13: ; preds = %8
%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 ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %13
%20 = load i32, i32* %4
%21 = icmp sge i32 %20, 3
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br label %28
28: ; preds = %22, %19
%29 = phi i1 [ false, %19 ], [ %27, %22 ]
%30 = zext i1 %29 to i32
%31 = call i32 @start(i32 %30)
store i32 %31, i32* %3
br label %56
32: ; preds = %13
%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 ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 @send_cli_message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 %39, i32* %3
br label %56
40: ; preds = %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 ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %54
46: ; preds = %40
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 3
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 2
%52 = load i8*, i8** %51
%53 = call i32 @send_cli_message(i8* %52)
store i32 %53, i32* %3
br label %56
54: ; preds = %46, %40
%55 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %56
56: ; preds = %54, %49, %38, %28, %11
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"start\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [5 x i8] c"stop\00"
@.str.4 = [7 x i8] c"server\00"
@str = [18 x i8] c"Invalid argument.\00"
@str.6 = [54 x i8] c"You should use one or two arguments. No action taken.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -4
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.6, i64 0, i64 0))
br label %41
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 ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = icmp ugt i32 %0, 2
br i1 %13, label %14, label %20
14: ; preds = %12
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %14, %12
%21 = phi i32 [ 0, %12 ], [ %19, %14 ]
%22 = tail call i32 @start(i32 %21)
br label %41
23: ; preds = %7
%24 = load i8*, i8** %8
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = tail call i32 @send_cli_message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %41
29: ; preds = %23
%30 = load i8*, i8** %8
%31 = tail call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
%33 = icmp eq i32 %0, 3
%34 = and i1 %33, %32
br i1 %34, label %35, label %39
35: ; preds = %29
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = tail call i32 @send_cli_message(i8* %37)
br label %41
39: ; preds = %29
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %41
41: ; preds = %39, %35, %27, %20, %5
%42 = phi i32 [ 1, %5 ], [ %22, %20 ], [ %28, %27 ], [ %38, %35 ], [ 1, %39 ]
ret i32 %42
}