#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*/ atoi(char *const);
int /*<<< orphan*/ client(char *const, int /*<<< orphan*/, int);
int /*<<< orphan*/ help();
int /*<<< orphan*/ server(char *const, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *const, char *);
int main(int argc, char *const *argv) {
  if (argc != 4) {
    help();
  }
  if (!strcmp(argv[1], "client")) {
    client(argv[2], atoi(argv[3]), true);
  } else if (!strcmp(argv[1], "server")) {
    server(argv[2], atoi(argv[3]));
  } else {
    help();
  }
  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)
cmpl   $0x4,-0x8(%rbp)
je     1177 <main+0x27>
mov    $0x0,%al
call   1050 <help@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <client@plt>
jmp    1214 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1208 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <server@plt>
jmp    120f <main+0xbf>
mov    $0x0,%al
call   1050 <help@plt>
jmp    1214 <main+0xc4>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x4,%edi
je     1163 <main+0x13>
xor    %eax,%eax
call   1050 <help@plt>
mov    0x8(%r14),%rbx
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1196 <main+0x46>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b4 <main+0x64>
xor    %eax,%eax
call   1050 <help@plt>
jmp    11cb <main+0x7b>
mov    0x10(%r14),%rbx
mov    0x18(%r14),%rdi
call   1060 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1070 <client@plt>
jmp    11cb <main+0x7b>
mov    0x10(%r14),%rbx
mov    0x18(%r14),%rdi
call   1060 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <server@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"client\00"
@.str.1 = [7 x i8] c"server\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @help()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 @client(i8* %13, i32 %16, i32 1)
br label %30
18: ; preds = %6
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = tail call i32 @server(i8* %23, i32 %26)
br label %30
28: ; preds = %18
%29 = tail call i32 (...) @help()
br label %30
30: ; preds = %21, %28, %11
ret i32 0
}