#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
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 /*<<< orphan*/ asctime(struct tm *);
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);
struct tm *localtime(int /*<<< orphan*/ *);
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 *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, scalar_t__);
int main(int argc, char *argv[]) {
  time_t timer;
  struct tm *local;
  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");
    timer = time(NULL);
    local = localtime(&timer);
    strcpy(pBuffer, asctime(local));
    printf("\nSending Current time to client");
    write(hSocket, pBuffer, strlen(pBuffer) + 1);
    read(hSocket, pBuffer, 100);
    if (strcmp(pBuffer, asctime(local)) == 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    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x44(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1264 <main+0x44>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    154f <main+0x32f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0xb4(%rbp)
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
mov    0x2d2d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    12d3 <main+0xb3>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    154f <main+0x32f>
mov    0x2d06(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0xb4(%rbp),%edi
call   1080 <htons@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0xb4(%rbp),%esi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
cmp    $0xffffffff,%eax
jne    1341 <main+0x121>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    154f <main+0x32f>
mov    -0x28(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   1120 <getsockname@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0x3c(%rbp),%edi
call   10f0 <ntohs@plt>
mov    -0xc0(%rbp),%esi
mov    %eax,%edx
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x3c(%rbp),%edi
call   10f0 <ntohs@plt>
mov    -0xbc(%rbp),%esi
mov    -0xb8(%rbp),%edx
mov    %eax,%ecx
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xd44(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
cmp    $0xffffffff,%eax
jne    13f1 <main+0x1d1>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    154f <main+0x32f>
jmp    13f6 <main+0x1d6>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x24(%rbp)
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <asctime@plt>
mov    -0xe0(%rbp),%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0xd4(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    -0xb0(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xd4(%rbp),%edi
mov    -0xd0(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <write@plt>
mov    -0x24(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x64,%edx
call   10b0 <read@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <asctime@plt>
mov    -0xc8(%rbp),%rdi
mov    %eax,%esi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1503 <main+0x2e3>
lea    0xc88(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1511 <main+0x2f1>
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
cmp    $0xffffffff,%eax
jne    154a <main+0x32a>
lea    0xc96(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    154f <main+0x32f>
jmp    13f6 <main+0x1d6>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movl   $0xc,0x18(%rsp)
cmp    $0x1,%edi
jg     125a <main+0x2a>
lea    0xf72(%rip),%rdi
jmp    1474 <main+0x244>
mov    0x8(%rsi),%rdi
call   1140 <atoi@plt>
mov    %eax,%ebp
lea    0xd94(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0xd97(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2d60(%rip),%r14
mov    (%r14),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
cmp    $0xffffffff,%eax
je     145b <main+0x22b>
mov    %eax,%ebx
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %ebp,%edi
call   1090 <htons@plt>
mov    %eax,0xc(%rsp)
mov    (%r14),%eax
mov    %eax,0x8(%rsp)
lea    0xd54(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   1110 <bind@plt>
cmp    $0xffffffff,%eax
je     1464 <main+0x234>
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    %ebx,%edi
call   1130 <getsockname@plt>
mov    0xc(%rsp),%edi
call   1100 <ntohs@plt>
lea    0xd24(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x10(%rsp),%r14d
mov    0x8(%rsp),%ebp
mov    0xc(%rsp),%edi
call   1100 <ntohs@plt>
lea    0xd36(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0xd60(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   10f0 <listen@plt>
cmp    $0xffffffff,%eax
je     146d <main+0x23d>
lea    0x20(%rsp),%r14
lea    0xd9f(%rip),%r15
lea    0xdbe(%rip),%r12
nopl   (%rax)
lea    0xdc8(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
call   1120 <accept@plt>
mov    %eax,%r13d
lea    0xd28(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %edi,%edi
call   10e0 <time@plt>
mov    %eax,0x1c(%rsp)
lea    0x1c(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <asctime@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
lea    0xd02(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r14,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r13d,%edi
mov    %r14,%rsi
call   1060 <write@plt>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x64,%edx
call   10c0 <read@plt>
mov    %rbp,%rdi
call   1080 <asctime@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   10d0 <strcmp@plt>
test   %rax,%rax
mov    %r15,%rdi
lea    0xcd5(%rip),%rax
cmove  %rax,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r13d,%edi
call   10b0 <close@plt>
cmp    $0xffffffff,%eax
jne    1380 <main+0x150>
lea    0xd10(%rip),%rdi
jmp    1474 <main+0x244>
lea    0xd4c(%rip),%rdi
jmp    1474 <main+0x244>
lea    0xd28(%rip),%rdi
jmp    1474 <main+0x244>
lea    0xd0d(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
%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 = [63 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 = [32 x i8] c"\0ASending Current time to client\00"
@.str.13 = [20 x i8] c"\0AThe messages match\00"
@.str.14 = [38 x i8] c"\0ASomething was changed in the message\00"
@.str.15 = [20 x i8] c"\0AClosing the socket\00"
@.str.16 = [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 %struct.tm*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.hostent*
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca [100 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 12, i32* %12
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = 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 %115
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %14
br label %24
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = call i32 @socket(i32 %27, i32 %28, i32 0)
store i32 %29, i32* %9
%30 = load i32, i32* %9
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = 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 %115
34: ; preds = %24
%35 = load i32, i32* @INADDR_ANY
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 0
store i32 %35, i32* %37
%38 = load i32, i32* %14
%39 = call i32 @htons(i32 %38)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i32 %39, i32* %40
%41 = load i32, i32* @AF_INET
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %41, i32* %42
%43 = load i32, i32* %14
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %9
%46 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%47 = call i32 @bind(i32 %45, %struct.sockaddr* %46, i32 12)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %34
%50 = 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 %115
51: ; preds = %34
%52 = load i32, i32* %9
%53 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%54 = call i32 @getsockname(i32 %52, %struct.sockaddr* %53, i32* %12)
%55 = load i32, i32* %9
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%57 = load i32, i32* %56
%58 = call i32 @ntohs(i32 %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %55, i32 %58)
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
%63 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %62, i32 0, i32 0
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%66 = load i32, i32* %65
%67 = call i32 @ntohs(i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0), i32 %61, i32 %64, i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 5)
%70 = load i32, i32* %9
%71 = call i32 @listen(i32 %70, i32 5)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %51
%74 = 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 %115
75: ; preds = %51
br label %76
76: ; preds = %114, %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%78 = load i32, i32* %9
%79 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%80 = call i32 @accept(i32 %78, %struct.sockaddr* %79, i32* %12)
store i32 %80, i32* %8
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%82 = call i32 @time(i32* null)
store i32 %82, i32* %6
%83 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %83, %struct.tm** %7
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%85 = load %struct.tm*, %struct.tm** %7
%86 = call i32 @asctime(%struct.tm* %85)
%87 = call i32 @strcpy(i8* %84, i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
%89 = load i32, i32* %8
%90 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%92 = call i64 @strlen(i8* %91)
%93 = add nsw i64 %92, 1
%94 = call i32 @write(i32 %89, i8* %90, i64 %93)
%95 = load i32, i32* %8
%96 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%97 = call i32 @read(i32 %95, i8* %96, i32 100)
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%99 = load %struct.tm*, %struct.tm** %7
%100 = call i32 @asctime(%struct.tm* %99)
%101 = call i64 @strcmp(i8* %98, i32 %100)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %76
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %107
105: ; preds = %76
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
br label %107
107: ; preds = %105, %103
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
%109 = load i32, i32* %8
%110 = call i32 @close(i32 %109)
%111 = icmp eq i32 %110, -1
br i1 %111, label %112, label %114
112: ; preds = %107
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0))
store i32 0, i32* %3
br label %115
114: ; preds = %107
br label %76
115: ; preds = %112, %73, %49, %32, %17
%116 = load i32, i32* %3
ret i32 %116
}

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 }
%struct.tm = 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 = [63 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 = [32 x i8] c"\0ASending Current time to client\00"
@.str.13 = [20 x i8] c"\0AThe messages match\00"
@.str.14 = [38 x i8] c"\0ASomething was changed in the message\00"
@.str.15 = [20 x i8] c"\0AClosing the socket\00"
@str = [26 x i8] c"\0AWaiting for a connection\00"
@str.17 = [24 x i8] c"\0ACould not close socket\00"
@str.18 = [18 x i8] c"\0ACould not listen\00"
@str.19 = [27 x i8] c"\0ACould not connect to host\00"
@str.20 = [25 x i8] c"\0ACould not make a socket\00"
@str.21 = [25 x i8] c"\0AUsage: server host-port\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast i32* %5 to i8*
store i32 12, i32* %5
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = icmp slt i32 %0, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %77
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = tail call i32 @socket(i32 %20, i32 %21, i32 0)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %14
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.20, i64 0, i64 0))
br label %77
26: ; preds = %14
%27 = load i32, i32* @INADDR_ANY
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2, i32 0
store i32 %27, i32* %28
%29 = tail call i32 @htons(i32 %17)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %29, i32* %30
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %31, i32* %32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%34 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%35 = call i32 @bind(i32 %22, %struct.sockaddr* %34, i32 12)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %39
37: ; preds = %26
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.19, i64 0, i64 0))
br label %77
39: ; preds = %26
%40 = call i32 @getsockname(i32 %22, %struct.sockaddr* %34, i32* %5)
%41 = load i32, i32* %30
%42 = call i32 @ntohs(i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i32 %22, i32 %42)
%44 = load i32, i32* %32
%45 = load i32, i32* %28
%46 = load i32, i32* %30
%47 = call i32 @ntohs(i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0), i32 %44, i32 %45, i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 5)
%50 = call i32 @listen(i32 %22, i32 5)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %54
52: ; preds = %39
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.18, i64 0, i64 0))
br label %77
54: ; preds = %39, %54
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%56 = call i32 @accept(i32 %22, %struct.sockaddr* %34, i32* %5)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%58 = call i32 @time(i32* null)
store i32 %58, i32* %3
%59 = call %struct.tm* @localtime(i32* %3)
%60 = call i32 @asctime(%struct.tm* %59)
%61 = call i32 @strcpy(i8* %10, i32 %60)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
%63 = call i64 @strlen(i8* %10)
%64 = add nsw i64 %63, 1
%65 = call i32 @write(i32 %56, i8* %10, i64 %64)
%66 = call i32 @read(i32 %56, i8* %10, i32 100)
%67 = call i32 @asctime(%struct.tm* %59)
%68 = call i64 @strcmp(i8* %10, i32 %67)
%69 = icmp eq i64 %68, 0
%70 = select i1 %69, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
%73 = call i32 @close(i32 %56)
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %54
75: ; preds = %54
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.17, i64 0, i64 0))
br label %77
77: ; preds = %75, %52, %37, %24, %12
ret i32 0
}