#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int s_addr;
};
struct sockaddr_in {
  int sin_family;
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int dummy;
};
typedef int /*<<< orphan*/ Address;

/* Variables and functions */
int AF_INET;
int INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int bind(int, struct sockaddr *, int);
int close(int);
int /*<<< orphan*/ getsockname(int, struct sockaddr *, int *);
int /*<<< orphan*/ htons(int);
int listen(int, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int socket(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ write(int, char *, scalar_t__);
int main(int argc, char *argv[]) {
  int hSocket, hServerSocket;
  struct hostent *pHostInfo;
  struct sockaddr_in Address;
  int nAddressSize = sizeof(struct sockaddr_in);
  char pBuffer[100];
  int nHostPort;
  if (argc < 2) {
    printf("\nUsage: server host-port\n");
    return 0;
  } else {
    nHostPort = atoi(argv[1]);
  }
  printf("\nStarting server");
  printf("\nMaking socket");
  hServerSocket = socket(AF_INET, SOCK_STREAM, 0);
  if (hServerSocket == -1) {
    printf("\nCould not make a socket\n");
    return 0;
  }
  Address.sin_addr.s_addr = INADDR_ANY;
  Address.sin_port = htons(nHostPort);
  Address.sin_family = AF_INET;
  printf("\nBinding to port %d", nHostPort);
  if (bind(hServerSocket, (struct sockaddr *)&Address, sizeof(Address)) == -1) {
    printf("\nCould not connect to host\n");
    return 0;
  }
  getsockname(hServerSocket, (struct sockaddr *)&Address, (int *)&nAddressSize);
  printf("opened socket as fd (%d) on port (%d) for stream i/o\n",
         hServerSocket, ntohs(Address.sin_port));
  printf("Server\n              sin_family        = %d\n              "
         "sin_addr.s_addr   = %d\n              sin_port          = %d\n",
         Address.sin_family, Address.sin_addr.s_addr, ntohs(Address.sin_port));
  printf("\nMaking a listen queue of %d elements", 5);
  if (listen(hServerSocket, 5) == -1) {
    printf("\nCould not listen\n");
    return 0;
  }
  for (;;) {
    printf("\nWaiting for a connection\n");
    hSocket = accept(hServerSocket, (struct sockaddr *)&Address, &nAddressSize);
    printf("\nGot a connection");
    strcpy(pBuffer, "This is the message I'm sending back and forth");
    printf("\nSending \"%s\" to client", pBuffer);
    write(hSocket, pBuffer, strlen(pBuffer) + 1);
    read(hSocket, pBuffer, 100);
    if (strcmp(pBuffer, "This is the message I'm sending back and forth") == 0)
      printf("\nThe messages match");
    else
      printf("\nSomething was changed in the message");
    printf("\nClosing the socket");
    if (close(hSocket) == -1) {
      printf("\nCould not close socket\n");
      return 0;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x34(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1234 <main+0x44>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x2f9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0xa4(%rbp)
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
mov    0x2d5d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    12a3 <main+0xb3>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x2f9>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0xa4(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2d24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0xa4(%rbp),%esi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1311 <main+0x121>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x2f9>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10f0 <getsockname@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0x2c(%rbp),%edi
call   10c0 <ntohs@plt>
mov    -0xb0(%rbp),%esi
mov    %eax,%edx
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x2c(%rbp),%edi
call   10c0 <ntohs@plt>
mov    -0xac(%rbp),%esi
mov    -0xa8(%rbp),%edx
mov    %eax,%ecx
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdac(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
jne    13c1 <main+0x1d1>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x2f9>
jmp    13c6 <main+0x1d6>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x14(%rbp)
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    0xd94(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xa0(%rbp),%rsi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xbc(%rbp),%edi
mov    -0xb8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1040 <write@plt>
mov    -0x14(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x64,%edx
call   1090 <read@plt>
lea    -0xa0(%rbp),%rdi
lea    0xd1c(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    149d <main+0x2ad>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    14ab <main+0x2bb>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    14e4 <main+0x2f4>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e9 <main+0x2f9>
jmp    13c6 <main+0x1d6>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movl   $0xc,0xc(%rsp)
cmp    $0x1,%edi
jg     1227 <main+0x27>
lea    0x1004(%rip),%rdi
jmp    141f <main+0x21f>
mov    0x8(%rsi),%rdi
call   1110 <atoi@plt>
mov    %eax,%ebp
lea    0xdc7(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdca(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2d93(%rip),%r14
mov    (%r14),%edi
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
cmp    $0xffffffff,%eax
je     1406 <main+0x206>
mov    %eax,%ebx
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    %ebp,%edi
call   1070 <htons@plt>
mov    %eax,0x4(%rsp)
mov    (%r14),%eax
mov    %eax,(%rsp)
lea    0xd88(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
je     140f <main+0x20f>
mov    %rsp,%rsi
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
call   1100 <getsockname@plt>
mov    0x4(%rsp),%edi
call   10d0 <ntohs@plt>
lea    0xd5c(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%r14d
mov    (%rsp),%ebp
mov    0x4(%rsp),%edi
call   10d0 <ntohs@plt>
lea    0xd6f(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdd1(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
je     1418 <main+0x218>
lea    0xde1(%rip),%rbp
lea    0x10(%rsp),%r14
lea    0xe30(%rip),%r15
lea    0xe4f(%rip),%r12
nopl   0x0(%rax,%rax,1)
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
mov    %rsp,%rsi
lea    0xc(%rsp),%rdx
call   10f0 <accept@plt>
mov    %eax,%r13d
lea    0xd92(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0xdba(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r13d,%edi
mov    %r14,%rsi
call   1050 <write@plt>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x64,%edx
call   10a0 <read@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
mov    %r15,%rdi
lea    0xd89(%rip),%rax
cmove  %rax,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13d,%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    1350 <main+0x150>
lea    0xdc4(%rip),%rdi
jmp    141f <main+0x21f>
lea    0xe00(%rip),%rdi
jmp    141f <main+0x21f>
lea    0xddc(%rip),%rdi
jmp    141f <main+0x21f>
lea    0xdc1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [26 x i8] c"\0AUsage: server host-port\0A\00"
@.str.1 = [17 x i8] c"\0AStarting server\00"
@.str.2 = [15 x i8] c"\0AMaking socket\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [26 x i8] c"\0ACould not make a socket\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [20 x i8] c"\0ABinding to port %d\00"
@.str.5 = [28 x i8] c"\0ACould not connect to host\0A\00"
@.str.6 = [54 x i8] c"opened socket as fd (%d) on port (%d) for stream i/o\0A\00"
@.str.7 = [119 x i8] c"Server\0A sin_family = %d\0A sin_addr.s_addr = %d\0A sin_port = %d\0A\00"
@.str.8 = [38 x i8] c"\0AMaking a listen queue of %d elements\00"
@.str.9 = [19 x i8] c"\0ACould not listen\0A\00"
@.str.10 = [27 x i8] c"\0AWaiting for a connection\0A\00"
@.str.11 = [18 x i8] c"\0AGot a connection\00"
@.str.12 = [47 x i8] c"This is the message I'm sending back and forth\00"
@.str.13 = [24 x i8] c"\0ASending \22%s\22 to client\00"
@.str.14 = [20 x i8] c"\0AThe messages match\00"
@.str.15 = [38 x i8] c"\0ASomething was changed in the message\00"
@.str.16 = [20 x i8] c"\0AClosing the socket\00"
@.str.17 = [25 x i8] c"\0ACould not close socket\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 %struct.hostent*
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca [100 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 12, i32* %10
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %108
17: ; preds = %2
%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* %12
br label %22
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %108
32: ; preds = %22
%33 = load i32, i32* @INADDR_ANY
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%35 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %34, i32 0, i32 0
store i32 %33, i32* %35
%36 = load i32, i32* %12
%37 = call i32 @htons(i32 %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %37, i32* %38
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %39, i32* %40
%41 = load i32, i32* %12
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %7
%44 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%45 = call i32 @bind(i32 %43, %struct.sockaddr* %44, i32 12)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %49
47: ; preds = %32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %108
49: ; preds = %32
%50 = load i32, i32* %7
%51 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%52 = call i32 @getsockname(i32 %50, %struct.sockaddr* %51, i32* %10)
%53 = load i32, i32* %7
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%55 = load i32, i32* %54
%56 = call i32 @ntohs(i32 %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %53, i32 %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%59 = load i32, i32* %58
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%61 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %60, i32 0, i32 0
%62 = load i32, i32* %61
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%64 = load i32, i32* %63
%65 = call i32 @ntohs(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.7, i64 0, i64 0), i32 %59, i32 %62, i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 5)
%68 = load i32, i32* %7
%69 = call i32 @listen(i32 %68, i32 5)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %73
71: ; preds = %49
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %108
73: ; preds = %49
br label %74
74: ; preds = %107, %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%76 = load i32, i32* %7
%77 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%78 = call i32 @accept(i32 %76, %struct.sockaddr* %77, i32* %10)
store i32 %78, i32* %6
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%81 = call i32 @strcpy(i8* %80, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %82)
%84 = load i32, i32* %6
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%86 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%87 = call i64 @strlen(i8* %86)
%88 = add nsw i64 %87, 1
%89 = call i32 @write(i32 %84, i8* %85, i64 %88)
%90 = load i32, i32* %6
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%92 = call i32 @read(i32 %90, i8* %91, i32 100)
%93 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %74
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
br label %100
98: ; preds = %74
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.15, i64 0, i64 0))
br label %100
100: ; preds = %98, %96
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%102 = load i32, i32* %6
%103 = call i32 @close(i32 %102)
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %107
105: ; preds = %100
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %3
br label %108
107: ; preds = %100
br label %74
108: ; preds = %105, %71, %47, %30, %15
%109 = load i32, i32* %3
ret i32 %109
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@.str.1 = [17 x i8] c"\0AStarting server\00"
@.str.2 = [15 x i8] c"\0AMaking socket\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [20 x i8] c"\0ABinding to port %d\00"
@.str.6 = [54 x i8] c"opened socket as fd (%d) on port (%d) for stream i/o\0A\00"
@.str.7 = [119 x i8] c"Server\0A sin_family = %d\0A sin_addr.s_addr = %d\0A sin_port = %d\0A\00"
@.str.8 = [38 x i8] c"\0AMaking a listen queue of %d elements\00"
@.str.11 = [18 x i8] c"\0AGot a connection\00"
@.str.12 = [47 x i8] c"This is the message I'm sending back and forth\00"
@.str.13 = [24 x i8] c"\0ASending \22%s\22 to client\00"
@.str.14 = [20 x i8] c"\0AThe messages match\00"
@.str.15 = [38 x i8] c"\0ASomething was changed in the message\00"
@.str.16 = [20 x i8] c"\0AClosing the socket\00"
@str = [26 x i8] c"\0AWaiting for a connection\00"
@str.18 = [24 x i8] c"\0ACould not close socket\00"
@str.19 = [18 x i8] c"\0ACould not listen\00"
@str.20 = [27 x i8] c"\0ACould not connect to host\00"
@str.21 = [25 x i8] c"\0ACould not make a socket\00"
@str.22 = [25 x i8] c"\0AUsage: server host-port\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 12, i32* %4
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
br label %71
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %12
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %71
24: ; preds = %12
%25 = load i32, i32* @INADDR_ANY
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2, i32 0
store i32 %25, i32* %26
%27 = tail call i32 @htons(i32 %15)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %27, i32* %28
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %29, i32* %30
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%32 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%33 = call i32 @bind(i32 %20, %struct.sockaddr* %32, i32 12)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %24
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.20, i64 0, i64 0))
br label %71
37: ; preds = %24
%38 = call i32 @getsockname(i32 %20, %struct.sockaddr* %32, i32* %4)
%39 = load i32, i32* %28
%40 = call i32 @ntohs(i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %20, i32 %40)
%42 = load i32, i32* %30
%43 = load i32, i32* %26
%44 = load i32, i32* %28
%45 = call i32 @ntohs(i32 %44)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @.str.7, i64 0, i64 0), i32 %42, i32 %43, i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 5)
%48 = call i32 @listen(i32 %20, i32 5)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %37
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.19, i64 0, i64 0))
br label %71
52: ; preds = %37, %52
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%54 = call i32 @accept(i32 %20, %struct.sockaddr* %32, i32* %4)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%56 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %8)
%58 = call i64 @strlen(i8* %8)
%59 = add nsw i64 %58, 1
%60 = call i32 @write(i32 %54, i8* %8, i64 %59)
%61 = call i32 @read(i32 %54, i8* %8, i32 100)
%62 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
%64 = select i1 %63, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.15, i64 0, i64 0)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%67 = call i32 @close(i32 %54)
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %52
69: ; preds = %52
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.18, i64 0, i64 0))
br label %71
71: ; preds = %69, %50, %35, %22, %10
ret i32 0
}