#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*/ client_run();
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ server_run();
int main(int argc, char *argv[]) {
  int opt;
  char role = 's';
  while ((opt = getopt(argc, argv, "cs")) != -1) {
    switch (opt) {
    case 'c':
      role = 'c';
      break;
    case 's':
      break;
    default:
      printf("usage: %s [-cs]\n", argv[0]);
      exit(1);
    }
  }
  if (role == 's') {
    server_run();
  } else {
    client_run();
  }
  return 0;
}


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   $0x73,-0x15(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11de <main+0x8e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x63,%eax
je     11ae <main+0x5e>
jmp    119d <main+0x4d>
mov    -0x1c(%rbp),%eax
sub    $0x73,%eax
je     11b7 <main+0x67>
jmp    11bc <main+0x6c>
movb   $0x63,-0x15(%rbp)
jmp    11d9 <main+0x89>
jmp    11d9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    116a <main+0x1a>
movsbl -0x15(%rbp),%eax
cmp    $0x73,%eax
jne    11f7 <main+0xa7>
mov    $0x0,%al
call   1050 <server_run@plt>
jmp    11fe <main+0xae>
mov    $0x0,%al
call   1030 <client_run@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r15b
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0x73,%eax
je     1170 <main+0x20>
cmp    $0xffffffff,%eax
je     1191 <main+0x41>
cmp    $0x63,%eax
jne    11b2 <main+0x62>
xor    %r15d,%r15d
jmp    1170 <main+0x20>
xor    %eax,%eax
test   $0x1,%r15b
je     11a0 <main+0x50>
call   1050 <server_run@plt>
jmp    11a5 <main+0x55>
call   1030 <client_run@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"cs\00"
@.str.1 = [17 x i8] c"usage: %s [-cs]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 115, i8* %7
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %17 [
i32 99, label %15
i32 115, label %16
]
15: ; preds = %13
store i8 99, i8* %7
br label %23
16: ; preds = %13
br label %23
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16, %15
br label %8
24: ; preds = %8
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 115
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (...) @server_run()
br label %32
30: ; preds = %24
%31 = call i32 (...) @client_run()
br label %32
32: ; preds = %30, %28
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"cs\00"
@.str.1 = [17 x i8] c"usage: %s [-cs]\0A\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i1 [ true, %2 ], [ false, %5 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %7 [
i32 -1, label %11
i32 99, label %3
i32 115, label %5
]
7: ; preds = %5
%8 = load i8*, i8** %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %5
br i1 %4, label %12, label %14
12: ; preds = %11
%13 = tail call i32 (...) @server_run()
br label %16
14: ; preds = %11
%15 = tail call i32 (...) @client_run()
br label %16
16: ; preds = %14, %12
ret i32 0
}