#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 *, char *);
int start_client();
int start_server();
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int rc = 0;
  if (2 <= argc && 0 == strcmp(argv[1], "-s")) {
    rc = start_server();
  } else if (2 <= argc && 0 == strcmp(argv[1], "-c")) {
    rc = start_client();
  } else {
    if (argc > 1)
      printf("Unknown option: >%s<\n", argv[1]);
    printf("Usage: %s [-c|-s]\n", argv[0]);
    rc = 1;
  }
  return rc;
}


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   $0x0,-0x14(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jg     119c <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    119c <main+0x5c>
mov    $0x0,%al
call   1060 <start_server@plt>
mov    %eax,-0x14(%rbp)
jmp    1218 <main+0xd8>
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jg     11db <main+0x9b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4a(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11db <main+0x9b>
mov    $0x0,%al
call   1050 <start_client@plt>
mov    %eax,-0x14(%rbp)
jmp    1213 <main+0xd3>
cmpl   $0x1,-0x8(%rbp)
jle    11f9 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1218 <main+0xd8>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     1183 <main+0x43>
mov    0x8(%rbx),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1199 <main+0x59>
mov    0x8(%rbx),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a1 <main+0x61>
mov    0x8(%rbx),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1060 <start_server@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <start_client@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-s\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [22 x i8] c"Unknown option: >%s<\0A\00"
@.str.3 = [19 x i8] c"Usage: %s [-c|-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
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sle i32 2, %7
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 0, %13
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 (...) @start_server()
store i32 %16, i32* %6
br label %42
17: ; preds = %9, %2
%18 = load i32, i32* %4
%19 = icmp sle i32 2, %18
br i1 %19, label %20, label %28
20: ; preds = %17
%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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 0, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 (...) @start_client()
store i32 %27, i32* %6
br label %41
28: ; preds = %20, %17
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 1
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %31, %28
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %39)
store i32 1, i32* %6
br label %41
41: ; preds = %36, %26
br label %42
42: ; preds = %41, %15
%43 = load i32, i32* %6
ret i32 %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"-s\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [22 x i8] c"Unknown option: >%s<\0A\00"
@.str.3 = [19 x i8] c"Usage: %s [-c|-s]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @start_server()
br label %23
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 (...) @start_client()
br label %23
17: ; preds = %11
%18 = load i8*, i8** %5
%19 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %2, %17
%21 = load i8*, i8** %1
%22 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %15, %20, %9
%24 = phi i32 [ %10, %9 ], [ %16, %15 ], [ 1, %20 ]
ret i32 %24
}