#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 in_addr {
  int dummy;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_zero;
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  scalar_t__ h_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bzero(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int rand();
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int sock, bytes_recieved;
  char send_data[1024], recv_data[1024];
  struct hostent *host;
  struct sockaddr_in server_addr;
  srand(time(NULL));
  host = gethostbyname("127.0.0.1");
  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("Socket");
    exit(1);
  }
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(5001);
  server_addr.sin_addr = *((struct in_addr *)host->h_addr);
  bzero(&(server_addr.sin_zero), 8);
  if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) ==
      -1) {
    perror("Connect: could not connect to socket");
    exit(1);
  }
  while (1) {
    bytes_recieved = recv(sock, recv_data, 1024, 0);
    recv_data[bytes_recieved] = '\0';
    if (strcmp(recv_data, "q") == 0 || strcmp(recv_data, "Q") == 0) {
      close(sock);
    } else {
      printf("\nRecieved data = %s ", recv_data);
      int numSensors = atoi(recv_data);
      strcpy(send_data, "[");
      int x = 0;
      for (x; x < numSensors; x++) {
        char str[5];
        sprintf(str, "%d", 19 + rand() % 4);
        strcat(send_data, "\"");
        strcat(send_data, str);
        strcat(send_data, "\",");
      }
    }
    int l = strlen(send_data) - 1;
    send_data[l] = ']';
    send(sock, send_data, strlen(send_data), 0);
    sleep(6);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
lea    0xd87(%rip),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0x818(%rbp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    12c0 <main+0x70>
lea    0xd59(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x81c(%rbp)
mov    $0x1389,%edi
call   1060 <htons@plt>
mov    %eax,-0x820(%rbp)
mov    -0x818(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x824(%rbp)
lea    -0x828(%rbp),%rdi
mov    $0x8,%esi
call   10f0 <bzero@plt>
mov    -0x8(%rbp),%edi
lea    -0x828(%rbp),%rsi
mov    $0x4,%edx
call   1140 <connect@plt>
cmp    $0xffffffff,%eax
jne    1335 <main+0xe5>
lea    0xceb(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    133a <main+0xea>
mov    -0x8(%rbp),%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movb   $0x0,-0x810(%rbp,%rax,1)
lea    -0x810(%rbp),%rdi
lea    0xcc9(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1399 <main+0x149>
lea    -0x810(%rbp),%rdi
lea    0xcae(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13a6 <main+0x156>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
jmp    147f <main+0x22f>
lea    -0x810(%rbp),%rsi
lea    0xc86(%rip),%rdi
call   1080 <printf@plt>
lea    -0x810(%rbp),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x82c(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xc76(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x830(%rbp)
mov    -0x830(%rbp),%eax
cmp    -0x82c(%rbp),%eax
jge    147a <main+0x22a>
lea    -0x835(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    $0x0,%al
call   1160 <rand@plt>
mov    -0x848(%rbp),%rdi
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x13,%edx
lea    0xc29(%rip),%rsi
call   1120 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xc19(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    -0x835(%rbp),%rsi
call   1110 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xbf5(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x830(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x830(%rbp)
jmp    13e8 <main+0x198>
jmp    147f <main+0x22f>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x83c(%rbp)
movslq -0x83c(%rbp),%rax
movb   $0x5d,-0x410(%rbp,%rax,1)
5d
mov    -0x8(%rbp),%eax
mov    %eax,-0x854(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x850(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x854(%rbp),%edi
mov    -0x850(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    $0x6,%edi
call   1150 <sleep@plt>
jmp    133a <main+0xea>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
lea    0xd8a(%rip),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,%rbx
mov    0x2d63(%rip),%r14
mov    (%r14),%edi
mov    0x2d49(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
cmp    $0xffffffff,%eax
je     1430 <main+0x1e0>
mov    %eax,%ebp
mov    (%r14),%eax
mov    %eax,0x14(%rsp)
mov    $0x1389,%edi
call   1060 <htons@plt>
mov    %eax,0x10(%rsp)
mov    (%rbx),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   10f0 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1140 <connect@plt>
cmp    $0xffffffff,%eax
je     1439 <main+0x1e9>
lea    0x20(%rsp),%r13
lea    0x420(%rsp),%rbx
lea    0x1b(%rsp),%r12
lea    0xd50(%rip),%r15
lea    0xd4b(%rip),%r14
mov    %ebp,0x4(%rsp)
jmp    135f <main+0x10f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1090 <close@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x5d,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    $0x6,%edi
call   1150 <sleep@plt>
lea    0x20(%rsp),%r13
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cltq
movb   $0x0,0x20(%rsp,%rax,1)
mov    %r13,%rdi
lea    0xcb5(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1320 <main+0xd0>
mov    %r13,%rdi
lea    0xca3(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1320 <main+0xd0>
lea    0xc94(%rip),%rdi
mov    %r13,%rsi
call   1080 <printf@plt>
mov    %r13,%rdi
call   1100 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
lea    0xc8d(%rip),%rsi
call   1040 <strcpy@plt>
test   %ebp,%ebp
lea    0xc81(%rip),%r13
jle    1327 <main+0xd7>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1160 <rand@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edx
add    $0x13,%edx
mov    %r12,%rdi
mov    %r13,%rsi
call   1120 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1110 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1110 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1110 <strcat@plt>
add    $0xffffffff,%ebp
jne    13e0 <main+0x190>
jmp    1327 <main+0xd7>
lea    0xbd3(%rip),%rdi
jmp    1440 <main+0x1f0>
lea    0xbd1(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.hostent = type { i64 }
%struct.sockaddr_in = type { i32, %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"Socket\00"
@.str.2 = [37 x i8] c"Connect: could not connect to socket\00"
@.str.3 = [2 x i8] c"q\00"
@.str.4 = [2 x i8] c"Q\00"
@.str.5 = [21 x i8] c"\0ARecieved data = %s \00"
@.str.6 = [2 x i8] c"[\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [2 x i8] c"\22\00"
@.str.9 = [3 x i8] c"\22,\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca %struct.hostent*
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca i32
%10 = alloca [5 x i8]
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
%14 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store %struct.hostent* %14, %struct.hostent** %6
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %2
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %0
%20 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %0
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 3
store i32 %23, i32* %24
%25 = call i32 @htons(i32 5001)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %25, i32* %26
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%28 = load %struct.hostent*, %struct.hostent** %6
%29 = getelementptr inbounds %struct.hostent, %struct.hostent* %28, i32 0, i32 0
%30 = load i64, i64* %29
%31 = inttoptr i64 %30 to %struct.in_addr*
%32 = bitcast %struct.in_addr* %27 to i8*
%33 = bitcast %struct.in_addr* %31 to i8*
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%35 = call i32 @bzero(i32* %34, i32 8)
%36 = load i32, i32* %2
%37 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%38 = call i32 @connect(i32 %36, %struct.sockaddr* %37, i32 4)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %22
%41 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %22
br label %44
44: ; preds = %43, %90
%45 = load i32, i32* %2
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%47 = call i32 @recv(i32 %45, i8* %46, i32 1024, i32 0)
store i32 %47, i32* %3
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %49
store i8 0, i8* %50
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %44
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %54, %44
%59 = load i32, i32* %2
%60 = call i32 @close(i32 %59)
br label %90
61: ; preds = %54
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%63 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %8
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%67 = call i32 @strcpy(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %9
%68 = load i32, i32* %9
br label %69
69: ; preds = %86, %61
%70 = load i32, i32* %9
%71 = load i32, i32* %8
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %89
73: ; preds = %69
%74 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%75 = call i32 (...) @rand()
%76 = srem i32 %75, 4
%77 = add nsw i32 19, %76
%78 = call i32 @sprintf(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%80 = call i32 @strcat(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%82 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%83 = call i32 @strcat(i8* %81, i8* %82)
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%85 = call i32 @strcat(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %86
86: ; preds = %73
%87 = load i32, i32* %9
%88 = add nsw i32 %87, 1
store i32 %88, i32* %9
br label %69
89: ; preds = %69
br label %90
90: ; preds = %89, %58
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%92 = call i32 @strlen(i8* %91)
%93 = sub nsw i32 %92, 1
store i32 %93, i32* %11
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %95
store i8 93, i8* %96
%97 = load i32, i32* %2
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%100 = call i32 @strlen(i8* %99)
%101 = call i32 @send(i32 %97, i8* %98, i32 %100, i32 0)
%102 = call i32 @sleep(i32 6)
br label %44
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i64 }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"Socket\00"
@.str.2 = [37 x i8] c"Connect: could not connect to socket\00"
@.str.3 = [2 x i8] c"q\00"
@.str.4 = [2 x i8] c"Q\00"
@.str.5 = [21 x i8] c"\0ARecieved data = %s \00"
@.str.6 = [2 x i8] c"[\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [2 x i8] c"\22\00"
@.str.9 = [3 x i8] c"\22,\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = alloca %struct.sockaddr_in
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = tail call i32 @time(i32* null)
%9 = tail call i32 @srand(i32 %8)
%10 = tail call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 %19, i32* %20
%21 = tail call i32 @htons(i32 5001)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.hostent, %struct.hostent* %10, i64 0, i32 0
%24 = load i64, i64* %23
%25 = inttoptr i64 %24 to i32*
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%27 = load i32, i32* %25
store i32 %27, i32* %26
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%29 = call i32 @bzero(i32* %28, i32 8)
%30 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%31 = call i32 @connect(i32 %13, %struct.sockaddr* %30, i32 4)
%32 = icmp eq i32 %31, -1
br i1 %32, label %35, label %33
33: ; preds = %18
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
br label %38
35: ; preds = %18
%36 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %33, %65
%39 = call i32 @recv(i32 %13, i8* %6, i32 1024, i32 0)
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %40
store i8 0, i8* %41
%42 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %38
%45 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44, %38
%48 = call i32 @close(i32 %13)
br label %65
49: ; preds = %44
%50 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%51 = call i32 @atoi(i8* %6)
%52 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp sgt i32 %51, 0
br i1 %53, label %54, label %65
54: ; preds = %49, %54
%55 = phi i32 [ %63, %54 ], [ 0, %49 ]
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 4
%58 = add nsw i32 %57, 19
%59 = call i32 @sprintf(i8* %34, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %58)
%60 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%61 = call i32 @strcat(i8* %5, i8* %34)
%62 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%63 = add nuw nsw i32 %55, 1
%64 = icmp eq i32 %63, %51
br i1 %64, label %65, label %54
65: ; preds = %54, %49, %47
%66 = call i32 @strlen(i8* %5)
%67 = add nsw i32 %66, -1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %68
store i8 93, i8* %69
%70 = call i32 @strlen(i8* %5)
%71 = call i32 @send(i32 %13, i8* %5, i32 %70, i32 0)
%72 = call i32 @sleep(i32 6)
br label %38
}