#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int getopt(int, char **, char *);
int /*<<< orphan*/ io(char *, char *);
char *optarg;
int /*<<< orphan*/ print_usage(char *);
int main(int argc, char *argv[]) {
  char *server = NULL;
  char *port = NULL;
  if (argc == 3) {
    server = argv[1];
    port = argv[2];
  } else {
    int opt;
    while ((opt = getopt(argc, argv, "s:p:")) != -1) {
      switch (opt) {
      case 's':
        server = optarg;
        break;
      case 'p':
        port = optarg;
        break;
      }
    }
  }
  if (!server || !port) {
    print_usage(argv[0]);
    return EXIT_FAILURE;
  }
  io(server, port);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    117d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11f1 <main+0xc1>
jmp    1182 <main+0x52>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe70(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     11ec <main+0xbc>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x70,%eax
je     11d9 <main+0xa9>
jmp    11b5 <main+0x85>
mov    -0x28(%rbp),%eax
sub    $0x73,%eax
jne    11e7 <main+0xb7>
jmp    11c6 <main+0x96>
mov    0x2e2b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11e7 <main+0xb7>
mov    0x2e18(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1182 <main+0x52>
jmp    11f1 <main+0xc1>
cmpq   $0x0,-0x18(%rbp)
je     1207 <main+0xd7>
cmpq   $0x0,-0x20(%rbp)
jne    1224 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <print_usage@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    123d <main+0x10d>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <io@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1169 <main+0x39>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%r15
test   %r14,%r14
je     11a8 <main+0x78>
test   %r15,%r15
je     11a8 <main+0x78>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <io@plt>
mov    0x2e69(%rip),%rax
jmp    11b7 <main+0x87>
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xe8b(%rip),%r12
mov    0x2e7c(%rip),%r13
xor    %r15d,%r15d
nop
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <getopt@plt>
cmp    $0xffffffff,%eax
je     114b <main+0x1b>
cmp    $0x70,%eax
je     11a2 <main+0x72>
cmp    $0x73,%eax
jne    1180 <main+0x50>
mov    0x0(%r13),%r14
jmp    1180 <main+0x50>
mov    0x0(%r13),%r15
jmp    1180 <main+0x50>
mov    (%rbx),%rdi
call   1050 <print_usage@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"s:p:\00"
@optarg = global i8* null
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
store i8* %17, i8** %7
br label %32
18: ; preds = %2
br label %19
19: ; preds = %30, %18
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %22, i32* %8
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load i32, i32* %8
switch i32 %25, label %30 [
i32 115, label %26
i32 112, label %28
]
26: ; preds = %24
%27 = load i8*, i8** @optarg
store i8* %27, i8** %6
br label %30
28: ; preds = %24
%29 = load i8*, i8** @optarg
store i8* %29, i8** %7
br label %30
30: ; preds = %24, %28, %26
br label %19
31: ; preds = %19
br label %32
32: ; preds = %31, %11
%33 = load i8*, i8** %6
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i8*, i8** %7
%37 = icmp ne i8* %36, null
br i1 %37, label %44, label %38
38: ; preds = %35, %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @print_usage(i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
store i32 %43, i32* %3
br label %49
44: ; preds = %35
%45 = load i8*, i8** %6
%46 = load i8*, i8** %7
%47 = call i32 @io(i8* %45, i8* %46)
%48 = load i32, i32* @EXIT_SUCCESS
store i32 %48, i32* %3
br label %49
49: ; preds = %44, %38
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [5 x i8] c"s:p:\00"
@optarg = global i8* null
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
br label %20
9: ; preds = %16, %9
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %9 [
i32 -1, label %20
i32 115, label %11
i32 112, label %18
]
11: ; preds = %9
%12 = load i8*, i8** @optarg
br label %13
13: ; preds = %2, %11
%14 = phi i8* [ %12, %11 ], [ null, %2 ]
%15 = phi i8* [ %17, %11 ], [ null, %2 ]
br label %16
16: ; preds = %13, %18
%17 = phi i8* [ %15, %13 ], [ %19, %18 ]
br label %9
18: ; preds = %9
%19 = load i8*, i8** @optarg
br label %16
20: ; preds = %9, %4
%21 = phi i8* [ %6, %4 ], [ %14, %9 ]
%22 = phi i8* [ %8, %4 ], [ %17, %9 ]
%23 = icmp ne i8* %21, null
%24 = icmp ne i8* %22, null
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %29, label %26
26: ; preds = %20
%27 = load i8*, i8** %1
%28 = tail call i32 @print_usage(i8* %27)
br label %31
29: ; preds = %20
%30 = tail call i32 @io(i8* %21, i8* %22)
br label %31
31: ; preds = %29, %26
%32 = phi i32* [ @EXIT_SUCCESS, %29 ], [ @EXIT_FAILURE, %26 ]
%33 = load i32, i32* %32
ret i32 %33
}