#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 const *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run_webserver(int);
int main(int argc, const char *argv[]) {
  int port = 8888;
  if (argc > 2) {
    printf("Usage : %s <port>\n", argv[0]);
    return 1;
  }
  if (argc == 2) {
    port = atoi(argv[1]);
  }
  run_webserver(port);
  printf("Good Bye");
  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)
movl   $0x22b8,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1178 <main+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11af <main+0x7f>
cmpl   $0x2,-0x8(%rbp)
jne    1192 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <run_webserver@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jl     114e <main+0x1e>
mov    (%rsi),%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    117a <main+0x4a>
mov    %edi,%eax
mov    $0x22b8,%edi
cmp    $0x2,%eax
jne    1165 <main+0x35>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1030 <run_webserver@plt>
lea    0xea2(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [9 x i8] c"Good Bye\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
store i32 8888, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %26
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
br label %22
22: ; preds = %17, %14
%23 = load i32, i32* %6
%24 = call i32 @run_webserver(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %26
26: ; preds = %22, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [9 x i8] c"Good Bye\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %17
7: ; preds = %2
%8 = icmp eq i32 %0, 2
br i1 %8, label %9, label %13
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
br label %13
13: ; preds = %9, %7
%14 = phi i32 [ %12, %9 ], [ 8888, %7 ]
%15 = tail call i32 @run_webserver(i32 %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %13, %4
%18 = phi i32 [ 1, %4 ], [ 0, %13 ]
ret i32 %18
}