#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*/ socklen_t;
typedef int /*<<< orphan*/ sin;
typedef int /*<<< orphan*/ addr_p;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
int listen(int, int);
int /*<<< orphan*/ my_fun(char *);
int my_read(int, char *, int);
int my_write(int, char *, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  struct sockaddr_in sin;
  struct sockaddr_in cin;
  int l_fd;
  int c_fd;
  socklen_t len;
  char buf[100];
  char addr_p[INET_ADDRSTRLEN];
  int port = 8000;
  int n;
  bzero(&sin, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = INADDR_ANY;
  sin.sin_port = htons(port);
  if ((l_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("fail to creat socket");
    exit(1);
  }
  if (bind(l_fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
    perror("fail to bind");
    exit(1);
  }
  if (listen(l_fd, 10) == -1) {
    perror("fail to listen");
    exit(1);
  }
  printf("waiting ...\n");
  while (1) {
    if ((c_fd = accept(l_fd, (struct sockaddr *)&cin, &len)) == -1) {
      perror("fail to accept");
      exit(1);
    }
    n = my_read(c_fd, buf, 100);
    if (n == -1)
      exit(1);
    else if (n == 0) {
      printf("the connect has been closed\n");
      close(c_fd);
      continue;
    }
    inet_ntop(AF_INET, &cin.sin_addr, addr_p, sizeof(addr_p));
    printf("client IP is %s, port is %d\n", addr_p, ntohs(cin.sin_port));
    printf("content is : %s\n", buf);
    my_fun(buf);
    n = my_write(c_fd, buf, n);
    if (n == -1)
      exit(1);
    if (close(c_fd) == -1) {
      perror("fail to close");
      exit(1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xb8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xa0(%rbp)
movl   $0x1f40,-0xa4(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0xc,%esi
call   10c0 <bzero@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2d77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xa4(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    12b7 <main+0xc7>
lea    0xd58(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12e7 <main+0xf7>
lea    0xd3d(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x24(%rbp),%edi
mov    $0xa,%esi
call   1080 <listen@plt>
cmp    $0xffffffff,%eax
jne    1313 <main+0x123>
lea    0xd1e(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1326 <main+0x136>
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   10e0 <accept@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
jne    1358 <main+0x168>
lea    0xcf5(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1040 <my_read@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0xffffffff,-0xa8(%rbp)
jne    1389 <main+0x199>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x0,-0xa8(%rbp)
jne    13b1 <main+0x1c1>
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%edi
call   1070 <close@plt>
jmp    1321 <main+0x131>
jmp    13b6 <main+0x1c6>
mov    -0xb0(%rbp),%rdx
mov    -0xb8(%rbp),%rax
mov    0x2c1d(%rip),%rcx
mov    (%rcx),%edi
lea    -0x20(%rbp),%rsi
add    $0x4,%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x20(%rbp),%edi
call   1090 <ntohs@plt>
mov    -0xb0(%rbp),%rsi
mov    %eax,%edx
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xc7e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1100 <my_fun@plt>
mov    -0x28(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    -0xa8(%rbp),%edx
call   10d0 <my_write@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0xffffffff,-0xa8(%rbp)
jne    144e <main+0x25e>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1475 <main+0x285>
lea    0xc32(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    1321 <main+0x131>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
mov    %rax,-0x50(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    -0x38(%rbp),%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    0x2da1(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    $0x1f40,%edi
call   1060 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    (%rbx),%edi
mov    0x2d62(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
cmp    $0xffffffff,%eax
jne    1285 <main+0x85>
lea    0xd7d(%rip),%rdi
jmp    12e9 <main+0xe9>
mov    %eax,%r13d
lea    -0x38(%rbp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12a6 <main+0xa6>
lea    0xd71(%rip),%rdi
jmp    12e9 <main+0xe9>
mov    %r13d,%edi
mov    $0xa,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
jne    12c1 <main+0xc1>
lea    0xd63(%rip),%rdi
jmp    12e9 <main+0xe9>
lea    0xdb4(%rip),%rdi
call   1040 <puts@plt>
lea    -0x48(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
mov    %r13d,%edi
call   10f0 <accept@plt>
cmp    $0xffffffff,%eax
jne    12f8 <main+0xf8>
lea    0xd48(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    %eax,%r12d
lea    -0xc0(%rbp),%rbx
jmp    133c <main+0x13c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xd71(%rip),%rdi
call   1040 <puts@plt>
mov    %r12d,%edi
call   1080 <close@plt>
mov    %r13d,%edi
lea    -0x48(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,%r12d
cmp    $0xffffffff,%eax
je     12e2 <main+0xe2>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1050 <my_read@plt>
test   %eax,%eax
je     1310 <main+0x110>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     13d5 <main+0x1d5>
mov    0x2c89(%rip),%rax
mov    (%rax),%edi
lea    -0x44(%rbp),%rsi
mov    %r15,%rdx
mov    -0x50(%rbp),%rcx
call   1030 <inet_ntop@plt>
mov    -0x48(%rbp),%edi
call   10a0 <ntohs@plt>
lea    0xcc0(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcca(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1110 <my_fun@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   10e0 <my_write@plt>
cmp    $0xffffffff,%eax
je     13d5 <main+0x1d5>
mov    %r12d,%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1324 <main+0x124>
lea    0xc9e(%rip),%rdi
jmp    12e9 <main+0xe9>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"fail to creat socket\00"
@.str.1 = [13 x i8] c"fail to bind\00"
@.str.2 = [15 x i8] c"fail to listen\00"
@.str.3 = [13 x i8] c"waiting ...\0A\00"
@.str.4 = [15 x i8] c"fail to accept\00"
@.str.5 = [29 x i8] c"the connect has been closed\0A\00"
@.str.6 = [29 x i8] c"client IP is %s, port is %d\0A\00"
@.str.7 = [17 x i8] c"content is : %s\0A\00"
@.str.8 = [14 x i8] c"fail to close\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = load i32, i32* @INET_ADDRSTRLEN
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i8, i64 %13
store i64 %13, i64* %9
store i32 8000, i32* %10
%16 = call i32 @bzero(%struct.sockaddr_in* %2, i32 12)
%17 = load i32, i32* @AF_INET
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i32 %17, i32* %18
%19 = load i32, i32* @INADDR_ANY
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i32 0, i32 0
store i32 %19, i32* %21
%22 = load i32, i32* %10
%23 = call i32 @htons(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
store i32 %23, i32* %24
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %4
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %0
%30 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %0
%33 = load i32, i32* %4
%34 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%35 = call i32 @bind(i32 %33, %struct.sockaddr* %34, i32 12)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %32
%41 = load i32, i32* %4
%42 = call i32 @listen(i32 %41, i32 10)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %40
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %102, %69, %47
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%53 = call i32 @accept(i32 %51, %struct.sockaddr* %52, i32* %6)
store i32 %53, i32* %5
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %50
%59 = load i32, i32* %5
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%61 = call i32 @my_read(i32 %59, i8* %60, i32 100)
store i32 %61, i32* %11
%62 = load i32, i32* %11
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = load i32, i32* %11
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %66
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* %5
%72 = call i32 @close(i32 %71)
br label %49
73: ; preds = %66
br label %74
74: ; preds = %73
%75 = load i32, i32* @AF_INET
%76 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%77 = trunc i64 %13 to i32
%78 = call i32 @inet_ntop(i32 %75, %struct.TYPE_2__* %76, i8* %15, i32 %77)
%79 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%80 = load i32, i32* %79
%81 = call i32 @ntohs(i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %15, i32 %81)
%83 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %83)
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%86 = call i32 @my_fun(i8* %85)
%87 = load i32, i32* %5
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%89 = load i32, i32* %11
%90 = call i32 @my_write(i32 %87, i8* %88, i32 %89)
store i32 %90, i32* %11
%91 = load i32, i32* %11
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %95
93: ; preds = %74
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %74
%96 = load i32, i32* %5
%97 = call i32 @close(i32 %96)
%98 = icmp eq i32 %97, -1
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %95
br label %49
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"fail to creat socket\00"
@.str.1 = [13 x i8] c"fail to bind\00"
@.str.2 = [15 x i8] c"fail to listen\00"
@.str.4 = [15 x i8] c"fail to accept\00"
@.str.6 = [29 x i8] c"client IP is %s, port is %d\0A\00"
@.str.7 = [17 x i8] c"content is : %s\0A\00"
@.str.8 = [14 x i8] c"fail to close\00"
@str = [12 x i8] c"waiting ...\00"
@str.9 = [28 x i8] c"the connect has been closed\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = load i32, i32* @INET_ADDRSTRLEN
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = call i32 @bzero(%struct.sockaddr_in* %1, i32 12)
%13 = load i32, i32* @AF_INET
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %13, i32* %14
%15 = load i32, i32* @INADDR_ANY
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %15, i32* %16
%17 = tail call i32 @htons(i32 8000)
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %17, i32* %18
%19 = load i32, i32* @AF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = tail call i32 @socket(i32 %19, i32 %20, i32 0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %0
%24 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %0
%27 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%28 = call i32 @bind(i32 %21, %struct.sockaddr* %27, i32 12)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %26
%34 = call i32 @listen(i32 %21, i32 10)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %33
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%41 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%42 = call i32 @accept(i32 %21, %struct.sockaddr* %41, i32* %3)
%43 = icmp eq i32 %42, -1
br i1 %43, label %47, label %44
44: ; preds = %39
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
br label %50
47: ; preds = %58, %39
%48 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %44, %58
%51 = phi i32 [ %42, %44 ], [ %59, %58 ]
%52 = call i32 @my_read(i32 %51, i8* %8, i32 100)
switch i32 %52, label %61 [
i32 -1, label %53
i32 0, label %55
]
53: ; preds = %50
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %50
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.9, i64 0, i64 0))
%57 = call i32 @close(i32 %51)
br label %58
58: ; preds = %55, %73
%59 = call i32 @accept(i32 %21, %struct.sockaddr* %41, i32* %3)
%60 = icmp eq i32 %59, -1
br i1 %60, label %47, label %50
61: ; preds = %50
%62 = load i32, i32* @AF_INET
%63 = call i32 @inet_ntop(i32 %62, %struct.TYPE_2__* %45, i8* %11, i32 %9)
%64 = load i32, i32* %46
%65 = call i32 @ntohs(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %11, i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%68 = call i32 @my_fun(i8* %8)
%69 = call i32 @my_write(i32 %51, i8* %8, i32 %52)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %73
71: ; preds = %61
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %61
%74 = call i32 @close(i32 %51)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %58
76: ; preds = %73
%77 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
}