#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__ {
  void *s_addr;
};
struct sockaddr_in {
  void *sin_port;
  TYPE_1__ sin_addr;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ serv_addr1;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ cli_addr1;
typedef int /*<<< orphan*/ cli_addr;

/* Variables and functions */
void *AF_INET;
void *INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error(char *);
void *htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int server_socket_fd, client_socket_fd, portno;
  socklen_t clilen;
  char buffer[256];
  struct sockaddr_in serv_addr, cli_addr;
  int n;
  int server_socket_fd1, client_socket_fd1, portno1;
  socklen_t clilen1;
  char buffer1[256];
  struct sockaddr_in serv_addr1, cli_addr1;
  int n1;
  server_socket_fd = socket(AF_INET, SOCK_STREAM, 0);
  if (server_socket_fd < 0) {
    error("ERROR opening socket");
  }
  server_socket_fd1 = socket(AF_INET, SOCK_STREAM, 0);
  if (server_socket_fd1 < 0) {
    error("ERROR opening socket1");
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  portno = atoi(argv[1]);
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = INADDR_ANY;
  serv_addr.sin_port = htons(portno);
  memset((char *)&serv_addr1, 0, sizeof(serv_addr1));
  portno1 = atoi(argv[2]);
  serv_addr1.sin_family = AF_INET;
  serv_addr1.sin_addr.s_addr = INADDR_ANY;
  serv_addr1.sin_port = htons(portno1);
  if (bind(server_socket_fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) <
      0) {
    error("ERROR on binding");
  }
  if (bind(server_socket_fd1, (struct sockaddr *)&serv_addr1,
           sizeof(serv_addr1)) < 0) {
    error("ERROR on binding 1");
  }
  listen(server_socket_fd, 5);
  clilen = sizeof(cli_addr);
  listen(server_socket_fd1, 5);
  clilen1 = sizeof(cli_addr1);
  client_socket_fd =
      accept(server_socket_fd, (struct sockaddr *)&cli_addr, &clilen);
  if (client_socket_fd < 0) {
    error("ERROR on accept");
  }
  client_socket_fd1 =
      accept(server_socket_fd1, (struct sockaddr *)&cli_addr1, &clilen1);
  if (client_socket_fd1 < 0) {
    error("ERROR on accept 1");
  }
  char moderatorMessage[256];
  int c;
  while (1) {
    memset(buffer, 0, 256);
    n = read(client_socket_fd, buffer, 255);
    if (n < 0) {
      error("ERROR reading from socket");
    }
    memset(buffer1, 0, 256);
    n1 = read(client_socket_fd1, buffer1, 255);
    if (n1 < 0) {
      error("ERROR reading from socket");
    }
    printf("Here is the message from connection 1: %s\n", buffer1);
    printf("Here is the message from connection 0: %s\n", buffer);
    n = write(client_socket_fd, buffer1, strlen(buffer1));
    if (n < 0) {
      error("ERROR writing to socket");
    }
    n1 = write(client_socket_fd1, buffer, strlen(buffer));
    if (n1 < 0) {
      error("ERROR writing to socket");
    }
  }
  close(client_socket_fd);
  close(server_socket_fd);
  close(client_socket_fd1);
  close(server_socket_fd1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e08(%rip),%rax
mov    (%rax),%rdi
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    120c <main+0x4c>
lea    0xdf9(%rip),%rdi
call   10b0 <error@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%rdi
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x158(%rbp)
cmpl   $0x0,-0x158(%rbp)
jge    1245 <main+0x85>
lea    0xdd5(%rip),%rdi
call   10b0 <error@plt>
lea    -0x138(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d79(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x128(%rbp)
mov    0x2d60(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x130(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <htons@plt>
mov    %rax,-0x138(%rbp)
lea    -0x288(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x160(%rbp)
mov    0x2d22(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x278(%rbp)
mov    0x2d09(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x280(%rbp)
mov    -0x160(%rbp),%edi
call   1050 <htons@plt>
mov    %rax,-0x288(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x138(%rbp),%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    131d <main+0x15d>
lea    0xd13(%rip),%rdi
call   10b0 <error@plt>
mov    -0x158(%rbp),%edi
lea    -0x288(%rbp),%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    134a <main+0x18a>
lea    0xcf7(%rip),%rdi
call   10b0 <error@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1090 <listen@plt>
movl   $0x18,-0x20(%rbp)
mov    -0x158(%rbp),%edi
mov    $0x5,%esi
call   1090 <listen@plt>
movl   $0x18,-0x164(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x150(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13a4 <main+0x1e4>
lea    0xcb0(%rip),%rdi
call   10b0 <error@plt>
mov    -0x158(%rbp),%edi
lea    -0x2a0(%rbp),%rsi
lea    -0x164(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x15c(%rbp)
cmpl   $0x0,-0x15c(%rbp)
jge    13dc <main+0x21c>
lea    0xc88(%rip),%rdi
call   10b0 <error@plt>
jmp    13e1 <main+0x221>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    -0x18(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xff,%edx
call   1080 <read@plt>
mov    %eax,-0x154(%rbp)
cmpl   $0x0,-0x154(%rbp)
jge    1427 <main+0x267>
lea    0xc4f(%rip),%rdi
call   10b0 <error@plt>
lea    -0x270(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    -0x15c(%rbp),%edi
lea    -0x270(%rbp),%rsi
mov    $0xff,%edx
call   1080 <read@plt>
mov    %eax,-0x2a4(%rbp)
cmpl   $0x0,-0x2a4(%rbp)
jge    1470 <main+0x2b0>
lea    0xc06(%rip),%rdi
call   10b0 <error@plt>
lea    -0x270(%rbp),%rsi
lea    0xc0d(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xc25(%rip),%rdi
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c4(%rbp)
lea    -0x270(%rbp),%rax
mov    %rax,-0x3c0(%rbp)
lea    -0x270(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x3c4(%rbp),%edi
mov    -0x3c0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x154(%rbp)
cmpl   $0x0,-0x154(%rbp)
jge    14ec <main+0x32c>
lea    0xbfa(%rip),%rdi
call   10b0 <error@plt>
mov    -0x15c(%rbp),%eax
mov    %eax,-0x3d4(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x3d0(%rbp)
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x3d4(%rbp),%edi
mov    -0x3d0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x2a4(%rbp)
cmpl   $0x0,-0x2a4(%rbp)
jge    1545 <main+0x385>
lea    0xba1(%rip),%rdi
call   10b0 <error@plt>
jmp    13e1 <main+0x221>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x278,%rsp
mov    %rsi,%r14
mov    0x2e0d(%rip),%r12
mov    (%r12),%rdi
mov    0x2dea(%rip),%rbp
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1202 <main+0x42>
lea    0xe03(%rip),%rdi
call   10b0 <error@plt>
mov    (%r12),%rdi
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1222 <main+0x62>
lea    0xdf8(%rip),%rdi
call   10b0 <error@plt>
lea    0x28(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x8(%r14),%rdi
call   10d0 <atoi@plt>
mov    (%r12),%rcx
mov    %rcx,0x38(%rsp)
mov    0x2d91(%rip),%r13
mov    0x0(%r13),%rcx
mov    %rcx,0x30(%rsp)
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,0x28(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x10(%r14),%rdi
call   10d0 <atoi@plt>
mov    (%r12),%rcx
mov    %rcx,0x20(%rsp)
mov    0x0(%r13),%rcx
mov    %rcx,0x18(%rsp)
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,0x10(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
test   %rax,%rax
jns    12bc <main+0xfc>
lea    0xd74(%rip),%rdi
call   10b0 <error@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x18,%edx
call   10a0 <bind@plt>
test   %rax,%rax
jns    12de <main+0x11e>
lea    0xd63(%rip),%rdi
call   10b0 <error@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1090 <listen@plt>
movl   $0x18,0x4(%rsp)
mov    %ebp,%edi
mov    $0x5,%esi
call   1090 <listen@plt>
movl   $0x18,(%rsp)
lea    0x58(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %ebx,%edi
call   10c0 <accept@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    1329 <main+0x169>
lea    0xd2b(%rip),%rdi
call   10b0 <error@plt>
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
mov    %ebp,%edi
call   10c0 <accept@plt>
mov    %eax,%r13d
lea    0xd1d(%rip),%rax
mov    %rax,0x8(%rsp)
test   %r13d,%r13d
jns    1356 <main+0x196>
mov    0x8(%rsp),%rdi
call   10b0 <error@plt>
lea    0x170(%rsp),%rbx
lea    0x70(%rsp),%rbp
lea    0xd21(%rip),%r12
lea    0xd45(%rip),%r14
lea    0xd69(%rip),%rax
mov    %rax,0x8(%rsp)
jmp    1399 <main+0x1d9>
nop
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
js     134c <main+0x18c>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   1080 <read@plt>
test   %eax,%eax
jns    13c8 <main+0x208>
lea    0xcae(%rip),%rdi
call   10b0 <error@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xff,%edx
call   1080 <read@plt>
test   %eax,%eax
jns    13f7 <main+0x237>
lea    0xc7f(%rip),%rdi
call   10b0 <error@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
jns    1380 <main+0x1c0>
lea    0xcb0(%rip),%rdi
call   10b0 <error@plt>
jmp    1380 <main+0x1c0>

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@.str.1 = [22 x i8] c"ERROR opening socket1\00"
@INADDR_ANY = global i8* null
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [19 x i8] c"ERROR on binding 1\00"
@.str.4 = [16 x i8] c"ERROR on accept\00"
@.str.5 = [18 x i8] c"ERROR on accept 1\00"
@.str.6 = [26 x i8] c"ERROR reading from socket\00"
@.str.7 = [43 x i8] c"Here is the message from connection 1: %s\0A\00"
@.str.8 = [43 x i8] c"Here is the message from connection 0: %s\0A\00"
@.str.9 = [24 x i8] c"ERROR writing to socket\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 i32
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [256 x i8]
%19 = alloca %struct.sockaddr_in
%20 = alloca %struct.sockaddr_in
%21 = alloca i32
%22 = alloca [256 x i8]
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%24 = load i8*, i8** @AF_INET
%25 = load i32, i32* @SOCK_STREAM
%26 = call i32 @socket(i8* %24, i32 %25, i32 0)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %2
%30 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %2
%32 = load i8*, i8** @AF_INET
%33 = load i32, i32* @SOCK_STREAM
%34 = call i32 @socket(i8* %32, i32 %33, i32 0)
store i32 %34, i32* %14
%35 = load i32, i32* %14
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %39
39: ; preds = %37, %31
%40 = bitcast %struct.sockaddr_in* %11 to i8*
%41 = call i32 @memset(i8* %40, i32 0, i32 24)
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %8
%46 = load i8*, i8** @AF_INET
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i8* %46, i8** %47
%48 = load i8*, i8** @INADDR_ANY
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i32 0, i32 0
store i8* %48, i8** %50
%51 = load i32, i32* %8
%52 = call i8* @htons(i32 %51)
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i8* %52, i8** %53
%54 = bitcast %struct.sockaddr_in* %19 to i8*
%55 = call i32 @memset(i8* %54, i32 0, i32 24)
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %16
%60 = load i8*, i8** @AF_INET
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 2
store i8* %60, i8** %61
%62 = load i8*, i8** @INADDR_ANY
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 1
%64 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %63, i32 0, i32 0
store i8* %62, i8** %64
%65 = load i32, i32* %16
%66 = call i8* @htons(i32 %65)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 0
store i8* %66, i8** %67
%68 = load i32, i32* %6
%69 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%70 = call i64 @bind(i32 %68, %struct.sockaddr* %69, i32 24)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %39
%73 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %74
74: ; preds = %72, %39
%75 = load i32, i32* %14
%76 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%77 = call i64 @bind(i32 %75, %struct.sockaddr* %76, i32 24)
%78 = icmp slt i64 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %81
81: ; preds = %79, %74
%82 = load i32, i32* %6
%83 = call i32 @listen(i32 %82, i32 5)
store i32 24, i32* %9
%84 = load i32, i32* %14
%85 = call i32 @listen(i32 %84, i32 5)
store i32 24, i32* %17
%86 = load i32, i32* %6
%87 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%88 = call i32 @accept(i32 %86, %struct.sockaddr* %87, i32* %9)
store i32 %88, i32* %7
%89 = load i32, i32* %7
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %81
%92 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %93
93: ; preds = %91, %81
%94 = load i32, i32* %14
%95 = bitcast %struct.sockaddr_in* %20 to %struct.sockaddr*
%96 = call i32 @accept(i32 %94, %struct.sockaddr* %95, i32* %17)
store i32 %96, i32* %15
%97 = load i32, i32* %15
%98 = icmp slt i32 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %93
%100 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %101
101: ; preds = %99, %93
br label %102
102: ; preds = %101, %146
%103 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%104 = call i32 @memset(i8* %103, i32 0, i32 256)
%105 = load i32, i32* %7
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%107 = call i32 @read(i32 %105, i8* %106, i32 255)
store i32 %107, i32* %13
%108 = load i32, i32* %13
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %102
%111 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %112
112: ; preds = %110, %102
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%114 = call i32 @memset(i8* %113, i32 0, i32 256)
%115 = load i32, i32* %15
%116 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%117 = call i32 @read(i32 %115, i8* %116, i32 255)
store i32 %117, i32* %21
%118 = load i32, i32* %21
%119 = icmp slt i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %112
%121 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %122
122: ; preds = %120, %112
%123 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%124 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %123)
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%126 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %125)
%127 = load i32, i32* %7
%128 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%130 = call i32 @strlen(i8* %129)
%131 = call i32 @write(i32 %127, i8* %128, i32 %130)
store i32 %131, i32* %13
%132 = load i32, i32* %13
%133 = icmp slt i32 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %122
%135 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %136
136: ; preds = %134, %122
%137 = load i32, i32* %15
%138 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%139 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%140 = call i32 @strlen(i8* %139)
%141 = call i32 @write(i32 %137, i8* %138, i32 %140)
store i32 %141, i32* %21
%142 = load i32, i32* %21
%143 = icmp slt i32 %142, 0
br i1 %143, label %144, label %146
144: ; preds = %136
%145 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %146
146: ; preds = %144, %136
br label %102
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@.str.1 = [22 x i8] c"ERROR opening socket1\00"
@INADDR_ANY = global i8* null
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [19 x i8] c"ERROR on binding 1\00"
@.str.4 = [16 x i8] c"ERROR on accept\00"
@.str.5 = [18 x i8] c"ERROR on accept 1\00"
@.str.6 = [26 x i8] c"ERROR reading from socket\00"
@.str.7 = [43 x i8] c"Here is the message from connection 1: %s\0A\00"
@.str.8 = [43 x i8] c"Here is the message from connection 0: %s\0A\00"
@.str.9 = [24 x i8] c"ERROR writing to socket\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca [256 x i8]
%9 = alloca %struct.sockaddr_in
%10 = alloca %struct.sockaddr_in
%11 = bitcast i32* %3 to i8*
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = bitcast %struct.sockaddr_in* %5 to i8*
%14 = bitcast %struct.sockaddr_in* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%17 = bitcast %struct.sockaddr_in* %9 to i8*
%18 = bitcast %struct.sockaddr_in* %10 to i8*
%19 = load i8*, i8** @AF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = tail call i32 @socket(i8* %19, i32 %20, i32 0)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %2
%26 = load i8*, i8** @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = tail call i32 @socket(i8* %26, i32 %27, i32 0)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = tail call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %25
%33 = call i32 @memset(i8* %13, i32 0, i32 24)
%34 = getelementptr inbounds i8*, i8** %1, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
%37 = load i8*, i8** @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i8* %37, i8** %38
%39 = load i8*, i8** @INADDR_ANY
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
store i8* %39, i8** %40
%41 = call i8* @htons(i32 %36)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
store i8* %41, i8** %42
%43 = call i32 @memset(i8* %17, i32 0, i32 24)
%44 = getelementptr inbounds i8*, i8** %1, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = load i8*, i8** @AF_INET
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i64 0, i32 2
store i8* %47, i8** %48
%49 = load i8*, i8** @INADDR_ANY
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i64 0, i32 1, i32 0
store i8* %49, i8** %50
%51 = call i8* @htons(i32 %46)
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i64 0, i32 0
store i8* %51, i8** %52
%53 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%54 = call i64 @bind(i32 %21, %struct.sockaddr* %53, i32 24)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %32
%57 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %32
%59 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%60 = call i64 @bind(i32 %28, %struct.sockaddr* %59, i32 24)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %64
64: ; preds = %62, %58
%65 = call i32 @listen(i32 %21, i32 5)
store i32 24, i32* %3
%66 = call i32 @listen(i32 %28, i32 5)
store i32 24, i32* %7
%67 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%68 = call i32 @accept(i32 %21, %struct.sockaddr* %67, i32* %3)
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %64
%71 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %72
72: ; preds = %70, %64
%73 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%74 = call i32 @accept(i32 %28, %struct.sockaddr* %73, i32* %7)
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %100, %72
%77 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), %72 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), %100 ]
%78 = call i32 @error(i8* %77)
br label %79
79: ; preds = %72, %76
br label %80
80: ; preds = %79, %100
%81 = call i32 @memset(i8* %12, i32 0, i32 256)
%82 = call i32 @read(i32 %68, i8* %12, i32 255)
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %86
86: ; preds = %84, %80
%87 = call i32 @memset(i8* %16, i32 0, i32 256)
%88 = call i32 @read(i32 %74, i8* %16, i32 255)
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %86
%91 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %92
92: ; preds = %90, %86
%93 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %16)
%94 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %12)
%95 = call i32 @strlen(i8* %16)
%96 = call i32 @write(i32 %68, i8* %16, i32 %95)
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %100
100: ; preds = %98, %92
%101 = call i32 @strlen(i8* %12)
%102 = call i32 @write(i32 %74, i8* %12, i32 %101)
%103 = icmp slt i32 %102, 0
br i1 %103, label %76, label %80
}