#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*/ async_read(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ client_init(char *, int /*<<< orphan*/);
int /*<<< orphan*/ secure_shell(int /*<<< orphan*/);
int /*<<< orphan*/ server_init(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argv[1][0] == 'c')
    secure_shell(client_init(argv[2], atoi(argv[3])));
  else if (argv[1][0] == 's')
    secure_shell(server_init(atoi(argv[2])));
  else if (argv[1][0] == 'a')
    async_read(client_init(argv[2], atoi(argv[3])), 0);
  else if (argv[1][0] == 'b')
    async_read(server_init(atoi(argv[2])), 0);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
jne    11aa <main+0x5a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1060 <client_init@plt>
mov    %eax,%edi
call   1030 <secure_shell@plt>
jmp    1264 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    11de <main+0x8e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1040 <server_init@plt>
mov    %eax,%edi
call   1030 <secure_shell@plt>
jmp    125f <main+0x10f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jne    1224 <main+0xd4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1060 <client_init@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <async_read@plt>
jmp    125a <main+0x10a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x62,%eax
jne    1255 <main+0x105>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1040 <server_init@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <async_read@plt>
jmp    125a <main+0x10a>
jmp    125f <main+0x10f>
jmp    1264 <main+0x114>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rax
mov    (%rax),%al
add    $0x9f,%al
cmp    $0x12,%al
ja     11d4 <main+0x84>
movzbl %al,%eax
lea    0xe99(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x10(%rsi),%rbx
mov    0x18(%rsi),%rdi
call   1070 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <client_init@plt>
jmp    1199 <main+0x49>
mov    0x10(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1040 <server_init@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <async_read@plt>
jmp    11d4 <main+0x84>
mov    0x10(%rsi),%rbx
mov    0x18(%rsi),%rdi
call   1070 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <client_init@plt>
jmp    11cd <main+0x7d>
mov    0x10(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
call   1040 <server_init@plt>
mov    %eax,%edi
call   1030 <secure_shell@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 99
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 3
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = call i32 @client_init(i8* %16, i32 %20)
%22 = call i32 @secure_shell(i32 %21)
br label %74
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 115
br i1 %30, label %31, label %38
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = call i32 @server_init(i32 %35)
%37 = call i32 @secure_shell(i32 %36)
br label %73
38: ; preds = %23
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 97
br i1 %45, label %46, label %56
46: ; preds = %38
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 2
%49 = load i8*, i8** %48
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 3
%52 = load i8*, i8** %51
%53 = call i32 @atoi(i8* %52)
%54 = call i32 @client_init(i8* %49, i32 %53)
%55 = call i32 @async_read(i32 %54, i32 0)
br label %72
56: ; preds = %38
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = getelementptr inbounds i8, i8* %59, i64 0
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 98
br i1 %63, label %64, label %71
64: ; preds = %56
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 @atoi(i8* %67)
%69 = call i32 @server_init(i32 %68)
%70 = call i32 @async_read(i32 %69, i32 0)
br label %71
71: ; preds = %64, %56
br label %72
72: ; preds = %71, %46
br label %73
73: ; preds = %72, %31
br label %74
74: ; preds = %73, %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
switch i8 %5, label %34 [
i8 99, label %6
i8 115, label %14
i8 97, label %20
i8 98, label %28
]
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i32 @client_init(i8* %8, i32 %11)
%13 = tail call i32 @secure_shell(i32 %12)
br label %34
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = tail call i32 @server_init(i32 %17)
%19 = tail call i32 @secure_shell(i32 %18)
br label %34
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = tail call i32 @client_init(i8* %22, i32 %25)
%27 = tail call i32 @async_read(i32 %26, i32 0)
br label %34
28: ; preds = %2
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = tail call i32 @server_init(i32 %31)
%33 = tail call i32 @async_read(i32 %32, i32 0)
br label %34
34: ; preds = %2, %14, %28, %20, %6
ret i32 0
}