#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_nl {
  int nlmsg_len;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  void *msg_name;
  scalar_t__ nlmsg_flags;
  void *nlmsg_pid;
  scalar_t__ nl_groups;
  void *nl_pid;
  void *nl_family;
};
struct sockaddr {
  int dummy;
};
struct nlmsghdr {
  int nlmsg_len;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  void *msg_name;
  scalar_t__ nlmsg_flags;
  void *nlmsg_pid;
  scalar_t__ nl_groups;
  void *nl_pid;
  void *nl_family;
};
struct msghdr {
  int nlmsg_len;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  void *msg_name;
  scalar_t__ nlmsg_flags;
  void *nlmsg_pid;
  scalar_t__ nl_groups;
  void *nl_pid;
  void *nl_family;
};
struct iovec {
  int iov_len;
  void *iov_base;
};
typedef int /*<<< orphan*/ src_addr;
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ dest_addr;

/* Variables and functions */
void *AF_NETLINK;
scalar_t__ NLMSG_DATA(struct sockaddr_nl *);
int NLMSG_SPACE(int);
int /*<<< orphan*/ SOCK_RAW;
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
void *getpid();
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(struct sockaddr_nl *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int recvmsg(int, struct sockaddr_nl *, int /*<<< orphan*/);
int sendmsg(int, struct sockaddr_nl *, int /*<<< orphan*/);
int socket(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcpy(scalar_t__, char *);
int main(int argc, char **argv) {
  struct sockaddr_nl src_addr;
  struct sockaddr_nl dest_addr;
  struct nlmsghdr *nlh = NULL;
  struct iovec iov;
  int sock_fd, ret;
  struct msghdr msg;
  sock_fd = socket(AF_NETLINK, SOCK_RAW, 17);
  if (sock_fd == -1) {
    perror("socket failed\n");
    return 1;
  }
  memset(&msg, 0, sizeof(msg));
  memset(&src_addr, 0, sizeof(src_addr));
  src_addr.nl_family = AF_NETLINK;
  src_addr.nl_pid = getpid();
  src_addr.nl_groups = 0;
  ret = bind(sock_fd, (struct sockaddr *)&src_addr, sizeof(src_addr));
  if (ret == -1) {
    perror("bind failed\n");
    return 1;
  }
  memset(&dest_addr, 0, sizeof(dest_addr));
  dest_addr.nl_family = AF_NETLINK;
  dest_addr.nl_pid = 0;
  dest_addr.nl_groups = 0;
  nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(1024));
  nlh->nlmsg_len = NLMSG_SPACE(1024);
  nlh->nlmsg_pid = getpid();
  nlh->nlmsg_flags = 0;
  strcpy(NLMSG_DATA(nlh), "hello nl");
  iov.iov_base = (void *)nlh;
  iov.iov_len = nlh->nlmsg_len;
  msg.msg_name = (void *)&dest_addr;
  msg.msg_namelen = sizeof(dest_addr);
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  ret = sendmsg(sock_fd, &msg, 0);
  if (ret == -1) {
    perror("sendmsg failed\n");
    return 1;
  }
  memset(nlh, 0, NLMSG_SPACE(1024));
  ret = recvmsg(sock_fd, &msg, 0);
  if (ret == -1) {
    perror("recvmsg failed\n");
    return 1;
  }
  printf("received message: %s\n", (char *)NLMSG_DATA(nlh));
  close(sock_fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0xa8(%rbp)
mov    0x2de5(%rip),%rax
mov    (%rax),%rdi
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
mov    $0x11,%edx
call   10f0 <socket@plt>
mov    %eax,-0xbc(%rbp)
cmpl   $0xffffffff,-0xbc(%rbp)
jne    123c <main+0x6c>
lea    0xdd5(%rip),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x2a5>
lea    -0x108(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0xbc(%rbp),%edi
lea    -0x58(%rbp),%rsi
mov    $0x48,%edx
call   10d0 <bind@plt>
mov    %eax,-0xc0(%rbp)
cmpl   $0xffffffff,-0xc0(%rbp)
jne    12bf <main+0xef>
lea    0xd61(%rip),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x2a5>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0xa8(%rbp)
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
mov    %eax,%ecx
mov    -0xa8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %rax,%rcx
mov    -0xa8(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0xa8(%rbp),%rax
movq   $0x0,0x20(%rax)
mov    -0xa8(%rbp),%rdi
call   10a0 <NLMSG_DATA@plt>
mov    %rax,%rdi
lea    0xcc5(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0xa8(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0xa8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xb8(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
movl   $0x48,-0x104(%rbp)
lea    -0xb8(%rbp),%rax
mov    %rax,-0xf8(%rbp)
movl   $0x1,-0x100(%rbp)
mov    -0xbc(%rbp),%edi
lea    -0x108(%rbp),%rsi
xor    %edx,%edx
call   1040 <sendmsg@plt>
mov    %eax,-0xc0(%rbp)
cmpl   $0xffffffff,-0xc0(%rbp)
jne    13e8 <main+0x218>
lea    0xc4e(%rip),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x2a5>
mov    -0xa8(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
mov    -0x110(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0xbc(%rbp),%edi
lea    -0x108(%rbp),%rsi
xor    %edx,%edx
call   10c0 <recvmsg@plt>
mov    %eax,-0xc0(%rbp)
cmpl   $0xffffffff,-0xc0(%rbp)
jne    144f <main+0x27f>
lea    0xbf7(%rip),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x2a5>
mov    -0xa8(%rbp),%rdi
call   10a0 <NLMSG_DATA@plt>
mov    %rax,%rsi
lea    0xbe0(%rip),%rdi
call   1060 <printf@plt>
mov    -0xbc(%rbp),%edi
call   1080 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xe8,%rsp
mov    0x2dfc(%rip),%r15
mov    (%r15),%rdi
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    $0x11,%edx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     1364 <main+0x194>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
lea    0x58(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
mov    (%r15),%rax
mov    %rax,0x98(%rsp)
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %rax,0x90(%rsp)
movq   $0x0,0x88(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x48,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
je     136d <main+0x19d>
lea    0xa0(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
mov    (%r15),%rax
mov    %rax,0xe0(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0xd0(%rsp)
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %rax,0x28(%rbx)
movq   $0x0,0x20(%rbx)
mov    %rbx,%rdi
call   10a0 <NLMSG_DATA@plt>
lea    0xd45(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,0x8(%rsp)
mov    (%rbx),%eax
mov    %eax,(%rsp)
mov    %r14,0x28(%rsp)
movabs $0x100000048,%rax
mov    %rax,0x14(%rsp)
mov    %rsp,%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
xor    %edx,%edx
call   1040 <sendmsg@plt>
cmp    $0xffffffff,%eax
je     1376 <main+0x1a6>
mov    $0x400,%edi
call   1090 <NLMSG_SPACE@plt>
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <memset@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
xor    %edx,%edx
call   10c0 <recvmsg@plt>
cmp    $0xffffffff,%eax
je     137f <main+0x1af>
mov    %rbx,%rdi
call   10a0 <NLMSG_DATA@plt>
lea    0xcf2(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1080 <close@plt>
jmp    1391 <main+0x1c1>
lea    0xc95(%rip),%rdi
jmp    1386 <main+0x1b6>
lea    0xc9b(%rip),%rdi
jmp    1386 <main+0x1b6>
lea    0xca8(%rip),%rdi
jmp    1386 <main+0x1b6>
lea    0xcaf(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_nl = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.iovec = type { i32, i8* }
%struct.nlmsghdr = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.msghdr = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.sockaddr = type { i32 }
@AF_NETLINK = global i8* null
@SOCK_RAW = global i32 0
@.str = [15 x i8] c"socket failed\0A\00"
@.str.1 = [13 x i8] c"bind failed\0A\00"
@.str.2 = [9 x i8] c"hello nl\00"
@.str.3 = [16 x i8] c"sendmsg failed\0A\00"
@.str.4 = [16 x i8] c"recvmsg failed\0A\00"
@.str.5 = [22 x i8] c"received message: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_nl
%7 = alloca %struct.sockaddr_nl
%8 = alloca %struct.nlmsghdr*
%9 = alloca %struct.iovec
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.msghdr
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.nlmsghdr* null, %struct.nlmsghdr** %8
%13 = load i8*, i8** @AF_NETLINK
%14 = load i32, i32* @SOCK_RAW
%15 = call i32 @socket(i8* %13, i32 %14, i32 17)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %96
20: ; preds = %2
%21 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%22 = call i32 @memset(%struct.sockaddr_nl* %21, i32 0, i32 72)
%23 = call i32 @memset(%struct.sockaddr_nl* %6, i32 0, i32 72)
%24 = load i8*, i8** @AF_NETLINK
%25 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %6, i32 0, i32 9
store i8* %24, i8** %25
%26 = call i8* (...) @getpid()
%27 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %6, i32 0, i32 8
store i8* %26, i8** %27
%28 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %6, i32 0, i32 7
store i64 0, i64* %28
%29 = load i32, i32* %10
%30 = bitcast %struct.sockaddr_nl* %6 to %struct.sockaddr*
%31 = call i32 @bind(i32 %29, %struct.sockaddr* %30, i32 72)
store i32 %31, i32* %11
%32 = load i32, i32* %11
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %36
34: ; preds = %20
%35 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %96
36: ; preds = %20
%37 = call i32 @memset(%struct.sockaddr_nl* %7, i32 0, i32 72)
%38 = load i8*, i8** @AF_NETLINK
%39 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %7, i32 0, i32 9
store i8* %38, i8** %39
%40 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %7, i32 0, i32 8
store i8* null, i8** %40
%41 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %7, i32 0, i32 7
store i64 0, i64* %41
%42 = call i32 @NLMSG_SPACE(i32 1024)
%43 = call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to %struct.nlmsghdr*
store %struct.nlmsghdr* %44, %struct.nlmsghdr** %8
%45 = call i32 @NLMSG_SPACE(i32 1024)
%46 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%47 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %46, i32 0, i32 0
store i32 %45, i32* %47
%48 = call i8* (...) @getpid()
%49 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%50 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %49, i32 0, i32 6
store i8* %48, i8** %50
%51 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%52 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %51, i32 0, i32 5
store i64 0, i64* %52
%53 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%54 = bitcast %struct.nlmsghdr* %53 to %struct.sockaddr_nl*
%55 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %54)
%56 = call i32 @strcpy(i64 %55, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%57 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%58 = bitcast %struct.nlmsghdr* %57 to i8*
%59 = getelementptr inbounds %struct.iovec, %struct.iovec* %9, i32 0, i32 1
store i8* %58, i8** %59
%60 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%61 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %60, i32 0, i32 0
%62 = load i32, i32* %61
%63 = getelementptr inbounds %struct.iovec, %struct.iovec* %9, i32 0, i32 0
store i32 %62, i32* %63
%64 = bitcast %struct.sockaddr_nl* %7 to i8*
%65 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 4
store i8* %64, i8** %65
%66 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 1
store i32 72, i32* %66
%67 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 3
store %struct.iovec* %9, %struct.iovec** %67
%68 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 2
store i32 1, i32* %68
%69 = load i32, i32* %10
%70 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%71 = call i32 @sendmsg(i32 %69, %struct.sockaddr_nl* %70, i32 0)
store i32 %71, i32* %11
%72 = load i32, i32* %11
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %76
74: ; preds = %36
%75 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %96
76: ; preds = %36
%77 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%78 = bitcast %struct.nlmsghdr* %77 to %struct.sockaddr_nl*
%79 = call i32 @NLMSG_SPACE(i32 1024)
%80 = call i32 @memset(%struct.sockaddr_nl* %78, i32 0, i32 %79)
%81 = load i32, i32* %10
%82 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%83 = call i32 @recvmsg(i32 %81, %struct.sockaddr_nl* %82, i32 0)
store i32 %83, i32* %11
%84 = load i32, i32* %11
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %88
86: ; preds = %76
%87 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %96
88: ; preds = %76
%89 = load %struct.nlmsghdr*, %struct.nlmsghdr** %8
%90 = bitcast %struct.nlmsghdr* %89 to %struct.sockaddr_nl*
%91 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %90)
%92 = inttoptr i64 %91 to i8*
%93 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %92)
%94 = load i32, i32* %10
%95 = call i32 @close(i32 %94)
br label %96
96: ; preds = %88, %86, %74, %34, %18
%97 = load i32, i32* %3
ret i32 %97
}

LLVM IR (-O2):
%struct.sockaddr_nl = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.iovec = type { i32, i8* }
%struct.msghdr = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.nlmsghdr = type { i32, i32, i32, %struct.iovec*, i8*, i64, i8*, i64, i8*, i8* }
%struct.sockaddr = type { i32 }
@AF_NETLINK = global i8* null
@SOCK_RAW = global i32 0
@.str = [15 x i8] c"socket failed\0A\00"
@.str.1 = [13 x i8] c"bind failed\0A\00"
@.str.2 = [9 x i8] c"hello nl\00"
@.str.3 = [16 x i8] c"sendmsg failed\0A\00"
@.str.4 = [16 x i8] c"recvmsg failed\0A\00"
@.str.5 = [22 x i8] c"received message: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_nl
%4 = alloca %struct.sockaddr_nl
%5 = alloca %struct.iovec
%6 = alloca %struct.msghdr
%7 = bitcast %struct.sockaddr_nl* %3 to i8*
%8 = bitcast %struct.sockaddr_nl* %4 to i8*
%9 = bitcast %struct.iovec* %5 to i8*
%10 = bitcast %struct.msghdr* %6 to i8*
%11 = load i8*, i8** @AF_NETLINK
%12 = load i32, i32* @SOCK_RAW
%13 = tail call i32 @socket(i8* %11, i32 %12, i32 17)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %73
17: ; preds = %2
%18 = bitcast %struct.msghdr* %6 to %struct.sockaddr_nl*
%19 = call i32 @memset(%struct.sockaddr_nl* %18, i32 0, i32 72)
%20 = call i32 @memset(%struct.sockaddr_nl* %3, i32 0, i32 72)
%21 = load i8*, i8** @AF_NETLINK
%22 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %3, i64 0, i32 9
store i8* %21, i8** %22
%23 = call i8* (...) @getpid()
%24 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %3, i64 0, i32 8
store i8* %23, i8** %24
%25 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %3, i64 0, i32 7
store i64 0, i64* %25
%26 = bitcast %struct.sockaddr_nl* %3 to %struct.sockaddr*
%27 = call i32 @bind(i32 %13, %struct.sockaddr* %26, i32 72)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %17
%30 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %73
31: ; preds = %17
%32 = call i32 @memset(%struct.sockaddr_nl* %4, i32 0, i32 72)
%33 = load i8*, i8** @AF_NETLINK
%34 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %4, i64 0, i32 9
store i8* %33, i8** %34
%35 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %4, i64 0, i32 7
%36 = bitcast i64* %35 to i8*
%37 = call i32 @NLMSG_SPACE(i32 1024)
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to %struct.nlmsghdr*
%40 = call i32 @NLMSG_SPACE(i32 1024)
%41 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %39, i64 0, i32 0
store i32 %40, i32* %41
%42 = call i8* (...) @getpid()
%43 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %39, i64 0, i32 6
store i8* %42, i8** %43
%44 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %39, i64 0, i32 5
store i64 0, i64* %44
%45 = inttoptr i64 %38 to %struct.sockaddr_nl*
%46 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %45)
%47 = call i32 @strcpy(i64 %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%48 = inttoptr i64 %38 to i8*
%49 = getelementptr inbounds %struct.iovec, %struct.iovec* %5, i64 0, i32 1
store i8* %48, i8** %49
%50 = load i32, i32* %41
%51 = getelementptr inbounds %struct.iovec, %struct.iovec* %5, i64 0, i32 0
store i32 %50, i32* %51
%52 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 4
%53 = bitcast i8** %52 to %struct.sockaddr_nl**
store %struct.sockaddr_nl* %4, %struct.sockaddr_nl** %53
%54 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 1
store i32 72, i32* %54
%55 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 3
store %struct.iovec* %5, %struct.iovec** %55
%56 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 2
store i32 1, i32* %56
%57 = call i32 @sendmsg(i32 %13, %struct.sockaddr_nl* %18, i32 0)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %61
59: ; preds = %31
%60 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %73
61: ; preds = %31
%62 = call i32 @NLMSG_SPACE(i32 1024)
%63 = call i32 @memset(%struct.sockaddr_nl* %45, i32 0, i32 %62)
%64 = call i32 @recvmsg(i32 %13, %struct.sockaddr_nl* %18, i32 0)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %68
66: ; preds = %61
%67 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %73
68: ; preds = %61
%69 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %45)
%70 = inttoptr i64 %69 to i8*
%71 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %70)
%72 = call i32 @close(i32 %13)
br label %73
73: ; preds = %68, %66, %59, %29, %15
%74 = phi i32 [ 1, %15 ], [ 1, %29 ], [ 1, %59 ], [ 1, %66 ], [ 0, %68 ]
ret i32 %74
}