#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct sockaddr {
  int dummy;
};
struct addrinfo {
  scalar_t__ ai_addr;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  struct addrinfo *ai_next;
};

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int getpid();
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             int);
char *malloc(int);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
char rand();
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ stderr;
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ wait(int *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int sockfd, numbytes;
  char *inbuf, *outbuf, *hostname, *port;
  struct addrinfo hints, *servinfo, *p;
  int rv, numThreads, numRequests, i, j, dataLength, status, combined = 0;
  char s[INET6_ADDRSTRLEN];
  if (argc != 6) {
    fprintf(
        stderr,
        "usage: %s <hostname> <port> <numThreads> <numRequests> <dataLength>\n",
        argv[0]);
    return 1;
  }
  hostname = argv[1];
  port = argv[2];
  numThreads = atoi(argv[3]);
  numRequests = atoi(argv[4]);
  dataLength = atoi(argv[5]);
  inbuf = malloc(dataLength);
  outbuf = malloc(dataLength);
  for (i = 0; i < numThreads; ++i) {
    if (!fork()) {
      memset(&hints, 0, sizeof hints);
      hints.ai_family = AF_UNSPEC;
      hints.ai_socktype = SOCK_STREAM;
      if ((rv = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) {
        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
        return 1;
      }
      for (p = servinfo; p != NULL; p = p->ai_next) {
        if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) ==
            -1) {
          perror("client: socket");
          continue;
        }
        if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
          close(sockfd);
          perror("client: connect");
          continue;
        }
        break;
      }
      if (p == NULL) {
        fprintf(stderr, "client: failed to connect\n");
        return 2;
      }
      inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s,
                sizeof s);
      freeaddrinfo(servinfo);
      srand(getpid() * time(NULL));
      for (j = 0; j < numRequests; ++j) {
        for (i = 0; i < dataLength; ++i)
          outbuf[i] = rand();
        for (i = 0; i < dataLength;) {
          numbytes = write(sockfd, outbuf + i, dataLength - i);
          if (numbytes <= 0) {
            perror("write");
            return 1;
          }
          i += numbytes;
        }
        for (i = 0; i < dataLength;) {
          numbytes = read(sockfd, inbuf + i, dataLength - i);
          if (numbytes <= 0) {
            perror("read");
            return 1;
          }
          i += numbytes;
        }
        if (memcmp(inbuf, outbuf, dataLength)) {
          fprintf(stderr, "Wrong data echoed back!\n");
          for (i = 0; i < dataLength; ++i) {
            if (inbuf[i] != outbuf[i]) {
              fprintf(stderr, "First mismatch: %d -> %d, %d\n", i, inbuf[i],
                      outbuf[i]);
              break;
            }
          }
          return 1;
        }
      }
      close(sockfd);
      return 0;
    }
  }
  for (i = 0; i < numThreads; ++i) {
    wait(&status);
    combined = combined || status;
  }
  if (combined)
    fprintf(stderr, "At least one child failed!\n");
  return combined;
}


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   $0x0,-0x88(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xb0(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x98(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     12fd <main+0x9d>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd20(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%edi
call   10f0 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x80(%rbp),%edi
call   10f0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    1763 <main+0x503>
mov    $0x0,%al
call   1150 <fork@plt>
cmp    $0x0,%eax
jne    1750 <main+0x4f0>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2c49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2c25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   1130 <getaddrinfo@plt>
mov    %eax,-0x6c(%rbp)
cmp    $0x0,%eax
je     140d <main+0x1ad>
mov    0x2c00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x6c(%rbp),%edi
call   1070 <gai_strerror@plt>
mov    -0xb4(%rbp),%edi
mov    %rax,%rdx
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
mov    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
je     14a5 <main+0x245>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x68(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x68(%rbp),%rax
mov    0x10(%rax),%edx
call   1180 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1457 <main+0x1f7>
lea    0xc09(%rip),%rdi
call   1100 <perror@plt>
jmp    1494 <main+0x234>
mov    -0x14(%rbp),%edi
mov    -0x68(%rbp),%rax
mov    (%rax),%rsi
mov    -0x68(%rbp),%rax
mov    0xc(%rax),%edx
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
jne    148f <main+0x22f>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
lea    0xbe0(%rip),%rdi
call   1100 <perror@plt>
jmp    1494 <main+0x234>
jmp    14a5 <main+0x245>
mov    -0x68(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    1415 <main+0x1b5>
cmpq   $0x0,-0x68(%rbp)
jne    14dd <main+0x27d>
mov    0x2b19(%rip),%rax
mov    (%rax),%edi
lea    0xbb5(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%rdi
call   1040 <get_in_addr@plt>
mov    -0xbc(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %eax,%esi
mov    -0xb0(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x60(%rbp),%rdi
call   1170 <freeaddrinfo@plt>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,-0xb8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <time@plt>
mov    -0xb8(%rbp),%edi
imul   %eax,%edi
call   10b0 <srand@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    1732 <main+0x4d2>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    1588 <main+0x328>
mov    $0x0,%al
call   1160 <rand@plt>
mov    %al,%dl
mov    -0x28(%rbp),%rax
movslq -0x78(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    155a <main+0x2fa>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    15f1 <main+0x391>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
movslq -0x78(%rbp),%rax
add    %rax,%rsi
mov    -0x80(%rbp),%edx
sub    -0x78(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     15e3 <main+0x383>
lea    0xac8(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
mov    -0x18(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    158f <main+0x32f>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    165a <main+0x3fa>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
movslq -0x78(%rbp),%rax
add    %rax,%rsi
mov    -0x80(%rbp),%edx
sub    -0x78(%rbp),%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     164c <main+0x3ec>
lea    0xa65(%rip),%rdi
call   1100 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
mov    -0x18(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    15f8 <main+0x398>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x80(%rbp),%edx
call   10c0 <memcmp@plt>
cmp    $0x0,%rax
je     171f <main+0x4bf>
mov    0x2955(%rip),%rax
mov    (%rax),%edi
lea    0xa17(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    1709 <main+0x4a9>
mov    -0x20(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x28(%rbp),%rcx
movslq -0x78(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     16f6 <main+0x496>
mov    0x290b(%rip),%rax
mov    (%rax),%edi
mov    -0x78(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    -0x28(%rbp),%rax
movslq -0x78(%rbp),%rsi
movsbl (%rax,%rsi,1),%r8d
lea    0x9ca(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1709 <main+0x4a9>
jmp    16fb <main+0x49b>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1692 <main+0x432>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
jmp    1724 <main+0x4c4>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1547 <main+0x2e7>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
jmp    17fd <main+0x59d>
jmp    1755 <main+0x4f5>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1364 <main+0x104>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    17c6 <main+0x566>
lea    -0x84(%rbp),%rdi
call   1140 <wait@plt>
mov    $0x1,%al
cmpl   $0x0,-0x88(%rbp)
mov    %al,-0xbd(%rbp)
jne    17a7 <main+0x547>
cmpl   $0x0,-0x84(%rbp)
setne  %al
mov    %al,-0xbd(%rbp)
mov    -0xbd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x88(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    176a <main+0x50a>
cmpl   $0x0,-0x88(%rbp)
je     17ea <main+0x58a>
mov    0x27f6(%rip),%rax
mov    (%rax),%edi
lea    0x8ef(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    -0x88(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x9c(%rbp)
mov    -0x90(%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    $0x58,%rsp
mov    %rsi,%r15
mov    %rsp,%rbx
mov    0x2d6a(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%r14
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmp    $0x6,%edi
jne    135f <main+0xff>
mov    %rcx,-0x60(%rbp)
mov    0x8(%r15),%rax
mov    %rax,-0x38(%rbp)
mov    0x10(%r15),%rax
mov    %rax,-0x48(%rbp)
mov    0x18(%r15),%rdi
call   1110 <atoi@plt>
mov    %eax,%r12d
mov    0x20(%r15),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    0x28(%r15),%rdi
call   1110 <atoi@plt>
mov    %eax,%r13d
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    %r13d,%edi
call   10f0 <malloc@plt>
test   %r12d,%r12d
jle    1591 <main+0x331>
mov    %rax,%r15
mov    %rbx,-0x30(%rbp)
mov    %r12d,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1150 <fork@plt>
test   %eax,%eax
je     1383 <main+0x123>
add    $0xffffffff,%ebx
jne    1300 <main+0xa0>
test   %r12d,%r12d
jle    1471 <main+0x211>
xor    %ebx,%ebx
lea    -0x80(%rbp),%r14
nop
mov    %r14,%rdi
call   1140 <wait@plt>
xor    %eax,%eax
or     -0x80(%rbp),%ebx
setne  %al
mov    %eax,%ebx
add    $0xffffffff,%r12d
jne    1320 <main+0xc0>
xor    %esi,%esi
test   %al,%al
mov    -0x30(%rbp),%rbx
je     1593 <main+0x333>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1379 <main+0x119>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xc8e(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%esi
jmp    1593 <main+0x333>
lea    -0x80(%rbp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2c43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2c1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x58(%rbp),%rcx
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %rbx,%rdx
call   1130 <getaddrinfo@plt>
test   %eax,%eax
je     13f7 <main+0x197>
mov    0x2c03(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1070 <gai_strerror@plt>
lea    0xc68(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%esi
mov    -0x30(%rbp),%rbx
jmp    1593 <main+0x333>
mov    -0x58(%rbp),%rbx
test   %rbx,%rbx
je     144c <main+0x1ec>
mov    0x14(%rbx),%esi
mov    0x8(%rbx),%edi
mov    0x10(%rbx),%edx
call   1180 <socket@plt>
lea    0xc41(%rip),%rdi
cmp    $0xffffffff,%eax
je     143e <main+0x1de>
mov    %eax,%r12d
mov    (%rbx),%rsi
mov    0xc(%rbx),%edx
mov    %eax,%edi
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
jne    147c <main+0x21c>
mov    %r12d,%edi
call   1090 <close@plt>
lea    0xc27(%rip),%rdi
call   1100 <perror@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
jne    1400 <main+0x1a0>
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
lea    0xc19(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x2,%esi
mov    -0x30(%rbp),%rbx
jmp    1593 <main+0x333>
xor    %esi,%esi
mov    -0x30(%rbp),%rbx
jmp    1593 <main+0x333>
mov    %r12d,-0x38(%rbp)
mov    0x8(%rbx),%r12d
mov    (%rbx),%rdi
call   1040 <get_in_addr@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    %r14,%rdx
mov    -0x60(%rbp),%rcx
call   1030 <inet_ntop@plt>
mov    -0x58(%rbp),%rdi
call   1170 <freeaddrinfo@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   10e0 <time@plt>
imul   %eax,%ebx
mov    %ebx,%edi
call   10b0 <srand@plt>
cmpl   $0x0,-0x3c(%rbp)
mov    -0x50(%rbp),%r14
jle    1585 <main+0x325>
mov    %r13d,%r12d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,-0x48(%rbp)
test   %r13d,%r13d
jle    1563 <main+0x303>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1160 <rand@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    14f0 <main+0x290>
test   %r13d,%r13d
jle    1563 <main+0x303>
xor    %r14d,%r14d
mov    -0x30(%rbp),%rbx
movslq %r14d,%rax
lea    (%r15,%rax,1),%rsi
mov    %r13d,%edx
sub    %eax,%edx
mov    -0x38(%rbp),%edi
call   1050 <write@plt>
test   %eax,%eax
jle    15ec <main+0x38c>
add    %eax,%r14d
cmp    %r14d,%r13d
jg     1510 <main+0x2b0>
test   %r13d,%r13d
mov    -0x50(%rbp),%r14
jle    1563 <main+0x303>
xor    %ebx,%ebx
nop
movslq %ebx,%rax
lea    (%r14,%rax,1),%rsi
mov    %r13d,%edx
sub    %eax,%edx
mov    -0x38(%rbp),%edi
call   10a0 <read@plt>
test   %eax,%eax
jle    15fd <main+0x39d>
add    %eax,%ebx
cmp    %ebx,%r13d
jg     1540 <main+0x2e0>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
call   10c0 <memcmp@plt>
test   %rax,%rax
jne    15a7 <main+0x347>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
cmp    -0x3c(%rbp),%eax
jne    14e0 <main+0x280>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x30(%rbp),%rbx
xor    %esi,%esi
mov    %rbx,%rsp
mov    %esi,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a22(%rip),%r14
mov    (%r14),%edi
lea    0xae3(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%esi
test   %r13d,%r13d
jle    160e <main+0x3ae>
xor    %edx,%edx
mov    -0x30(%rbp),%rbx
mov    -0x50(%rbp),%rax
movsbl (%rax,%rdx,1),%ecx
movsbl (%r15,%rdx,1),%r8d
cmp    %r8b,%cl
jne    1617 <main+0x3b7>
add    $0x1,%rdx
cmp    %rdx,%r12
jne    15d3 <main+0x373>
jmp    1593 <main+0x333>
lea    0xa9d(%rip),%rdi
call   1100 <perror@plt>
jmp    1379 <main+0x119>
lea    0xa92(%rip),%rdi
call   1100 <perror@plt>
jmp    13e9 <main+0x189>
mov    -0x30(%rbp),%rbx
jmp    1593 <main+0x333>
mov    (%r14),%edi
lea    0xa93(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1379 <main+0x119>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo* }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [69 x i8] c"usage: %s <hostname> <port> <numThreads> <numRequests> <dataLength>\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [15 x i8] c"client: socket\00"
@.str.3 = [16 x i8] c"client: connect\00"
@.str.4 = [27 x i8] c"client: failed to connect\0A\00"
@.str.5 = [6 x i8] c"write\00"
@.str.6 = [5 x i8] c"read\00"
@.str.7 = [25 x i8] c"Wrong data echoed back!\0A\00"
@.str.8 = [30 x i8] c"First mismatch: %d -> %d, %d\0A\00"
@.str.9 = [28 x i8] c"At least one child failed!\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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.addrinfo
%13 = alloca %struct.addrinfo*
%14 = alloca %struct.addrinfo*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i64
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %22
%26 = load i32, i32* @INET6_ADDRSTRLEN
%27 = zext i32 %26 to i64
%28 = call i8* @llvm.stacksave()
store i8* %28, i8** %23
%29 = alloca i8, i64 %27
store i64 %27, i64* %24
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 6
br i1 %31, label %32, label %38
32: ; preds = %2
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %36)
store i32 1, i32* %3
store i32 1, i32* %25
br label %293
38: ; preds = %2
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
store i8* %41, i8** %10
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
store i8* %44, i8** %11
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i32 @atoi(i8* %47)
store i32 %48, i32* %16
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 4
%51 = load i8*, i8** %50
%52 = call i32 @atoi(i8* %51)
store i32 %52, i32* %17
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 5
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %20
%57 = load i32, i32* %20
%58 = call i8* @malloc(i32 %57)
store i8* %58, i8** %8
%59 = load i32, i32* %20
%60 = call i8* @malloc(i32 %59)
store i8* %60, i8** %9
store i32 0, i32* %18
br label %61
61: ; preds = %264, %38
%62 = load i32, i32* %18
%63 = load i32, i32* %16
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %267
65: ; preds = %61
%66 = call i32 (...) @fork()
%67 = icmp ne i32 %66, 0
br i1 %67, label %263, label %68
68: ; preds = %65
%69 = call i32 @memset(%struct.addrinfo* %12, i32 0, i32 32)
%70 = load i32, i32* @AF_UNSPEC
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 1
store i32 %70, i32* %71
%72 = load i32, i32* @SOCK_STREAM
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 4
store i32 %72, i32* %73
%74 = load i8*, i8** %10
%75 = load i8*, i8** %11
%76 = call i32 @getaddrinfo(i8* %74, i8* %75, %struct.addrinfo* %12, %struct.addrinfo** %13)
store i32 %76, i32* %15
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %83
78: ; preds = %68
%79 = load i32, i32* @stderr
%80 = load i32, i32* %15
%81 = call i8* @gai_strerror(i32 %80)
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %81)
store i32 1, i32* %3
store i32 1, i32* %25
br label %293
83: ; preds = %68
%84 = load %struct.addrinfo*, %struct.addrinfo** %13
store %struct.addrinfo* %84, %struct.addrinfo** %14
br label %85
85: ; preds = %117, %83
%86 = load %struct.addrinfo*, %struct.addrinfo** %14
%87 = icmp ne %struct.addrinfo* %86, null
br i1 %87, label %88, label %121
88: ; preds = %85
%89 = load %struct.addrinfo*, %struct.addrinfo** %14
%90 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %89, i32 0, i32 1
%91 = load i32, i32* %90
%92 = load %struct.addrinfo*, %struct.addrinfo** %14
%93 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %92, i32 0, i32 4
%94 = load i32, i32* %93
%95 = load %struct.addrinfo*, %struct.addrinfo** %14
%96 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %95, i32 0, i32 3
%97 = load i32, i32* %96
%98 = call i32 @socket(i32 %91, i32 %94, i32 %97)
store i32 %98, i32* %6
%99 = icmp eq i32 %98, -1
br i1 %99, label %100, label %102
100: ; preds = %88
%101 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %117
102: ; preds = %88
%103 = load i32, i32* %6
%104 = load %struct.addrinfo*, %struct.addrinfo** %14
%105 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %104, i32 0, i32 0
%106 = load i64, i64* %105
%107 = load %struct.addrinfo*, %struct.addrinfo** %14
%108 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i32 0, i32 2
%109 = load i32, i32* %108
%110 = call i32 @connect(i32 %103, i64 %106, i32 %109)
%111 = icmp eq i32 %110, -1
br i1 %111, label %112, label %116
112: ; preds = %102
%113 = load i32, i32* %6
%114 = call i32 @close(i32 %113)
%115 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %117
116: ; preds = %102
br label %121
117: ; preds = %112, %100
%118 = load %struct.addrinfo*, %struct.addrinfo** %14
%119 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %118, i32 0, i32 5
%120 = load %struct.addrinfo*, %struct.addrinfo** %119
store %struct.addrinfo* %120, %struct.addrinfo** %14
br label %85
121: ; preds = %116, %85
%122 = load %struct.addrinfo*, %struct.addrinfo** %14
%123 = icmp eq %struct.addrinfo* %122, null
br i1 %123, label %124, label %127
124: ; preds = %121
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store i32 2, i32* %3
store i32 1, i32* %25
br label %293
127: ; preds = %121
%128 = load %struct.addrinfo*, %struct.addrinfo** %14
%129 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %128, i32 0, i32 1
%130 = load i32, i32* %129
%131 = load %struct.addrinfo*, %struct.addrinfo** %14
%132 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %131, i32 0, i32 0
%133 = load i64, i64* %132
%134 = inttoptr i64 %133 to %struct.sockaddr*
%135 = call i32 @get_in_addr(%struct.sockaddr* %134)
%136 = trunc i64 %27 to i32
%137 = call i32 @inet_ntop(i32 %130, i32 %135, i8* %29, i32 %136)
%138 = load %struct.addrinfo*, %struct.addrinfo** %13
%139 = call i32 @freeaddrinfo(%struct.addrinfo* %138)
%140 = call i32 (...) @getpid()
%141 = call i32 @time(i32* null)
%142 = mul nsw i32 %140, %141
%143 = call i32 @srand(i32 %142)
store i32 0, i32* %19
br label %144
144: ; preds = %257, %127
%145 = load i32, i32* %19
%146 = load i32, i32* %17
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %260
148: ; preds = %144
store i32 0, i32* %18
br label %149
149: ; preds = %159, %148
%150 = load i32, i32* %18
%151 = load i32, i32* %20
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %162
153: ; preds = %149
%154 = call signext i8 (...) @rand()
%155 = load i8*, i8** %9
%156 = load i32, i32* %18
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %155, i64 %157
store i8 %154, i8* %158
br label %159
159: ; preds = %153
%160 = load i32, i32* %18
%161 = add nsw i32 %160, 1
store i32 %161, i32* %18
br label %149
162: ; preds = %149
store i32 0, i32* %18
br label %163
163: ; preds = %181, %162
%164 = load i32, i32* %18
%165 = load i32, i32* %20
%166 = icmp slt i32 %164, %165
br i1 %166, label %167, label %185
167: ; preds = %163
%168 = load i32, i32* %6
%169 = load i8*, i8** %9
%170 = load i32, i32* %18
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %169, i64 %171
%173 = load i32, i32* %20
%174 = load i32, i32* %18
%175 = sub nsw i32 %173, %174
%176 = call i32 @write(i32 %168, i8* %172, i32 %175)
store i32 %176, i32* %7
%177 = load i32, i32* %7
%178 = icmp sle i32 %177, 0
br i1 %178, label %179, label %181
179: ; preds = %167
%180 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %25
br label %293
181: ; preds = %167
%182 = load i32, i32* %7
%183 = load i32, i32* %18
%184 = add nsw i32 %183, %182
store i32 %184, i32* %18
br label %163
185: ; preds = %163
store i32 0, i32* %18
br label %186
186: ; preds = %204, %185
%187 = load i32, i32* %18
%188 = load i32, i32* %20
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %208
190: ; preds = %186
%191 = load i32, i32* %6
%192 = load i8*, i8** %8
%193 = load i32, i32* %18
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8, i8* %192, i64 %194
%196 = load i32, i32* %20
%197 = load i32, i32* %18
%198 = sub nsw i32 %196, %197
%199 = call i32 @read(i32 %191, i8* %195, i32 %198)
store i32 %199, i32* %7
%200 = load i32, i32* %7
%201 = icmp sle i32 %200, 0
br i1 %201, label %202, label %204
202: ; preds = %190
%203 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %25
br label %293
204: ; preds = %190
%205 = load i32, i32* %7
%206 = load i32, i32* %18
%207 = add nsw i32 %206, %205
store i32 %207, i32* %18
br label %186
208: ; preds = %186
%209 = load i8*, i8** %8
%210 = load i8*, i8** %9
%211 = load i32, i32* %20
%212 = call i64 @memcmp(i8* %209, i8* %210, i32 %211)
%213 = icmp ne i64 %212, 0
br i1 %213, label %214, label %256
214: ; preds = %208
%215 = load i32, i32* @stderr
%216 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %18
br label %217
217: ; preds = %252, %214
%218 = load i32, i32* %18
%219 = load i32, i32* %20
%220 = icmp slt i32 %218, %219
br i1 %220, label %221, label %255
221: ; preds = %217
%222 = load i8*, i8** %8
%223 = load i32, i32* %18
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds i8, i8* %222, i64 %224
%226 = load i8, i8* %225
%227 = sext i8 %226 to i32
%228 = load i8*, i8** %9
%229 = load i32, i32* %18
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i8, i8* %228, i64 %230
%232 = load i8, i8* %231
%233 = sext i8 %232 to i32
%234 = icmp ne i32 %227, %233
br i1 %234, label %235, label %251
235: ; preds = %221
%236 = load i32, i32* @stderr
%237 = load i32, i32* %18
%238 = load i8*, i8** %8
%239 = load i32, i32* %18
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds i8, i8* %238, i64 %240
%242 = load i8, i8* %241
%243 = sext i8 %242 to i32
%244 = load i8*, i8** %9
%245 = load i32, i32* %18
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds i8, i8* %244, i64 %246
%248 = load i8, i8* %247
%249 = sext i8 %248 to i32
%250 = call i32 (i32, i8*, ...) @fprintf(i32 %236, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %237, i32 %243, i32 %249)
br label %255
251: ; preds = %221
br label %252
252: ; preds = %251
%253 = load i32, i32* %18
%254 = add nsw i32 %253, 1
store i32 %254, i32* %18
br label %217
255: ; preds = %235, %217
store i32 1, i32* %3
store i32 1, i32* %25
br label %293
256: ; preds = %208
br label %257
257: ; preds = %256
%258 = load i32, i32* %19
%259 = add nsw i32 %258, 1
store i32 %259, i32* %19
br label %144
260: ; preds = %144
%261 = load i32, i32* %6
%262 = call i32 @close(i32 %261)
store i32 0, i32* %3
store i32 1, i32* %25
br label %293
263: ; preds = %65
br label %264
264: ; preds = %263
%265 = load i32, i32* %18
%266 = add nsw i32 %265, 1
store i32 %266, i32* %18
br label %61
267: ; preds = %61
store i32 0, i32* %18
br label %268
268: ; preds = %282, %267
%269 = load i32, i32* %18
%270 = load i32, i32* %16
%271 = icmp slt i32 %269, %270
br i1 %271, label %272, label %285
272: ; preds = %268
%273 = call i32 @wait(i32* %21)
%274 = load i32, i32* %22
%275 = icmp ne i32 %274, 0
br i1 %275, label %279, label %276
276: ; preds = %272
%277 = load i32, i32* %21
%278 = icmp ne i32 %277, 0
br label %279
279: ; preds = %276, %272
%280 = phi i1 [ true, %272 ], [ %278, %276 ]
%281 = zext i1 %280 to i32
store i32 %281, i32* %22
br label %282
282: ; preds = %279
%283 = load i32, i32* %18
%284 = add nsw i32 %283, 1
store i32 %284, i32* %18
br label %268
285: ; preds = %268
%286 = load i32, i32* %22
%287 = icmp ne i32 %286, 0
br i1 %287, label %288, label %291
288: ; preds = %285
%289 = load i32, i32* @stderr
%290 = call i32 (i32, i8*, ...) @fprintf(i32 %289, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %291
291: ; preds = %288, %285
%292 = load i32, i32* %22
store i32 %292, i32* %3
store i32 1, i32* %25
br label %293
293: ; preds = %291, %260, %255, %202, %179, %124, %78, %32
%294 = load i8*, i8** %23
%295 = load i32, i32* %3
ret i32 %295
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo* }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [69 x i8] c"usage: %s <hostname> <port> <numThreads> <numRequests> <dataLength>\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [15 x i8] c"client: socket\00"
@.str.3 = [16 x i8] c"client: connect\00"
@.str.4 = [27 x i8] c"client: failed to connect\0A\00"
@.str.5 = [6 x i8] c"write\00"
@.str.6 = [5 x i8] c"read\00"
@.str.7 = [25 x i8] c"Wrong data echoed back!\0A\00"
@.str.8 = [30 x i8] c"First mismatch: %d -> %d, %d\0A\00"
@.str.9 = [28 x i8] c"At least one child failed!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca i32
%6 = bitcast %struct.addrinfo* %3 to i8*
%7 = bitcast %struct.addrinfo** %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = load i32, i32* @INET6_ADDRSTRLEN
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca i8, i64 %10
%13 = icmp eq i32 %0, 6
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %182
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = getelementptr inbounds i8*, i8** %1, i64 4
%27 = load i8*, i8** %26
%28 = tail call i32 @atoi(i8* %27)
%29 = getelementptr inbounds i8*, i8** %1, i64 5
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = tail call i8* @malloc(i32 %31)
%33 = tail call i8* @malloc(i32 %31)
%34 = icmp sgt i32 %25, 0
br i1 %34, label %38, label %182
35: ; preds = %38
%36 = icmp eq i32 %42, %25
br i1 %36, label %37, label %38
37: ; preds = %35
br i1 %34, label %167, label %182
38: ; preds = %18, %35
%39 = phi i32 [ %42, %35 ], [ 0, %18 ]
%40 = tail call i32 (...) @fork()
%41 = icmp eq i32 %40, 0
%42 = add nuw nsw i32 %39, 1
br i1 %41, label %43, label %35
43: ; preds = %38
%44 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%45 = load i32, i32* @AF_UNSPEC
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 1
store i32 %45, i32* %46
%47 = load i32, i32* @SOCK_STREAM
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %47, i32* %48
%49 = call i32 @getaddrinfo(i8* %20, i8* %22, %struct.addrinfo* %3, %struct.addrinfo** %4)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %43
%52 = load %struct.addrinfo*, %struct.addrinfo** %4
%53 = icmp eq %struct.addrinfo* %52, null
br i1 %53, label %83, label %58
54: ; preds = %43
%55 = load i32, i32* @stderr
%56 = call i8* @gai_strerror(i32 %49)
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %56)
br label %182
58: ; preds = %51, %77
%59 = phi %struct.addrinfo* [ %81, %77 ], [ %52, %51 ]
%60 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 1
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 4
%63 = load i32, i32* %62
%64 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 3
%65 = load i32, i32* %64
%66 = call i32 @socket(i32 %61, i32 %63, i32 %65)
%67 = icmp eq i32 %66, -1
br i1 %67, label %77, label %68
68: ; preds = %58
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 0
%70 = load i64, i64* %69
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 2
%72 = load i32, i32* %71
%73 = call i32 @connect(i32 %66, i64 %70, i32 %72)
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %86
75: ; preds = %68
%76 = call i32 @close(i32 %66)
br label %77
77: ; preds = %58, %75
%78 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %75 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %58 ]
%79 = call i32 @perror(i8* %78)
%80 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 5
%81 = load %struct.addrinfo*, %struct.addrinfo** %80
%82 = icmp eq %struct.addrinfo* %81, null
br i1 %82, label %83, label %58
83: ; preds = %77, %51
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %182
86: ; preds = %68
%87 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 1
%88 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 0
%89 = load i32, i32* %87
%90 = load i64, i64* %88
%91 = inttoptr i64 %90 to %struct.sockaddr*
%92 = call i32 @get_in_addr(%struct.sockaddr* %91)
%93 = call i32 @inet_ntop(i32 %89, i32 %92, i8* %12, i32 %9)
%94 = load %struct.addrinfo*, %struct.addrinfo** %4
%95 = call i32 @freeaddrinfo(%struct.addrinfo* %94)
%96 = call i32 (...) @getpid()
%97 = call i32 @time(i32* null)
%98 = mul nsw i32 %97, %96
%99 = call i32 @srand(i32 %98)
%100 = icmp sgt i32 %28, 0
br i1 %100, label %101, label %165
101: ; preds = %86
%102 = icmp sgt i32 %31, 0
%103 = zext i32 %31 to i64
br label %106
104: ; preds = %140
%105 = icmp eq i32 %143, %28
br i1 %105, label %165, label %106
106: ; preds = %101, %104
%107 = phi i32 [ 0, %101 ], [ %143, %104 ]
br i1 %102, label %109, label %140
108: ; preds = %109
br i1 %102, label %118, label %140
109: ; preds = %106, %109
%110 = phi i64 [ %113, %109 ], [ 0, %106 ]
%111 = call signext i8 (...) @rand()
%112 = getelementptr inbounds i8, i8* %33, i64 %110
store i8 %111, i8* %112
%113 = add nuw nsw i64 %110, 1
%114 = icmp eq i64 %113, %103
br i1 %114, label %108, label %109
115: ; preds = %118
%116 = icmp sgt i32 %31, %125
br i1 %116, label %118, label %117
117: ; preds = %115
br i1 %102, label %130, label %140
118: ; preds = %108, %115
%119 = phi i32 [ %125, %115 ], [ 0, %108 ]
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %33, i64 %120
%122 = sub nsw i32 %31, %119
%123 = call i32 @write(i32 %66, i8* %121, i32 %122)
%124 = icmp slt i32 %123, 1
%125 = add nsw i32 %123, %119
br i1 %124, label %126, label %115
126: ; preds = %118
%127 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %182
128: ; preds = %130
%129 = icmp sgt i32 %31, %137
br i1 %129, label %130, label %140
130: ; preds = %117, %128
%131 = phi i32 [ %137, %128 ], [ 0, %117 ]
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %32, i64 %132
%134 = sub nsw i32 %31, %131
%135 = call i32 @read(i32 %66, i8* %133, i32 %134)
%136 = icmp slt i32 %135, 1
%137 = add nsw i32 %135, %131
br i1 %136, label %138, label %128
138: ; preds = %130
%139 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %182
140: ; preds = %128, %106, %108, %117
%141 = call i64 @memcmp(i8* %32, i8* %33, i32 %31)
%142 = icmp eq i64 %141, 0
%143 = add nuw nsw i32 %107, 1
br i1 %142, label %104, label %144
144: ; preds = %140
%145 = load i32, i32* @stderr
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %145, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br i1 %102, label %147, label %182
147: ; preds = %144
%148 = zext i32 %31 to i64
br label %149
149: ; preds = %147, %162
%150 = phi i64 [ 0, %147 ], [ %163, %162 ]
%151 = getelementptr inbounds i8, i8* %32, i64 %150
%152 = load i8, i8* %151
%153 = getelementptr inbounds i8, i8* %33, i64 %150
%154 = load i8, i8* %153
%155 = icmp eq i8 %152, %154
br i1 %155, label %162, label %156
156: ; preds = %149
%157 = trunc i64 %150 to i32
%158 = sext i8 %154 to i32
%159 = sext i8 %152 to i32
%160 = load i32, i32* @stderr
%161 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %157, i32 %159, i32 %158)
br label %182
162: ; preds = %149
%163 = add nuw nsw i64 %150, 1
%164 = icmp eq i64 %163, %148
br i1 %164, label %182, label %149
165: ; preds = %104, %86
%166 = call i32 @close(i32 %66)
br label %182
167: ; preds = %37, %167
%168 = phi i32 [ %175, %167 ], [ 0, %37 ]
%169 = phi i32 [ %176, %167 ], [ 0, %37 ]
%170 = call i32 @wait(i32* %5)
%171 = icmp ne i32 %168, 0
%172 = load i32, i32* %5
%173 = icmp ne i32 %172, 0
%174 = select i1 %171, i1 true, i1 %173
%175 = zext i1 %174 to i32
%176 = add nuw nsw i32 %169, 1
%177 = icmp eq i32 %176, %25
br i1 %177, label %178, label %167
178: ; preds = %167
br i1 %174, label %179, label %182
179: ; preds = %178
%180 = load i32, i32* @stderr
%181 = call i32 (i32, i8*, ...) @fprintf(i32 %180, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %182
182: ; preds = %162, %18, %37, %144, %178, %179, %156, %165, %138, %126, %83, %54, %14
%183 = phi i32 [ 1, %14 ], [ 1, %54 ], [ 2, %83 ], [ 1, %126 ], [ 1, %138 ], [ 0, %165 ], [ 1, %156 ], [ 1, %179 ], [ 0, %178 ], [ 1, %144 ], [ 0, %37 ], [ 0, %18 ], [ 1, %162 ]
ret i32 %183
}