#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 atoi(char *);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ error_minor(char *);
int /*<<< orphan*/ param_err();
scalar_t__ runServer(int);
int main(int argc, char *argv[]) {
  int port;
  if (argc == 2) {
    if ((port = atoi(argv[1])) == 0)
      error("Error: Invalid port");
  } else if (argc == 2 - 1)
    port = 69;
  else
    param_err();
  if (runServer(port) != 0)
    error_minor("Error: starting error, unknown reason");
  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   $0x2,-0x8(%rbp)
jne    119a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1195 <main+0x45>
lea    0xe70(%rip),%rdi
call   1050 <error@plt>
jmp    11bc <main+0x6c>
cmpl   $0x1,-0x8(%rbp)
jne    11b0 <main+0x60>
movl   $0x45,-0x14(%rbp)
jmp    11b7 <main+0x67>
mov    $0x0,%al
call   1030 <param_err@plt>
jmp    11bc <main+0x6c>
mov    -0x14(%rbp),%edi
call   1070 <runServer@plt>
cmp    $0x0,%rax
je     11da <main+0x8a>
lea    0xe3f(%rip),%rdi
call   1040 <error_minor@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,%eax
mov    $0x45,%edi
cmp    $0x1,%eax
je     117f <main+0x2f>
cmp    $0x2,%eax
jne    1199 <main+0x49>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
test   %eax,%eax
jne    117f <main+0x2f>
lea    0xe88(%rip),%rdi
call   1050 <error@plt>
xor    %edi,%edi
call   1070 <runServer@plt>
test   %rax,%rax
je     1195 <main+0x45>
lea    0xe84(%rip),%rdi
call   1040 <error_minor@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <param_err@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Error: Invalid port\00"
@.str.1 = [38 x i8] c"Error: starting error, unknown reason\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %9
br label %25
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 69, i32* %6
br label %24
22: ; preds = %18
%23 = call i32 (...) @param_err()
br label %24
24: ; preds = %22, %21
br label %25
25: ; preds = %24, %17
%26 = load i32, i32* %6
%27 = call i64 @runServer(i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @error_minor(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Error: Invalid port\00"
@.str.1 = [38 x i8] c"Error: starting error, unknown reason\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %10 [
i32 2, label %3
i32 1, label %12
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = tail call i32 (...) @param_err()
unreachable
12: ; preds = %2, %3, %8
%13 = phi i32 [ 0, %8 ], [ %6, %3 ], [ 69, %2 ]
%14 = tail call i64 @runServer(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @error_minor(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
ret i32 0
}