#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;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int BUF_SIZE = 1024;
  int port;
  int sockfd, connectedfd;
  struct sockaddr_in listen_addr;
  struct sockaddr_in client_addr;
  int sin_size, recv_size;
  char buffer[BUF_SIZE + 1];
  sin_size = sizeof(struct sockaddr_in);
  if (argc != 2) {
    fprintf(stderr, "usage: tcp_server port\n");
    exit(1);
  }
  port = atoi(argv[1]);
  if (port <= 0) {
    fprintf(stderr, "error: invalid port\n");
    exit(1);
  }
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    exit(1);
  }
  listen_addr.sin_family = AF_INET;
  listen_addr.sin_port = htons(port);
  listen_addr.sin_addr.s_addr = INADDR_ANY;
  if (bind(sockfd, (struct sockaddr *)&listen_addr, sizeof(struct sockaddr)) ==
      -1) {
    perror("bind");
    exit(1);
  }
  if (listen(sockfd, 5) == -1) {
    perror("listen");
    exit(1);
  }
  while (1) {
    if ((connectedfd = accept(sockfd, (struct sockaddr *)&client_addr,
                              &sin_size)) == -1) {
      perror("accept");
      continue;
    }
    printf("%s connected now.\n", inet_ntoa(client_addr.sin_addr));
    while (1) {
      if ((recv_size = recv(connectedfd, buffer, BUF_SIZE, 0)) == 0) {
        close(connectedfd);
        if (errno != 0) {
          perror("recv");
        }
        break;
      }
      buffer[recv_size] = '\0';
      if (send(connectedfd, buffer, recv_size, 0) == -1) {
        perror("send");
        close(connectedfd);
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x400,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movl   $0xc,-0x44(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1256 <main+0x76>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
lea    0xdb9(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     128f <main+0xaf>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
lea    0xd98(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
mov    0x2d29(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    12ca <main+0xea>
lea    0xd72(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2cf8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    131d <main+0x13d>
lea    0xd26(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1349 <main+0x169>
lea    0xcff(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    134e <main+0x16e>
jmp    1353 <main+0x173>
mov    -0x1c(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
jne    1380 <main+0x1a0>
lea    0xcca(%rip),%rdi
call   10c0 <perror@plt>
jmp    134e <main+0x16e>
mov    -0x40(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xcb5(%rip),%rdi
call   1070 <printf@plt>
jmp    139c <main+0x1bc>
mov    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%edi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x48(%rbp)
cmp    $0x0,%eax
jne    13e3 <main+0x203>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    0x2bf8(%rip),%rax
cmpq   $0x0,(%rax)
je     13de <main+0x1fe>
lea    0xc81(%rip),%rdi
call   10c0 <perror@plt>
jmp    1423 <main+0x243>
mov    -0x60(%rbp),%rsi
movslq -0x48(%rbp),%rax
movb   $0x0,(%rsi,%rax,1)
mov    -0x20(%rbp),%edi
mov    -0x48(%rbp),%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    141e <main+0x23e>
lea    0xc53(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
jmp    1423 <main+0x243>
jmp    1397 <main+0x1b7>
jmp    134e <main+0x16e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
movl   $0xc,0xc(%rsp)
cmp    $0x2,%edi
jne    135a <main+0x17a>
mov    0x8(%rsi),%rdi
call   10e0 <atoi@plt>
test   %eax,%eax
jle    136c <main+0x18c>
mov    %eax,%ebp
mov    0x2dcc(%rip),%r14
mov    (%r14),%edi
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     138b <main+0x1ab>
mov    %eax,%ebx
mov    (%r14),%eax
mov    %eax,0x18(%rsp)
mov    %ebp,%edi
call   1050 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
je     1394 <main+0x1b4>
mov    %ebx,%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
je     139d <main+0x1bd>
lea    0x20(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0xdae(%rip),%r13
lea    0x30(%rsp),%rbp
jmp    12ac <main+0xcc>
lea    0xd99(%rip),%rdi
call   10c0 <perror@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10d0 <accept@plt>
cmp    $0xffffffff,%eax
je     12a0 <main+0xc0>
mov    %eax,%r12d
mov    0x20(%rsp),%edi
call   1040 <inet_ntoa@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1070 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     1330 <main+0x150>
movslq %eax,%rcx
movb   $0x0,0x30(%rsp,%rcx,1)
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    12e0 <main+0x100>
lea    0xd46(%rip),%rdi
call   10c0 <perror@plt>
mov    %r12d,%edi
call   1080 <close@plt>
jmp    12ac <main+0xcc>
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
call   1080 <close@plt>
mov    0x2c81(%rip),%rax
cmpq   $0x0,(%rax)
je     12ac <main+0xcc>
lea    0xd0a(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ac <main+0xcc>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
lea    0xc96(%rip),%rsi
jmp    137c <main+0x19c>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
lea    0xc9c(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xc9b(%rip),%rdi
jmp    13a4 <main+0x1c4>
lea    0xc99(%rip),%rdi
jmp    13a4 <main+0x1c4>
lea    0xc95(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage: tcp_server port\0A\00"
@.str.1 = [21 x i8] c"error: invalid port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [7 x i8] c"listen\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [19 x i8] c"%s connected now.\0A\00"
@errno = global i64 0
@.str.7 = [5 x i8] c"recv\00"
@.str.8 = [5 x i8] c"send\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 i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1024, i32* %6
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %14
%20 = alloca i8, i64 %18
store i64 %18, i64* %15
store i32 12, i32* %12
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 2
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %27
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %27
%39 = load i32, i32* @AF_INET
%40 = load i32, i32* @SOCK_STREAM
%41 = call i32 @socket(i32 %39, i32 %40, i32 0)
store i32 %41, i32* %8
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = load i32, i32* @AF_INET
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %47, i32* %48
%49 = load i32, i32* %7
%50 = call i32 @htons(i32 %49)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %50, i32* %51
%52 = load i32, i32* @INADDR_ANY
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%54 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %53, i32 0, i32 0
store i32 %52, i32* %54
%55 = load i32, i32* %8
%56 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%57 = call i32 @bind(i32 %55, %struct.sockaddr* %56, i32 4)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %62
59: ; preds = %46
%60 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %46
%63 = load i32, i32* %8
%64 = call i32 @listen(i32 %63, i32 5)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %62
br label %70
70: ; preds = %111, %76, %69
br label %71
71: ; preds = %70
%72 = load i32, i32* %8
%73 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%74 = call i32 @accept(i32 %72, %struct.sockaddr* %73, i32* %12)
store i32 %74, i32* %9
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %78
76: ; preds = %71
%77 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %70
78: ; preds = %71
%79 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%80 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %79, i32 0, i32 0
%81 = load i32, i32* %80
%82 = call i8* @inet_ntoa(i32 %81)
%83 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %82)
br label %84
84: ; preds = %110, %78
br label %85
85: ; preds = %84
%86 = load i32, i32* %9
%87 = load i32, i32* %6
%88 = call i32 @recv(i32 %86, i8* %20, i32 %87, i32 0)
store i32 %88, i32* %13
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %98
90: ; preds = %85
%91 = load i32, i32* %9
%92 = call i32 @close(i32 %91)
%93 = load i64, i64* @errno
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %90
%96 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %97
97: ; preds = %95, %90
br label %111
98: ; preds = %85
%99 = load i32, i32* %13
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %20, i64 %100
store i8 0, i8* %101
%102 = load i32, i32* %9
%103 = load i32, i32* %13
%104 = call i32 @send(i32 %102, i8* %20, i32 %103, i32 0)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %110
106: ; preds = %98
%107 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%108 = load i32, i32* %9
%109 = call i32 @close(i32 %108)
br label %111
110: ; preds = %98
br label %84
111: ; preds = %106, %97
br label %70
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage: tcp_server port\0A\00"
@.str.1 = [21 x i8] c"error: invalid port\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@INADDR_ANY = global i32 0
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [7 x i8] c"listen\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [19 x i8] c"%s connected now.\0A\00"
@errno = global i64 0
@.str.7 = [5 x i8] c"recv\00"
@.str.8 = [5 x i8] c"send\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = bitcast %struct.sockaddr_in* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = alloca [1025 x i8]
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* %9, i64 0, i64 0
store i32 12, i32* %5
%11 = icmp eq i32 %0, 2
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %16
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = tail call i32 @socket(i32 %26, i32 %27, i32 0)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %25
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %34, i32* %35
%36 = tail call i32 @htons(i32 %19)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %36, i32* %37
%38 = load i32, i32* @INADDR_ANY
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %38, i32* %39
%40 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%41 = call i32 @bind(i32 %28, %struct.sockaddr* %40, i32 4)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %46
43: ; preds = %33
%44 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %33
%47 = call i32 @listen(i32 %28, i32 5)
%48 = icmp eq i32 %47, -1
br i1 %48, label %52, label %49
49: ; preds = %46
%50 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
br label %55
52: ; preds = %46
%53 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %81, %49
%56 = call i32 @accept(i32 %28, %struct.sockaddr* %50, i32* %5)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %81
60: ; preds = %55
%61 = load i32, i32* %51
%62 = call i8* @inet_ntoa(i32 %61)
%63 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %73, %60
%65 = call i32 @recv(i32 %56, i8* %10, i32 1024, i32 0)
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %64
%68 = call i32 @close(i32 %56)
%69 = load i64, i64* @errno
%70 = icmp eq i64 %69, 0
br i1 %70, label %81, label %71
71: ; preds = %67
%72 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %81
73: ; preds = %64
%74 = sext i32 %65 to i64
%75 = getelementptr inbounds [1025 x i8], [1025 x i8]* %9, i64 0, i64 %74
store i8 0, i8* %75
%76 = call i32 @send(i32 %56, i8* %10, i32 %65, i32 0)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %64
78: ; preds = %73
%79 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%80 = call i32 @close(i32 %56)
br label %81
81: ; preds = %78, %71, %67, %58
br label %55
}