#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 sockaddr_ll {
  int /*<<< orphan*/ sll_family;
  int /*<<< orphan*/ sll_ifindex;
  int /*<<< orphan*/ sll_protocol;
};
struct sockaddr {
  int dummy;
};
struct packet_mreq {
  scalar_t__ mr_alen;
  int /*<<< orphan*/ mr_type;
  int /*<<< orphan*/ mr_ifindex;
};
struct ifreq {
  int /*<<< orphan*/ ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
};

/* Variables and functions */
int /*<<< orphan*/ AF_PACKET;
int /*<<< orphan*/ ETH_P_ALL;
int /*<<< orphan*/ IFNAMSIZ;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ PACKET_ADD_MEMBERSHIP;
int /*<<< orphan*/ PACKET_MR_ALLMULTI;
int /*<<< orphan*/ PF_PACKET;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOL_SOCKET;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int ioctl(int, int /*<<< orphan*/, struct ifreq *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
               struct packet_mreq *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *,
                          int /*<<< orphan*/);
int open_incoming_socket(char *dev_name) {
  int fd, retval;
  struct sockaddr_ll sock_addr;
  struct ifreq if_req;
  struct packet_mreq mc_req;
  fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
  if (fd == -1) {
    syslog(LOG_ERR,
           "can't open raw packet socket, "
           "interface %s will not be used: %s",
           dev_name, strerror(errno));
    return -1;
  }
  strncpy(if_req.ifr_name, dev_name, IFNAMSIZ);
  retval = ioctl(fd, SIOCGIFINDEX, &if_req);
  if (retval == -1) {
    syslog(LOG_ERR,
           "can't ioctl on raw packet socket, "
           "interface %s will not be used: %s",
           dev_name, strerror(errno));
    close(fd);
    return -1;
  }
  sock_addr.sll_protocol = htons(ETH_P_ALL);
  sock_addr.sll_ifindex = if_req.ifr_ifindex;
  sock_addr.sll_family = AF_PACKET;
  retval = bind(fd, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr_ll));
  if (retval == -1) {
    syslog(LOG_ERR,
           "can't bind packet raw packet socket to "
           "interface %s -- it will not be used: %s",
           dev_name, strerror(errno));
    close(fd);
    return -1;
  }
  mc_req.mr_ifindex = if_req.ifr_ifindex;
  mc_req.mr_type = PACKET_MR_ALLMULTI;
  mc_req.mr_alen = 0;
  retval = setsockopt(fd, SOL_SOCKET, PACKET_ADD_MEMBERSHIP, &mc_req,
                      sizeof(struct packet_mreq));
  if (retval == -1) {
    syslog(LOG_ERR,
           "can't set socket options to join all "
           "multicast groups -- multicast may not be "
           "forwarded from %s: %s",
           dev_name, strerror(errno));
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_incoming_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
call   1050 <htons@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    %eax,%edx
call   10b0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1222 <open_incoming_socket+0x92>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rdx
mov    %eax,%ecx
lea    0xdef(%rip),%rsi
call   1080 <syslog@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13be <open_incoming_socket+0x22e>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    -0x14(%rbp),%edi
mov    0x2d47(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1060 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    12a4 <open_incoming_socket+0x114>
mov    0x2d30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    %eax,%ecx
lea    0xdb5(%rip),%rsi
call   1080 <syslog@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13be <open_incoming_socket+0x22e>
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2cfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1330 <open_incoming_socket+0x1a0>
mov    0x2ca4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %eax,%ecx
lea    0xd6d(%rip),%rsi
call   1080 <syslog@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13be <open_incoming_socket+0x22e>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2c73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c8c(%rip),%rax
mov    (%rax),%esi
mov    0x2c43(%rip),%rax
mov    (%rax),%edx
lea    -0x40(%rbp),%rcx
mov    $0x10,%r8d
call   1040 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    13b8 <open_incoming_socket+0x228>
mov    0x2c0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %eax,%ecx
lea    0xd20(%rip),%rsi
call   1080 <syslog@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_incoming_socket>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
mov    0x2e4c(%rip),%rax
mov    (%rax),%ebp
mov    0x2e2b(%rip),%rax
mov    (%rax),%ebx
mov    0x2e12(%rip),%r15
mov    (%r15),%edi
call   1050 <htons@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   10b0 <socket@plt>
cmp    $0xffffffff,%eax
je     12b4 <open_incoming_socket+0x124>
mov    %eax,%ebp
mov    0x2ddd(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rsi
call   1030 <strncpy@plt>
mov    0x2d9c(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebp,%edi
call   1060 <ioctl@plt>
cmp    $0xffffffff,%eax
je     12e0 <open_incoming_socket+0x150>
mov    (%r15),%edi
call   1050 <htons@plt>
mov    %eax,0x10(%rsp)
mov    (%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1090 <bind@plt>
cmp    $0xffffffff,%eax
je     1300 <open_incoming_socket+0x170>
mov    (%rsp),%eax
mov    %eax,0x24(%rsp)
mov    0x2d67(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2d81(%rip),%rax
mov    (%rax),%esi
mov    0x2d38(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebp,%edi
mov    $0x10,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1336 <open_incoming_socket+0x1a6>
mov    0x2d04(%rip),%rax
mov    (%rax),%ebx
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xe30(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %eax,%ecx
call   1080 <syslog@plt>
jmp    1336 <open_incoming_socket+0x1a6>
mov    0x2cd5(%rip),%rax
mov    (%rax),%ebx
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd2e(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %eax,%ecx
call   1080 <syslog@plt>
jmp    1331 <open_incoming_socket+0x1a1>
mov    0x2ca9(%rip),%rax
mov    (%rax),%ebx
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd42(%rip),%rsi
jmp    131e <open_incoming_socket+0x18e>
mov    0x2c89(%rip),%rax
mov    (%rax),%ebx
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
lea    0xd66(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %eax,%ecx
call   1080 <syslog@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_ll = type { i32, i32, i32 }
%struct.ifreq = type { i32, i32 }
%struct.packet_mreq = type { i64, i32, i32 }
%struct.sockaddr = type { i32 }
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@ETH_P_ALL = global i32 0
@LOG_ERR = global i32 0
@.str = [64 x i8] c"can't open raw packet socket, interface %s will not be used: %s\00"
@errno = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFINDEX = global i32 0
@.str.1 = [68 x i8] c"can't ioctl on raw packet socket, interface %s will not be used: %s\00"
@AF_PACKET = global i32 0
@.str.2 = [79 x i8] c"can't bind packet raw packet socket to interface %s -- it will not be used: %s\00"
@PACKET_MR_ALLMULTI = global i32 0
@SOL_SOCKET = global i32 0
@PACKET_ADD_MEMBERSHIP = global i32 0
@.str.3 = [100 x i8] c"can't set socket options to join all multicast groups -- multicast may not be forwarded from %s: %s\00"
define i32 @open_incoming_socket(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_ll
%7 = alloca %struct.ifreq
%8 = alloca %struct.packet_mreq
store i8* %0, i8** %3
%9 = load i32, i32* @PF_PACKET
%10 = load i32, i32* @SOCK_RAW
%11 = load i32, i32* @ETH_P_ALL
%12 = call i32 @htons(i32 %11)
%13 = call i32 @socket(i32 %9, i32 %10, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %22
16: ; preds = %1
%17 = load i32, i32* @LOG_ERR
%18 = load i8*, i8** %3
%19 = load i32, i32* @errno
%20 = call i32 @strerror(i32 %19)
%21 = call i32 @syslog(i32 %17, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %20)
store i32 -1, i32* %2
br label %84
22: ; preds = %1
%23 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %7, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load i8*, i8** %3
%26 = load i32, i32* @IFNAMSIZ
%27 = call i32 @strncpy(i32 %24, i8* %25, i32 %26)
%28 = load i32, i32* %4
%29 = load i32, i32* @SIOCGIFINDEX
%30 = call i32 @ioctl(i32 %28, i32 %29, %struct.ifreq* %7)
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %41
33: ; preds = %22
%34 = load i32, i32* @LOG_ERR
%35 = load i8*, i8** %3
%36 = load i32, i32* @errno
%37 = call i32 @strerror(i32 %36)
%38 = call i32 @syslog(i32 %34, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), i8* %35, i32 %37)
%39 = load i32, i32* %4
%40 = call i32 @close(i32 %39)
store i32 -1, i32* %2
br label %84
41: ; preds = %22
%42 = load i32, i32* @ETH_P_ALL
%43 = call i32 @htons(i32 %42)
%44 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %6, i32 0, i32 2
store i32 %43, i32* %44
%45 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %7, i32 0, i32 0
%46 = load i32, i32* %45
%47 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %6, i32 0, i32 1
store i32 %46, i32* %47
%48 = load i32, i32* @AF_PACKET
%49 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %6, i32 0, i32 0
store i32 %48, i32* %49
%50 = load i32, i32* %4
%51 = bitcast %struct.sockaddr_ll* %6 to %struct.sockaddr*
%52 = call i32 @bind(i32 %50, %struct.sockaddr* %51, i32 12)
store i32 %52, i32* %5
%53 = load i32, i32* %5
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %63
55: ; preds = %41
%56 = load i32, i32* @LOG_ERR
%57 = load i8*, i8** %3
%58 = load i32, i32* @errno
%59 = call i32 @strerror(i32 %58)
%60 = call i32 @syslog(i32 %56, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0), i8* %57, i32 %59)
%61 = load i32, i32* %4
%62 = call i32 @close(i32 %61)
store i32 -1, i32* %2
br label %84
63: ; preds = %41
%64 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %7, i32 0, i32 0
%65 = load i32, i32* %64
%66 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %8, i32 0, i32 2
store i32 %65, i32* %66
%67 = load i32, i32* @PACKET_MR_ALLMULTI
%68 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %8, i32 0, i32 1
store i32 %67, i32* %68
%69 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %8, i32 0, i32 0
store i64 0, i64* %69
%70 = load i32, i32* %4
%71 = load i32, i32* @SOL_SOCKET
%72 = load i32, i32* @PACKET_ADD_MEMBERSHIP
%73 = call i32 @setsockopt(i32 %70, i32 %71, i32 %72, %struct.packet_mreq* %8, i32 16)
store i32 %73, i32* %5
%74 = load i32, i32* %5
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %82
76: ; preds = %63
%77 = load i32, i32* @LOG_ERR
%78 = load i8*, i8** %3
%79 = load i32, i32* @errno
%80 = call i32 @strerror(i32 %79)
%81 = call i32 @syslog(i32 %77, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0), i8* %78, i32 %80)
br label %82
82: ; preds = %76, %63
%83 = load i32, i32* %4
store i32 %83, i32* %2
br label %84
84: ; preds = %82, %55, %33, %16
%85 = load i32, i32* %2
ret i32 %85
}

LLVM IR (-O2):
%struct.sockaddr_ll = type { i32, i32, i32 }
%struct.ifreq = type { i32, i32 }
%struct.packet_mreq = type { i64, i32, i32 }
%struct.sockaddr = type { i32 }
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@ETH_P_ALL = global i32 0
@LOG_ERR = global i32 0
@.str = [64 x i8] c"can't open raw packet socket, interface %s will not be used: %s\00"
@errno = global i32 0
@IFNAMSIZ = global i32 0
@SIOCGIFINDEX = global i32 0
@.str.1 = [68 x i8] c"can't ioctl on raw packet socket, interface %s will not be used: %s\00"
@AF_PACKET = global i32 0
@.str.2 = [79 x i8] c"can't bind packet raw packet socket to interface %s -- it will not be used: %s\00"
@PACKET_MR_ALLMULTI = global i32 0
@SOL_SOCKET = global i32 0
@PACKET_ADD_MEMBERSHIP = global i32 0
@.str.3 = [100 x i8] c"can't set socket options to join all multicast groups -- multicast may not be forwarded from %s: %s\00"
define i32 @open_incoming_socket(i8* %0) {
%2 = alloca %struct.sockaddr_ll
%3 = alloca %struct.ifreq
%4 = alloca %struct.packet_mreq
%5 = bitcast %struct.sockaddr_ll* %2 to i8*
%6 = bitcast %struct.ifreq* %3 to i8*
%7 = bitcast %struct.packet_mreq* %4 to i8*
%8 = load i32, i32* @PF_PACKET
%9 = load i32, i32* @SOCK_RAW
%10 = load i32, i32* @ETH_P_ALL
%11 = tail call i32 @htons(i32 %10)
%12 = tail call i32 @socket(i32 %8, i32 %9, i32 %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load i32, i32* @LOG_ERR
%16 = load i32, i32* @errno
%17 = tail call i32 @strerror(i32 %16)
%18 = tail call i32 @syslog(i32 %15, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %17)
br label %64
19: ; preds = %1
%20 = load i32, i32* @IFNAMSIZ
%21 = tail call i32 @strncpy(i32 undef, i8* %0, i32 %20)
%22 = load i32, i32* @SIOCGIFINDEX
%23 = call i32 @ioctl(i32 %12, i32 %22, %struct.ifreq* %3)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %31
25: ; preds = %19
%26 = load i32, i32* @LOG_ERR
%27 = load i32, i32* @errno
%28 = call i32 @strerror(i32 %27)
%29 = call i32 @syslog(i32 %26, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %28)
%30 = call i32 @close(i32 %12)
br label %64
31: ; preds = %19
%32 = load i32, i32* @ETH_P_ALL
%33 = call i32 @htons(i32 %32)
%34 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %2, i64 0, i32 2
store i32 %33, i32* %34
%35 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %2, i64 0, i32 1
store i32 %36, i32* %37
%38 = load i32, i32* @AF_PACKET
%39 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %2, i64 0, i32 0
store i32 %38, i32* %39
%40 = bitcast %struct.sockaddr_ll* %2 to %struct.sockaddr*
%41 = call i32 @bind(i32 %12, %struct.sockaddr* %40, i32 12)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %49
43: ; preds = %31
%44 = load i32, i32* @LOG_ERR
%45 = load i32, i32* @errno
%46 = call i32 @strerror(i32 %45)
%47 = call i32 @syslog(i32 %44, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %46)
%48 = call i32 @close(i32 %12)
br label %64
49: ; preds = %31
%50 = load i32, i32* %35
%51 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %4, i64 0, i32 2
store i32 %50, i32* %51
%52 = load i32, i32* @PACKET_MR_ALLMULTI
%53 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %4, i64 0, i32 1
store i32 %52, i32* %53
%54 = getelementptr inbounds %struct.packet_mreq, %struct.packet_mreq* %4, i64 0, i32 0
store i64 0, i64* %54
%55 = load i32, i32* @SOL_SOCKET
%56 = load i32, i32* @PACKET_ADD_MEMBERSHIP
%57 = call i32 @setsockopt(i32 %12, i32 %55, i32 %56, %struct.packet_mreq* %4, i32 16)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %64
59: ; preds = %49
%60 = load i32, i32* @LOG_ERR
%61 = load i32, i32* @errno
%62 = call i32 @strerror(i32 %61)
%63 = call i32 @syslog(i32 %60, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 %62)
br label %64
64: ; preds = %49, %59, %43, %25, %14
%65 = phi i32 [ -1, %14 ], [ -1, %25 ], [ -1, %43 ], [ %12, %59 ], [ %12, %49 ]
ret i32 %65
}