#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 timeval {
  double tv_usec;
};
struct TYPE_2__ {
  int s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server_address;
typedef int in_addr_t;
typedef int /*<<< orphan*/ client_address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
scalar_t__ bind(int, struct sockaddr const *, int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
long time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int max_connections = 2;
  if (argc > 1) {
    max_connections = atoi(argv[1]);
  }
  struct sockaddr_in server_address;
  memset(&server_address, 0, sizeof(server_address));
  server_address.sin_family = AF_INET;
  server_address.sin_addr.s_addr = htonl(INADDR_ANY);
  server_address.sin_port = htons(8000);
  int server_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (bind(server_socket, (const struct sockaddr *)&server_address,
           sizeof(server_address)) < 0) {
    printf("Failed to bind server.\n");
    return -1;
  }
  if (listen(server_socket, max_connections) < 0) {
    printf("Failed to set server socket to listen\n");
    return -1;
  }
  int client_sockets[max_connections];
  struct sockaddr_in client_address;
  socklen_t sizeof_client_address = sizeof(client_address);
  int num_connected = 0;
  in_addr_t client_IPs[max_connections];
  printf("Waiting on %i clients to connect\n", max_connections);
  while (num_connected < max_connections) {
    if ((client_sockets[num_connected] =
             accept(server_socket, (struct sockaddr *)&client_address,
                    &sizeof_client_address)) < 0) {
      printf("Server failed to accept client");
      return -1;
    }
    client_IPs[num_connected] = client_address.sin_addr.s_addr;
    printf("Client %i has reported in\n", num_connected);
    num_connected++;
  }
  struct timeval tv;
  long int timesec1 = time(NULL);
  gettimeofday(&tv, NULL);
  float timems1 = tv.tv_usec * 0.001;
  int i, j;
  int buffer_size = 30;
  char buffer[buffer_size];
  in_addr_t next_IP;
  for (i = 0; i < num_connected; i++) {
    if (i < num_connected - 1)
      next_IP = client_IPs[i + 1];
    else
      next_IP = 0;
    for (j = 0; j < buffer_size; j++)
      buffer[j] = '\0';
    sprintf(buffer, "%i+%i+%i", i, num_connected, next_IP);
    if (send(client_sockets[i], buffer, buffer_size, 0) != buffer_size) {
      printf("Sending info to Client %i failed.\n", i);
      return -1;
    }
  }
  int recieve_size;
  for (j = 0; j < buffer_size; j++)
    buffer[j] = '\0';
  if ((recieve_size = recv(client_sockets[num_connected - 1], buffer,
                           buffer_size, 0)) < 0) {
    printf("Recieve from Client %i failed.\n", num_connected - 1);
    return -1;
  }
  printf("\nRecieved result from Client %i:\n --- Size of LCS = %s\n",
         num_connected - 1, buffer);
  long int timesec2 = time(NULL);
  gettimeofday(&tv, NULL);
  float timems2 = tv.tv_usec * 0.001;
  float runtime = (timesec2 - timesec1) * 1000 + (timems2 - timems1);
  printf("\nRuntime: %f ms\n\n", runtime);
  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   $0x2,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    121a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2da3(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x20(%rbp)
mov    $0x1f40,%edi
call   1040 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
mov    0x2d6b(%rip),%rax
mov    (%rax),%edx
call   1100 <socket@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    12ac <main+0xcc>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    166a <main+0x48a>
mov    -0x24(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10b0 <listen@plt>
cmp    $0x0,%rax
jge    12db <main+0xfb>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    166a <main+0x48a>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0xc,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x14(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x14(%rbp),%esi
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13cb <main+0x1eb>
mov    -0x24(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   10d0 <accept@plt>
mov    -0xb0(%rbp),%rcx
movslq -0x50(%rbp),%rdx
mov    %eax,(%rcx,%rdx,4)
cmp    $0x0,%eax
jge    139b <main+0x1bb>
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1663 <main+0x483>
mov    -0xa8(%rbp),%rax
mov    -0x48(%rbp),%edx
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%esi
lea    0xcd2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1347 <main+0x167>
xor    %eax,%eax
mov    %eax,%edi
mov    %rdi,-0xc0(%rbp)
call   10a0 <time@plt>
mov    -0xc0(%rbp),%rsi
mov    %rax,-0x70(%rbp)
lea    -0x68(%rbp),%rdi
call   1070 <gettimeofday@plt>
movsd  -0x68(%rbp),%xmm0
movsd  0xc04(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
movl   $0x1e,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1530 <main+0x350>
mov    -0x78(%rbp),%eax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1477 <main+0x297>
mov    -0xa8(%rbp),%rax
mov    -0x78(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8c(%rbp)
jmp    1481 <main+0x2a1>
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    14b1 <main+0x2d1>
mov    -0xb8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1488 <main+0x2a8>
mov    -0xb8(%rbp),%rdi
mov    -0x78(%rbp),%edx
mov    -0x50(%rbp),%ecx
mov    -0x8c(%rbp),%r8d
lea    0xbd7(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0xb8(%rbp),%rsi
mov    -0xb0(%rbp),%rax
movslq -0x78(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x80(%rbp),%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmp    -0x80(%rbp),%eax
je     151d <main+0x33d>
mov    -0x78(%rbp),%esi
lea    0xba9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1663 <main+0x483>
jmp    1522 <main+0x342>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    143c <main+0x25c>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    1560 <main+0x380>
mov    -0xb8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1537 <main+0x357>
mov    -0xb8(%rbp),%rsi
mov    -0xb0(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x80(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x90(%rbp)
cmp    $0x0,%eax
jge    15ba <main+0x3da>
mov    -0x50(%rbp),%esi
sub    $0x1,%esi
lea    0xb2f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
jmp    1663 <main+0x483>
mov    -0xb8(%rbp),%rdx
mov    -0x50(%rbp),%esi
sub    $0x1,%esi
lea    0xb21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %rax,-0x98(%rbp)
lea    -0x68(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
movsd  0xa06(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
mov    -0x98(%rbp),%rax
sub    -0x70(%rbp),%rax
imul   $0x3e8,%rax,%rax
cvtsi2ss %rax,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
subss  -0x74(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xad9(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x5c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    $0x2,%r14d
cmp    $0x2,%edi
jl     1218 <main+0x28>
mov    0x8(%rsi),%rdi
call   10f0 <atoi@plt>
mov    %eax,%r14d
lea    -0x60(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x60(%rbp)
mov    $0x1f40,%edi
call   1050 <htons@plt>
mov    %eax,-0x5c(%rbp)
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    0x2d63(%rip),%rax
mov    (%rax),%esi
mov    0x2d6a(%rip),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
test   %rax,%rax
js     140d <main+0x21d>
mov    %ebx,%edi
mov    %r14d,%esi
call   10c0 <listen@plt>
test   %rax,%rax
js     1416 <main+0x226>
mov    %rsp,-0x38(%rbp)
mov    %r14d,%r13d
mov    %rsp,%r15
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
movl   $0xc,-0x48(%rbp)
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
lea    0xd33(%rip),%rdi
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r14d,%r14d
jle    1349 <main+0x159>
mov    %r14d,-0x30(%rbp)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
lea    -0x88(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,(%r15,%r14,4)
test   %eax,%eax
js     142d <main+0x23d>
mov    -0x88(%rbp),%eax
mov    %eax,(%r12,%r14,4)
lea    0xd1a(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r13
jne    1300 <main+0x110>
mov    -0x30(%rbp),%eax
mov    %rax,-0x50(%rbp)
xor    %edi,%edi
call   10b0 <time@plt>
mov    %rax,%r14
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
movsd  -0x40(%rbp),%xmm0
mov    %rsp,%r13
add    $0xffffffffffffffe0,%r13
mov    %r13,%rsp
mov    -0x50(%rbp),%rcx
test   %ecx,%ecx
movsd  %xmm0,-0x70(%rbp)
je     1440 <main+0x250>
mov    %r12,-0x78(%rbp)
mov    %r14,-0x68(%rbp)
lea    -0x1(%rcx),%eax
mov    %eax,-0x44(%rbp)
cltq
mov    %ecx,%edx
mov    %rdx,-0x30(%rbp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x0,%r8d
mov    %rax,%r12
cmp    %rax,%rbx
jge    13b7 <main+0x1c7>
mov    -0x78(%rbp),%rax
mov    0x4(%rax,%rbx,4),%r8d
xorps  %xmm0,%xmm0
movups %xmm0,0xe(%r13)
movaps %xmm0,0x0(%r13)
mov    %r13,%rdi
lea    0xc96(%rip),%rsi
mov    %ebx,%edx
mov    %rcx,%r14
call   1100 <sprintf@plt>
mov    (%r15,%rbx,4),%edi
mov    %r13,%rsi
mov    $0x1e,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x1e,%eax
jne    14f5 <main+0x305>
add    $0x1,%rbx
cmp    %rbx,-0x30(%rbp)
mov    %r14,%rcx
mov    %r12,%rax
jne    13a0 <main+0x1b0>
mov    -0x68(%rbp),%r14
mov    -0x44(%rbp),%ebx
jmp    144c <main+0x25c>
lea    0xd0c(%rip),%rdi
jmp    141d <main+0x22d>
lea    0xcdd(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r12d
jmp    151d <main+0x32d>
lea    0xbf6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1510 <main+0x320>
mov    $0xffffffff,%ebx
mov    $0xffffffffffffffff,%rax
xorps  %xmm0,%xmm0
movups %xmm0,0xe(%r13)
movaps %xmm0,0x0(%r13)
mov    (%r15,%rax,4),%edi
xor    %r12d,%r12d
mov    %r13,%rsi
mov    $0x1e,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     1500 <main+0x310>
movsd  -0x70(%rbp),%xmm0
mulsd  0xb7c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
lea    0xc1c(%rip),%rdi
mov    %ebx,%esi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %rax,%rbx
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
movsd  -0x40(%rbp),%xmm0
mulsd  0xb3e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
sub    %r14,%rbx
imul   $0x3e8,%rbx,%rax
cvtsi2ss %rax,%xmm1
subss  -0x30(%rbp),%xmm0
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xbfc(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1516 <main+0x326>
lea    0xb71(%rip),%rdi
mov    %ebx,%esi
jmp    1509 <main+0x319>
lea    0xb89(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%r12d
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { double }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [24 x i8] c"Failed to bind server.\0A\00"
@.str.1 = [39 x i8] c"Failed to set server socket to listen\0A\00"
@.str.2 = [34 x i8] c"Waiting on %i clients to connect\0A\00"
@.str.3 = [31 x i8] c"Server failed to accept client\00"
@.str.4 = [27 x i8] c"Client %i has reported in\0A\00"
@.str.5 = [9 x i8] c"%i+%i+%i\00"
@.str.6 = [35 x i8] c"Sending info to Client %i failed.\0A\00"
@.str.7 = [32 x i8] c"Recieve from Client %i failed.\0A\00"
@.str.8 = [56 x i8] c"\0ARecieved result from Client %i:\0A --- Size of LCS = %s\0A\00"
@.str.9 = [18 x i8] c"\0ARuntime: %f ms\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i32
%16 = alloca %struct.timeval
%17 = alloca i64
%18 = alloca float
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i64
%23 = alloca i32
%24 = alloca i32
%25 = alloca i64
%26 = alloca float
%27 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2, i32* %6
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %35
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %6
br label %35
35: ; preds = %30, %2
%36 = call i32 @memset(%struct.sockaddr_in* %7, i32 0, i32 12)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %37, i32* %38
%39 = load i32, i32* @INADDR_ANY
%40 = call i32 @htonl(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
store i32 %40, i32* %42
%43 = call i32 @htons(i32 8000)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %43, i32* %44
%45 = load i32, i32* @PF_INET
%46 = load i32, i32* @SOCK_STREAM
%47 = load i32, i32* @IPPROTO_TCP
%48 = call i32 @socket(i32 %45, i32 %46, i32 %47)
store i32 %48, i32* %8
%49 = load i32, i32* %8
%50 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%51 = call i64 @bind(i32 %49, %struct.sockaddr* %50, i32 12)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %35
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %204
55: ; preds = %35
%56 = load i32, i32* %8
%57 = load i32, i32* %6
%58 = call i64 @listen(i32 %56, i32 %57)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %204
62: ; preds = %55
%63 = load i32, i32* %6
%64 = zext i32 %63 to i64
%65 = call i8* @llvm.stacksave()
store i8* %65, i8** %9
%66 = alloca i32, i64 %64
store i64 %64, i64* %10
store i32 12, i32* %12
store i32 0, i32* %13
%67 = load i32, i32* %6
%68 = zext i32 %67 to i64
%69 = alloca i32, i64 %68
store i64 %68, i64* %14
%70 = load i32, i32* %6
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %86, %62
%73 = load i32, i32* %13
%74 = load i32, i32* %6
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %97
76: ; preds = %72
%77 = load i32, i32* %8
%78 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%79 = call i32 @accept(i32 %77, %struct.sockaddr* %78, i32* %12)
%80 = load i32, i32* %13
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %66, i64 %81
store i32 %79, i32* %82
%83 = icmp slt i32 %79, 0
br i1 %83, label %84, label %86
84: ; preds = %76
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
store i32 1, i32* %15
br label %202
86: ; preds = %76
%87 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%88 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %87, i32 0, i32 0
%89 = load i32, i32* %88
%90 = load i32, i32* %13
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %69, i64 %91
store i32 %89, i32* %92
%93 = load i32, i32* %13
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %93)
%95 = load i32, i32* %13
%96 = add nsw i32 %95, 1
store i32 %96, i32* %13
br label %72
97: ; preds = %72
%98 = call i64 @time(i32* null)
store i64 %98, i64* %17
%99 = call i32 @gettimeofday(%struct.timeval* %16, i32* null)
%100 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%101 = load double, double* %100
%102 = fmul double %101, 1.000000e-03
%103 = fptrunc double %102 to float
store float %103, float* %18
store i32 30, i32* %21
%104 = load i32, i32* %21
%105 = zext i32 %104 to i64
%106 = alloca i8, i64 %105
store i64 %105, i64* %22
store i32 0, i32* %19
br label %107
107: ; preds = %152, %97
%108 = load i32, i32* %19
%109 = load i32, i32* %13
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %155
111: ; preds = %107
%112 = load i32, i32* %19
%113 = load i32, i32* %13
%114 = sub nsw i32 %113, 1
%115 = icmp slt i32 %112, %114
br i1 %115, label %116, label %122
116: ; preds = %111
%117 = load i32, i32* %19
%118 = add nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32, i32* %69, i64 %119
%121 = load i32, i32* %120
store i32 %121, i32* %23
br label %123
122: ; preds = %111
store i32 0, i32* %23
br label %123
123: ; preds = %122, %116
store i32 0, i32* %20
br label %124
124: ; preds = %132, %123
%125 = load i32, i32* %20
%126 = load i32, i32* %21
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %135
128: ; preds = %124
%129 = load i32, i32* %20
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %106, i64 %130
store i8 0, i8* %131
br label %132
132: ; preds = %128
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
br label %124
135: ; preds = %124
%136 = load i32, i32* %19
%137 = load i32, i32* %13
%138 = load i32, i32* %23
%139 = call i32 @sprintf(i8* %106, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %136, i32 %137, i32 %138)
%140 = load i32, i32* %19
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i32, i32* %66, i64 %141
%143 = load i32, i32* %142
%144 = load i32, i32* %21
%145 = call i32 @send(i32 %143, i8* %106, i32 %144, i32 0)
%146 = load i32, i32* %21
%147 = icmp ne i32 %145, %146
br i1 %147, label %148, label %151
148: ; preds = %135
%149 = load i32, i32* %19
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %149)
store i32 -1, i32* %3
store i32 1, i32* %15
br label %202
151: ; preds = %135
br label %152
152: ; preds = %151
%153 = load i32, i32* %19
%154 = add nsw i32 %153, 1
store i32 %154, i32* %19
br label %107
155: ; preds = %107
store i32 0, i32* %20
br label %156
156: ; preds = %164, %155
%157 = load i32, i32* %20
%158 = load i32, i32* %21
%159 = icmp slt i32 %157, %158
br i1 %159, label %160, label %167
160: ; preds = %156
%161 = load i32, i32* %20
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i8, i8* %106, i64 %162
store i8 0, i8* %163
br label %164
164: ; preds = %160
%165 = load i32, i32* %20
%166 = add nsw i32 %165, 1
store i32 %166, i32* %20
br label %156
167: ; preds = %156
%168 = load i32, i32* %13
%169 = sub nsw i32 %168, 1
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i32, i32* %66, i64 %170
%172 = load i32, i32* %171
%173 = load i32, i32* %21
%174 = call i32 @recv(i32 %172, i8* %106, i32 %173, i32 0)
store i32 %174, i32* %24
%175 = icmp slt i32 %174, 0
br i1 %175, label %176, label %180
176: ; preds = %167
%177 = load i32, i32* %13
%178 = sub nsw i32 %177, 1
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %178)
store i32 -1, i32* %3
store i32 1, i32* %15
br label %202
180: ; preds = %167
%181 = load i32, i32* %13
%182 = sub nsw i32 %181, 1
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i32 %182, i8* %106)
%184 = call i64 @time(i32* null)
store i64 %184, i64* %25
%185 = call i32 @gettimeofday(%struct.timeval* %16, i32* null)
%186 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%187 = load double, double* %186
%188 = fmul double %187, 1.000000e-03
%189 = fptrunc double %188 to float
store float %189, float* %26
%190 = load i64, i64* %25
%191 = load i64, i64* %17
%192 = sub nsw i64 %190, %191
%193 = mul nsw i64 %192, 1000
%194 = sitofp i64 %193 to float
%195 = load float, float* %26
%196 = load float, float* %18
%197 = fsub float %195, %196
%198 = fadd float %194, %197
store float %198, float* %27
%199 = load float, float* %27
%200 = fpext float %199 to double
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), double %200)
store i32 0, i32* %3
store i32 1, i32* %15
br label %202
202: ; preds = %180, %176, %148, %84
%203 = load i8*, i8** %9
br label %204
204: ; preds = %202, %60, %53
%205 = load i32, i32* %3
ret i32 %205
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { double }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [34 x i8] c"Waiting on %i clients to connect\0A\00"
@.str.3 = [31 x i8] c"Server failed to accept client\00"
@.str.4 = [27 x i8] c"Client %i has reported in\0A\00"
@.str.5 = [9 x i8] c"%i+%i+%i\00"
@.str.6 = [35 x i8] c"Sending info to Client %i failed.\0A\00"
@.str.7 = [32 x i8] c"Recieve from Client %i failed.\0A\00"
@.str.8 = [56 x i8] c"\0ARecieved result from Client %i:\0A --- Size of LCS = %s\0A\00"
@.str.9 = [18 x i8] c"\0ARuntime: %f ms\0A\0A\00"
@str = [38 x i8] c"Failed to set server socket to listen\00"
@str.10 = [23 x i8] c"Failed to bind server.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
br label %12
12: ; preds = %8, %2
%13 = phi i32 [ %11, %8 ], [ 2, %2 ]
%14 = bitcast %struct.sockaddr_in* %3 to i8*
%15 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %16, i32* %17
%18 = load i32, i32* @INADDR_ANY
%19 = call i32 @htonl(i32 %18)
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %19, i32* %20
%21 = call i32 @htons(i32 8000)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %21, i32* %22
%23 = load i32, i32* @PF_INET
%24 = load i32, i32* @SOCK_STREAM
%25 = load i32, i32* @IPPROTO_TCP
%26 = call i32 @socket(i32 %23, i32 %24, i32 %25)
%27 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%28 = call i64 @bind(i32 %26, %struct.sockaddr* %27, i32 12)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %12
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
br label %128
32: ; preds = %12
%33 = call i64 @listen(i32 %26, i32 %13)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %128
37: ; preds = %32
%38 = zext i32 %13 to i64
%39 = call i8* @llvm.stacksave()
%40 = alloca i32, i64 %38
%41 = bitcast %struct.sockaddr_in* %4 to i8*
%42 = bitcast i32* %5 to i8*
store i32 12, i32* %5
%43 = alloca i32, i64 %38
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%45 = icmp sgt i32 %13, 0
br i1 %45, label %46, label %63
46: ; preds = %37
%47 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
br label %49
49: ; preds = %46, %56
%50 = phi i64 [ 0, %46 ], [ %61, %56 ]
%51 = call i32 @accept(i32 %26, %struct.sockaddr* %47, i32* %5)
%52 = getelementptr inbounds i32, i32* %40, i64 %50
store i32 %51, i32* %52
%53 = icmp slt i32 %51, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %126
56: ; preds = %49
%57 = load i32, i32* %48
%58 = getelementptr inbounds i32, i32* %43, i64 %50
store i32 %57, i32* %58
%59 = trunc i64 %50 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%61 = add nuw nsw i64 %50, 1
%62 = icmp eq i64 %61, %38
br i1 %62, label %63, label %49
63: ; preds = %56, %37
%64 = phi i32 [ 0, %37 ], [ %13, %56 ]
%65 = bitcast %struct.timeval* %6 to i8*
%66 = call i64 @time(i32* null)
%67 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%68 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%69 = load double, double* %68
%70 = fmul double %69, 1.000000e-03
%71 = fptrunc double %70 to float
%72 = alloca [30 x i8]
%73 = getelementptr inbounds [30 x i8], [30 x i8]* %72, i64 0, i64 0
%74 = getelementptr inbounds [30 x i8], [30 x i8]* %72, i64 0, i64 0
%75 = icmp eq i32 %64, 0
br i1 %75, label %80, label %76
76: ; preds = %63
%77 = add nsw i32 %64, -1
%78 = sext i32 %77 to i64
%79 = zext i32 %64 to i64
br label %87
80: ; preds = %105, %63
%81 = phi i64 [ -1, %63 ], [ %78, %105 ]
%82 = phi i32 [ -1, %63 ], [ %77, %105 ]
%83 = getelementptr inbounds i32, i32* %40, i64 %81
%84 = load i32, i32* %83
%85 = call i32 @recv(i32 %84, i8* %74, i32 30, i32 0)
%86 = icmp slt i32 %85, 0
br i1 %86, label %108, label %110
87: ; preds = %76, %105
%88 = phi i64 [ 0, %76 ], [ %106, %105 ]
%89 = icmp slt i64 %88, %78
br i1 %89, label %90, label %94
90: ; preds = %87
%91 = add nuw nsw i64 %88, 1
%92 = getelementptr inbounds i32, i32* %43, i64 %91
%93 = load i32, i32* %92
br label %94
94: ; preds = %87, %90
%95 = phi i32 [ %93, %90 ], [ 0, %87 ]
%96 = trunc i64 %88 to i32
%97 = call i32 @sprintf(i8* %74, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %96, i32 %64, i32 %95)
%98 = getelementptr inbounds i32, i32* %40, i64 %88
%99 = load i32, i32* %98
%100 = call i32 @send(i32 %99, i8* %74, i32 30, i32 0)
%101 = icmp eq i32 %100, 30
br i1 %101, label %105, label %102
102: ; preds = %94
%103 = trunc i64 %88 to i32
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %103)
br label %124
105: ; preds = %94
%106 = add nuw nsw i64 %88, 1
%107 = icmp eq i64 %106, %79
br i1 %107, label %80, label %87
108: ; preds = %80
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %82)
br label %124
110: ; preds = %80
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i32 %82, i8* %74)
%112 = call i64 @time(i32* null)
%113 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%114 = load double, double* %68
%115 = fmul double %114, 1.000000e-03
%116 = fptrunc double %115 to float
%117 = sub nsw i64 %112, %66
%118 = mul nsw i64 %117, 1000
%119 = sitofp i64 %118 to float
%120 = fsub float %116, %71
%121 = fadd float %120, %119
%122 = fpext float %121 to double
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), double %122)
br label %124
124: ; preds = %108, %110, %102
%125 = phi i32 [ -1, %102 ], [ -1, %108 ], [ 0, %110 ]
br label %126
126: ; preds = %124, %54
%127 = phi i32 [ -1, %54 ], [ %125, %124 ]
br label %128
128: ; preds = %126, %35, %30
%129 = phi i32 [ -1, %30 ], [ -1, %35 ], [ %127, %126 ]
ret i32 %129
}