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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EAGAIN;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ INADDR_ANY;
int INET_ADDRSTRLEN;
int O_NONBLOCK;
int /*<<< orphan*/ SOCK_DGRAM;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int fcntl(int, int /*<<< orphan*/, ...);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
int /*<<< orphan*/ my_fun(char *);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  struct sockaddr_in sin;
  struct sockaddr_in cin;
  int s_fd;
  int port = 8000;
  socklen_t addr_len;
  char buf[100];
  char addr_p[INET_ADDRSTRLEN];
  int n, flags;
  bzero(&sin, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = INADDR_ANY;
  sin.sin_port = htons(port);
  s_fd = socket(AF_INET, SOCK_DGRAM, 0);
  if (s_fd == -1) {
    perror("fail to create socket");
    exit(1);
  }
  if (bind(s_fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
    perror("call to bind");
    exit(1);
  }
  flags = fcntl(s_fd, F_GETFL);
  flags |= O_NONBLOCK;
  if (fcntl(s_fd, F_SETFL, flags) == -1) {
    perror("fail to fcntl");
    exit(1);
  }
  while (1) {
    sleep(5);
    addr_len = sizeof(cin);
    n = recvfrom(s_fd, buf, 100, 0, (struct sockaddr *)&cin, &addr_len);
    if ((n == -1) && (errno != EAGAIN)) {
      perror("fail to receive\n");
      exit(1);
    } else if (errno == EAGAIN) {
      printf("socket are not ready now\n");
      continue;
    }
    inet_ntop(AF_INET, &cin.sin_addr, addr_p, addr_len);
    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 = sendto(s_fd, buf, n, 0, (struct sockaddr *)&cin, addr_len);
    if (n == -1 && errno != EAGAIN) {
      perror("fail to send\n");
      exit(1);
    } else if (errno == EAGAIN) {
      printf("socket are not ready now\n");
      continue;
    }
  }
  if (close(s_fd) == -1) {
    perror("fail to close");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1f40,-0x28(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
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)
lea    -0x10(%rbp),%rdi
mov    $0xc,%esi
call   10c0 <bzero@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x28(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    129b <main+0xbb>
lea    0xd74(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12cb <main+0xeb>
lea    0xd5a(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x24(%rbp),%edi
mov    0x2cd3(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1040 <fcntl@plt>
mov    %eax,-0xa8(%rbp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%eax
or     -0xa8(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2cbd(%rip),%rax
mov    (%rax),%esi
mov    -0xa8(%rbp),%edx
mov    $0x0,%al
call   1040 <fcntl@plt>
cmp    $0xffffffff,%eax
jne    1331 <main+0x151>
lea    0xd01(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1336 <main+0x156>
jmp    133b <main+0x15b>
mov    $0x5,%edi
call   10f0 <sleep@plt>
movl   $0xc,-0x2c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x90(%rbp),%rsi
lea    -0x20(%rbp),%r8
mov    $0x64,%edx
xor    %ecx,%ecx
lea    -0x2c(%rbp),%r9
call   1080 <recvfrom@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0xffffffff,-0xa4(%rbp)
jne    13ad <main+0x1cd>
mov    0x2c34(%rip),%rax
mov    (%rax),%rax
mov    0x2c0a(%rip),%rcx
cmp    (%rcx),%rax
je     13ad <main+0x1cd>
lea    0xc93(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2c04(%rip),%rax
mov    (%rax),%rax
mov    0x2bda(%rip),%rcx
cmp    (%rcx),%rax
jne    13da <main+0x1fa>
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1336 <main+0x156>
jmp    13df <main+0x1ff>
mov    -0xb0(%rbp),%rdx
mov    0x2bfb(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
add    $0x4,%rsi
mov    -0x2c(%rbp),%ecx
call   1030 <inet_ntop@plt>
mov    -0x20(%rbp),%edi
call   1090 <ntohs@plt>
mov    -0xb0(%rbp),%rsi
mov    %eax,%edx
lea    0xc45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xc4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   10e0 <my_fun@plt>
mov    -0x24(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    -0xa4(%rbp),%edx
lea    -0x20(%rbp),%r8
mov    -0x2c(%rbp),%r9d
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0xffffffff,-0xa4(%rbp)
jne    14a1 <main+0x2c1>
mov    0x2b40(%rip),%rax
mov    (%rax),%rax
mov    0x2b16(%rip),%rcx
cmp    (%rcx),%rax
je     14a1 <main+0x2c1>
lea    0xbf8(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2b10(%rip),%rax
mov    (%rax),%rax
mov    0x2ae6(%rip),%rcx
cmp    (%rcx),%rax
jne    14ce <main+0x2ee>
lea    0xb80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1336 <main+0x156>
jmp    14d3 <main+0x2f3>
jmp    1336 <main+0x156>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
lea    -0x38(%rbp),%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    0x2db1(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    $0x1f40,%edi
call   1060 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    (%rbx),%edi
mov    0x2d72(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
jne    1278 <main+0x88>
lea    0xd8d(%rip),%rdi
jmp    141c <main+0x22c>
mov    %eax,%r12d
lea    -0x38(%rbp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
jne    129c <main+0xac>
lea    0xd7f(%rip),%rdi
jmp    141c <main+0x22c>
mov    0x2d05(%rip),%rax
mov    (%rax),%esi
mov    %r12d,%edi
xor    %eax,%eax
call   1050 <fcntl@plt>
mov    0x2d2a(%rip),%rcx
or     (%rcx),%eax
mov    0x2d01(%rip),%rcx
mov    (%rcx),%esi
mov    %r12d,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fcntl@plt>
cmp    $0xffffffff,%eax
jne    12de <main+0xee>
lea    0xd4a(%rip),%rdi
jmp    141c <main+0x22c>
lea    -0xc0(%rbp),%r13
lea    -0x50(%rbp),%r15
lea    -0x2c(%rbp),%rbx
jmp    1305 <main+0x115>
nop
cmp    %rcx,%rax
jne    1415 <main+0x225>
lea    0xd7e(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   1100 <sleep@plt>
movl   $0xc,-0x2c(%rbp)
mov    %r12d,%edi
mov    %r13,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    %rbx,%r9
call   1090 <recvfrom@plt>
mov    %eax,%r14d
mov    0x2c80(%rip),%rax
mov    (%rax),%rax
mov    0x2c56(%rip),%rcx
mov    (%rcx),%rcx
cmp    $0xffffffff,%r14d
je     12f0 <main+0x100>
cmp    %rcx,%rax
je     12f9 <main+0x109>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%ecx
lea    -0x4c(%rbp),%rsi
mov    %r15,%rbx
mov    -0x40(%rbp),%r15
mov    %r15,%rdx
call   1030 <inet_ntop@plt>
mov    -0x50(%rbp),%edi
call   10a0 <ntohs@plt>
lea    0xcc4(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%r15
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xccb(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
call   10f0 <my_fun@plt>
mov    -0x2c(%rbp),%r9d
mov    %r13,%rsi
mov    %r12d,%r13d
mov    %r12d,%edi
mov    %r14d,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1080 <sendto@plt>
mov    0x2bf1(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2bc7(%rip),%rdx
mov    (%rdx),%rdx
cmp    $0xffffffff,%eax
je     13f5 <main+0x205>
cmp    %rdx,%rcx
lea    -0x2c(%rbp),%rbx
mov    %r13d,%r12d
lea    -0xc0(%rbp),%r13
jne    1305 <main+0x115>
jmp    12f9 <main+0x109>
cmp    %rdx,%rcx
lea    -0x2c(%rbp),%rbx
mov    %r13d,%r12d
lea    -0xc0(%rbp),%r13
je     12f9 <main+0x109>
lea    0xc5d(%rip),%rdi
jmp    141c <main+0x22c>
lea    0xc15(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <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_DGRAM = global i32 0
@.str = [22 x i8] c"fail to create socket\00"
@.str.1 = [13 x i8] c"call to bind\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.2 = [14 x i8] c"fail to fcntl\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.3 = [17 x i8] c"fail to receive\0A\00"
@.str.4 = [26 x i8] c"socket are not ready now\0A\00"
@.str.5 = [29 x i8] c"client IP is %s, port is %d\0A\00"
@.str.6 = [17 x i8] c"content is : %s\0A\00"
@.str.7 = [14 x i8] c"fail to send\0A\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
store i32 8000, i32* %5
%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
%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* %5
%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_DGRAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %0
%31 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %0
%34 = load i32, i32* %4
%35 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%36 = call i32 @bind(i32 %34, %struct.sockaddr* %35, i32 12)
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %33
%42 = load i32, i32* %4
%43 = load i32, i32* @F_GETFL
%44 = call i32 (i32, i32, ...) @fcntl(i32 %42, i32 %43)
store i32 %44, i32* %11
%45 = load i32, i32* @O_NONBLOCK
%46 = load i32, i32* %11
%47 = or i32 %46, %45
store i32 %47, i32* %11
%48 = load i32, i32* %4
%49 = load i32, i32* @F_SETFL
%50 = load i32, i32* %11
%51 = call i32 (i32, i32, ...) @fcntl(i32 %48, i32 %49, i32 %50)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %56
53: ; preds = %41
%54 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %41
br label %57
57: ; preds = %115, %112, %77, %56
br label %58
58: ; preds = %57
%59 = call i32 @sleep(i32 5)
store i32 12, i32* %6
%60 = load i32, i32* %4
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%62 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%63 = call i32 @recvfrom(i32 %60, i8* %61, i32 100, i32 0, %struct.sockaddr* %62, i32* %6)
store i32 %63, i32* %10
%64 = load i32, i32* %10
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %73
66: ; preds = %58
%67 = load i64, i64* @errno
%68 = load i64, i64* @EAGAIN
%69 = icmp ne i64 %67, %68
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %66, %58
%74 = load i64, i64* @errno
%75 = load i64, i64* @EAGAIN
%76 = icmp eq i64 %74, %75
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %57
79: ; preds = %73
br label %80
80: ; preds = %79
%81 = load i32, i32* @AF_INET
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%83 = load i32, i32* %6
%84 = call i32 @inet_ntop(i32 %81, %struct.TYPE_2__* %82, i8* %15, i32 %83)
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%86 = load i32, i32* %85
%87 = call i32 @ntohs(i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 %87)
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %89)
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%92 = call i32 @my_fun(i8* %91)
%93 = load i32, i32* %4
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%95 = load i32, i32* %10
%96 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%97 = load i32, i32* %6
%98 = call i32 @sendto(i32 %93, i8* %94, i32 %95, i32 0, %struct.sockaddr* %96, i32 %97)
store i32 %98, i32* %10
%99 = load i32, i32* %10
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %108
101: ; preds = %80
%102 = load i64, i64* @errno
%103 = load i64, i64* @EAGAIN
%104 = icmp ne i64 %102, %103
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %101, %80
%109 = load i64, i64* @errno
%110 = load i64, i64* @EAGAIN
%111 = icmp eq i64 %109, %110
br i1 %111, label %112, label %114
112: ; preds = %108
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %57
114: ; preds = %108
br label %115
115: ; preds = %114
br label %57
}

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_DGRAM = global i32 0
@.str = [22 x i8] c"fail to create socket\00"
@.str.1 = [13 x i8] c"call to bind\00"
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.2 = [14 x i8] c"fail to fcntl\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.3 = [17 x i8] c"fail to receive\0A\00"
@.str.5 = [29 x i8] c"client IP is %s, port is %d\0A\00"
@.str.6 = [17 x i8] c"content is : %s\0A\00"
@.str.7 = [14 x i8] c"fail to send\0A\00"
@str.8 = [25 x i8] c"socket are not ready now\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_DGRAM
%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 ([22 x i8], [22 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 = load i32, i32* @F_GETFL
%35 = call i32 (i32, i32, ...) @fcntl(i32 %21, i32 %34)
%36 = load i32, i32* @O_NONBLOCK
%37 = or i32 %36, %35
%38 = load i32, i32* @F_SETFL
%39 = call i32 (i32, i32, ...) @fcntl(i32 %21, i32 %38, i32 %37)
%40 = icmp eq i32 %39, -1
br i1 %40, label %45, label %41
41: ; preds = %33
%42 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
br label %48
45: ; preds = %33
%46 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %63, %41
%49 = call i32 @sleep(i32 5)
store i32 12, i32* %3
%50 = call i32 @recvfrom(i32 %21, i8* %8, i32 100, i32 0, %struct.sockaddr* %42, i32* %3)
%51 = icmp eq i32 %50, -1
%52 = load i64, i64* @errno
%53 = load i64, i64* @EAGAIN
%54 = icmp eq i64 %52, %53
br i1 %51, label %55, label %59
55: ; preds = %48
br i1 %54, label %60, label %56
56: ; preds = %55
%57 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %48
br i1 %54, label %60, label %64
60: ; preds = %59, %55, %83, %79
%61 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0), %79 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0), %83 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0), %55 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0), %59 ]
%62 = call i32 @puts(i8* dereferenceable(1) %61)
br label %63
63: ; preds = %60, %83
br label %48
64: ; preds = %59
%65 = load i32, i32* @AF_INET
%66 = load i32, i32* %3
%67 = call i32 @inet_ntop(i32 %65, %struct.TYPE_2__* %43, i8* %11, i32 %66)
%68 = load i32, i32* %44
%69 = call i32 @ntohs(i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i8* %11, i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %8)
%72 = call i32 @my_fun(i8* %8)
%73 = load i32, i32* %3
%74 = call i32 @sendto(i32 %21, i8* %8, i32 %50, i32 0, %struct.sockaddr* %42, i32 %73)
%75 = icmp eq i32 %74, -1
%76 = load i64, i64* @errno
%77 = load i64, i64* @EAGAIN
%78 = icmp eq i64 %76, %77
br i1 %75, label %79, label %83
79: ; preds = %64
br i1 %78, label %60, label %80
80: ; preds = %79
%81 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %64
br i1 %78, label %60, label %63
}