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

/* Variables and functions */
void *AF_INET;
void *INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BROADCAST;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
void *htons(int);
int /*<<< orphan*/ memset(int /*<<< orphan*/, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             int /*<<< orphan*/ *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
bool broadcast_receiver_run() {
  int sockfd;
  char buf[10];
  struct sockaddr_in sendaddr;
  struct sockaddr_in recvaddr;
  int numbytes;
  int addr_len;
  int broadcast = 1;
  if ((sockfd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) {
    perror("socket");
    exit(1);
  }
  if ((setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &broadcast,
                  sizeof broadcast)) == -1) {
    perror("setsockopt - SO_SOCKET ");
    exit(1);
  }
  printf("Socket created\n");
  sendaddr.sin_family = AF_INET;
  sendaddr.sin_port = htons(8000);
  sendaddr.sin_addr.s_addr = INADDR_ANY;
  memset(sendaddr.sin_zero, '\0', sizeof sendaddr.sin_zero);
  recvaddr.sin_family = AF_INET;
  recvaddr.sin_port = htons(8000);
  recvaddr.sin_addr.s_addr = INADDR_ANY;
  memset(recvaddr.sin_zero, '\0', sizeof recvaddr.sin_zero);
  if (bind(sockfd, (struct sockaddr *)&recvaddr, sizeof recvaddr) == -1) {
    perror("bind");
    exit(1);
  }
  while (true) {
    addr_len = sizeof sendaddr;
    if ((numbytes =
             recvfrom(sockfd, buf, sizeof buf, 0, (struct sockaddr *)&sendaddr,
                      (socklen_t *)&addr_len)) == -1) {
      perror("recvfrom");
      buf[0] = '\1';
      break;
    }
    printf("%s", buf);
    if (*buf == 0)
      break;
    else if (*buf == 'F') {
      system("st key push s1");
    } else if (*buf == 'C') {
      system("st key push s2; st key release s2; st key release s1");
    } else if (*buf == 'S') {
      system("st key push s2; st key release s2");
    } else if (*buf == 'R') {
      system("st key release s2; st key release s1");
    } else if (*buf == 'V') {
      system("st key click rec");
    } else if (*buf == 'P') {
      system("st key click ok");
    } else if (*buf == 'X') {
      break;
    }
  }
  close(sockfd);
  return *buf;
}


x86 assembly (clang, -O0):
<broadcast_receiver_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x1,-0x5c(%rbp)
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    11fa <broadcast_receiver_run+0x4a>
lea    0xe15(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    0x2de4(%rip),%rax
mov    (%rax),%esi
mov    0x2dbb(%rip),%rax
mov    (%rax),%edx
lea    -0x5c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    123d <broadcast_receiver_run+0x8d>
lea    0xdd9(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x1f40,%edi
call   1050 <htons@plt>
mov    %rax,-0x20(%rbp)
mov    0x2d6a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
mov    0x2d55(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    $0x1f40,%edi
call   1050 <htons@plt>
mov    %rax,-0x40(%rbp)
mov    0x2d31(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x20,%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12ed <broadcast_receiver_run+0x13d>
lea    0xd51(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    12f2 <broadcast_receiver_run+0x142>
movl   $0x20,-0x58(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xe(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0xa,%edx
xor    %ecx,%ecx
lea    -0x58(%rbp),%r9
call   1090 <recvfrom@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
jne    1335 <broadcast_receiver_run+0x185>
lea    0xd0d(%rip),%rdi
call   10b0 <perror@plt>
movb   $0x1,-0xe(%rbp)
jmp    1447 <broadcast_receiver_run+0x297>
lea    -0xe(%rbp),%rsi
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsbl -0xe(%rbp),%eax
cmp    $0x0,%eax
jne    1359 <broadcast_receiver_run+0x1a9>
jmp    1447 <broadcast_receiver_run+0x297>
movsbl -0xe(%rbp),%eax
cmp    $0x46,%eax
jne    1377 <broadcast_receiver_run+0x1c7>
lea    0xcd3(%rip),%rdi
call   1040 <system@plt>
jmp    143d <broadcast_receiver_run+0x28d>
movsbl -0xe(%rbp),%eax
cmp    $0x43,%eax
jne    1395 <broadcast_receiver_run+0x1e5>
lea    0xcc4(%rip),%rdi
call   1040 <system@plt>
jmp    1438 <broadcast_receiver_run+0x288>
movsbl -0xe(%rbp),%eax
cmp    $0x53,%eax
jne    13b3 <broadcast_receiver_run+0x203>
lea    0xcdb(%rip),%rdi
call   1040 <system@plt>
jmp    1433 <broadcast_receiver_run+0x283>
movsbl -0xe(%rbp),%eax
cmp    $0x52,%eax
jne    13d1 <broadcast_receiver_run+0x221>
lea    0xc98(%rip),%rdi
call   1040 <system@plt>
jmp    142e <broadcast_receiver_run+0x27e>
movsbl -0xe(%rbp),%eax
cmp    $0x56,%eax
jne    13ef <broadcast_receiver_run+0x23f>
lea    0xcc1(%rip),%rdi
call   1040 <system@plt>
jmp    1429 <broadcast_receiver_run+0x279>
movsbl -0xe(%rbp),%eax
cmp    $0x50,%eax
jne    140d <broadcast_receiver_run+0x25d>
lea    0xcb4(%rip),%rdi
call   1040 <system@plt>
jmp    1424 <broadcast_receiver_run+0x274>
movsbl -0xe(%rbp),%eax
cmp    $0x58,%eax
jne    141f <broadcast_receiver_run+0x26f>
jmp    1447 <broadcast_receiver_run+0x297>
jmp    1424 <broadcast_receiver_run+0x274>
jmp    1429 <broadcast_receiver_run+0x279>
jmp    142e <broadcast_receiver_run+0x27e>
jmp    1433 <broadcast_receiver_run+0x283>
jmp    1438 <broadcast_receiver_run+0x288>
jmp    143d <broadcast_receiver_run+0x28d>
jmp    1442 <broadcast_receiver_run+0x292>
jmp    12f2 <broadcast_receiver_run+0x142>
mov    -0x4(%rbp),%edi
call   1080 <close@plt>
movsbl -0xe(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<broadcast_receiver_run>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x1,0x8(%rsp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     13bf <broadcast_receiver_run+0x1ff>
mov    %eax,%r15d
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
mov    0x2dbd(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     13c8 <broadcast_receiver_run+0x208>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
mov    0x2da4(%rip),%rbx
mov    (%rbx),%rax
mov    %rax,0x30(%rsp)
mov    $0x1f40,%edi
call   1060 <htons@plt>
mov    %rax,0x28(%rsp)
mov    0x2d7e(%rip),%rbp
mov    0x0(%rbp),%rax
mov    %rax,0x20(%rsp)
xor    %esi,%esi
mov    $0x4,%edx
call   1080 <memset@plt>
mov    (%rbx),%rax
mov    %rax,0x50(%rsp)
mov    $0x1f40,%edi
call   1060 <htons@plt>
mov    %rax,0x48(%rsp)
mov    0x0(%rbp),%rax
mov    %rax,0x40(%rsp)
xor    %esi,%esi
mov    $0x4,%edx
call   1080 <memset@plt>
lea    0x38(%rsp),%rsi
mov    %r15d,%edi
mov    $0x20,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
je     13d1 <broadcast_receiver_run+0x211>
movl   $0x20,0x4(%rsp)
lea    0xe(%rsp),%rsi
lea    0x18(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %r15d,%edi
mov    $0xa,%edx
xor    %ecx,%ecx
call   10a0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1392 <broadcast_receiver_run+0x1d2>
lea    0xd99(%rip),%r14
lea    0xe(%rsp),%rbx
lea    0x18(%rsp),%r12
lea    0x4(%rsp),%rbp
lea    0xcfe(%rip),%r13
jmp    133a <broadcast_receiver_run+0x17a>
lea    0xdf4(%rip),%rdi
nopl   0x0(%rax,%rax,1)
call   1050 <system@plt>
movl   $0x20,0x4(%rsp)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
mov    %r12,%r8
mov    %rbp,%r9
call   10a0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1392 <broadcast_receiver_run+0x1d2>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
movzbl 0xe(%rsp),%eax
lea    -0x43(%rax),%ecx
cmp    $0x15,%cl
ja     138c <broadcast_receiver_run+0x1cc>
movzbl %cl,%eax
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
lea    0xd22(%rip),%rdi
jmp    *%rax
lea    0xd28(%rip),%rdi
jmp    1310 <broadcast_receiver_run+0x150>
lea    0xd2f(%rip),%rdi
jmp    1310 <broadcast_receiver_run+0x150>
lea    0xd4b(%rip),%rdi
jmp    1310 <broadcast_receiver_run+0x150>
lea    0xd64(%rip),%rdi
jmp    1310 <broadcast_receiver_run+0x150>
test   %al,%al
jne    1315 <broadcast_receiver_run+0x155>
jmp    13a3 <broadcast_receiver_run+0x1e3>
lea    0xce3(%rip),%rdi
call   10c0 <perror@plt>
movb   $0x1,0xe(%rsp)
mov    %r15d,%edi
call   1090 <close@plt>
movsbl 0xe(%rsp),%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc92(%rip),%rdi
jmp    13d8 <broadcast_receiver_run+0x218>
lea    0xc90(%rip),%rdi
jmp    13d8 <broadcast_receiver_run+0x218>
lea    0xc9f(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [7 x i8] c"socket\00"
@SOL_SOCKET = global i32 0
@SO_BROADCAST = global i32 0
@.str.1 = [24 x i8] c"setsockopt - SO_SOCKET \00"
@.str.2 = [16 x i8] c"Socket created\0A\00"
@AF_INET = global i8* null
@INADDR_ANY = global i8* null
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [9 x i8] c"recvfrom\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [15 x i8] c"st key push s1\00"
@.str.7 = [53 x i8] c"st key push s2; st key release s2; st key release s1\00"
@.str.8 = [34 x i8] c"st key push s2; st key release s2\00"
@.str.9 = [37 x i8] c"st key release s2; st key release s1\00"
@.str.10 = [17 x i8] c"st key click rec\00"
@.str.11 = [16 x i8] c"st key click ok\00"
define i32 @broadcast_receiver_run() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 1, i32* %7
%8 = load i32, i32* @PF_INET
%9 = load i32, i32* @SOCK_DGRAM
%10 = call i32 @socket(i32 %8, i32 %9, i32 0)
store i32 %10, i32* %1
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %0
%16 = load i32, i32* %1
%17 = load i32, i32* @SOL_SOCKET
%18 = load i32, i32* @SO_BROADCAST
%19 = call i32 @setsockopt(i32 %16, i32 %17, i32 %18, i32* %7, i32 4)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %15
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%26 = load i8*, i8** @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 3
store i8* %26, i8** %27
%28 = call i8* @htons(i32 8000)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i8* %28, i8** %29
%30 = load i8*, i8** @INADDR_ANY
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
store i8* %30, i8** %32
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%34 = load i32, i32* %33
%35 = call i32 @memset(i32 %34, i8 signext 0, i32 4)
%36 = load i8*, i8** @AF_INET
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 3
store i8* %36, i8** %37
%38 = call i8* @htons(i32 8000)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i8* %38, i8** %39
%40 = load i8*, i8** @INADDR_ANY
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
store i8* %40, i8** %42
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @memset(i32 %44, i8 signext 0, i32 4)
%46 = load i32, i32* %1
%47 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%48 = call i32 @bind(i32 %46, %struct.sockaddr* %47, i32 32)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %53
50: ; preds = %24
%51 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %24
br label %54
54: ; preds = %53, %126
store i32 32, i32* %6
%55 = load i32, i32* %1
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%57 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%58 = call i32 @recvfrom(i32 %55, i8* %56, i32 10, i32 0, %struct.sockaddr* %57, i32* %6)
store i32 %58, i32* %5
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
store i8 1, i8* %62
br label %127
63: ; preds = %54
%64 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %64)
%66 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %63
br label %127
71: ; preds = %63
%72 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 70
br i1 %75, label %76, label %78
76: ; preds = %71
%77 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %125
78: ; preds = %71
%79 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 67
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = call i32 @system(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
br label %124
85: ; preds = %78
%86 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 83
br i1 %89, label %90, label %92
90: ; preds = %85
%91 = call i32 @system(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
br label %123
92: ; preds = %85
%93 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 82
br i1 %96, label %97, label %99
97: ; preds = %92
%98 = call i32 @system(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
br label %122
99: ; preds = %92
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp eq i32 %102, 86
br i1 %103, label %104, label %106
104: ; preds = %99
%105 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
br label %121
106: ; preds = %99
%107 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 80
br i1 %110, label %111, label %113
111: ; preds = %106
%112 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %120
113: ; preds = %106
%114 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 88
br i1 %117, label %118, label %119
118: ; preds = %113
br label %127
119: ; preds = %113
br label %120
120: ; preds = %119, %111
br label %121
121: ; preds = %120, %104
br label %122
122: ; preds = %121, %97
br label %123
123: ; preds = %122, %90
br label %124
124: ; preds = %123, %83
br label %125
125: ; preds = %124, %76
br label %126
126: ; preds = %125
br label %54
127: ; preds = %118, %70, %60
%128 = load i32, i32* %1
%129 = call i32 @close(i32 %128)
%130 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
ret i32 %132
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [7 x i8] c"socket\00"
@SOL_SOCKET = global i32 0
@SO_BROADCAST = global i32 0
@.str.1 = [24 x i8] c"setsockopt - SO_SOCKET \00"
@AF_INET = global i8* null
@INADDR_ANY = global i8* null
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [9 x i8] c"recvfrom\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [15 x i8] c"st key push s1\00"
@.str.7 = [53 x i8] c"st key push s2; st key release s2; st key release s1\00"
@.str.8 = [34 x i8] c"st key push s2; st key release s2\00"
@.str.9 = [37 x i8] c"st key release s2; st key release s1\00"
@.str.10 = [17 x i8] c"st key click rec\00"
@.str.11 = [16 x i8] c"st key click ok\00"
@str = [15 x i8] c"Socket created\00"
define i32 @broadcast_receiver_run() {
%1 = alloca [10 x i8]
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%7 = bitcast %struct.sockaddr_in* %2 to i8*
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%11 = load i32, i32* @PF_INET
%12 = load i32, i32* @SOCK_DGRAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = load i32, i32* @SOL_SOCKET
%20 = load i32, i32* @SO_BROADCAST
%21 = call i32 @setsockopt(i32 %13, i32 %19, i32 %20, i32* %5, i32 4)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %18
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%28 = load i8*, i8** @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 3
store i8* %28, i8** %29
%30 = call i8* @htons(i32 8000)
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i8* %30, i8** %31
%32 = load i8*, i8** @INADDR_ANY
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1, i32 0
store i8* %32, i8** %33
%34 = call i32 @memset(i32 undef, i8 signext 0, i32 4)
%35 = load i8*, i8** @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i8* %35, i8** %36
%37 = call i8* @htons(i32 8000)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i8* %37, i8** %38
%39 = load i8*, i8** @INADDR_ANY
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i8* %39, i8** %40
%41 = call i32 @memset(i32 undef, i8 signext 0, i32 4)
%42 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%43 = call i32 @bind(i32 %13, %struct.sockaddr* %42, i32 32)
%44 = icmp eq i32 %43, -1
br i1 %44, label %49, label %45
45: ; preds = %26
%46 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
store i32 32, i32* %4
%47 = call i32 @recvfrom(i32 %13, i8* %6, i32 10, i32 0, %struct.sockaddr* %46, i32* %4)
%48 = icmp eq i32 %47, -1
br i1 %48, label %52, label %54
49: ; preds = %26
%50 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %65, %45
%53 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
store i8 1, i8* %6
br label %68
54: ; preds = %45, %65
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%56 = load i8, i8* %6
switch i8 %56, label %65 [
i8 0, label %68
i8 70, label %62
i8 67, label %57
i8 83, label %58
i8 82, label %59
i8 86, label %60
i8 80, label %61
i8 88, label %68
]
57: ; preds = %54
br label %62
58: ; preds = %54
br label %62
59: ; preds = %54
br label %62
60: ; preds = %54
br label %62
61: ; preds = %54
br label %62
62: ; preds = %54, %57, %59, %61, %60, %58
%63 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), %58 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), %60 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), %61 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), %59 ], [ getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), %57 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %54 ]
%64 = call i32 @system(i8* %63)
br label %65
65: ; preds = %62, %54
store i32 32, i32* %4
%66 = call i32 @recvfrom(i32 %13, i8* %6, i32 10, i32 0, %struct.sockaddr* %46, i32* %4)
%67 = icmp eq i32 %66, -1
br i1 %67, label %52, label %54
68: ; preds = %54, %54, %52
%69 = call i32 @close(i32 %13)
%70 = load i8, i8* %6
%71 = sext i8 %70 to i32
ret i32 %71
}