#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_6__ TYPE_3__;
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  void *s_addr;
};
struct sockaddr_in {
  TYPE_3__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct TYPE_5__ {
  int /*<<< orphan*/ s_addr;
};
struct TYPE_4__ {
  void *s_addr;
};
struct ip_mreq {
  TYPE_2__ imr_interface;
  TYPE_1__ imr_multiaddr;
};
typedef int /*<<< orphan*/ reuse;
typedef int /*<<< orphan*/ mgroup;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_ADD_MEMBERSHIP;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
void *inet_addr(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int recvfrom(int, unsigned char *, int, int /*<<< orphan*/, struct sockaddr *,
             unsigned int *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int /*<<< orphan*/, unsigned char *, int);
int main(int argc, char *argv[]) {
  int sockfd;
  struct sockaddr_in addr;
  struct ip_mreq mgroup;
  int reuse;
  unsigned int addrlen;
  int len;
  unsigned char udp_packet[65535];
  if (argc != 3) {
    fprintf(stderr, "Usage: %s ip_addr port > output.ts\n", argv[0]);
    return 0;
  } else {
    memset((char *)&mgroup, 0, sizeof(mgroup));
    mgroup.imr_multiaddr.s_addr = inet_addr(argv[1]);
    mgroup.imr_interface.s_addr = INADDR_ANY;
    memset((char *)&addr, 0, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_port = htons(atoi(argv[2]));
    addr.sin_addr.s_addr = inet_addr(argv[1]);
    addrlen = sizeof(addr);
  }
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sockfd < 0) {
    perror("socket(): error ");
    return 0;
  }
  reuse = 1;
  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse,
                 sizeof(reuse)) < 0) {
    perror("setsockopt() SO_REUSEADDR: error ");
  }
  if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("bind(): error");
    close(sockfd);
    return 0;
  }
  if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mgroup,
                 sizeof(mgroup)) < 0) {
    perror("setsockopt() IPPROTO_IP: error ");
    close(sockfd);
    return 0;
  }
  while (1) {
    len = recvfrom(sockfd, udp_packet, 65535, 0, (struct sockaddr *)&addr,
                   &addrlen);
    if (len < 0) {
      perror("recvfrom(): error ");
    } else {
      write(STDOUT_FILENO, udp_packet, len);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     120b <main+0x4b>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe06(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e9 <main+0x229>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <inet_addr@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <inet_addr@plt>
mov    %rax,-0x28(%rbp)
movl   $0x10,-0x40(%rbp)
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12c1 <main+0x101>
lea    0xd74(%rip),%rdi
call   10c0 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e9 <main+0x229>
movl   $0x1,-0x3c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d0e(%rip),%rax
mov    (%rax),%esi
mov    0x2cc5(%rip),%rax
mov    (%rax),%edx
lea    -0x3c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1302 <main+0x142>
lea    0xd38(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   10b0 <bind@plt>
cmp    $0x0,%rax
jge    133d <main+0x17d>
lea    0xd33(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e9 <main+0x229>
mov    -0x14(%rbp),%edi
mov    0x2c81(%rip),%rax
mov    (%rax),%esi
mov    0x2c88(%rip),%rax
mov    (%rax),%edx
lea    -0x38(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    138b <main+0x1cb>
lea    0xcf3(%rip),%rdi
call   10c0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e9 <main+0x229>
jmp    1390 <main+0x1d0>
mov    -0x14(%rbp),%edi
lea    -0x10050(%rbp),%rsi
lea    -0x28(%rbp),%r8
mov    $0xffff,%edx
xor    %ecx,%ecx
lea    -0x40(%rbp),%r9
call   10a0 <recvfrom@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    13cc <main+0x20c>
lea    0xcc3(%rip),%rdi
call   10c0 <perror@plt>
jmp    13e4 <main+0x224>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
lea    -0x10050(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1040 <write@plt>
jmp    1390 <main+0x1d0>
mov    -0x4(%rbp),%eax
add    $0x10050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10038,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1344 <main+0x184>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    0x8(%rbx),%rdi
call   1080 <inet_addr@plt>
mov    %rax,0x28(%rsp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
mov    0x2daf(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x1c(%rsp)
mov    0x10(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   1080 <inet_addr@plt>
mov    %rax,0x10(%rsp)
movl   $0x10,0x8(%rsp)
mov    0x0(%rbp),%edi
mov    0x2d5c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     1370 <main+0x1b0>
mov    %eax,%r14d
movl   $0x1,0xc(%rsp)
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
mov    0x2d18(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %r14d,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     137e <main+0x1be>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x10,%edx
call   10b0 <bind@plt>
test   %rax,%rax
js     138f <main+0x1cf>
mov    0x2d00(%rip),%rax
mov    (%rax),%esi
mov    0x2d07(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rcx
mov    %r14d,%edi
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     1398 <main+0x1d8>
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%rbp
lea    0xd80(%rip),%r12
mov    0x2ce4(%rip),%r13
jmp    131e <main+0x15e>
xchg   %ax,%ax
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xffff,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    %rbp,%r9
call   10a0 <recvfrom@plt>
test   %eax,%eax
jns    1310 <main+0x150>
mov    %r12,%rdi
call   10c0 <perror@plt>
jmp    131e <main+0x15e>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xca9(%rip),%rsi
call   1090 <fprintf@plt>
xor    %eax,%eax
add    $0x10038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcad(%rip),%rdi
call   10c0 <perror@plt>
jmp    135c <main+0x19c>
lea    0xcb0(%rip),%rdi
call   10c0 <perror@plt>
jmp    12a6 <main+0xe6>
lea    0xcc1(%rip),%rdi
jmp    139f <main+0x1df>
lea    0xcc6(%rip),%rdi
call   10c0 <perror@plt>
mov    %r14d,%edi
call   1070 <close@plt>
jmp    135c <main+0x19c>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_6__, i32, i32 }
%struct.TYPE_6__ = type { i8* }
%struct.ip_mreq = type { %struct.TYPE_5__, %struct.TYPE_4__ }
%struct.TYPE_5__ = type { i32 }
%struct.TYPE_4__ = type { i8* }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s ip_addr port > output.ts\0A\00"
@INADDR_ANY = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [17 x i8] c"socket(): error \00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [34 x i8] c"setsockopt() SO_REUSEADDR: error \00"
@.str.3 = [14 x i8] c"bind(): error\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.4 = [32 x i8] c"setsockopt() IPPROTO_IP: error \00"
@.str.5 = [19 x i8] c"recvfrom(): error \00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca %struct.ip_mreq
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [65535 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 0, i32* %3
br label %102
21: ; preds = %2
%22 = bitcast %struct.ip_mreq* %8 to i8*
%23 = call i32 @memset(i8* %22, i32 0, i32 16)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i8* @inet_addr(i8* %26)
%28 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %8, i32 0, i32 1
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
store i8* %27, i8** %29
%30 = load i32, i32* @INADDR_ANY
%31 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %8, i32 0, i32 0
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %31, i32 0, i32 0
store i32 %30, i32* %32
%33 = bitcast %struct.sockaddr_in* %7 to i8*
%34 = call i32 @memset(i8* %33, i32 0, i32 16)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %35, i32* %36
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
%41 = call i32 @htons(i32 %40)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %41, i32* %42
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i8* @inet_addr(i8* %45)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%48 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %47, i32 0, i32 0
store i8* %46, i8** %48
store i32 16, i32* %10
br label %49
49: ; preds = %21
%50 = load i32, i32* @AF_INET
%51 = load i32, i32* @SOCK_DGRAM
%52 = call i32 @socket(i32 %50, i32 %51, i32 0)
store i32 %52, i32* %6
%53 = load i32, i32* %6
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %102
57: ; preds = %49
store i32 1, i32* %9
%58 = load i32, i32* %6
%59 = load i32, i32* @SOL_SOCKET
%60 = load i32, i32* @SO_REUSEADDR
%61 = bitcast i32* %9 to i8*
%62 = call i64 @setsockopt(i32 %58, i32 %59, i32 %60, i8* %61, i32 4)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %57
%65 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64, %57
%67 = load i32, i32* %6
%68 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%69 = call i64 @bind(i32 %67, %struct.sockaddr* %68, i32 16)
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %66
%72 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%73 = load i32, i32* %6
%74 = call i32 @close(i32 %73)
store i32 0, i32* %3
br label %102
75: ; preds = %66
%76 = load i32, i32* %6
%77 = load i32, i32* @IPPROTO_IP
%78 = load i32, i32* @IP_ADD_MEMBERSHIP
%79 = bitcast %struct.ip_mreq* %8 to i8*
%80 = call i64 @setsockopt(i32 %76, i32 %77, i32 %78, i8* %79, i32 16)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %75
%83 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%84 = load i32, i32* %6
%85 = call i32 @close(i32 %84)
store i32 0, i32* %3
br label %102
86: ; preds = %75
br label %87
87: ; preds = %86, %101
%88 = load i32, i32* %6
%89 = getelementptr inbounds [65535 x i8], [65535 x i8]* %12, i64 0, i64 0
%90 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%91 = call i32 @recvfrom(i32 %88, i8* %89, i32 65535, i32 0, %struct.sockaddr* %90, i32* %10)
store i32 %91, i32* %11
%92 = load i32, i32* %11
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %87
%95 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %101
96: ; preds = %87
%97 = load i32, i32* @STDOUT_FILENO
%98 = getelementptr inbounds [65535 x i8], [65535 x i8]* %12, i64 0, i64 0
%99 = load i32, i32* %11
%100 = call i32 @write(i32 %97, i8* %98, i32 %99)
br label %101
101: ; preds = %96, %94
br label %87
102: ; preds = %82, %71, %55, %15
%103 = load i32, i32* %3
ret i32 %103
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_6__, i32, i32 }
%struct.TYPE_6__ = type { i8* }
%struct.ip_mreq = type { %struct.TYPE_5__, %struct.TYPE_4__ }
%struct.TYPE_5__ = type { i32 }
%struct.TYPE_4__ = type { i8* }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s ip_addr port > output.ts\0A\00"
@INADDR_ANY = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [17 x i8] c"socket(): error \00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [34 x i8] c"setsockopt() SO_REUSEADDR: error \00"
@.str.3 = [14 x i8] c"bind(): error\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.4 = [32 x i8] c"setsockopt() IPPROTO_IP: error \00"
@.str.5 = [19 x i8] c"recvfrom(): error \00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.ip_mreq
%5 = alloca i32
%6 = alloca i32
%7 = alloca [65535 x i8]
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = bitcast %struct.ip_mreq* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = getelementptr inbounds [65535 x i8], [65535 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 3
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %74
18: ; preds = %2
%19 = call i32 @memset(i8* %9, i32 0, i32 16)
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i8* @inet_addr(i8* %21)
%23 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %4, i64 0, i32 1, i32 0
store i8* %22, i8** %23
%24 = load i32, i32* @INADDR_ANY
%25 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %4, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = call i32 @memset(i8* %8, i32 0, i32 16)
%27 = load i32, i32* @AF_INET
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %27, i32* %28
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = call i32 @htons(i32 %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %32, i32* %33
%34 = load i8*, i8** %20
%35 = call i8* @inet_addr(i8* %34)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i8* %35, i8** %36
store i32 16, i32* %6
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_DGRAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %18
%42 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %74
43: ; preds = %18
store i32 1, i32* %5
%44 = load i32, i32* @SOL_SOCKET
%45 = load i32, i32* @SO_REUSEADDR
%46 = call i64 @setsockopt(i32 %39, i32 %44, i32 %45, i8* %10, i32 4)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48, %43
%51 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%52 = call i64 @bind(i32 %39, %struct.sockaddr* %51, i32 16)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%56 = call i32 @close(i32 %39)
br label %74
57: ; preds = %50
%58 = load i32, i32* @IPPROTO_IP
%59 = load i32, i32* @IP_ADD_MEMBERSHIP
%60 = call i64 @setsockopt(i32 %39, i32 %58, i32 %59, i8* %9, i32 16)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @close(i32 %39)
br label %74
65: ; preds = %57, %73
%66 = call i32 @recvfrom(i32 %39, i8* %12, i32 65535, i32 0, %struct.sockaddr* %51, i32* %6)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %73
70: ; preds = %65
%71 = load i32, i32* @STDOUT_FILENO
%72 = call i32 @write(i32 %71, i8* %12, i32 %66)
br label %73
73: ; preds = %70, %68
br label %65
74: ; preds = %62, %54, %41, %14
ret i32 0
}