#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 timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
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*/ fd_set;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_DGRAM;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
           struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strstr(char *, char *);
int ServerListenBroadcast(void) {
  int ret = -1;
  int sock = -1;
  int len = -1;
  char buf[20];
  fd_set readfd;
  struct timeval timeout;
  struct sockaddr_in local_addr;
  struct sockaddr_in from_addr;
  sock = socket(AF_INET, SOCK_DGRAM, 0);
  if (0 > sock) {
    perror("client socket err");
    return -1;
  }
  len = sizeof(struct sockaddr_in);
  memset(&local_addr, 0, sizeof(struct sockaddr_in));
  local_addr.sin_family = AF_INET;
  local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  local_addr.sin_port = htons(8888);
  ret = bind(sock, (struct sockaddr *)&local_addr, sizeof(struct sockaddr_in));
  if (0 > ret) {
    perror("server1 bind err");
    goto _out;
  }
  while (1) {
    FD_ZERO(&readfd);
    FD_SET(sock, &readfd);
    timeout.tv_sec = 2;
    timeout.tv_usec = 0;
    ret = select(sock + 1, &readfd, NULL, NULL, &timeout);
    switch (ret) {
    case -1:
      printf("select error!\n");
      goto _out;
    case 0:
      printf("time out!\n");
      break;
    default: {
      if (FD_ISSET(sock, &readfd)) {
        ret = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *)&from_addr,
                       &len);
        if (0 > ret) {
          perror("server recieve err");
          goto _out;
        }
        printf("buf : %s\n", buf);
        if (strstr(buf, "IP_FOUND")) {
          ret = sendto(sock, "IP_FOUND_ACK", strlen("IP_FOUND_ACK") + 1, 0,
                       (struct sockaddr *)&from_addr, len);
          if (0 > ret) {
            perror("server send err");
            goto _out;
          }
          printf("IP is %s\n", inet_ntoa(from_addr.sin_addr));
          goto _out;
        }
      }
    }
    }
  }
  close(sock);
  return 0;
_out:
  close(sock);
  return -1;
}


x86 assembly (clang, -O0):
<ServerListenBroadcast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jle    126f <ServerListenBroadcast+0x5f>
lea    0xda2(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1479 <ServerListenBroadcast+0x269>
movl   $0xc,-0x10(%rbp)
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2d47(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x58(%rbp)
mov    $0x22b8,%edi
call   1060 <htons@plt>
mov    %eax,-0x54(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    12e0 <ServerListenBroadcast+0xd0>
lea    0xd3c(%rip),%rdi
call   1100 <perror@plt>
jmp    146a <ServerListenBroadcast+0x25a>
jmp    12e5 <ServerListenBroadcast+0xd5>
lea    -0x34(%rbp),%rdi
mov    %rdi,-0x78(%rbp)
call   10c0 <FD_ZERO@plt>
mov    -0x78(%rbp),%rsi
mov    -0xc(%rbp),%edi
call   1110 <FD_SET@plt>
mov    -0x78(%rbp),%rsi
movl   $0x2,-0x48(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x48(%rbp),%r8
mov    %rcx,%rdx
call   10d0 <select@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x6c(%rbp)
sub    $0xffffffff,%eax
je     134e <ServerListenBroadcast+0x13e>
jmp    133e <ServerListenBroadcast+0x12e>
mov    -0x6c(%rbp),%eax
test   %eax,%eax
je     1361 <ServerListenBroadcast+0x151>
jmp    1374 <ServerListenBroadcast+0x164>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    146a <ServerListenBroadcast+0x25a>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1465 <ServerListenBroadcast+0x255>
mov    -0xc(%rbp),%edi
lea    -0x34(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
je     1460 <ServerListenBroadcast+0x250>
mov    -0xc(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x68(%rbp),%r8
mov    $0x14,%edx
xor    %ecx,%ecx
lea    -0x10(%rbp),%r9
call   10e0 <recvfrom@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    13c3 <ServerListenBroadcast+0x1b3>
lea    0xc84(%rip),%rdi
call   1100 <perror@plt>
jmp    146a <ServerListenBroadcast+0x25a>
lea    -0x30(%rbp),%rsi
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    0xc7a(%rip),%rsi
call   1120 <strstr@plt>
cmp    $0x0,%eax
je     145b <ServerListenBroadcast+0x24b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    0xc68(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x7c(%rbp),%edi
mov    %eax,%edx
add    $0x1,%edx
lea    -0x68(%rbp),%r8
mov    -0x10(%rbp),%r9d
lea    0xc4c(%rip),%rsi
xor    %ecx,%ecx
call   10a0 <sendto@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    143d <ServerListenBroadcast+0x22d>
lea    0xc3d(%rip),%rdi
call   1100 <perror@plt>
jmp    146a <ServerListenBroadcast+0x25a>
mov    -0x68(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xc31(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    146a <ServerListenBroadcast+0x25a>
jmp    1460 <ServerListenBroadcast+0x250>
jmp    1465 <ServerListenBroadcast+0x255>
jmp    12e5 <ServerListenBroadcast+0xd5>
mov    -0xc(%rbp),%edi
call   10b0 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ServerListenBroadcast>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    0x2db3(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     13e6 <ServerListenBroadcast+0x1c6>
mov    %eax,%r14d
movl   $0xc,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x10(%rsp)
mov    $0x22b8,%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
test   %eax,%eax
js     13f4 <ServerListenBroadcast+0x1d4>
mov    %r14d,%ebp
add    $0x1,%ebp
lea    0x2c(%rsp),%rbx
lea    0x30(%rsp),%r15
lea    0xdab(%rip),%r12
lea    0x40(%rsp),%r13
jmp    12d8 <ServerListenBroadcast+0xb8>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   10d0 <FD_ZERO@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1120 <FD_SET@plt>
movl   $0x2,0x30(%rsp)
movq   $0x0,0x38(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   10e0 <select@plt>
test   %eax,%eax
je     12d0 <ServerListenBroadcast+0xb0>
cmp    $0xffffffff,%eax
je     13be <ServerListenBroadcast+0x19e>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1040 <FD_ISSET@plt>
test   %eax,%eax
je     12d8 <ServerListenBroadcast+0xb8>
mov    %r14d,%edi
mov    %r13,%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
lea    0x20(%rsp),%r8
lea    0xc(%rsp),%r9
call   10f0 <recvfrom@plt>
test   %eax,%eax
js     1402 <ServerListenBroadcast+0x1e2>
lea    0xce2(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%rdi
lea    0xcd8(%rip),%rsi
call   1130 <strstr@plt>
test   %eax,%eax
je     12d8 <ServerListenBroadcast+0xb8>
lea    0xccd(%rip),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    0xc(%rsp),%r9d
lea    0x20(%rsp),%r8
mov    %r14d,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
call   10b0 <sendto@plt>
test   %eax,%eax
js     1410 <ServerListenBroadcast+0x1f0>
mov    0x20(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xcb4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    13ca <ServerListenBroadcast+0x1aa>
lea    0xcb5(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
mov    $0xffffffff,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc13(%rip),%rdi
call   1110 <perror@plt>
jmp    13d2 <ServerListenBroadcast+0x1b2>
lea    0xc17(%rip),%rdi
call   1110 <perror@plt>
jmp    13ca <ServerListenBroadcast+0x1aa>
lea    0xc1a(%rip),%rdi
call   1110 <perror@plt>
jmp    13ca <ServerListenBroadcast+0x1aa>
lea    0xc3f(%rip),%rdi
call   1110 <perror@plt>
jmp    13ca <ServerListenBroadcast+0x1aa>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [18 x i8] c"client socket err\00"
@INADDR_ANY = global i32 0
@.str.1 = [17 x i8] c"server1 bind err\00"
@.str.2 = [15 x i8] c"select error!\0A\00"
@.str.3 = [11 x i8] c"time out!\0A\00"
@.str.4 = [19 x i8] c"server recieve err\00"
@.str.5 = [10 x i8] c"buf : %s\0A\00"
@.str.6 = [9 x i8] c"IP_FOUND\00"
@.str.7 = [13 x i8] c"IP_FOUND_ACK\00"
@.str.8 = [16 x i8] c"server send err\00"
@.str.9 = [10 x i8] c"IP is %s\0A\00"
define i32 @ServerListenBroadcast() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x i8]
%6 = alloca i32
%7 = alloca %struct.timeval
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
store i32 -1, i32* %2
store i32 -1, i32* %3
store i32 -1, i32* %4
%10 = load i32, i32* @AF_INET
%11 = load i32, i32* @SOCK_DGRAM
%12 = call i32 @socket(i32 %10, i32 %11, i32 0)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp sgt i32 0, %13
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %91
17: ; preds = %0
store i32 12, i32* %4
%18 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %19, i32* %20
%21 = load i32, i32* @INADDR_ANY
%22 = call i32 @htonl(i32 %21)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %23, i32 0, i32 0
store i32 %22, i32* %24
%25 = call i32 @htons(i32 8888)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* %3
%28 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%29 = call i32 @bind(i32 %27, %struct.sockaddr* %28, i32 12)
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = icmp sgt i32 0, %30
br i1 %31, label %32, label %34
32: ; preds = %17
%33 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %88
34: ; preds = %17
br label %35
35: ; preds = %34, %87
%36 = call i32 @FD_ZERO(i32* %6)
%37 = load i32, i32* %3
%38 = call i32 @FD_SET(i32 %37, i32* %6)
%39 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
store i32 2, i32* %39
%40 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
store i64 0, i64* %40
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
%43 = call i32 @select(i32 %42, i32* %6, i32* null, i32* null, %struct.timeval* %7)
store i32 %43, i32* %2
%44 = load i32, i32* %2
switch i32 %44, label %49 [
i32 -1, label %45
i32 0, label %47
]
45: ; preds = %35
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %88
47: ; preds = %35
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %87
49: ; preds = %35
%50 = load i32, i32* %3
%51 = call i32 @FD_ISSET(i32 %50, i32* %6)
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %86
53: ; preds = %49
%54 = load i32, i32* %3
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%56 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%57 = call i32 @recvfrom(i32 %54, i8* %55, i32 20, i32 0, %struct.sockaddr* %56, i32* %4)
store i32 %57, i32* %2
%58 = load i32, i32* %2
%59 = icmp sgt i32 0, %58
br i1 %59, label %60, label %62
60: ; preds = %53
%61 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %88
62: ; preds = %53
%63 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%66 = call i32 @strstr(i8* %65, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %85
68: ; preds = %62
%69 = load i32, i32* %3
%70 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%71 = add nsw i32 %70, 1
%72 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%73 = load i32, i32* %4
%74 = call i32 @sendto(i32 %69, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %71, i32 0, %struct.sockaddr* %72, i32 %73)
store i32 %74, i32* %2
%75 = load i32, i32* %2
%76 = icmp sgt i32 0, %75
br i1 %76, label %77, label %79
77: ; preds = %68
%78 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %88
79: ; preds = %68
%80 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%81 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %80, i32 0, i32 0
%82 = load i32, i32* %81
%83 = call i8* @inet_ntoa(i32 %82)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %83)
br label %88
85: ; preds = %62
br label %86
86: ; preds = %85, %49
br label %87
87: ; preds = %86, %47
br label %35
88: ; preds = %79, %77, %60, %45, %32
%89 = load i32, i32* %3
%90 = call i32 @close(i32 %89)
store i32 -1, i32* %1
br label %91
91: ; preds = %88, %15
%92 = load i32, i32* %1
ret i32 %92
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [18 x i8] c"client socket err\00"
@INADDR_ANY = global i32 0
@.str.1 = [17 x i8] c"server1 bind err\00"
@.str.4 = [19 x i8] c"server recieve err\00"
@.str.5 = [10 x i8] c"buf : %s\0A\00"
@.str.6 = [9 x i8] c"IP_FOUND\00"
@.str.7 = [13 x i8] c"IP_FOUND_ACK\00"
@.str.8 = [16 x i8] c"server send err\00"
@.str.9 = [10 x i8] c"IP is %s\0A\00"
@str = [10 x i8] c"time out!\00"
@str.10 = [14 x i8] c"select error!\00"
define i32 @ServerListenBroadcast() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_in
%7 = bitcast i32* %1 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = bitcast i32* %3 to i8*
%10 = bitcast %struct.timeval* %4 to i8*
%11 = bitcast %struct.sockaddr_in* %5 to i8*
%12 = bitcast %struct.sockaddr_in* %6 to i8*
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_DGRAM
%15 = tail call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %74
19: ; preds = %0
store i32 12, i32* %1
%20 = call i32 @memset(%struct.sockaddr_in* %5, i32 0, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = call i32 @htons(i32 8888)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i32 %26, i32* %27
%28 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%29 = call i32 @bind(i32 %15, %struct.sockaddr* %28, i32 12)
%30 = icmp slt i32 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %19
%32 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%33 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%34 = add nuw nsw i32 %15, 1
%35 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
br label %38
36: ; preds = %19
%37 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %72
38: ; preds = %49, %31
%39 = call i32 @FD_ZERO(i32* %3)
%40 = call i32 @FD_SET(i32 %15, i32* %3)
store i32 2, i32* %32
store i64 0, i64* %33
%41 = call i32 @select(i32 %34, i32* %3, i32* null, i32* null, %struct.timeval* %4)
switch i32 %41, label %46 [
i32 -1, label %42
i32 0, label %44
]
42: ; preds = %38
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0))
br label %72
44: ; preds = %38
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %49
46: ; preds = %38
%47 = call i32 @FD_ISSET(i32 %15, i32* %3)
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %46, %55, %44
br label %38
50: ; preds = %46
%51 = call i32 @recvfrom(i32 %15, i8* %8, i32 20, i32 0, %struct.sockaddr* %35, i32* %1)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %72
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%57 = call i32 @strstr(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%58 = icmp eq i32 %57, 0
br i1 %58, label %49, label %59
59: ; preds = %55
%60 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%61 = add nsw i32 %60, 1
%62 = load i32, i32* %1
%63 = call i32 @sendto(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %61, i32 0, %struct.sockaddr* %35, i32 %62)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %72
67: ; preds = %59
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0, i32 0
%69 = load i32, i32* %68
%70 = call i8* @inet_ntoa(i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %67, %65, %53, %42, %36
%73 = call i32 @close(i32 %15)
br label %74
74: ; preds = %72, %17
ret i32 -1
}