#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 {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ hostAddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
scalar_t__ close(int);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ kbhit();
scalar_t__ listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int clientProcessing(int *workSock, int *listenSock, char *hostName,
                     char *port) {
  struct sockaddr_in hostAddr;
  char buf[1024];
  int readBytes;
  if (((*listenSock) = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("socket");
    return -1;
  }
  hostAddr.sin_family = AF_INET;
  hostAddr.sin_port = htons(atoi(port));
  hostAddr.sin_addr.s_addr = inet_addr(hostName);
  if (bind((*listenSock), (struct sockaddr *)&hostAddr, sizeof(hostAddr)) < 0) {
    perror("bind");
    return -1;
  }
  if (listen((*listenSock), 1) < 0) {
    perror("listen");
    return -1;
  }
  while (!kbhit()) {
    printf("waiting for connection\n");
    if (((*workSock) = accept((*listenSock), 0, 0)) < 0) {
      perror("accept");
      return -2;
    }
    printf("new client connected\n");
    while (!kbhit()) {
      if ((readBytes = recv((*workSock), buf, 1024, 0)) < 0) {
        perror("recv");
        return -2;
      }
      if (!readBytes) {
        perror("recv connection lost");
        break;
      }
      if (send((*workSock), buf, readBytes, 0) < 0) {
        perror("send");
        return -2;
      }
    }
    if (close((*workSock)) < 0) {
      perror("close workSock child");
      return -2;
    }
    printf("connection closed\n");
  }
  if (close(*listenSock) < 0) {
    perror("close listenSock");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<clientProcessing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    0x2ddd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jge    122b <clientProcessing+0x5b>
lea    0xde6(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0x0,%rax
jge    128c <clientProcessing+0xbc>
lea    0xd8c(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   10a0 <listen@plt>
cmp    $0x0,%rax
jge    12be <clientProcessing+0xee>
lea    0xd5f(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
jmp    12c3 <clientProcessing+0xf3>
mov    $0x0,%al
call   1070 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12df <clientProcessing+0x10f>
jmp    1426 <clientProcessing+0x256>
lea    0xd2d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
xor    %edx,%edx
mov    %edx,%esi
call   10d0 <accept@plt>
mov    -0x10(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jge    1321 <clientProcessing+0x151>
lea    0xd1b(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
lea    0xd0a(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1349 <clientProcessing+0x179>
jmp    13e8 <clientProcessing+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x444(%rbp)
cmp    $0x0,%eax
jge    1389 <clientProcessing+0x1b9>
lea    0xcd0(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
cmpl   $0x0,-0x444(%rbp)
jne    13a7 <clientProcessing+0x1d7>
lea    0xcb0(%rip),%rdi
call   10c0 <perror@plt>
jmp    13e8 <clientProcessing+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rsi
mov    -0x444(%rbp),%edx
xor    %ecx,%ecx
call   1050 <send@plt>
cmp    $0x0,%rax
jge    13e3 <clientProcessing+0x213>
lea    0xc90(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
jmp    132d <clientProcessing+0x15d>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1080 <close@plt>
cmp    $0x0,%rax
jge    1415 <clientProcessing+0x245>
lea    0xc63(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
lea    0xc60(%rip),%rdi
call   1060 <printf@plt>
jmp    12c3 <clientProcessing+0xf3>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1080 <close@plt>
cmp    $0x0,%rax
jge    1453 <clientProcessing+0x283>
lea    0xc4d(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145a <clientProcessing+0x28a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clientProcessing>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rcx,%rbp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2df4(%rip),%r12
mov    (%r12),%edi
mov    0x2dd9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,(%r14)
test   %eax,%eax
js     1379 <clientProcessing+0x1a9>
mov    (%r12),%eax
mov    %eax,0x8(%rsp)
mov    %rbp,%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x4(%rsp)
mov    %r15,%rdi
call   1090 <inet_addr@plt>
mov    %eax,(%rsp)
mov    (%r14),%edi
mov    %rsp,%rsi
mov    $0xc,%edx
call   10b0 <bind@plt>
test   %rax,%rax
js     1382 <clientProcessing+0x1b2>
mov    (%r14),%edi
mov    $0x1,%esi
call   10a0 <listen@plt>
test   %rax,%rax
js     138b <clientProcessing+0x1bb>
xor    %r13d,%r13d
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
je     1293 <clientProcessing+0xc3>
mov    (%r14),%edi
call   1080 <close@plt>
test   %rax,%rax
jns    139d <clientProcessing+0x1cd>
lea    0xdc0(%rip),%rdi
jmp    1392 <clientProcessing+0x1c2>
lea    0xdc5(%rip),%r15
lea    0xdd5(%rip),%r12
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <puts@plt>
mov    (%r14),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <accept@plt>
mov    %eax,(%rbx)
test   %eax,%eax
js     13b2 <clientProcessing+0x1e2>
mov    %r12,%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
jne    1330 <clientProcessing+0x160>
mov    (%rbx),%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     135c <clientProcessing+0x18c>
je     1317 <clientProcessing+0x147>
mov    (%rbx),%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %rax,%rax
jns    12e0 <clientProcessing+0x110>
jmp    1365 <clientProcessing+0x195>
lea    0xd01(%rip),%rdi
call   10c0 <perror@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%edi
call   1080 <close@plt>
test   %rax,%rax
js     13bb <clientProcessing+0x1eb>
lea    0xd48(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
je     12b0 <clientProcessing+0xe0>
jmp    1276 <clientProcessing+0xa6>
lea    0xcb7(%rip),%rdi
jmp    136c <clientProcessing+0x19c>
lea    0xcc8(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xfffffffe,%r13d
jmp    139d <clientProcessing+0x1cd>
lea    0xc80(%rip),%rdi
jmp    1392 <clientProcessing+0x1c2>
lea    0xc7e(%rip),%rdi
jmp    1392 <clientProcessing+0x1c2>
lea    0xc7a(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xffffffff,%r13d
mov    %r13d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc5a(%rip),%rdi
jmp    136c <clientProcessing+0x19c>
lea    0xc77(%rip),%rdi
jmp    136c <clientProcessing+0x19c>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.3 = [24 x i8] c"waiting for connection\0A\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [22 x i8] c"new client connected\0A\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [21 x i8] c"recv connection lost\00"
@.str.8 = [5 x i8] c"send\00"
@.str.9 = [21 x i8] c"close workSock child\00"
@.str.10 = [19 x i8] c"connection closed\0A\00"
@.str.11 = [17 x i8] c"close listenSock\00"
define i32 @clientProcessing(i32* %0, i32* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca %struct.sockaddr_in
%11 = alloca [1024 x i8]
%12 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = load i32*, i32** %7
store i32 %15, i32* %16
%17 = icmp slt i32 %15, 0
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
br label %105
20: ; preds = %4
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i8*, i8** %9
%24 = call i32 @atoi(i8* %23)
%25 = call i32 @htons(i32 %24)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i8*, i8** %8
%28 = call i32 @inet_addr(i8* %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i32*, i32** %7
%32 = load i32, i32* %31
%33 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%34 = call i64 @bind(i32 %32, %struct.sockaddr* %33, i32 12)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %20
%37 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %5
br label %105
38: ; preds = %20
%39 = load i32*, i32** %7
%40 = load i32, i32* %39
%41 = call i64 @listen(i32 %40, i32 1)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %5
br label %105
45: ; preds = %38
br label %46
46: ; preds = %95, %45
%47 = call i32 (...) @kbhit()
%48 = icmp ne i32 %47, 0
%49 = xor i1 %48, true
br i1 %49, label %50, label %97
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%52 = load i32*, i32** %7
%53 = load i32, i32* %52
%54 = call i32 @accept(i32 %53, i32 0, i32 0)
%55 = load i32*, i32** %6
store i32 %54, i32* %55
%56 = icmp slt i32 %54, 0
br i1 %56, label %57, label %59
57: ; preds = %50
%58 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32 -2, i32* %5
br label %105
59: ; preds = %50
%60 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %61
61: ; preds = %87, %59
%62 = call i32 (...) @kbhit()
%63 = icmp ne i32 %62, 0
%64 = xor i1 %63, true
br i1 %64, label %65, label %88
65: ; preds = %61
%66 = load i32*, i32** %6
%67 = load i32, i32* %66
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%69 = call i32 @recv(i32 %67, i8* %68, i32 1024, i32 0)
store i32 %69, i32* %12
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %65
%72 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 -2, i32* %5
br label %105
73: ; preds = %65
%74 = load i32, i32* %12
%75 = icmp ne i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %73
%77 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %88
78: ; preds = %73
%79 = load i32*, i32** %6
%80 = load i32, i32* %79
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%82 = load i32, i32* %12
%83 = call i64 @send(i32 %80, i8* %81, i32 %82, i32 0)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %78
%86 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
store i32 -2, i32* %5
br label %105
87: ; preds = %78
br label %61
88: ; preds = %76, %61
%89 = load i32*, i32** %6
%90 = load i32, i32* %89
%91 = call i64 @close(i32 %90)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %88
%94 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
store i32 -2, i32* %5
br label %105
95: ; preds = %88
%96 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %46
97: ; preds = %46
%98 = load i32*, i32** %7
%99 = load i32, i32* %98
%100 = call i64 @close(i32 %99)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %97
%103 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
store i32 -1, i32* %5
br label %105
104: ; preds = %97
store i32 0, i32* %5
br label %105
105: ; preds = %104, %102, %93, %85, %71, %57, %43, %36, %18
%106 = load i32, i32* %5
ret i32 %106
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [21 x i8] c"recv connection lost\00"
@.str.8 = [5 x i8] c"send\00"
@.str.9 = [21 x i8] c"close workSock child\00"
@.str.11 = [17 x i8] c"close listenSock\00"
@str = [23 x i8] c"waiting for connection\00"
@str.12 = [21 x i8] c"new client connected\00"
@str.13 = [18 x i8] c"connection closed\00"
define i32 @clientProcessing(i32* nocapture %0, i32* nocapture %1, i8* %2, i8* nocapture %3) {
%5 = alloca %struct.sockaddr_in
%6 = alloca [1024 x i8]
%7 = bitcast %struct.sockaddr_in* %5 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* @AF_INET
%10 = load i32, i32* @SOCK_STREAM
%11 = tail call i32 @socket(i32 %9, i32 %10, i32 0)
store i32 %11, i32* %1
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %82
15: ; preds = %4
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %16, i32* %17
%18 = tail call i32 @atoi(i8* %3)
%19 = tail call i32 @htons(i32 %18)
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i32 %19, i32* %20
%21 = tail call i32 @inet_addr(i8* %2)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
store i32 %21, i32* %22
%23 = load i32, i32* %1
%24 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%25 = call i64 @bind(i32 %23, %struct.sockaddr* %24, i32 12)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %15
%28 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %82
29: ; preds = %15
%30 = load i32, i32* %1
%31 = call i64 @listen(i32 %30, i32 1)
%32 = icmp slt i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = call i32 (...) @kbhit()
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %76
36: ; preds = %29
%37 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %82
38: ; preds = %33, %72
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%40 = load i32, i32* %1
%41 = call i32 @accept(i32 %40, i32 0, i32 0)
store i32 %41, i32* %0
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %82
45: ; preds = %38
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.12, i64 0, i64 0))
br label %47
47: ; preds = %60, %45
%48 = call i32 (...) @kbhit()
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %66
50: ; preds = %47
%51 = load i32, i32* %0
%52 = call i32 @recv(i32 %51, i8* %8, i32 1024, i32 0)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %82
56: ; preds = %50
%57 = icmp eq i32 %52, 0
br i1 %57, label %58, label %60
58: ; preds = %56
%59 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %66
60: ; preds = %56
%61 = load i32, i32* %0
%62 = call i64 @send(i32 %61, i8* %8, i32 %52, i32 0)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %47
64: ; preds = %60
%65 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %82
66: ; preds = %47, %58
%67 = load i32, i32* %0
%68 = call i64 @close(i32 %67)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %82
72: ; preds = %66
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.13, i64 0, i64 0))
%74 = call i32 (...) @kbhit()
%75 = icmp eq i32 %74, 0
br i1 %75, label %38, label %76
76: ; preds = %72, %33
%77 = load i32, i32* %1
%78 = call i64 @close(i32 %77)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %82
82: ; preds = %76, %80, %70, %64, %54, %43, %36, %27, %13
%83 = phi i32 [ -1, %13 ], [ -1, %27 ], [ -1, %36 ], [ -2, %43 ], [ -2, %54 ], [ -2, %64 ], [ -2, %70 ], [ -1, %80 ], [ 0, %76 ]
ret i32 %83
}