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

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ serv_addr;
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ STDOUT_FILENO;
int WCONTINUED;
int WUNTRACED;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ get_port(char *);
int getpid();
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ waitpid(scalar_t__, int *, int);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  pid_t pid[10];
  int s;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s [address] [port].\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  for (int i = 0; i < 1000; i++) {
    pid[i] = fork();
    if (pid[i] < 0)
      perror("fork");
    else if (pid[i] == 0) {
      int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
      struct sockaddr_in serv_addr;
      memset(&serv_addr, 0, sizeof(serv_addr));
      serv_addr.sin_family = AF_INET;
      serv_addr.sin_addr.s_addr = inet_addr(argv[1]);
      serv_addr.sin_port = htons(get_port(argv[2]));
      s = connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
      if (s == -1)
        perror("connect");
      char buffer[BUFSIZ];
      sprintf(buffer, "Message from client: %d\n", getpid());
      send(sock, buffer, strlen(buffer), 0);
      ssize_t count;
      count = recv(sock, buffer, sizeof(buffer), 0);
      write(STDOUT_FILENO, buffer, count);
      sleep(i);
      close(sock);
      printf("pid %d exit\n", getpid());
      exit(0);
    } else {
      continue;
    }
  }
  for (int i = 0; i < 1000; i++) {
    int status;
    waitpid(pid[i], &status, WUNTRACED | WCONTINUED);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     128d <main+0x4d>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd86(%rip),%rsi
call   10e0 <fprintf@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x3e8,-0x68(%rbp)
jge    1474 <main+0x234>
mov    $0x0,%al
call   1150 <fork@plt>
mov    %rax,%rcx
movslq -0x68(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
movslq -0x68(%rbp),%rax
cmpq   $0x0,-0x60(%rbp,%rax,8)
jge    12d5 <main+0x95>
lea    0xd52(%rip),%rdi
call   1100 <perror@plt>
jmp    1461 <main+0x221>
movslq -0x68(%rbp),%rax
cmpq   $0x0,-0x60(%rbp,%rax,8)
jne    145c <main+0x21c>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
mov    0x2cda(%rip),%rax
mov    (%rax),%edx
call   1160 <socket@plt>
mov    %eax,-0x6c(%rbp)
lea    -0x78(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <inet_addr@plt>
mov    %eax,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <get_port@plt>
mov    %eax,%edi
call   1080 <htons@plt>
mov    %eax,-0x78(%rbp)
mov    -0x6c(%rbp),%edi
lea    -0x78(%rbp),%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1375 <main+0x135>
lea    0xcb2(%rip),%rdi
call   1100 <perror@plt>
mov    0x2c34(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xa8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0xa0(%rbp),%rdi
mov    %eax,%edx
lea    0xc65(%rip),%rsi
call   1110 <sprintf@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x6c(%rbp),%eax
mov    %eax,-0xac(%rbp)
call   1070 <strlen@plt>
mov    -0xac(%rbp),%edi
mov    -0xa0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%rax
mov    -0x6c(%rbp),%edi
mov    %eax,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0xa0(%rbp),%rsi
mov    %eax,-0x8c(%rbp)
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
mov    -0x8c(%rbp),%edx
call   1040 <write@plt>
mov    -0x68(%rbp),%edi
call   1140 <sleep@plt>
mov    -0x6c(%rbp),%edi
call   10c0 <close@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xbf3(%rip),%rdi
call   10a0 <printf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
jmp    1466 <main+0x226>
jmp    1466 <main+0x226>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1294 <main+0x54>
movl   $0x0,-0x90(%rbp)
cmpl   $0x3e8,-0x90(%rbp)
jge    14cc <main+0x28c>
movslq -0x90(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
mov    0x2b27(%rip),%rax
mov    (%rax),%edx
mov    0x2aee(%rip),%rax
or     (%rax),%edx
lea    -0x94(%rbp),%rsi
call   10f0 <waitpid@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    147e <main+0x23e>
xor    %eax,%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    %rsi,%r15
cmp    $0x3,%edi
jne    140f <main+0x1cf>
lea    0xdb9(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1150 <fork@plt>
mov    %rax,-0x90(%rbp,%rbx,8)
ff
test   %rax,%rax
js     1295 <main+0x55>
je     12f5 <main+0xb5>
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1270 <main+0x30>
jmp    129f <main+0x5f>
mov    %r14,%rdi
call   1100 <perror@plt>
jmp    1286 <main+0x46>
xor    %ebx,%ebx
mov    0x2d20(%rip),%r15
mov    0x2ce9(%rip),%r12
lea    -0x38(%rbp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x90(%rbp,%rbx,8),%rdi
ff
mov    (%r12),%edx
or     (%r15),%edx
mov    %r14,%rsi
call   10f0 <waitpid@plt>
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    12c0 <main+0x80>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ce4(%rip),%r13
mov    0x0(%r13),%edi
mov    0x2cb1(%rip),%rax
mov    (%rax),%esi
mov    0x2cc8(%rip),%rax
mov    (%rax),%edx
call   1160 <socket@plt>
mov    %eax,%r14d
lea    -0x38(%rbp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x0(%r13),%eax
mov    %eax,-0x30(%rbp)
mov    0x8(%r15),%rdi
call   10d0 <inet_addr@plt>
mov    %eax,-0x34(%rbp)
mov    0x10(%r15),%rdi
call   1060 <get_port@plt>
mov    %eax,%edi
call   1080 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
cmp    $0xffffffff,%eax
jne    1374 <main+0x134>
lea    0xcb3(%rip),%rdi
call   1100 <perror@plt>
mov    0x2c35(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%r12
mov    %r15,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xc8a(%rip),%rsi
mov    %r12,%rdi
mov    %eax,%edx
call   1110 <sprintf@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r14d,%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %r14d,%edi
mov    %r12,%rsi
mov    %r15d,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    0x2c18(%rip),%rcx
mov    (%rcx),%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %ebx,%edi
call   1140 <sleep@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xc42(%rip),%rdi
mov    %eax,%esi
call   10a0 <printf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xbde(%rip),%rsi
call   10e0 <fprintf@plt>
mov    0x2b7a(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [29 x i8] c"Usage: %s [address] [port].\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [5 x i8] c"fork\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [8 x i8] c"connect\00"
@BUFSIZ = global i32 0
@.str.3 = [25 x i8] c"Message from client: %d\0A\00"
@STDOUT_FILENO = global i32 0
@.str.4 = [13 x i8] c"pid %d exit\0A\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i64]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %26
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %2
store i32 0, i32* %8
br label %27
27: ; preds = %100, %26
%28 = load i32, i32* %8
%29 = icmp slt i32 %28, 1000
br i1 %29, label %30, label %103
30: ; preds = %27
%31 = call i64 (...) @fork()
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 %33
store i64 %31, i64* %34
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 %36
%38 = load i64, i64* %37
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %99
42: ; preds = %30
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 %44
%46 = load i64, i64* %45
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %98
48: ; preds = %42
%49 = load i32, i32* @AF_INET
%50 = load i32, i32* @SOCK_STREAM
%51 = load i32, i32* @IPPROTO_TCP
%52 = call i32 @socket(i32 %49, i32 %50, i32 %51)
store i32 %52, i32* %9
%53 = call i32 @memset(%struct.sockaddr_in* %10, i32 0, i32 12)
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %54, i32* %55
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i32 @inet_addr(i8* %58)
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%61 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %60, i32 0, i32 0
store i32 %59, i32* %61
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 2
%64 = load i8*, i8** %63
%65 = call i32 @get_port(i8* %64)
%66 = call i32 @htons(i32 %65)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i32 %66, i32* %67
%68 = load i32, i32* %9
%69 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%70 = call i32 @connect(i32 %68, %struct.sockaddr* %69, i32 12)
store i32 %70, i32* %7
%71 = load i32, i32* %7
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %48
%74 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %75
75: ; preds = %73, %48
%76 = load i32, i32* @BUFSIZ
%77 = zext i32 %76 to i64
%78 = call i8* @llvm.stacksave()
store i8* %78, i8** %11
%79 = alloca i8, i64 %77
store i64 %77, i64* %12
%80 = call i32 (...) @getpid()
%81 = call i32 @sprintf(i8* %79, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %80)
%82 = load i32, i32* %9
%83 = call i32 @strlen(i8* %79)
%84 = call i32 @send(i32 %82, i8* %79, i32 %83, i32 0)
%85 = load i32, i32* %9
%86 = trunc i64 %77 to i32
%87 = call i32 @recv(i32 %85, i8* %79, i32 %86, i32 0)
store i32 %87, i32* %13
%88 = load i32, i32* @STDOUT_FILENO
%89 = load i32, i32* %13
%90 = call i32 @write(i32 %88, i8* %79, i32 %89)
%91 = load i32, i32* %8
%92 = call i32 @sleep(i32 %91)
%93 = load i32, i32* %9
%94 = call i32 @close(i32 %93)
%95 = call i32 (...) @getpid()
%96 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %95)
%97 = call i32 @exit(i32 0)
unreachable
98: ; preds = %42
br label %100
99: ; preds = %40
br label %100
100: ; preds = %99, %98
%101 = load i32, i32* %8
%102 = add nsw i32 %101, 1
store i32 %102, i32* %8
br label %27
103: ; preds = %27
store i32 0, i32* %14
br label %104
104: ; preds = %116, %103
%105 = load i32, i32* %14
%106 = icmp slt i32 %105, 1000
br i1 %106, label %107, label %119
107: ; preds = %104
%108 = load i32, i32* %14
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 %109
%111 = load i64, i64* %110
%112 = load i32, i32* @WUNTRACED
%113 = load i32, i32* @WCONTINUED
%114 = or i32 %112, %113
%115 = call i32 @waitpid(i64 %111, i32* %15, i32 %114)
br label %116
116: ; preds = %107
%117 = load i32, i32* %14
%118 = add nsw i32 %117, 1
store i32 %118, i32* %14
br label %104
119: ; preds = %104
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [29 x i8] c"Usage: %s [address] [port].\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [5 x i8] c"fork\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [8 x i8] c"connect\00"
@BUFSIZ = global i32 0
@.str.3 = [25 x i8] c"Message from client: %d\0A\00"
@STDOUT_FILENO = global i32 0
@.str.4 = [13 x i8] c"pid %d exit\0A\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i64]
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = bitcast [10 x i64]* %3 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %65
%15 = bitcast i32* %5 to i8*
br label %69
16: ; preds = %2, %65
%17 = phi i64 [ %66, %65 ], [ 0, %2 ]
%18 = tail call i64 (...) @fork()
%19 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %17
store i64 %18, i64* %19
%20 = icmp slt i64 %18, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %65
23: ; preds = %16
%24 = icmp eq i64 %18, 0
br i1 %24, label %25, label %65
25: ; preds = %23
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = load i32, i32* @IPPROTO_TCP
%29 = tail call i32 @socket(i32 %26, i32 %27, i32 %28)
%30 = bitcast %struct.sockaddr_in* %4 to i8*
%31 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%32 = load i32, i32* @AF_INET
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %32, i32* %33
%34 = getelementptr inbounds i8*, i8** %1, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @inet_addr(i8* %35)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %36, i32* %37
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @get_port(i8* %39)
%41 = call i32 @htons(i32 %40)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %41, i32* %42
%43 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%44 = call i32 @connect(i32 %29, %struct.sockaddr* %43, i32 12)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %25
%47 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %46, %25
%49 = trunc i64 %17 to i32
%50 = load i32, i32* @BUFSIZ
%51 = zext i32 %50 to i64
%52 = alloca i8, i64 %51
%53 = call i32 (...) @getpid()
%54 = call i32 @sprintf(i8* %52, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = call i32 @strlen(i8* %52)
%56 = call i32 @send(i32 %29, i8* %52, i32 %55, i32 0)
%57 = call i32 @recv(i32 %29, i8* %52, i32 %50, i32 0)
%58 = load i32, i32* @STDOUT_FILENO
%59 = call i32 @write(i32 %58, i8* %52, i32 %57)
%60 = call i32 @sleep(i32 %49)
%61 = call i32 @close(i32 %29)
%62 = call i32 (...) @getpid()
%63 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = call i32 @exit(i32 0)
unreachable
65: ; preds = %23, %21
%66 = add nuw nsw i64 %17, 1
%67 = icmp eq i64 %66, 1000
br i1 %67, label %14, label %16
68: ; preds = %69
ret i32 0
69: ; preds = %14, %69
%70 = phi i64 [ 0, %14 ], [ %77, %69 ]
%71 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %70
%72 = load i64, i64* %71
%73 = load i32, i32* @WUNTRACED
%74 = load i32, i32* @WCONTINUED
%75 = or i32 %74, %73
%76 = call i32 @waitpid(i64 %72, i32* %5, i32 %75)
%77 = add nuw nsw i64 %70, 1
%78 = icmp eq i64 %77, 1000
br i1 %78, label %68, label %69
}