#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 do_client(char **);
int do_help(char **);
int do_server(char **);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *mode = argv[4];
  if (argc != 5)
    return do_help(argv);
  if (!strcmp(mode, "-l"))
    return do_server(argv);
  else if (!strcmp(mode, "-s"))
    return do_client(argv);
  else
    return do_help(argv);
}


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    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     117d <main+0x3d>
mov    -0x10(%rbp),%rdi
call   1060 <do_help@plt>
mov    %eax,-0x4(%rbp)
jmp    11dd <main+0x9d>
mov    -0x18(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a7 <main+0x67>
mov    -0x10(%rbp),%rdi
call   1050 <do_server@plt>
mov    %eax,-0x4(%rbp)
jmp    11dd <main+0x9d>
mov    -0x18(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d1 <main+0x91>
mov    -0x10(%rbp),%rdi
call   1030 <do_client@plt>
mov    %eax,-0x4(%rbp)
jmp    11dd <main+0x9d>
mov    -0x10(%rbp),%rdi
call   1060 <do_help@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x5,%edi
jne    1176 <main+0x36>
mov    0x20(%rbx),%r14
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1185 <main+0x45>
lea    0xe99(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1194 <main+0x54>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <do_help@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <do_server@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <do_client@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 4
%9 = load i8*, i8** %8
store i8* %9, i8** %6
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 5
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = call i32 @do_help(i8** %13)
store i32 %14, i32* %3
br label %32
15: ; preds = %2
%16 = load i8*, i8** %6
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = call i32 @do_server(i8** %20)
store i32 %21, i32* %3
br label %32
22: ; preds = %15
%23 = load i8*, i8** %6
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = call i32 @do_client(i8** %27)
store i32 %28, i32* %3
br label %32
29: ; preds = %22
%30 = load i8**, i8*** %5
%31 = call i32 @do_help(i8** %30)
store i32 %31, i32* %3
br label %32
32: ; preds = %29, %26, %19, %12
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 4
%4 = load i8*, i8** %3
%5 = icmp eq i32 %0, 5
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @do_help(i8** %1)
br label %20
8: ; preds = %2
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @do_server(i8** %1)
br label %20
13: ; preds = %8
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @do_client(i8** %1)
br label %20
18: ; preds = %13
%19 = tail call i32 @do_help(i8** %1)
br label %20
20: ; preds = %18, %16, %11, %6
%21 = phi i32 [ %7, %6 ], [ %19, %18 ], [ %17, %16 ], [ %12, %11 ]
ret i32 %21
}