#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__ {
  void *s_addr;
};
struct sockaddr_in {
  void *sin_port;
  TYPE_1__ sin_addr;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ opt;
typedef int /*<<< orphan*/ addrto;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ INADDR_BROADCAST;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BROADCAST;
int /*<<< orphan*/ _IONBF;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
void *htonl(int /*<<< orphan*/);
void *htons(int);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ memset(char *, char, int);
int ntohs(void *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             int /*<<< orphan*/ *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main() {
  setvbuf(stdout, NULL, _IONBF, 0);
  fflush(stdout);
  struct sockaddr_in addrto;
  bzero(&addrto, sizeof(struct sockaddr_in));
  addrto.sin_family = AF_INET;
  addrto.sin_addr.s_addr = htonl(INADDR_ANY);
  addrto.sin_port = htons(6023);
  struct sockaddr_in from;
  bzero(&from, sizeof(struct sockaddr_in));
  from.sin_family = AF_INET;
  from.sin_addr.s_addr = htonl(INADDR_ANY);
  from.sin_port = htons(6023);
  int sock = -1;
  if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
    printf("socket error\n");
    return -1;
  }
  const int opt = 1;
  int nb = 0;
  nb = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&opt, sizeof(opt));
  if (nb == -1) {
    printf("set socket error...\n");
    return -1;
  }
  if (bind(sock, (struct sockaddr *)&(addrto), sizeof(struct sockaddr_in)) ==
      -1) {
    printf("bind error...\n");
    return -1;
  }
  int len = sizeof(struct sockaddr_in);
  char smsg[100] = {0};
  bzero(&addrto, sizeof(struct sockaddr_in));
  addrto.sin_family = AF_INET;
  addrto.sin_addr.s_addr = htonl(INADDR_BROADCAST);
  addrto.sin_port = htons(6023);
  int nlen = sizeof(addrto);
  while (1) {
    int ret = recvfrom(sock, smsg, 100, 0, (struct sockaddr *)&from,
                       (socklen_t *)&len);
    if (ret <= 0) {
      printf("read error....\n");
    } else {
      printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
      printf("ret=%d, recv=%s\n", ret, smsg);
      printf("from.sin_addr.s_addr=%s, from.sin_port=%d\n",
             inet_ntoa(from.sin_addr), ntohs(from.sin_port));
      printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    }
    memset(smsg, 'a', 20);
    ret = sendto(sock, smsg, 20, 0, (struct sockaddr *)&addrto, nlen);
    if (ret <= 0) {
    } else {
      printf("send succuss.\n");
    }
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
mov    0x2db6(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10d0 <setvbuf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
lea    -0x20(%rbp),%rdi
mov    $0x18,%esi
call   10f0 <bzero@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1787,%edi
call   1050 <htons@plt>
mov    %rax,-0x20(%rbp)
lea    -0x38(%rbp),%rdi
mov    $0x18,%esi
call   10f0 <bzero@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %rax,-0x30(%rbp)
mov    $0x1787,%edi
call   1050 <htons@plt>
mov    %rax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
mov    0x2d2d(%rip),%rax
mov    (%rax),%rdi
mov    0x2d03(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0xffffffff,%eax
jne    12ec <main+0xfc>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f0 <main+0x300>
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x3c(%rbp),%edi
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
mov    0x2cab(%rip),%rax
mov    (%rax),%edx
lea    -0x40(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xffffffff,-0x44(%rbp)
jne    1345 <main+0x155>
lea    0xcdc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f0 <main+0x300>
mov    -0x3c(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x18,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1379 <main+0x189>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f0 <main+0x300>
movl   $0x18,-0x48(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1080 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    $0x18,%esi
call   10f0 <bzero@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1787,%edi
call   1050 <htons@plt>
mov    %rax,-0x20(%rbp)
movl   $0x18,-0xb4(%rbp)
mov    -0x3c(%rbp),%edi
lea    -0xb0(%rbp),%rsi
lea    -0x38(%rbp),%r8
mov    $0x64,%edx
xor    %ecx,%ecx
lea    -0x48(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x0,-0xb8(%rbp)
jg     141d <main+0x22d>
lea    0xc21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1484 <main+0x294>
lea    0xc1e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xb8(%rbp),%esi
lea    -0xb0(%rbp),%rdx
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <inet_ntoa@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x38(%rbp),%rdi
call   10c0 <ntohs@plt>
mov    -0xc0(%rbp),%rsi
mov    %eax,%edx
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xbc5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x61,%esi
mov    $0x14,%edx
call   1080 <memset@plt>
mov    -0x3c(%rbp),%edi
lea    -0xb0(%rbp),%rsi
lea    -0x20(%rbp),%r8
mov    -0xb4(%rbp),%r9d
mov    $0x14,%edx
xor    %ecx,%ecx
call   1090 <sendto@plt>
mov    %eax,-0xb8(%rbp)
cmpl   $0x0,-0xb8(%rbp)
jg     14d3 <main+0x2e3>
jmp    14e1 <main+0x2f1>
lea    0xbc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1100 <sleep@plt>
jmp    13d9 <main+0x1e9>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    0x2d90(%rip),%rbx
mov    (%rbx),%edi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   10e0 <setvbuf@plt>
mov    (%rbx),%edi
call   10b0 <fflush@plt>
lea    0x10(%rsp),%rdi
mov    $0x18,%esi
call   1100 <bzero@plt>
mov    0x2d97(%rip),%rbx
mov    (%rbx),%rax
mov    %rax,0x20(%rsp)
mov    0x2d80(%rip),%rbp
mov    0x0(%rbp),%edi
call   1080 <htonl@plt>
mov    %rax,0x18(%rsp)
mov    $0x1787,%edi
call   1060 <htons@plt>
mov    %rax,0x10(%rsp)
lea    0x28(%rsp),%rdi
mov    $0x18,%esi
call   1100 <bzero@plt>
mov    (%rbx),%rax
mov    %rax,0x38(%rsp)
mov    0x0(%rbp),%edi
call   1080 <htonl@plt>
mov    %rax,0x30(%rsp)
mov    $0x1787,%edi
call   1060 <htons@plt>
mov    %rax,0x28(%rsp)
mov    (%rbx),%rdi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
cmp    $0xffffffff,%eax
je     1466 <main+0x266>
mov    %eax,%r15d
movl   $0x1,0xc(%rsp)
mov    0x2d13(%rip),%rax
mov    (%rax),%esi
mov    0x2cda(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r15d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     146f <main+0x26f>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x18,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
je     1478 <main+0x278>
movl   $0x18,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movl   $0x0,0xa0(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x18,%esi
call   1100 <bzero@plt>
mov    (%rbx),%rax
mov    %rax,0x20(%rsp)
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %rax,0x18(%rsp)
mov    $0x1787,%edi
call   1060 <htons@plt>
mov    %rax,0x10(%rsp)
lea    0x40(%rsp),%rbx
lea    0xcd3(%rip),%r12
lea    0xc9f(%rip),%r13
jmp    13aa <main+0x1aa>
nop
mov    $0x1,%edi
call   1110 <sleep@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
lea    0x28(%rsp),%r8
lea    0x8(%rsp),%r9
call   10c0 <recvfrom@plt>
mov    %r12,%rdi
test   %eax,%eax
jle    1419 <main+0x219>
mov    %eax,%r14d
mov    %r13,%rdi
call   1030 <puts@plt>
lea    0xc21(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x30(%rsp),%rdi
call   1050 <inet_ntoa@plt>
mov    %rax,%rbp
mov    0x28(%rsp),%rdi
call   10d0 <ntohs@plt>
lea    0xc07(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
mov    $0x14,%edx
call   1090 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x14,%edx
xor    %ecx,%ecx
lea    0x10(%rsp),%r8
mov    $0x18,%r9d
call   10a0 <sendto@plt>
test   %eax,%eax
jle    13a0 <main+0x1a0>
lea    0xbff(%rip),%rdi
call   1030 <puts@plt>
jmp    13a0 <main+0x1a0>
lea    0xc2d(%rip),%rdi
jmp    147f <main+0x27f>
lea    0xc10(%rip),%rdi
jmp    147f <main+0x27f>
lea    0xbf9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@stdout = global i32 0
@_IONBF = global i32 0
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [14 x i8] c"socket error\0A\00"
@SOL_SOCKET = global i32 0
@SO_BROADCAST = global i32 0
@.str.1 = [21 x i8] c"set socket error...\0A\00"
@.str.2 = [15 x i8] c"bind error...\0A\00"
@INADDR_BROADCAST = global i32 0
@.str.3 = [16 x i8] c"read error....\0A\00"
@.str.4 = [32 x i8] c"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\0A\00"
@.str.5 = [17 x i8] c"ret=%d, recv=%s\0A\00"
@.str.6 = [43 x i8] c"from.sin_addr.s_addr=%s, from.sin_port=%d\0A\00"
@.str.7 = [15 x i8] c"send succuss.\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 i32
%8 = alloca [100 x i8]
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = load i32, i32* @stdout
%12 = load i32, i32* @_IONBF
%13 = call i32 @setvbuf(i32 %11, i32* null, i32 %12, i32 0)
%14 = load i32, i32* @stdout
%15 = call i32 @fflush(i32 %14)
%16 = call i32 @bzero(%struct.sockaddr_in* %2, i32 24)
%17 = load i8*, i8** @AF_INET
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i8* %17, i8** %18
%19 = load i32, i32* @INADDR_ANY
%20 = call i8* @htonl(i32 %19)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%22 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %21, i32 0, i32 0
store i8* %20, i8** %22
%23 = call i8* @htons(i32 6023)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
store i8* %23, i8** %24
%25 = call i32 @bzero(%struct.sockaddr_in* %3, i32 24)
%26 = load i8*, i8** @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i8* %26, i8** %27
%28 = load i32, i32* @INADDR_ANY
%29 = call i8* @htonl(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%31 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %30, i32 0, i32 0
store i8* %29, i8** %31
%32 = call i8* @htons(i32 6023)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
store i8* %32, i8** %33
store i32 -1, i32* %4
%34 = load i8*, i8** @AF_INET
%35 = load i32, i32* @SOCK_DGRAM
%36 = call i32 @socket(i8* %34, i32 %35, i32 0)
store i32 %36, i32* %4
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %40
38: ; preds = %0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %106
40: ; preds = %0
store i32 1, i32* %5
store i32 0, i32* %6
%41 = load i32, i32* %4
%42 = load i32, i32* @SOL_SOCKET
%43 = load i32, i32* @SO_BROADCAST
%44 = bitcast i32* %5 to i8*
%45 = call i32 @setsockopt(i32 %41, i32 %42, i32 %43, i8* %44, i32 4)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %50
48: ; preds = %40
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %106
50: ; preds = %40
%51 = load i32, i32* %4
%52 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%53 = call i32 @bind(i32 %51, %struct.sockaddr* %52, i32 24)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %106
57: ; preds = %50
store i32 24, i32* %7
%58 = bitcast [100 x i8]* %8 to i8*
%59 = call i32 @bzero(%struct.sockaddr_in* %2, i32 24)
%60 = load i8*, i8** @AF_INET
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i8* %60, i8** %61
%62 = load i32, i32* @INADDR_BROADCAST
%63 = call i8* @htonl(i32 %62)
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%65 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %64, i32 0, i32 0
store i8* %63, i8** %65
%66 = call i8* @htons(i32 6023)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
store i8* %66, i8** %67
store i32 24, i32* %9
br label %68
68: ; preds = %57, %104
%69 = load i32, i32* %4
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%71 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%72 = call i32 @recvfrom(i32 %69, i8* %70, i32 100, i32 0, %struct.sockaddr* %71, i32* %7)
store i32 %72, i32* %10
%73 = load i32, i32* %10
%74 = icmp sle i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %68
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %91
77: ; preds = %68
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%79 = load i32, i32* %10
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %79, i8* %80)
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%83 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %82, i32 0, i32 0
%84 = load i8*, i8** %83
%85 = call i8* @inet_ntoa(i8* %84)
%86 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%87 = load i8*, i8** %86
%88 = call i32 @ntohs(i8* %87)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %85, i32 %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %91
91: ; preds = %77, %75
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%93 = call i32 @memset(i8* %92, i8 signext 97, i32 20)
%94 = load i32, i32* %4
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%96 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%97 = load i32, i32* %9
%98 = call i32 @sendto(i32 %94, i8* %95, i32 20, i32 0, %struct.sockaddr* %96, i32 %97)
store i32 %98, i32* %10
%99 = load i32, i32* %10
%100 = icmp sle i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %91
br label %104
102: ; preds = %91
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %104
104: ; preds = %102, %101
%105 = call i32 @sleep(i32 1)
br label %68
106: ; preds = %55, %48, %38
%107 = load i32, i32* %1
ret i32 %107
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@stdout = global i32 0
@_IONBF = global i32 0
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_BROADCAST = global i32 0
@INADDR_BROADCAST = global i32 0
@.str.5 = [17 x i8] c"ret=%d, recv=%s\0A\00"
@.str.6 = [43 x i8] c"from.sin_addr.s_addr=%s, from.sin_port=%d\0A\00"
@str.8 = [31 x i8] c"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\00"
@str.9 = [14 x i8] c"send succuss.\00"
@str.10 = [15 x i8] c"read error....\00"
@str.11 = [14 x i8] c"bind error...\00"
@str.12 = [20 x i8] c"set socket error...\00"
@str.13 = [13 x i8] c"socket error\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = load i32, i32* @stdout
%7 = load i32, i32* @_IONBF
%8 = tail call i32 @setvbuf(i32 %6, i32* null, i32 %7, i32 0)
%9 = load i32, i32* @stdout
%10 = tail call i32 @fflush(i32 %9)
%11 = bitcast %struct.sockaddr_in* %1 to i8*
%12 = call i32 @bzero(%struct.sockaddr_in* %1, i32 24)
%13 = load i8*, i8** @AF_INET
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i8* %13, i8** %14
%15 = load i32, i32* @INADDR_ANY
%16 = tail call i8* @htonl(i32 %15)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i8* %16, i8** %17
%18 = tail call i8* @htons(i32 6023)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i8* %18, i8** %19
%20 = bitcast %struct.sockaddr_in* %2 to i8*
%21 = call i32 @bzero(%struct.sockaddr_in* %2, i32 24)
%22 = load i8*, i8** @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i8* %22, i8** %23
%24 = load i32, i32* @INADDR_ANY
%25 = tail call i8* @htonl(i32 %24)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1, i32 0
store i8* %25, i8** %26
%27 = tail call i8* @htons(i32 6023)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
store i8* %27, i8** %28
%29 = load i8*, i8** @AF_INET
%30 = load i32, i32* @SOCK_DGRAM
%31 = tail call i32 @socket(i8* %29, i32 %30, i32 0)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %35
33: ; preds = %0
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.13, i64 0, i64 0))
br label %78
35: ; preds = %0
%36 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%37 = load i32, i32* @SOL_SOCKET
%38 = load i32, i32* @SO_BROADCAST
%39 = call i32 @setsockopt(i32 %31, i32 %37, i32 %38, i8* %36, i32 4)
%40 = icmp eq i32 %39, -1
br i1 %40, label %75, label %41
41: ; preds = %35
%42 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%43 = call i32 @bind(i32 %31, %struct.sockaddr* %42, i32 24)
%44 = icmp eq i32 %43, -1
br i1 %44, label %75, label %45
45: ; preds = %41
%46 = bitcast i32* %4 to i8*
store i32 24, i32* %4
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%48 = call i32 @bzero(%struct.sockaddr_in* %1, i32 24)
%49 = load i8*, i8** @AF_INET
store i8* %49, i8** %14
%50 = load i32, i32* @INADDR_BROADCAST
%51 = call i8* @htonl(i32 %50)
store i8* %51, i8** %17
%52 = call i8* @htons(i32 6023)
store i8* %52, i8** %19
%53 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
br label %54
54: ; preds = %73, %45
%55 = call i32 @recvfrom(i32 %31, i8* %47, i32 100, i32 0, %struct.sockaddr* %53, i32* %4)
%56 = icmp slt i32 %55, 1
br i1 %56, label %65, label %57
57: ; preds = %54
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %55, i8* %47)
%60 = load i8*, i8** %26
%61 = call i8* @inet_ntoa(i8* %60)
%62 = load i8*, i8** %28
%63 = call i32 @ntohs(i8* %62)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %61, i32 %63)
br label %65
65: ; preds = %54, %57
%66 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0), %57 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0), %54 ]
%67 = call i32 @puts(i8* dereferenceable(1) %66)
%68 = call i32 @memset(i8* %47, i8 signext 97, i32 20)
%69 = call i32 @sendto(i32 %31, i8* %47, i32 20, i32 0, %struct.sockaddr* %42, i32 24)
%70 = icmp slt i32 %69, 1
br i1 %70, label %73, label %71
71: ; preds = %65
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
br label %73
73: ; preds = %65, %71
%74 = call i32 @sleep(i32 1)
br label %54
75: ; preds = %41, %35
%76 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0), %35 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0), %41 ]
%77 = call i32 @puts(i8* dereferenceable(1) %76)
br label %78
78: ; preds = %75, %33
ret i32 -1
}