#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 */
typedef int /*<<< orphan*/ mcgroup;

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ NETLINK_ADD_MEMBERSHIP;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ setsockopt(int, int, int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *, int,
                          int /*<<< orphan*/);
void join_multicast(int fd, int mcgroup) {
  if (setsockopt(fd, 270, NETLINK_ADD_MEMBERSHIP, &mcgroup, sizeof(mcgroup)) <
      0) {
    do {
      syslog(LOG_ERR,
             "%s(%d): "
             "%s",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Ongy/ip-notify/refs/heads/master/src/"
             "ip-notify.c",
             62, strerror(errno));
      exit(-1);
    } while (0);
  }
}


x86 assembly (clang, -O0):
<join_multicast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
mov    $0x10e,%esi
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    11bf <join_multicast+0x7f>
jmp    117d <join_multicast+0x3d>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%r8d
lea    0xe5c(%rip),%rsi
lea    0xe60(%rip),%rdx
mov    $0x3e,%ecx
call   1040 <syslog@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<join_multicast>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,0xc(%rsp)
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    $0x10e,%esi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     1172 <join_multicast+0x32>
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e4f(%rip),%rax
mov    (%rax),%ebx
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe70(%rip),%rsi
lea    0xe74(%rip),%rdx
mov    %ebx,%edi
mov    $0x3e,%ecx
mov    %eax,%r8d
call   1040 <syslog@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@NETLINK_ADD_MEMBERSHIP = global i32 0
@LOG_ERR = global i32 0
@.str = [11 x i8] c"%s(%d): %s\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Ongy/ip-notify/refs/heads/master/src/ip-notify.c\00"
@errno = global i32 0
define void @join_multicast(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @NETLINK_ADD_MEMBERSHIP
%7 = call i64 @setsockopt(i32 %5, i32 270, i32 %6, i32* %4, i32 4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
br label %10
10: ; preds = %9
%11 = load i32, i32* @LOG_ERR
%12 = load i32, i32* @errno
%13 = call i32 @strerror(i32 %12)
%14 = call i32 @syslog(i32 %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %13)
%15 = call i32 @exit(i32 -1)
unreachable
16: ; No predecessors!
br label %17
17: ; preds = %16, %2
ret void
}

LLVM IR (-O2):
@NETLINK_ADD_MEMBERSHIP = global i32 0
@LOG_ERR = global i32 0
@.str = [11 x i8] c"%s(%d): %s\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Ongy/ip-notify/refs/heads/master/src/ip-notify.c\00"
@errno = global i32 0
define void @join_multicast(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @NETLINK_ADD_MEMBERSHIP
%5 = call i64 @setsockopt(i32 %0, i32 270, i32 %4, i32* %3, i32 4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @LOG_ERR
%9 = load i32, i32* @errno
%10 = call i32 @strerror(i32 %9)
%11 = call i32 @syslog(i32 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %10)
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
ret void
}