#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 */

/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
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*/ *);
scalar_t__ GetBroadcastAddr(int, struct sockaddr_in *);
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ SetBroadcast(int, struct sockaddr_in *);
int /*<<< orphan*/ close(int);
char *inet_ntoa(int /*<<< orphan*/);
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 *, scalar_t__, int /*<<< orphan*/, struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strstr(char *, char *);
int ClientBroadcast(void) {
  int ret = -1;
  int sock = -1;
  char buf[20];
  fd_set readfd;
  struct timeval timeout;
  struct sockaddr_in broadcast_addr;
  struct sockaddr_in from_addr;
  int len = sizeof(struct sockaddr_in);
  sock = socket(AF_INET, SOCK_DGRAM, 0);
  if (0 > sock) {
    perror("client socket err");
    return -1;
  }
  if (GetBroadcastAddr(sock, &broadcast_addr)) {
    printf("get broadcast addr failed!\n");
    goto _out;
  }
  if (SetBroadcast(sock, &broadcast_addr)) {
    printf("set broadcast failed!\n");
    goto _out;
  }
  while (1) {
    ret = sendto(sock, "IP_FOUND", strlen("IP_FOUND") + 1, 0,
                 (struct sockaddr *)&broadcast_addr, len);
    if (0 > ret) {
      perror("server send err");
      goto _out;
    }
    FD_ZERO(&readfd);
    FD_SET(sock, &readfd);
    timeout.tv_sec = 5;
    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_ACK")) {
          printf("IP is %s\n", inet_ntoa(from_addr.sin_addr));
        }
      }
    }
    }
  }
  close(sock);
  return 0;
_out:
  close(sock);
  return -1;
}


x86 assembly (clang, -O0):
<ClientBroadcast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0x4,-0x4c(%rbp)
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    0x2dc3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jle    124c <ClientBroadcast+0x5c>
lea    0xdc5(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1434 <ClientBroadcast+0x244>
mov    -0xc(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1090 <GetBroadcastAddr@plt>
cmp    $0x0,%rax
je     1275 <ClientBroadcast+0x85>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1425 <ClientBroadcast+0x235>
mov    -0xc(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   10d0 <SetBroadcast@plt>
cmp    $0x0,%rax
je     129e <ClientBroadcast+0xae>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1425 <ClientBroadcast+0x235>
jmp    12a3 <ClientBroadcast+0xb3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
lea    0xd95(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%rdx
add    $0x1,%rdx
lea    -0x40(%rbp),%r8
mov    -0x4c(%rbp),%r9d
lea    0xd77(%rip),%rsi
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    12f4 <ClientBroadcast+0x104>
lea    0xd64(%rip),%rdi
call   10e0 <perror@plt>
jmp    1425 <ClientBroadcast+0x235>
lea    -0x24(%rbp),%rdi
mov    %rdi,-0x60(%rbp)
call   10a0 <FD_ZERO@plt>
mov    -0x60(%rbp),%rsi
mov    -0xc(%rbp),%edi
call   10f0 <FD_SET@plt>
mov    -0x60(%rbp),%rsi
movl   $0x5,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x38(%rbp),%r8
mov    %rcx,%rdx
call   10b0 <select@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0xffffffff,%eax
je     135d <ClientBroadcast+0x16d>
jmp    134d <ClientBroadcast+0x15d>
mov    -0x54(%rbp),%eax
test   %eax,%eax
je     1370 <ClientBroadcast+0x180>
jmp    1383 <ClientBroadcast+0x193>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1425 <ClientBroadcast+0x235>
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1420 <ClientBroadcast+0x230>
mov    -0xc(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%eax
je     141b <ClientBroadcast+0x22b>
mov    -0xc(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x48(%rbp),%r8
mov    $0x14,%edx
xor    %ecx,%ecx
lea    -0x4c(%rbp),%r9
call   10c0 <recvfrom@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    13d2 <ClientBroadcast+0x1e2>
lea    0xcb0(%rip),%rdi
call   10e0 <perror@plt>
jmp    1425 <ClientBroadcast+0x235>
lea    -0x20(%rbp),%rsi
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xca6(%rip),%rsi
call   1100 <strstr@plt>
cmp    $0x0,%eax
je     1416 <ClientBroadcast+0x226>
mov    -0x48(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    141b <ClientBroadcast+0x22b>
jmp    1420 <ClientBroadcast+0x230>
jmp    12a3 <ClientBroadcast+0xb3>
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClientBroadcast>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x4,0x14(%rsp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
mov    0x2dca(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     13d3 <ClientBroadcast+0x1e3>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1090 <GetBroadcastAddr@plt>
test   %rax,%rax
je     1246 <ClientBroadcast+0x56>
lea    0xe4c(%rip),%rdi
jmp    13b3 <ClientBroadcast+0x1c3>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10d0 <SetBroadcast@plt>
test   %rax,%rax
je     1263 <ClientBroadcast+0x73>
lea    0xe19(%rip),%rdi
jmp    13b3 <ClientBroadcast+0x1c3>
lea    0xda8(%rip),%rsi
lea    0x8(%rsp),%r8
mov    $0x9,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
mov    $0x4,%r9d
call   1070 <sendto@plt>
test   %eax,%eax
js     13e1 <ClientBroadcast+0x1f1>
mov    %ebx,%r14d
add    $0x1,%r14d
lea    0x1c(%rsp),%rbp
lea    0x20(%rsp),%r12
lea    0xd6f(%rip),%r13
lea    0x8(%rsp),%r15
mov    %ebx,0x10(%rsp)
jmp    12dd <ClientBroadcast+0xed>
xchg   %ax,%ax
lea    0xda8(%rip),%rdi
call   1030 <puts@plt>
mov    0x14(%rsp),%r9d
mov    $0x9,%edx
mov    %ebx,%edi
mov    %r13,%rsi
xor    %ecx,%ecx
mov    %r15,%r8
call   1070 <sendto@plt>
test   %eax,%eax
js     13e1 <ClientBroadcast+0x1f1>
mov    %rbp,%rdi
call   10a0 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   10f0 <FD_SET@plt>
movl   $0x5,0x20(%rsp)
movq   $0x0,0x28(%rsp)
mov    %r14d,%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r12,%r8
call   10b0 <select@plt>
test   %eax,%eax
je     12b0 <ClientBroadcast+0xc0>
cmp    $0xffffffff,%eax
je     13ac <ClientBroadcast+0x1bc>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <FD_ISSET@plt>
test   %eax,%eax
je     12bc <ClientBroadcast+0xcc>
mov    %ebx,%edi
mov    %rbp,%rbx
mov    %r13,%rbp
lea    0x30(%rsp),%r13
mov    %r13,%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
call   10c0 <recvfrom@plt>
test   %eax,%eax
js     13ef <ClientBroadcast+0x1ff>
lea    0xcdc(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0xcd2(%rip),%rsi
call   1100 <strstr@plt>
test   %eax,%eax
mov    %rbp,%r13
mov    %rbx,%rbp
mov    0x10(%rsp),%ebx
je     12bc <ClientBroadcast+0xcc>
mov    0x18(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xcb8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12bc <ClientBroadcast+0xcc>
lea    0xcb6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    $0xffffffff,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc26(%rip),%rdi
call   10e0 <perror@plt>
jmp    13bf <ClientBroadcast+0x1cf>
lea    0xc33(%rip),%rdi
call   10e0 <perror@plt>
jmp    13b8 <ClientBroadcast+0x1c8>
lea    0xc35(%rip),%rdi
call   10e0 <perror@plt>
mov    0x10(%rsp),%ebx
jmp    13b8 <ClientBroadcast+0x1c8>

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

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