#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 client();
int /*<<< orphan*/ printf(char *);
int server();
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("please input client/server\n");
    return 1;
  }
  if (!strcmp(argv[1], "client")) {
    return client();
  } else if (!strcmp(argv[1], "server")) {
    return server();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11dc <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a4 <main+0x64>
mov    $0x0,%al
call   1060 <client@plt>
mov    %eax,-0x4(%rbp)
jmp    11dc <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d0 <main+0x90>
mov    $0x0,%al
call   1050 <server@plt>
mov    %eax,-0x4(%rbp)
jmp    11dc <main+0x9c>
jmp    11d5 <main+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1176 <main+0x36>
mov    0x8(%rsi),%rbx
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1189 <main+0x49>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1191 <main+0x51>
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1060 <client@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <server@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"please input client/server\0A\00"
@.str.1 = [7 x i8] c"client\00"
@.str.2 = [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, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %28
10: ; preds = %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.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %10
%17 = call i32 (...) @client()
store i32 %17, i32* %3
br label %28
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %18
%25 = call i32 (...) @server()
store i32 %25, i32* %3
br label %28
26: ; preds = %18
br label %27
27: ; preds = %26
store i32 0, i32* %3
br label %28
28: ; preds = %27, %24, %16, %8
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"client\00"
@.str.2 = [7 x i8] c"server\00"
@str = [27 x i8] c"please input client/server\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %18
6: ; preds = %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.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 (...) @client()
br label %18
13: ; preds = %6
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 (...) @server()
br label %18
18: ; preds = %13, %16, %11, %4
%19 = phi i32 [ 1, %4 ], [ %17, %16 ], [ %12, %11 ], [ 0, %13 ]
ret i32 %19
}