#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*/ DisplayUsage(char *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ clientMode();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(int);
scalar_t__ opterr;
int optopt;
int /*<<< orphan*/ serverMode();
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int c;
  char sflag = 0;
  char cflag = 0;
  opterr = 0;
  while ((c = getopt(argc, argv, "sc")) != -1) {
    switch (c) {
    case 's':
      sflag = 1;
      break;
    case 'c':
      cflag = 1;
      break;
    case '?':
      if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      return 1;
    default:
      abort();
    }
  }
  if (argc == 1)
    DisplayUsage(argv[0]);
  else {
    if (sflag) {
      serverMode();
    } else if (cflag) {
      clientMode();
    }
  }
  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   $0x0,-0x15(%rbp)
movb   $0x0,-0x16(%rbp)
mov    0x2e3b(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe56(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1273 <main+0x103>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x3f,%eax
je     1203 <main+0x93>
jmp    11cf <main+0x5f>
mov    -0x1c(%rbp),%eax
sub    $0x63,%eax
je     11fa <main+0x8a>
jmp    11e0 <main+0x70>
mov    -0x1c(%rbp),%eax
sub    $0x73,%eax
jne    1267 <main+0xf7>
jmp    11f1 <main+0x81>
movb   $0x1,-0x15(%rbp)
jmp    126e <main+0xfe>
movb   $0x1,-0x16(%rbp)
jmp    126e <main+0xfe>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
call   1050 <isprint@plt>
cmp    $0x0,%eax
je     123d <main+0xcd>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    0x2dbe(%rip),%rax
mov    (%rax),%edx
lea    0xdd0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    125b <main+0xeb>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
mov    0x2d9b(%rip),%rax
mov    (%rax),%edx
lea    0xdc4(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c6 <main+0x156>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    119c <main+0x2c>
cmpl   $0x1,-0x8(%rbp)
jne    128e <main+0x11e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <DisplayUsage@plt>
jmp    12bf <main+0x14f>
cmpb   $0x0,-0x15(%rbp)
je     12a4 <main+0x134>
mov    $0x0,%al
call   1070 <serverMode@plt>
jmp    12ba <main+0x14a>
cmpb   $0x0,-0x16(%rbp)
je     12b5 <main+0x145>
mov    $0x0,%al
call   1080 <clientMode@plt>
jmp    12ba <main+0x14a>
jmp    12bf <main+0x14f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x2e4c(%rip),%rax
movq   $0x0,(%rax)
mov    $0x1,%r12b
xor    %ebx,%ebx
lea    0xe69(%rip),%r14
mov    %ebx,%ecx
nopl   0x0(%rax)
mov    %ecx,%ebx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
mov    $0x1,%cl
cmp    $0x63,%eax
je     11a0 <main+0x30>
cmp    $0xffffffff,%eax
je     11f0 <main+0x80>
cmp    $0x73,%eax
jne    11c5 <main+0x55>
xor    %r12d,%r12d
jmp    1197 <main+0x27>
cmp    $0x3f,%eax
jne    123f <main+0xcf>
mov    0x2e17(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1050 <isprint@plt>
mov    0x2df7(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
je     1216 <main+0xa6>
lea    0xe15(%rip),%rsi
jmp    121d <main+0xad>
cmp    $0x1,%ebp
jne    1201 <main+0x91>
mov    (%r15),%rdi
call   1090 <DisplayUsage@plt>
xor    %ebx,%ebx
jmp    1234 <main+0xc4>
test   $0x1,%r12b
je     122b <main+0xbb>
test   %bl,%bl
je     11fd <main+0x8d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <clientMode@plt>
jmp    1234 <main+0xc4>
lea    0xdfd(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    $0x1,%ebx
jmp    1234 <main+0xc4>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <serverMode@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [3 x i8] c"sc\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.2 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
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
store i64 0, i64* @opterr
br label %9
9: ; preds = %33, %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 %34
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %31 [
i32 115, label %16
i32 99, label %17
i32 63, label %18
]
16: ; preds = %14
store i8 1, i8* %7
br label %33
17: ; preds = %14
store i8 1, i8* %8
br label %33
18: ; preds = %14
%19 = load i32, i32* @optopt
%20 = call i32 @isprint(i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = load i32, i32* @optopt
%25 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %30
26: ; preds = %18
%27 = load i32, i32* @stderr
%28 = load i32, i32* @optopt
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %26, %22
store i32 1, i32* %3
br label %55
31: ; preds = %14
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %17, %16
br label %9
34: ; preds = %9
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @DisplayUsage(i8* %40)
br label %54
42: ; preds = %34
%43 = load i8, i8* %7
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (...) @serverMode()
br label %53
47: ; preds = %42
%48 = load i8, i8* %8
%49 = icmp ne i8 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (...) @clientMode()
br label %52
52: ; preds = %50, %47
br label %53
53: ; preds = %52, %45
br label %54
54: ; preds = %53, %37
store i32 0, i32* %3
br label %55
55: ; preds = %54, %30
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [3 x i8] c"sc\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.2 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
br label %3
3: ; preds = %6, %2
%4 = phi i1 [ true, %2 ], [ false, %6 ]
%5 = phi i8 [ 0, %2 ], [ %7, %6 ]
br label %6
6: ; preds = %6, %3
%7 = phi i8 [ %5, %3 ], [ 1, %6 ]
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %18 [
i32 -1, label %20
i32 115, label %3
i32 99, label %6
i32 63, label %9
]
9: ; preds = %6
%10 = load i32, i32* @optopt
%11 = tail call i32 @isprint(i32 %10)
%12 = icmp eq i32 %11, 0
%13 = load i32, i32* @stderr
br i1 %12, label %16, label %14
14: ; preds = %9
%15 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %32
16: ; preds = %9
%17 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %32
18: ; preds = %6
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %6
%21 = icmp eq i32 %0, 1
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i8*, i8** %1
%24 = tail call i32 @DisplayUsage(i8* %23)
br label %32
25: ; preds = %20
br i1 %4, label %28, label %26
26: ; preds = %25
%27 = tail call i32 (...) @serverMode()
br label %32
28: ; preds = %25
%29 = icmp eq i8 %7, 0
br i1 %29, label %32, label %30
30: ; preds = %28
%31 = tail call i32 (...) @clientMode()
br label %32
32: ; preds = %22, %28, %30, %26, %14, %16
%33 = phi i32 [ 1, %16 ], [ 1, %14 ], [ 0, %26 ], [ 0, %30 ], [ 0, %28 ], [ 0, %22 ]
ret i32 %33
}