#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 */
typedef int /*<<< orphan*/ hostname;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ server(int);
int /*<<< orphan*/ stderr;
main(int argc, char **argv) {
  int i, aPort = 7777;
  char hostname[64];
  fprintf(stderr, "usage:%s [port] \n", argv[0]);
  if (argc > 1)
    aPort = atoi(argv[1]);
  gethostname(hostname, sizeof(hostname));
  printf("\nI will be your chat server(%s) on port %d\n\n", hostname, aPort);
  server(aPort);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1e61,-0x18(%rbp)
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6c(%rip),%rsi
call   1040 <fprintf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11b3 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x40,%esi
call   1070 <gethostname@plt>
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
call   1050 <server@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1e61,%ebx
cmp    $0x2,%ebp
jl     119a <main+0x3a>
mov    0x8(%r14),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x40,%esi
call   1070 <gethostname@plt>
lea    0xe61(%rip),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <server@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"usage:%s [port] \0A\00"
@.str.1 = [45 x i8] c"\0AI will be your chat server(%s) on port %d\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 7777, i32* %7
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %7
br label %21
21: ; preds = %16, %2
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%23 = call i32 @gethostname(i8* %22, i32 64)
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%25 = load i32, i32* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %25)
%27 = load i32, i32* %7
%28 = call i32 @server(i32 %27)
%29 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"usage:%s [port] \0A\00"
@.str.1 = [45 x i8] c"\0AI will be your chat server(%s) on port %d\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%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, %2
%14 = phi i32 [ %12, %9 ], [ 7777, %2 ]
%15 = call i32 @gethostname(i8* %4, i32 64)
%16 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %14)
%17 = call i32 @server(i32 %14)
%18 = call i32 @exit(i32 0)
unreachable
}