#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 ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ client;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_UNSPEC;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr const *, int);
int /*<<< orphan*/ bzero(char **, int);
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main() {
  struct sockaddr_in server;
  server.sin_addr.s_addr = INADDR_ANY;
  server.sin_family = AF_INET;
  server.sin_port = htons(1234);
  int fd = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
  if (fd == -1) {
    perror("socket");
    return errno;
  }
  if (bind(fd, (const struct sockaddr *)&server, sizeof(server)) == -1) {
    perror("bind");
    return errno;
  }
  if (listen(fd, 10) == -1) {
    perror("listen");
    return errno;
  }
  while (1) {
    struct sockaddr_in client;
    socklen_t client_len = sizeof(client);
    printf("等待新的客户端连接\n");
    int client_fd = accept(fd, (struct sockaddr *)&client, &client_len);
    printf("ip为 %s 的客户端连接\n", inet_ntoa(client.sin_addr));
    if (client_fd == -1) {
      break;
    }
    char buf[256];
    while (1) {
      printf("等待ip为 %s 的客户端发送数据\n", inet_ntoa(client.sin_addr));
      bzero(&buf, 256);
      ssize_t i = recv(client_fd, buf, 256, 0);
      if (i == -1) {
        perror("recv");
        break;
      }
      if (i == 0) {
        printf("ip为 %s 的客户端断开连接\n", inet_ntoa(client.sin_addr));
        break;
      }
      if (i > 0) {
        printf("%zd %s\n", i, buf);
        send(client_fd, buf, strlen(buf), 0);
      }
    }
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2def(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x4d2,%edi
call   1060 <htons@plt>
mov    %eax,-0xc(%rbp)
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    0x2db1(%rip),%rax
mov    (%rax),%esi
mov    0x2dc8(%rip),%rax
mov    (%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1251 <main+0x81>
lea    0xdc5(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    141e <main+0x24e>
mov    -0x14(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1288 <main+0xb8>
lea    0xd95(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    141e <main+0x24e>
mov    -0x14(%rbp),%edi
mov    $0xa,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
jne    12bb <main+0xeb>
lea    0xd67(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    141e <main+0x24e>
jmp    12c0 <main+0xf0>
movl   $0xc,-0x24(%rbp)
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpl   $0xffffffff,-0x28(%rbp)
jne    1310 <main+0x140>
jmp    140f <main+0x23f>
jmp    1315 <main+0x145>
mov    -0x20(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    $0x100,%esi
call   10d0 <bzero@plt>
mov    -0x28(%rbp),%edi
lea    -0x130(%rbp),%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x134(%rbp)
cmpl   $0xffffffff,-0x134(%rbp)
jne    1379 <main+0x1a9>
lea    0xd07(%rip),%rdi
call   10c0 <perror@plt>
jmp    140a <main+0x23a>
cmpl   $0x0,-0x134(%rbp)
jne    13a4 <main+0x1d4>
mov    -0x20(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    140a <main+0x23a>
cmpl   $0x0,-0x134(%rbp)
jle    1405 <main+0x235>
mov    -0x134(%rbp),%esi
lea    -0x130(%rbp),%rdx
lea    0xcd9(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x144(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x140(%rbp)
lea    -0x130(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x144(%rbp),%edi
mov    -0x140(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
jmp    1315 <main+0x145>
jmp    12c0 <main+0xf0>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2ddb(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,0x28(%rsp)
mov    $0x4d2,%edi
call   1070 <htons@plt>
mov    %eax,0x24(%rsp)
mov    (%rbx),%edi
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
mov    0x2dbd(%rip),%rax
mov    (%rax),%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     13dd <main+0x1fd>
mov    %eax,%r15d
lea    0x20(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
je     13e6 <main+0x206>
mov    %r15d,%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
cmp    $0xffffffff,%eax
je     13ef <main+0x20f>
movl   $0xc,0xc(%rsp)
lea    0xe0c(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r15d,%edi
call   10f0 <accept@plt>
mov    %eax,%r12d
mov    0x10(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xd6c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
cmp    $0xffffffff,%r12d
je     13c1 <main+0x1e1>
lea    0xd6e(%rip),%rbp
lea    0x30(%rsp),%rbx
lea    0xd45(%rip),%r13
lea    0xdac(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp),%edi
call   1050 <inet_ntoa@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     134e <main+0x16e>
cmp    $0xffffffff,%eax
je     13b3 <main+0x1d3>
test   %eax,%eax
jle    12e0 <main+0x100>
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    12e0 <main+0x100>
mov    0x10(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xd00(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
movl   $0xc,0xc(%rsp)
lea    0xd12(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   10f0 <accept@plt>
mov    %eax,%r12d
mov    0x10(%rsp),%edi
call   1050 <inet_ntoa@plt>
mov    %r13,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
cmp    $0xffffffff,%r12d
jne    12e0 <main+0x100>
jmp    13c1 <main+0x1e1>
lea    0xc9f(%rip),%rdi
call   10d0 <perror@plt>
jmp    1368 <main+0x188>
mov    %r15d,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc1c(%rip),%rdi
jmp    13f6 <main+0x216>
lea    0xc1a(%rip),%rdi
jmp    13f6 <main+0x216>
lea    0xc16(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%eax
jmp    13cb <main+0x1eb>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@INADDR_ANY = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@PF_UNSPEC = global i32 0
@.str = [7 x i8] c"socket\00"
@errno = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.3 = [29 x i8] c"\E7\AD\89\E5\BE\85\E6\96\B0\E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E8\BF\9E\E6\8E\A5\0A\00"
@.str.4 = [29 x i8] c"ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E8\BF\9E\E6\8E\A5\0A\00"
@.str.5 = [41 x i8] c"\E7\AD\89\E5\BE\85ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E5\8F\91\E9\80\81\E6\95\B0\E6\8D\AE\0A\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [35 x i8] c"ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E6\96\AD\E5\BC\80\E8\BF\9E\E6\8E\A5\0A\00"
@.str.8 = [8 x i8] c"%zd %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i32
store i32 0, i32* %1
%9 = load i32, i32* @INADDR_ANY
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%11 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %10, i32 0, i32 0
store i32 %9, i32* %11
%12 = load i32, i32* @AF_INET
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i32 %12, i32* %13
%14 = call i32 @htons(i32 1234)
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
store i32 %14, i32* %15
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = load i32, i32* @PF_UNSPEC
%19 = call i32 @socket(i32 %16, i32 %17, i32 %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %0
%23 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @errno
store i32 %24, i32* %1
br label %96
25: ; preds = %0
%26 = load i32, i32* %3
%27 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%28 = call i32 @bind(i32 %26, %struct.sockaddr* %27, i32 12)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* @errno
store i32 %32, i32* %1
br label %96
33: ; preds = %25
%34 = load i32, i32* %3
%35 = call i32 @listen(i32 %34, i32 10)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%39 = load i32, i32* @errno
store i32 %39, i32* %1
br label %96
40: ; preds = %33
br label %41
41: ; preds = %40, %92
store i32 12, i32* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %3
%44 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%45 = call i32 @accept(i32 %43, %struct.sockaddr* %44, i32* %5)
store i32 %45, i32* %6
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%47 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %46, i32 0, i32 0
%48 = load i32, i32* %47
%49 = call i8* @inet_ntoa(i32 %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = load i32, i32* %6
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %54
53: ; preds = %41
br label %93
54: ; preds = %41
br label %55
55: ; preds = %54, %91
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%57 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %56, i32 0, i32 0
%58 = load i32, i32* %57
%59 = call i8* @inet_ntoa(i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %59)
%61 = bitcast [256 x i8]* %7 to i8**
%62 = call i32 @bzero(i8** %61, i32 256)
%63 = load i32, i32* %6
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%65 = call i32 @recv(i32 %63, i8* %64, i32 256, i32 0)
store i32 %65, i32* %8
%66 = load i32, i32* %8
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %70
68: ; preds = %55
%69 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %92
70: ; preds = %55
%71 = load i32, i32* %8
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %79
73: ; preds = %70
%74 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%75 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %74, i32 0, i32 0
%76 = load i32, i32* %75
%77 = call i8* @inet_ntoa(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %77)
br label %92
79: ; preds = %70
%80 = load i32, i32* %8
%81 = icmp sgt i32 %80, 0
br i1 %81, label %82, label %91
82: ; preds = %79
%83 = load i32, i32* %8
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %83, i8* %84)
%86 = load i32, i32* %6
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%89 = call i32 @strlen(i8* %88)
%90 = call i32 @send(i32 %86, i8* %87, i32 %89, i32 0)
br label %91
91: ; preds = %82, %79
br label %55
92: ; preds = %73, %68
br label %41
93: ; preds = %53
%94 = load i32, i32* %3
%95 = call i32 @close(i32 %94)
store i32 0, i32* %1
br label %96
96: ; preds = %93, %37, %30, %22
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@INADDR_ANY = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@PF_UNSPEC = global i32 0
@.str = [7 x i8] c"socket\00"
@errno = global i32 0
@.str.1 = [5 x i8] c"bind\00"
@.str.2 = [7 x i8] c"listen\00"
@.str.4 = [29 x i8] c"ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E8\BF\9E\E6\8E\A5\0A\00"
@.str.5 = [41 x i8] c"\E7\AD\89\E5\BE\85ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E5\8F\91\E9\80\81\E6\95\B0\E6\8D\AE\0A\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [35 x i8] c"ip\E4\B8\BA %s \E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E6\96\AD\E5\BC\80\E8\BF\9E\E6\8E\A5\0A\00"
@.str.8 = [8 x i8] c"%zd %s\0A\00"
@str = [28 x i8] c"\E7\AD\89\E5\BE\85\E6\96\B0\E7\9A\84\E5\AE\A2\E6\88\B7\E7\AB\AF\E8\BF\9E\E6\8E\A5\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = load i32, i32* @INADDR_ANY
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0, i32 0
store i32 %6, i32* %7
%8 = load i32, i32* @AF_INET
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %8, i32* %9
%10 = tail call i32 @htons(i32 1234)
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i32 %10, i32* %11
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = load i32, i32* @PF_UNSPEC
%15 = tail call i32 @socket(i32 %12, i32 %13, i32 %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @errno
br label %77
20: ; preds = %0
%21 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%22 = call i32 @bind(i32 %15, %struct.sockaddr* %21, i32 12)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @errno
br label %77
27: ; preds = %20
%28 = call i32 @listen(i32 %15, i32 10)
%29 = icmp eq i32 %28, -1
br i1 %29, label %44, label %30
30: ; preds = %27
%31 = bitcast %struct.sockaddr_in* %2 to i8*
%32 = bitcast i32* %3 to i8*
store i32 12, i32* %3
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%34 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%35 = call i32 @accept(i32 %15, %struct.sockaddr* %34, i32* %3)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
%37 = load i32, i32* %36
%38 = call i8* @inet_ntoa(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %38)
%40 = icmp eq i32 %35, -1
br i1 %40, label %75, label %41
41: ; preds = %30
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%43 = bitcast [256 x i8]* %4 to i8**
br label %47
44: ; preds = %27
%45 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%46 = load i32, i32* @errno
br label %77
47: ; preds = %41, %68
%48 = phi i32 [ %35, %41 ], [ %70, %68 ]
br label %49
49: ; preds = %63, %47
%50 = load i32, i32* %36
%51 = call i8* @inet_ntoa(i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = call i32 @bzero(i8** %43, i32 256)
%54 = call i32 @recv(i32 %48, i8* %42, i32 256, i32 0)
switch i32 %54, label %61 [
i32 -1, label %55
i32 0, label %57
]
55: ; preds = %49
%56 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %68
57: ; preds = %49
%58 = load i32, i32* %36
%59 = call i8* @inet_ntoa(i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %59)
br label %68
61: ; preds = %49
%62 = icmp sgt i32 %54, 0
br i1 %62, label %64, label %63
63: ; preds = %61, %64
br label %49
64: ; preds = %61
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %54, i8* %42)
%66 = call i32 @strlen(i8* %42)
%67 = call i32 @send(i32 %48, i8* %42, i32 %66, i32 0)
br label %63
68: ; preds = %57, %55
store i32 12, i32* %3
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%70 = call i32 @accept(i32 %15, %struct.sockaddr* %34, i32* %3)
%71 = load i32, i32* %36
%72 = call i8* @inet_ntoa(i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %72)
%74 = icmp eq i32 %70, -1
br i1 %74, label %75, label %47
75: ; preds = %68, %30
%76 = call i32 @close(i32 %15)
br label %77
77: ; preds = %75, %44, %24, %17
%78 = phi i32 [ %19, %17 ], [ %26, %24 ], [ %46, %44 ], [ 0, %75 ]
ret i32 %78
}