#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 /*<<< orphan*/ chatUser(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ stderr;
main(int argc, char *argv[]) {
  int i, aPort = 7777;
  char hostname[64];
  if (argc != 2) {
    fprintf(stderr, "Client-Usage: %s the_client_hostname\n", argv[0]);
    exit(1);
  }
  gethostname(hostname, sizeof(hostname));
  printf("\nStarting chat session: host(%s) port(%d)\n", hostname, aPort);
  chatUser(hostname, 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)
cmpl   $0x2,-0x8(%rbp)
je     119d <main+0x4d>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe72(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x60(%rbp),%rdi
mov    $0x40,%esi
call   1060 <gethostname@plt>
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <chatUser@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
cmp    $0x2,%edi
jne    1192 <main+0x42>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1060 <gethostname@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1e61,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e61,%esi
call   1050 <chatUser@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe5b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Client-Usage: %s the_client_hostname\0A\00"
@.str.1 = [43 x i8] c"\0AStarting chat session: host(%s) port(%d)\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* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%20 = call i32 @gethostname(i8* %19, i32 64)
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %22)
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%25 = load i32, i32* %7
%26 = call i32 @chatUser(i8* %24, i32 %25)
%27 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Client-Usage: %s the_client_hostname\0A\00"
@.str.1 = [43 x i8] c"\0AStarting chat session: host(%s) port(%d)\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 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = call i32 @gethostname(i8* %4, i32 64)
%13 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 7777)
%14 = call i32 @chatUser(i8* %4, i32 7777)
%15 = call i32 @exit(i32 0)
unreachable
}