#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_SUCCESS;
int getopt(int, char **, char *);
int optind;
int /*<<< orphan*/ runClientMode(char *);
int /*<<< orphan*/ runServerMode(char *);
int /*<<< orphan*/ usageAndExit(char *);
int main(int argc, char *argv[]) {
  int opt;
  char serverMode = 0;
  char clientMode = 0;
  while ((opt = getopt(argc, argv, "sc")) != -1) {
    switch (opt) {
    case 's':
      serverMode = 1;
      break;
    case 'c':
      clientMode = 1;
      break;
    default:
      usageAndExit(argv[0]);
    }
  }
  if (optind > argc)
    usageAndExit(argv[0]);
  if ((serverMode && clientMode) || (!serverMode && !clientMode))
    usageAndExit(argv[0]);
  if (serverMode) {
    runServerMode(argv[optind]);
  } else if (clientMode) {
    runClientMode(argv[optind]);
  }
  return EXIT_SUCCESS;
}


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)
movb   $0x0,-0x15(%rbp)
movb   $0x0,-0x16(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe94(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11c5 <main+0x85>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x63,%eax
je     11ab <main+0x6b>
jmp    1191 <main+0x51>
mov    -0x1c(%rbp),%eax
sub    $0x73,%eax
jne    11b4 <main+0x74>
jmp    11a2 <main+0x62>
movb   $0x1,-0x15(%rbp)
jmp    11c0 <main+0x80>
movb   $0x1,-0x16(%rbp)
jmp    11c0 <main+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usageAndExit@plt>
jmp    115e <main+0x1e>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jle    11e3 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usageAndExit@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x0,%eax
je     11fd <main+0xbd>
movsbl -0x16(%rbp),%eax
cmp    $0x0,%eax
jne    1211 <main+0xd1>
cmpb   $0x0,-0x15(%rbp)
jne    121d <main+0xdd>
cmpb   $0x0,-0x16(%rbp)
jne    121d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usageAndExit@plt>
cmpb   $0x0,-0x15(%rbp)
je     1243 <main+0x103>
mov    -0x10(%rbp),%rax
mov    0x2db6(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <runServerMode@plt>
jmp    1269 <main+0x129>
cmpb   $0x0,-0x16(%rbp)
je     1264 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x2d90(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <runClientMode@plt>
jmp    1269 <main+0x129>
mov    0x2d68(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r15b
xor    %r13d,%r13d
lea    0xea3(%rip),%r14
xor    %r12d,%r12d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
je     1193 <main+0x53>
cmp    $0x63,%eax
je     1186 <main+0x46>
cmp    $0x73,%eax
je     118b <main+0x4b>
mov    (%rbx),%rdi
call   1040 <usageAndExit@plt>
jmp    1160 <main+0x20>
mov    $0x1,%r12b
jmp    1160 <main+0x20>
mov    $0x1,%r13b
xor    %r15d,%r15d
jmp    1160 <main+0x20>
mov    0x2e4e(%rip),%r14
cmp    %ebp,(%r14)
jle    11a7 <main+0x67>
mov    (%rbx),%rdi
call   1040 <usageAndExit@plt>
test   %r12b,%r12b
setne  %al
test   %al,%r13b
jne    11c1 <main+0x81>
test   %r12b,%r12b
setne  %al
or     %al,%r13b
test   $0x1,%r13b
jne    11c9 <main+0x89>
mov    (%rbx),%rdi
call   1040 <usageAndExit@plt>
test   $0x1,%r15b
je     11e2 <main+0xa2>
test   %r12b,%r12b
je     11ee <main+0xae>
movslq (%r14),%rax
mov    (%rbx,%rax,8),%rdi
call   1030 <runClientMode@plt>
jmp    11ee <main+0xae>
movslq (%r14),%rax
mov    (%rbx,%rax,8),%rdi
call   1060 <runServerMode@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"sc\00"
@optind = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %7
store i8 0, i8* %8
br label %9
9: ; preds = %23, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %18 [
i32 115, label %16
i32 99, label %17
]
16: ; preds = %14
store i8 1, i8* %7
br label %23
17: ; preds = %14
store i8 1, i8* %8
br label %23
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @usageAndExit(i8* %21)
br label %23
23: ; preds = %18, %17, %16
br label %9
24: ; preds = %9
%25 = load i32, i32* @optind
%26 = load i32, i32* %4
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @usageAndExit(i8* %31)
br label %33
33: ; preds = %28, %24
%34 = load i8, i8* %7
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %37, %33
%42 = load i8, i8* %7
%43 = icmp ne i8 %42, 0
br i1 %43, label %52, label %44
44: ; preds = %41
%45 = load i8, i8* %8
%46 = icmp ne i8 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %44, %37
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i32 @usageAndExit(i8* %50)
br label %52
52: ; preds = %47, %44, %41
%53 = load i8, i8* %7
%54 = icmp ne i8 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %52
%56 = load i8**, i8*** %5
%57 = load i32, i32* @optind
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 @runServerMode(i8* %60)
br label %73
62: ; preds = %52
%63 = load i8, i8* %8
%64 = icmp ne i8 %63, 0
br i1 %64, label %65, label %72
65: ; preds = %62
%66 = load i8**, i8*** %5
%67 = load i32, i32* @optind
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @runClientMode(i8* %70)
br label %72
72: ; preds = %65, %62
br label %73
73: ; preds = %72, %55
%74 = load i32, i32* @EXIT_SUCCESS
ret i32 %74
}

LLVM IR (-O2):
@.str = [3 x i8] c"sc\00"
@optind = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i1 [ false, %2 ], [ true, %9 ]
%5 = phi i1 [ true, %2 ], [ false, %9 ]
%6 = phi i8 [ 0, %2 ], [ %8, %9 ]
br label %7
7: ; preds = %9, %3
%8 = phi i8 [ %6, %3 ], [ 1, %9 ]
br label %9
9: ; preds = %7, %11
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %11 [
i32 -1, label %14
i32 115, label %3
i32 99, label %7
]
11: ; preds = %9
%12 = load i8*, i8** %1
%13 = tail call i32 @usageAndExit(i8* %12)
br label %9
14: ; preds = %9
%15 = load i32, i32* @optind
%16 = icmp sgt i32 %15, %0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %1
%19 = tail call i32 @usageAndExit(i8* %18)
br label %20
20: ; preds = %17, %14
%21 = icmp ne i8 %8, 0
%22 = select i1 %4, i1 %21, i1 false
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = select i1 %4, i1 true, i1 %21
br i1 %24, label %28, label %25
25: ; preds = %23, %20
%26 = load i8*, i8** %1
%27 = tail call i32 @usageAndExit(i8* %26)
br label %28
28: ; preds = %25, %23
br i1 %5, label %35, label %29
29: ; preds = %28
%30 = load i32, i32* @optind
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = tail call i32 @runServerMode(i8* %33)
br label %43
35: ; preds = %28
%36 = icmp eq i8 %8, 0
br i1 %36, label %43, label %37
37: ; preds = %35
%38 = load i32, i32* @optind
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = tail call i32 @runClientMode(i8* %41)
br label %43
43: ; preds = %35, %37, %29
%44 = load i32, i32* @EXIT_SUCCESS
ret i32 %44
}