#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;
  scalar_t__ nlmsg_type;
  int nlmsg_flags;
  int member_1;
  int member_3;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  struct sockaddr_nl *msg_name;
  int /*<<< orphan*/ member_6;
  int /*<<< orphan*/ member_5;
  int /*<<< orphan*/ *member_4;
  struct iovec *member_2;
  struct sockaddr_nl *member_0;
  int /*<<< orphan*/ nlmsg_seq;
  int /*<<< orphan*/ nl_family;
};
struct rtattr {
  int rta_type;
  size_t rta_len;
};
struct nlmsghdr {
  int nlmsg_len;
  scalar_t__ nlmsg_type;
  int nlmsg_flags;
  int member_1;
  int member_3;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  struct nlmsghdr *msg_name;
  int /*<<< orphan*/ member_6;
  int /*<<< orphan*/ member_5;
  int /*<<< orphan*/ *member_4;
  struct iovec *member_2;
  struct nlmsghdr *member_0;
  int /*<<< orphan*/ nlmsg_seq;
  int /*<<< orphan*/ nl_family;
};
struct nlmsgerr {
  scalar_t__ error;
};
struct msghdr {
  int nlmsg_len;
  scalar_t__ nlmsg_type;
  int nlmsg_flags;
  int member_1;
  int member_3;
  int msg_namelen;
  int msg_iovlen;
  struct iovec *msg_iov;
  struct msghdr *msg_name;
  int /*<<< orphan*/ member_6;
  int /*<<< orphan*/ member_5;
  int /*<<< orphan*/ *member_4;
  struct iovec *member_2;
  struct msghdr *member_0;
  int /*<<< orphan*/ nlmsg_seq;
  int /*<<< orphan*/ nl_family;
};
struct iovec {
  int member_1;
  char *iov_base;
  int iov_len;
  struct sockaddr_nl *member_0;
};
struct ifinfomsg {
  int /*<<< orphan*/ ifi_family;
};
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ AF_NETLINK;
int /*<<< orphan*/ AF_UNSPEC;
void *IFLA_IFNAME;
int IFLA_INFO_DATA;
int IFLA_INFO_KIND;
int IFLA_LINKINFO;
int /*<<< orphan*/ NETLINK_ROUTE;
int NLMSG_ALIGN(int);
scalar_t__ NLMSG_DATA(struct sockaddr_nl *);
scalar_t__ NLMSG_ERROR;
int NLMSG_LENGTH(int);
int NLM_F_ACK;
int NLM_F_CREATE;
int NLM_F_EXCL;
int NLM_F_REQUEST;
int RTA_ALIGN(size_t);
int /*<<< orphan*/ RTA_DATA(struct rtattr *);
size_t RTA_LENGTH(scalar_t__);
scalar_t__ RTM_NEWLINK;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct sockaddr_nl *malloc(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, char *, scalar_t__);
int /*<<< orphan*/ memset(struct sockaddr_nl *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recvmsg(int, struct sockaddr_nl *, int /*<<< orphan*/);
scalar_t__ sendmsg(int, struct sockaddr_nl *, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
scalar_t__ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int fd = 0;
  if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) < 0) {
    fprintf(stderr, "failed to get socket: %s\n", strerror(errno));
    exit(1);
  }
  struct sockaddr_nl *sa = malloc(sizeof(struct sockaddr_nl));
  memset(sa, 0, sizeof(struct sockaddr_nl));
  sa->nl_family = AF_NETLINK;
  struct nlmsghdr *nlmsg = malloc(4096);
  memset(nlmsg, 0, 4096);
  nlmsg->nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
  nlmsg->nlmsg_type = RTM_NEWLINK;
  nlmsg->nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL | NLM_F_ACK;
  nlmsg->nlmsg_seq = time(NULL);
  struct ifinfomsg *ifmsg;
  ifmsg = (struct ifinfomsg *)NLMSG_DATA(nlmsg);
  ifmsg->ifi_family = AF_UNSPEC;
  struct rtattr *rta, *nest1, *nest2, *nest3;
  size_t rtalen;
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rtalen = RTA_LENGTH(strlen("veth1") + 1);
  rta->rta_type = IFLA_IFNAME;
  rta->rta_len = rtalen;
  memcpy(RTA_DATA(rta), "veth1", strlen("veth1") + 1);
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  nest1 =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rtalen = RTA_LENGTH(0);
  rta->rta_type = IFLA_LINKINFO;
  rta->rta_len = rtalen;
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rtalen = RTA_LENGTH(strlen("veth") + 1);
  rta->rta_type = IFLA_INFO_KIND;
  rta->rta_len = rtalen;
  memcpy(RTA_DATA(rta), "veth", strlen("veth") + 1);
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  nest2 =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rta->rta_type = IFLA_INFO_DATA;
  rtalen = RTA_LENGTH(0);
  rta->rta_len = rtalen;
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  nest3 =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rta->rta_type = 1;
  rtalen = RTA_LENGTH(0);
  rta->rta_len = rtalen;
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  nlmsg->nlmsg_len += sizeof(struct ifinfomsg);
  rta =
      ((struct rtattr *)(((void *)(nlmsg)) + NLMSG_ALIGN((nlmsg)->nlmsg_len)));
  rtalen = RTA_LENGTH(strlen("vpeer1") + 1);
  rta->rta_type = IFLA_IFNAME;
  rta->rta_len = rtalen;
  memcpy(RTA_DATA(rta), "vpeer1", strlen("vpeer1") + 1);
  nlmsg->nlmsg_len = NLMSG_ALIGN(nlmsg->nlmsg_len) + RTA_ALIGN(rtalen);
  nest3->rta_len =
      (void *)((struct rtattr *)(((void *)(nlmsg)) +
                                 NLMSG_ALIGN((nlmsg)->nlmsg_len))) -
      (void *)nest3;
  nest2->rta_len =
      (void *)((struct rtattr *)(((void *)(nlmsg)) +
                                 NLMSG_ALIGN((nlmsg)->nlmsg_len))) -
      (void *)nest2;
  nest1->rta_len =
      (void *)((struct rtattr *)(((void *)(nlmsg)) +
                                 NLMSG_ALIGN((nlmsg)->nlmsg_len))) -
      (void *)nest1;
  struct iovec iov = {nlmsg, nlmsg->nlmsg_len};
  struct msghdr msg = {sa, sizeof(*sa), &iov, 1, NULL, 0, 0};
  if (sendmsg(fd, &msg, 0) < 0) {
    fprintf(stderr, "failed to get socket: %s\n", strerror(errno));
    exit(1);
  }
  int len = 4096;
  char buf[len];
  iov.iov_base = buf;
  iov.iov_len = len;
  memset(&msg, 0, sizeof(msg));
  msg.msg_name = sa;
  msg.msg_namelen = sizeof(*sa);
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  recvmsg(fd, &msg, 0);
  close(fd);
  struct nlmsghdr *ret = (struct nlmsghdr *)buf;
  if (ret->nlmsg_type == NLMSG_ERROR) {
    struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(ret);
    if (err->error < 0) {
      printf("error: %d\n, failed to create links\n", err->error);
      return 1;
    }
  } else {
    printf("failed to create links\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
mov    0x2d06(%rip),%rax
mov    (%rax),%edx
call   1150 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    12b1 <main+0x81>
mov    0x2d0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf8(%rbp)
mov    0x2ced(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    -0xf8(%rbp),%edi
mov    %rax,%rdx
lea    0xd5e(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    $0x60,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1090 <memset@plt>
mov    0x2cd2(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x5c(%rax)
mov    $0x1000,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1090 <memset@plt>
mov    $0x4,%edi
call   1050 <NLMSG_LENGTH@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2c6a(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2c98(%rip),%rax
mov    (%rax),%ecx
mov    0x2caf(%rip),%rax
or     (%rax),%ecx
mov    0x2c56(%rip),%rax
or     (%rax),%ecx
mov    0x2c6d(%rip),%rax
or     (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x10(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x58(%rax)
mov    -0x18(%rbp),%rdi
call   10e0 <NLMSG_DATA@plt>
mov    %rax,-0x20(%rbp)
mov    0x2c5e(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x188(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x188(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xc70(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    0x2bf2(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rdi
call   1110 <RTA_DATA@plt>
mov    %eax,-0x180(%rbp)
lea    0xc27(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x180(%rbp),%edi
mov    %rax,%rdx
add    $0x1,%rdx
lea    0xc0e(%rip),%rsi
call   10c0 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x17c(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x17c(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x178(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x170(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    0x2af9(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x164(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x164(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x160(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xb15(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    0x2ac9(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rdi
call   1110 <RTA_DATA@plt>
mov    %eax,-0x158(%rbp)
lea    0xacf(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x158(%rbp),%edi
mov    %rax,%rdx
add    $0x1,%rdx
lea    0xab6(%rip),%rsi
call   10c0 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x154(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x154(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x150(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x150(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x148(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    0x2970(%rip),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x13c(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x13c(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x138(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x130(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x124(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x124(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movslq (%rax),%rcx
add    $0x4,%rcx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0x912(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1130 <RTA_LENGTH@plt>
mov    %rax,-0x48(%rbp)
mov    0x2889(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rdi
call   1110 <RTA_DATA@plt>
mov    %eax,-0x118(%rbp)
lea    0x8c9(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x118(%rbp),%edi
mov    %rax,%rdx
add    $0x1,%rdx
lea    0x8b0(%rip),%rsi
call   10c0 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,-0x114(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <RTA_ALIGN@plt>
mov    -0x114(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    -0x110(%rbp),%rcx
cltq
add    %rax,%rcx
mov    -0x40(%rbp),%rax
sub    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    -0x108(%rbp),%rcx
cltq
add    %rax,%rcx
mov    -0x38(%rbp),%rax
sub    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    -0x100(%rbp),%rcx
cltq
add    %rax,%rcx
mov    -0x30(%rbp),%rax
sub    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x58(%rbp)
movq   $0x0,-0x50(%rbp)
lea    -0xc8(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1090 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %eax,-0xc8(%rbp)
movq   $0x60,-0xc0(%rbp)
lea    -0x68(%rbp),%rax
mov    %eax,-0xb8(%rbp)
movl   $0x1,-0xb4(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc8(%rbp),%rsi
xor    %edx,%edx
call   1040 <sendmsg@plt>
cmp    $0x0,%rax
jge    18e9 <main+0x6b9>
mov    0x26d4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18c(%rbp)
mov    0x26b5(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
mov    -0x18c(%rbp),%edi
mov    %rax,%rdx
lea    0x726(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movl   $0x1000,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0xd8(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x198(%rbp)
mov    %rax,%rsp
mov    %rcx,-0xe0(%rbp)
mov    %rax,-0x60(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,-0x58(%rbp)
lea    -0xc8(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1090 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x60,-0xac(%rbp)
lea    -0x68(%rbp),%rax
mov    %rax,-0xa0(%rbp)
movl   $0x1,-0xa8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc8(%rbp),%rsi
xor    %edx,%edx
call   1100 <recvmsg@plt>
mov    -0x8(%rbp),%edi
call   10a0 <close@plt>
mov    -0x198(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x261e(%rip),%rcx
cmp    (%rcx),%rax
jne    1a0a <main+0x7da>
mov    -0xe8(%rbp),%rdi
call   10e0 <NLMSG_DATA@plt>
mov    %rax,-0xf0(%rbp)
mov    -0xf0(%rbp),%rax
cmpq   $0x0,(%rax)
jge    1a05 <main+0x7d5>
mov    -0xf0(%rbp),%rax
mov    (%rax),%rsi
lea    0x644(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xf4(%rbp)
jmp    1a3f <main+0x80f>
jmp    1a2e <main+0x7fe>
lea    0x627(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0xf4(%rbp)
jmp    1a3f <main+0x80f>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xf4(%rbp)
mov    -0xd8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    0x2d5d(%rip),%r14
mov    (%r14),%edi
mov    0x2d83(%rip),%rax
mov    (%rax),%esi
mov    0x2d0a(%rip),%rax
mov    (%rax),%edx
call   1150 <socket@plt>
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
js     16c1 <main+0x491>
mov    $0x60,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,-0x60(%rbp)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1090 <memset@plt>
mov    (%r14),%eax
mov    %eax,0x5c(%rbx)
mov    $0x1000,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1090 <memset@plt>
mov    $0x4,%edi
call   1060 <NLMSG_LENGTH@plt>
mov    %eax,(%rbx)
mov    0x2cfb(%rip),%rax
mov    0x2d14(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2ca9(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
mov    0x2cab(%rip),%rax
or     (%rax),%ecx
mov    0x2cc2(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x10(%rbx)
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,0x58(%rbx)
mov    %rbx,%rdi
call   10e0 <NLMSG_DATA@plt>
mov    0x2cc4(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r14
lea    (%rbx,%r14,1),%r12
mov    $0x6,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r13
mov    0x2c86(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx,%r14,1)
mov    %r13,0x8(%rbx,%r14,1)
mov    %r12,%rdi
call   1110 <RTA_DATA@plt>
lea    0xcce(%rip),%rsi
mov    $0x6,%edx
mov    %eax,%edi
call   10c0 <memcpy@plt>
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1030 <RTA_ALIGN@plt>
add    %eax,%r12d
mov    %r12d,(%rbx)
mov    %r12d,%edi
call   1070 <NLMSG_ALIGN@plt>
cltq
mov    %rax,-0x38(%rbp)
add    %rbx,%rax
mov    %rax,-0x58(%rbp)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r14
xor    %edi,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r12
mov    0x2bf8(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx,%r14,1)
mov    %r12,0x8(%rbx,%r14,1)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1030 <RTA_ALIGN@plt>
add    %eax,%r13d
mov    %r13d,(%rbx)
mov    %r13d,%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r14
lea    (%rbx,%r14,1),%r12
mov    $0x5,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r13
mov    0x2c0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx,%r14,1)
mov    %r13,0x8(%rbx,%r14,1)
mov    %r12,%rdi
call   1110 <RTA_DATA@plt>
lea    0xc20(%rip),%rsi
mov    $0x5,%edx
mov    %eax,%edi
call   10c0 <memcpy@plt>
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1030 <RTA_ALIGN@plt>
add    %eax,%r12d
mov    %r12d,(%rbx)
mov    %r12d,%edi
call   1070 <NLMSG_ALIGN@plt>
cltq
mov    %rax,-0x50(%rbp)
add    %rbx,%rax
mov    %rax,-0x48(%rbp)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r15
mov    0x2b16(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx,%r15,1)
xor    %edi,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r12
mov    %rax,0x8(%rbx,%r15,1)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1030 <RTA_ALIGN@plt>
add    %eax,%r13d
mov    %r13d,(%rbx)
mov    %r13d,%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r15
lea    (%rbx,%r15,1),%rax
mov    %rax,-0x40(%rbp)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r13
movl   $0x1,(%rbx,%r13,1)
xor    %edi,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r12
mov    %rax,0x8(%rbx,%r13,1)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r13d
mov    %r12,%rdi
call   1030 <RTA_ALIGN@plt>
lea    (%rax,%r13,1),%edi
add    $0x4,%edi
mov    %edi,(%rbx)
call   1070 <NLMSG_ALIGN@plt>
movslq %eax,%r14
lea    (%rbx,%r14,1),%r12
mov    $0x7,%edi
call   1130 <RTA_LENGTH@plt>
mov    %rax,%r13
mov    0x2ad2(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx,%r14,1)
mov    %r13,0x8(%rbx,%r14,1)
mov    %r12,%rdi
call   1110 <RTA_DATA@plt>
lea    0xb25(%rip),%rsi
mov    $0x7,%edx
mov    %eax,%edi
call   10c0 <memcpy@plt>
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1030 <RTA_ALIGN@plt>
add    %eax,%r12d
mov    %r12d,(%rbx)
mov    %r12d,%edi
call   1070 <NLMSG_ALIGN@plt>
cltq
add    %rbx,%rax
sub    -0x40(%rbp),%rax
mov    %rax,0x8(%rbx,%r15,1)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
cltq
add    %rbx,%rax
sub    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    %rax,0x8(%rbx,%rcx,1)
mov    (%rbx),%edi
call   1070 <NLMSG_ALIGN@plt>
cltq
add    %rbx,%rax
sub    -0x58(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rax,0x8(%rbx,%rcx,1)
mov    %ebx,-0x80(%rbp)
movslq (%rbx),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x70(%rbp)
movq   $0x0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0xe0(%rbp)
movaps %xmm0,-0xd0(%rbp)
movaps %xmm0,-0x90(%rbp)
movaps %xmm0,-0xa0(%rbp)
movaps %xmm0,-0xb0(%rbp)
movaps %xmm0,-0xc0(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,%rbx
mov    %eax,-0xe0(%rbp)
movq   $0x60,-0xd8(%rbp)
lea    -0x80(%rbp),%rax
mov    %eax,-0xd0(%rbp)
movl   $0x1,-0xcc(%rbp)
lea    -0xe0(%rbp),%rsi
mov    -0x2c(%rbp),%edi
xor    %edx,%edx
call   1040 <sendmsg@plt>
test   %rax,%rax
js     16c1 <main+0x491>
mov    %rsp,-0x38(%rbp)
mov    %rsp,%r14
lea    -0x1000(%r14),%r15
mov    %r15,%rsp
mov    %r15,-0x78(%rbp)
movl   $0x1000,-0x70(%rbp)
lea    -0xe0(%rbp),%r13
xor    %r12d,%r12d
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1090 <memset@plt>
mov    %rbx,-0xb0(%rbp)
movabs $0x100000060,%rax
mov    %rax,-0xc4(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x2c(%rbp),%ebx
mov    %ebx,%edi
mov    %r13,%rsi
xor    %edx,%edx
call   1100 <recvmsg@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
mov    -0xff8(%r14),%rax
mov    0x2954(%rip),%rcx
cmp    (%rcx),%rax
jne    1699 <main+0x469>
mov    %r15,%rdi
call   10e0 <NLMSG_DATA@plt>
mov    (%rax),%rsi
test   %rsi,%rsi
jns    16ab <main+0x47b>
lea    0x99c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    16a5 <main+0x475>
lea    0x9b0(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r12d
mov    -0x38(%rbp),%rsp
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x28c0(%rip),%rax
mov    (%rax),%ebx
mov    0x28a7(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
lea    0x921(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_nl = type { i32, i64, i32, i32, i32, i32, i32, %struct.iovec*, %struct.sockaddr_nl*, i32, i32, i32*, %struct.iovec*, %struct.sockaddr_nl*, i32, i32 }
%struct.iovec = type { i32, i8*, i32, %struct.sockaddr_nl* }
%struct.nlmsghdr = type { i32, i64, i32, i32, i32, i32, i32, %struct.iovec*, %struct.nlmsghdr*, i32, i32, i32*, %struct.iovec*, %struct.nlmsghdr*, i32, i32 }
%struct.ifinfomsg = type { i32 }
%struct.rtattr = type { i32, i64 }
%struct.msghdr = type { i32, i64, i32, i32, i32, i32, i32, %struct.iovec*, %struct.msghdr*, i32, i32, i32*, %struct.iovec*, %struct.msghdr*, i32, i32 }
%struct.nlmsgerr = type { i64 }
@AF_NETLINK = global i32 0
@SOCK_RAW = global i32 0
@NETLINK_ROUTE = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"failed to get socket: %s\0A\00"
@errno = global i32 0
@RTM_NEWLINK = global i64 0
@NLM_F_REQUEST = global i32 0
@NLM_F_CREATE = global i32 0
@NLM_F_EXCL = global i32 0
@NLM_F_ACK = global i32 0
@AF_UNSPEC = global i32 0
@.str.1 = [6 x i8] c"veth1\00"
@IFLA_IFNAME = global i8* null
@IFLA_LINKINFO = global i32 0
@.str.2 = [5 x i8] c"veth\00"
@IFLA_INFO_KIND = global i32 0
@IFLA_INFO_DATA = global i32 0
@.str.3 = [7 x i8] c"vpeer1\00"
@NLMSG_ERROR = global i64 0
@.str.4 = [36 x i8] c"error: %d\0A, failed to create links\0A\00"
@.str.5 = [24 x i8] c"failed to create links\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_nl*
%4 = alloca %struct.nlmsghdr*
%5 = alloca %struct.ifinfomsg*
%6 = alloca %struct.rtattr*
%7 = alloca %struct.rtattr*
%8 = alloca %struct.rtattr*
%9 = alloca %struct.rtattr*
%10 = alloca i64
%11 = alloca %struct.iovec
%12 = alloca %struct.msghdr
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i64
%16 = alloca %struct.nlmsghdr*
%17 = alloca %struct.nlmsgerr*
%18 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%19 = load i32, i32* @AF_NETLINK
%20 = load i32, i32* @SOCK_RAW
%21 = load i32, i32* @NETLINK_ROUTE
%22 = call i32 @socket(i32 %19, i32 %20, i32 %21)
store i32 %22, i32* %2
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %0
%25 = load i32, i32* @stderr
%26 = load i32, i32* @errno
%27 = call i8* @strerror(i32 %26)
%28 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %0
%31 = call %struct.sockaddr_nl* @malloc(i32 96)
store %struct.sockaddr_nl* %31, %struct.sockaddr_nl** %3
%32 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %3
%33 = call i32 @memset(%struct.sockaddr_nl* %32, i32 0, i32 96)
%34 = load i32, i32* @AF_NETLINK
%35 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %3
%36 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %35, i32 0, i32 15
store i32 %34, i32* %36
%37 = call %struct.sockaddr_nl* @malloc(i32 4096)
%38 = bitcast %struct.sockaddr_nl* %37 to %struct.nlmsghdr*
store %struct.nlmsghdr* %38, %struct.nlmsghdr** %4
%39 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%40 = bitcast %struct.nlmsghdr* %39 to %struct.sockaddr_nl*
%41 = call i32 @memset(%struct.sockaddr_nl* %40, i32 0, i32 4096)
%42 = call i32 @NLMSG_LENGTH(i32 4)
%43 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%44 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %43, i32 0, i32 0
store i32 %42, i32* %44
%45 = load i64, i64* @RTM_NEWLINK
%46 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%47 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %46, i32 0, i32 1
store i64 %45, i64* %47
%48 = load i32, i32* @NLM_F_REQUEST
%49 = load i32, i32* @NLM_F_CREATE
%50 = or i32 %48, %49
%51 = load i32, i32* @NLM_F_EXCL
%52 = or i32 %50, %51
%53 = load i32, i32* @NLM_F_ACK
%54 = or i32 %52, %53
%55 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%56 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %55, i32 0, i32 2
store i32 %54, i32* %56
%57 = call i32 @time(i32* null)
%58 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%59 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %58, i32 0, i32 14
store i32 %57, i32* %59
%60 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%61 = bitcast %struct.nlmsghdr* %60 to %struct.sockaddr_nl*
%62 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %61)
%63 = inttoptr i64 %62 to %struct.ifinfomsg*
store %struct.ifinfomsg* %63, %struct.ifinfomsg** %5
%64 = load i32, i32* @AF_UNSPEC
%65 = load %struct.ifinfomsg*, %struct.ifinfomsg** %5
%66 = getelementptr inbounds %struct.ifinfomsg, %struct.ifinfomsg* %65, i32 0, i32 0
store i32 %64, i32* %66
%67 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%68 = bitcast %struct.nlmsghdr* %67 to i8*
%69 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%70 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %69, i32 0, i32 0
%71 = load i32, i32* %70
%72 = call i32 @NLMSG_ALIGN(i32 %71)
%73 = sext i32 %72 to i64
%74 = getelementptr i8, i8* %68, i64 %73
%75 = bitcast i8* %74 to %struct.rtattr*
store %struct.rtattr* %75, %struct.rtattr** %6
%76 = call i64 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%77 = add nsw i64 %76, 1
%78 = call i64 @RTA_LENGTH(i64 %77)
store i64 %78, i64* %10
%79 = load i8*, i8** @IFLA_IFNAME
%80 = ptrtoint i8* %79 to i32
%81 = load %struct.rtattr*, %struct.rtattr** %6
%82 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %81, i32 0, i32 0
store i32 %80, i32* %82
%83 = load i64, i64* %10
%84 = load %struct.rtattr*, %struct.rtattr** %6
%85 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %84, i32 0, i32 1
store i64 %83, i64* %85
%86 = load %struct.rtattr*, %struct.rtattr** %6
%87 = call i32 @RTA_DATA(%struct.rtattr* %86)
%88 = call i64 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%89 = add nsw i64 %88, 1
%90 = call i32 @memcpy(i32 %87, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %89)
%91 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%92 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 @NLMSG_ALIGN(i32 %93)
%95 = load i64, i64* %10
%96 = call i32 @RTA_ALIGN(i64 %95)
%97 = add nsw i32 %94, %96
%98 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%99 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %98, i32 0, i32 0
store i32 %97, i32* %99
%100 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%101 = bitcast %struct.nlmsghdr* %100 to i8*
%102 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%103 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %102, i32 0, i32 0
%104 = load i32, i32* %103
%105 = call i32 @NLMSG_ALIGN(i32 %104)
%106 = sext i32 %105 to i64
%107 = getelementptr i8, i8* %101, i64 %106
%108 = bitcast i8* %107 to %struct.rtattr*
store %struct.rtattr* %108, %struct.rtattr** %7
%109 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%110 = bitcast %struct.nlmsghdr* %109 to i8*
%111 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%112 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %111, i32 0, i32 0
%113 = load i32, i32* %112
%114 = call i32 @NLMSG_ALIGN(i32 %113)
%115 = sext i32 %114 to i64
%116 = getelementptr i8, i8* %110, i64 %115
%117 = bitcast i8* %116 to %struct.rtattr*
store %struct.rtattr* %117, %struct.rtattr** %6
%118 = call i64 @RTA_LENGTH(i64 0)
store i64 %118, i64* %10
%119 = load i32, i32* @IFLA_LINKINFO
%120 = load %struct.rtattr*, %struct.rtattr** %6
%121 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %120, i32 0, i32 0
store i32 %119, i32* %121
%122 = load i64, i64* %10
%123 = load %struct.rtattr*, %struct.rtattr** %6
%124 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %123, i32 0, i32 1
store i64 %122, i64* %124
%125 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%126 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %125, i32 0, i32 0
%127 = load i32, i32* %126
%128 = call i32 @NLMSG_ALIGN(i32 %127)
%129 = load i64, i64* %10
%130 = call i32 @RTA_ALIGN(i64 %129)
%131 = add nsw i32 %128, %130
%132 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%133 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %132, i32 0, i32 0
store i32 %131, i32* %133
%134 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%135 = bitcast %struct.nlmsghdr* %134 to i8*
%136 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%137 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %136, i32 0, i32 0
%138 = load i32, i32* %137
%139 = call i32 @NLMSG_ALIGN(i32 %138)
%140 = sext i32 %139 to i64
%141 = getelementptr i8, i8* %135, i64 %140
%142 = bitcast i8* %141 to %struct.rtattr*
store %struct.rtattr* %142, %struct.rtattr** %6
%143 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%144 = add nsw i64 %143, 1
%145 = call i64 @RTA_LENGTH(i64 %144)
store i64 %145, i64* %10
%146 = load i32, i32* @IFLA_INFO_KIND
%147 = load %struct.rtattr*, %struct.rtattr** %6
%148 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %147, i32 0, i32 0
store i32 %146, i32* %148
%149 = load i64, i64* %10
%150 = load %struct.rtattr*, %struct.rtattr** %6
%151 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %150, i32 0, i32 1
store i64 %149, i64* %151
%152 = load %struct.rtattr*, %struct.rtattr** %6
%153 = call i32 @RTA_DATA(%struct.rtattr* %152)
%154 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%155 = add nsw i64 %154, 1
%156 = call i32 @memcpy(i32 %153, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %155)
%157 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%158 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %157, i32 0, i32 0
%159 = load i32, i32* %158
%160 = call i32 @NLMSG_ALIGN(i32 %159)
%161 = load i64, i64* %10
%162 = call i32 @RTA_ALIGN(i64 %161)
%163 = add nsw i32 %160, %162
%164 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%165 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %164, i32 0, i32 0
store i32 %163, i32* %165
%166 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%167 = bitcast %struct.nlmsghdr* %166 to i8*
%168 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%169 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %168, i32 0, i32 0
%170 = load i32, i32* %169
%171 = call i32 @NLMSG_ALIGN(i32 %170)
%172 = sext i32 %171 to i64
%173 = getelementptr i8, i8* %167, i64 %172
%174 = bitcast i8* %173 to %struct.rtattr*
store %struct.rtattr* %174, %struct.rtattr** %8
%175 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%176 = bitcast %struct.nlmsghdr* %175 to i8*
%177 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%178 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %177, i32 0, i32 0
%179 = load i32, i32* %178
%180 = call i32 @NLMSG_ALIGN(i32 %179)
%181 = sext i32 %180 to i64
%182 = getelementptr i8, i8* %176, i64 %181
%183 = bitcast i8* %182 to %struct.rtattr*
store %struct.rtattr* %183, %struct.rtattr** %6
%184 = load i32, i32* @IFLA_INFO_DATA
%185 = load %struct.rtattr*, %struct.rtattr** %6
%186 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %185, i32 0, i32 0
store i32 %184, i32* %186
%187 = call i64 @RTA_LENGTH(i64 0)
store i64 %187, i64* %10
%188 = load i64, i64* %10
%189 = load %struct.rtattr*, %struct.rtattr** %6
%190 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %189, i32 0, i32 1
store i64 %188, i64* %190
%191 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%192 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %191, i32 0, i32 0
%193 = load i32, i32* %192
%194 = call i32 @NLMSG_ALIGN(i32 %193)
%195 = load i64, i64* %10
%196 = call i32 @RTA_ALIGN(i64 %195)
%197 = add nsw i32 %194, %196
%198 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%199 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %198, i32 0, i32 0
store i32 %197, i32* %199
%200 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%201 = bitcast %struct.nlmsghdr* %200 to i8*
%202 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%203 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %202, i32 0, i32 0
%204 = load i32, i32* %203
%205 = call i32 @NLMSG_ALIGN(i32 %204)
%206 = sext i32 %205 to i64
%207 = getelementptr i8, i8* %201, i64 %206
%208 = bitcast i8* %207 to %struct.rtattr*
store %struct.rtattr* %208, %struct.rtattr** %9
%209 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%210 = bitcast %struct.nlmsghdr* %209 to i8*
%211 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%212 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %211, i32 0, i32 0
%213 = load i32, i32* %212
%214 = call i32 @NLMSG_ALIGN(i32 %213)
%215 = sext i32 %214 to i64
%216 = getelementptr i8, i8* %210, i64 %215
%217 = bitcast i8* %216 to %struct.rtattr*
store %struct.rtattr* %217, %struct.rtattr** %6
%218 = load %struct.rtattr*, %struct.rtattr** %6
%219 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %218, i32 0, i32 0
store i32 1, i32* %219
%220 = call i64 @RTA_LENGTH(i64 0)
store i64 %220, i64* %10
%221 = load i64, i64* %10
%222 = load %struct.rtattr*, %struct.rtattr** %6
%223 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %222, i32 0, i32 1
store i64 %221, i64* %223
%224 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%225 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %224, i32 0, i32 0
%226 = load i32, i32* %225
%227 = call i32 @NLMSG_ALIGN(i32 %226)
%228 = load i64, i64* %10
%229 = call i32 @RTA_ALIGN(i64 %228)
%230 = add nsw i32 %227, %229
%231 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%232 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %231, i32 0, i32 0
store i32 %230, i32* %232
%233 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%234 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %233, i32 0, i32 0
%235 = load i32, i32* %234
%236 = sext i32 %235 to i64
%237 = add i64 %236, 4
%238 = trunc i64 %237 to i32
store i32 %238, i32* %234
%239 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%240 = bitcast %struct.nlmsghdr* %239 to i8*
%241 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%242 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %241, i32 0, i32 0
%243 = load i32, i32* %242
%244 = call i32 @NLMSG_ALIGN(i32 %243)
%245 = sext i32 %244 to i64
%246 = getelementptr i8, i8* %240, i64 %245
%247 = bitcast i8* %246 to %struct.rtattr*
store %struct.rtattr* %247, %struct.rtattr** %6
%248 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%249 = add nsw i64 %248, 1
%250 = call i64 @RTA_LENGTH(i64 %249)
store i64 %250, i64* %10
%251 = load i8*, i8** @IFLA_IFNAME
%252 = ptrtoint i8* %251 to i32
%253 = load %struct.rtattr*, %struct.rtattr** %6
%254 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %253, i32 0, i32 0
store i32 %252, i32* %254
%255 = load i64, i64* %10
%256 = load %struct.rtattr*, %struct.rtattr** %6
%257 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %256, i32 0, i32 1
store i64 %255, i64* %257
%258 = load %struct.rtattr*, %struct.rtattr** %6
%259 = call i32 @RTA_DATA(%struct.rtattr* %258)
%260 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%261 = add nsw i64 %260, 1
%262 = call i32 @memcpy(i32 %259, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 %261)
%263 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%264 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %263, i32 0, i32 0
%265 = load i32, i32* %264
%266 = call i32 @NLMSG_ALIGN(i32 %265)
%267 = load i64, i64* %10
%268 = call i32 @RTA_ALIGN(i64 %267)
%269 = add nsw i32 %266, %268
%270 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%271 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %270, i32 0, i32 0
store i32 %269, i32* %271
%272 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%273 = bitcast %struct.nlmsghdr* %272 to i8*
%274 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%275 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %274, i32 0, i32 0
%276 = load i32, i32* %275
%277 = call i32 @NLMSG_ALIGN(i32 %276)
%278 = sext i32 %277 to i64
%279 = getelementptr i8, i8* %273, i64 %278
%280 = bitcast i8* %279 to %struct.rtattr*
%281 = bitcast %struct.rtattr* %280 to i8*
%282 = load %struct.rtattr*, %struct.rtattr** %9
%283 = bitcast %struct.rtattr* %282 to i8*
%284 = ptrtoint i8* %281 to i64
%285 = ptrtoint i8* %283 to i64
%286 = sub i64 %284, %285
%287 = load %struct.rtattr*, %struct.rtattr** %9
%288 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %287, i32 0, i32 1
store i64 %286, i64* %288
%289 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%290 = bitcast %struct.nlmsghdr* %289 to i8*
%291 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%292 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %291, i32 0, i32 0
%293 = load i32, i32* %292
%294 = call i32 @NLMSG_ALIGN(i32 %293)
%295 = sext i32 %294 to i64
%296 = getelementptr i8, i8* %290, i64 %295
%297 = bitcast i8* %296 to %struct.rtattr*
%298 = bitcast %struct.rtattr* %297 to i8*
%299 = load %struct.rtattr*, %struct.rtattr** %8
%300 = bitcast %struct.rtattr* %299 to i8*
%301 = ptrtoint i8* %298 to i64
%302 = ptrtoint i8* %300 to i64
%303 = sub i64 %301, %302
%304 = load %struct.rtattr*, %struct.rtattr** %8
%305 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %304, i32 0, i32 1
store i64 %303, i64* %305
%306 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%307 = bitcast %struct.nlmsghdr* %306 to i8*
%308 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%309 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %308, i32 0, i32 0
%310 = load i32, i32* %309
%311 = call i32 @NLMSG_ALIGN(i32 %310)
%312 = sext i32 %311 to i64
%313 = getelementptr i8, i8* %307, i64 %312
%314 = bitcast i8* %313 to %struct.rtattr*
%315 = bitcast %struct.rtattr* %314 to i8*
%316 = load %struct.rtattr*, %struct.rtattr** %7
%317 = bitcast %struct.rtattr* %316 to i8*
%318 = ptrtoint i8* %315 to i64
%319 = ptrtoint i8* %317 to i64
%320 = sub i64 %318, %319
%321 = load %struct.rtattr*, %struct.rtattr** %7
%322 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %321, i32 0, i32 1
store i64 %320, i64* %322
%323 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 0
%324 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%325 = ptrtoint %struct.nlmsghdr* %324 to i32
store i32 %325, i32* %323
%326 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 1
%327 = load %struct.nlmsghdr*, %struct.nlmsghdr** %4
%328 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %327, i32 0, i32 0
%329 = load i32, i32* %328
%330 = sext i32 %329 to i64
%331 = inttoptr i64 %330 to i8*
store i8* %331, i8** %326
%332 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 2
store i32 0, i32* %332
%333 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 3
store %struct.sockaddr_nl* null, %struct.sockaddr_nl** %333
%334 = bitcast %struct.msghdr* %12 to i8*
%335 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 0
%336 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %3
%337 = ptrtoint %struct.sockaddr_nl* %336 to i32
store i32 %337, i32* %335
%338 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 1
store i64 96, i64* %338
%339 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 2
%340 = ptrtoint %struct.iovec* %11 to i32
store i32 %340, i32* %339
%341 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 3
store i32 1, i32* %341
%342 = load i32, i32* %2
%343 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%344 = call i64 @sendmsg(i32 %342, %struct.sockaddr_nl* %343, i32 0)
%345 = icmp slt i64 %344, 0
br i1 %345, label %346, label %352
346: ; preds = %30
%347 = load i32, i32* @stderr
%348 = load i32, i32* @errno
%349 = call i8* @strerror(i32 %348)
%350 = call i32 @fprintf(i32 %347, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %349)
%351 = call i32 @exit(i32 1)
unreachable
352: ; preds = %30
store i32 4096, i32* %13
%353 = load i32, i32* %13
%354 = zext i32 %353 to i64
%355 = call i8* @llvm.stacksave()
store i8* %355, i8** %14
%356 = alloca i8, i64 %354
store i64 %354, i64* %15
%357 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 1
store i8* %356, i8** %357
%358 = load i32, i32* %13
%359 = getelementptr inbounds %struct.iovec, %struct.iovec* %11, i32 0, i32 2
store i32 %358, i32* %359
%360 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%361 = call i32 @memset(%struct.sockaddr_nl* %360, i32 0, i32 96)
%362 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %3
%363 = bitcast %struct.sockaddr_nl* %362 to %struct.msghdr*
%364 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 8
store %struct.msghdr* %363, %struct.msghdr** %364
%365 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 5
store i32 96, i32* %365
%366 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 7
store %struct.iovec* %11, %struct.iovec** %366
%367 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 6
store i32 1, i32* %367
%368 = load i32, i32* %2
%369 = bitcast %struct.msghdr* %12 to %struct.sockaddr_nl*
%370 = call i32 @recvmsg(i32 %368, %struct.sockaddr_nl* %369, i32 0)
%371 = load i32, i32* %2
%372 = call i32 @close(i32 %371)
%373 = bitcast i8* %356 to %struct.nlmsghdr*
store %struct.nlmsghdr* %373, %struct.nlmsghdr** %16
%374 = load %struct.nlmsghdr*, %struct.nlmsghdr** %16
%375 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %374, i32 0, i32 1
%376 = load i64, i64* %375
%377 = load i64, i64* @NLMSG_ERROR
%378 = icmp eq i64 %376, %377
br i1 %378, label %379, label %394
379: ; preds = %352
%380 = load %struct.nlmsghdr*, %struct.nlmsghdr** %16
%381 = bitcast %struct.nlmsghdr* %380 to %struct.sockaddr_nl*
%382 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %381)
%383 = inttoptr i64 %382 to %struct.nlmsgerr*
store %struct.nlmsgerr* %383, %struct.nlmsgerr** %17
%384 = load %struct.nlmsgerr*, %struct.nlmsgerr** %17
%385 = getelementptr inbounds %struct.nlmsgerr, %struct.nlmsgerr* %384, i32 0, i32 0
%386 = load i64, i64* %385
%387 = icmp slt i64 %386, 0
br i1 %387, label %388, label %393
388: ; preds = %379
%389 = load %struct.nlmsgerr*, %struct.nlmsgerr** %17
%390 = getelementptr inbounds %struct.nlmsgerr, %struct.nlmsgerr* %389, i32 0, i32 0
%391 = load i64, i64* %390
%392 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i64 %391)
store i32 1, i32* %1
store i32 1, i32* %18
br label %397
393: ; preds = %379
br label %396
394: ; preds = %352
%395 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
store i32 1, i32* %18
br label %397
396: ; preds = %393
store i32 0, i32* %1
store i32 1, i32* %18
br label %397
397: ; preds = %396, %394, %388
%398 = load i8*, i8** %14
%399 = load i32, i32* %1
ret i32 %399
}

LLVM IR (-O2):
%struct.iovec = type { i32, i8*, i32, %struct.sockaddr_nl* }
%struct.sockaddr_nl = type { i32, i64, i32, i32, i32, i32, i32, %struct.iovec*, %struct.sockaddr_nl*, i32, i32, i32*, %struct.iovec*, %struct.sockaddr_nl*, i32, i32 }
%struct.msghdr = type { i32, i64, i32, i32, i32, i32, i32, %struct.iovec*, %struct.msghdr*, i32, i32, i32*, %struct.iovec*, %struct.msghdr*, i32, i32 }
%struct.ifinfomsg = type { i32 }
%struct.rtattr = type { i32, i64 }
%struct.nlmsgerr = type { i64 }
@AF_NETLINK = global i32 0
@SOCK_RAW = global i32 0
@NETLINK_ROUTE = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"failed to get socket: %s\0A\00"
@errno = global i32 0
@RTM_NEWLINK = global i64 0
@NLM_F_REQUEST = global i32 0
@NLM_F_CREATE = global i32 0
@NLM_F_EXCL = global i32 0
@NLM_F_ACK = global i32 0
@AF_UNSPEC = global i32 0
@.str.1 = [6 x i8] c"veth1\00"
@IFLA_IFNAME = global i8* null
@IFLA_LINKINFO = global i32 0
@.str.2 = [5 x i8] c"veth\00"
@IFLA_INFO_KIND = global i32 0
@IFLA_INFO_DATA = global i32 0
@.str.3 = [7 x i8] c"vpeer1\00"
@NLMSG_ERROR = global i64 0
@.str.4 = [36 x i8] c"error: %d\0A, failed to create links\0A\00"
@str = [23 x i8] c"failed to create links\00"
define i32 @main() {
%1 = alloca %struct.iovec
%2 = alloca %struct.msghdr
%3 = load i32, i32* @AF_NETLINK
%4 = load i32, i32* @SOCK_RAW
%5 = load i32, i32* @NETLINK_ROUTE
%6 = tail call i32 @socket(i32 %3, i32 %4, i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = tail call i8* @strerror(i32 %10)
%12 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = tail call %struct.sockaddr_nl* @malloc(i32 96)
%16 = tail call i32 @memset(%struct.sockaddr_nl* %15, i32 0, i32 96)
%17 = load i32, i32* @AF_NETLINK
%18 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %15, i64 0, i32 15
store i32 %17, i32* %18
%19 = tail call %struct.sockaddr_nl* @malloc(i32 4096)
%20 = tail call i32 @memset(%struct.sockaddr_nl* %19, i32 0, i32 4096)
%21 = tail call i32 @NLMSG_LENGTH(i32 4)
%22 = getelementptr %struct.sockaddr_nl, %struct.sockaddr_nl* %19, i64 0, i32 0
store i32 %21, i32* %22
%23 = load i64, i64* @RTM_NEWLINK
%24 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %19, i64 0, i32 1
store i64 %23, i64* %24
%25 = load i32, i32* @NLM_F_REQUEST
%26 = load i32, i32* @NLM_F_CREATE
%27 = or i32 %26, %25
%28 = load i32, i32* @NLM_F_EXCL
%29 = or i32 %27, %28
%30 = load i32, i32* @NLM_F_ACK
%31 = or i32 %29, %30
%32 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %19, i64 0, i32 2
store i32 %31, i32* %32
%33 = tail call i32 @time(i32* null)
%34 = getelementptr inbounds %struct.sockaddr_nl, %struct.sockaddr_nl* %19, i64 0, i32 14
store i32 %33, i32* %34
%35 = tail call i64 @NLMSG_DATA(%struct.sockaddr_nl* %19)
%36 = inttoptr i64 %35 to %struct.ifinfomsg*
%37 = load i32, i32* @AF_UNSPEC
%38 = getelementptr inbounds %struct.ifinfomsg, %struct.ifinfomsg* %36, i64 0, i32 0
store i32 %37, i32* %38
%39 = bitcast %struct.sockaddr_nl* %19 to i8*
%40 = load i32, i32* %22
%41 = tail call i32 @NLMSG_ALIGN(i32 %40)
%42 = sext i32 %41 to i64
%43 = getelementptr i8, i8* %39, i64 %42
%44 = bitcast i8* %43 to %struct.rtattr*
%45 = tail call i64 @RTA_LENGTH(i64 6)
%46 = load i8*, i8** @IFLA_IFNAME
%47 = ptrtoint i8* %46 to i64
%48 = trunc i64 %47 to i32
%49 = bitcast i8* %43 to i32*
store i32 %48, i32* %49
%50 = getelementptr inbounds i8, i8* %43, i64 8
%51 = bitcast i8* %50 to i64*
store i64 %45, i64* %51
%52 = tail call i32 @RTA_DATA(%struct.rtattr* %44)
%53 = tail call i32 @memcpy(i32 %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 6)
%54 = load i32, i32* %22
%55 = tail call i32 @NLMSG_ALIGN(i32 %54)
%56 = tail call i32 @RTA_ALIGN(i64 %45)
%57 = add nsw i32 %56, %55
store i32 %57, i32* %22
%58 = tail call i32 @NLMSG_ALIGN(i32 %57)
%59 = sext i32 %58 to i64
%60 = getelementptr i8, i8* %39, i64 %59
%61 = load i32, i32* %22
%62 = tail call i32 @NLMSG_ALIGN(i32 %61)
%63 = sext i32 %62 to i64
%64 = getelementptr i8, i8* %39, i64 %63
%65 = tail call i64 @RTA_LENGTH(i64 0)
%66 = load i32, i32* @IFLA_LINKINFO
%67 = bitcast i8* %64 to i32*
store i32 %66, i32* %67
%68 = getelementptr inbounds i8, i8* %64, i64 8
%69 = bitcast i8* %68 to i64*
store i64 %65, i64* %69
%70 = load i32, i32* %22
%71 = tail call i32 @NLMSG_ALIGN(i32 %70)
%72 = tail call i32 @RTA_ALIGN(i64 %65)
%73 = add nsw i32 %72, %71
store i32 %73, i32* %22
%74 = tail call i32 @NLMSG_ALIGN(i32 %73)
%75 = sext i32 %74 to i64
%76 = getelementptr i8, i8* %39, i64 %75
%77 = bitcast i8* %76 to %struct.rtattr*
%78 = tail call i64 @RTA_LENGTH(i64 5)
%79 = load i32, i32* @IFLA_INFO_KIND
%80 = bitcast i8* %76 to i32*
store i32 %79, i32* %80
%81 = getelementptr inbounds i8, i8* %76, i64 8
%82 = bitcast i8* %81 to i64*
store i64 %78, i64* %82
%83 = tail call i32 @RTA_DATA(%struct.rtattr* %77)
%84 = tail call i32 @memcpy(i32 %83, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 5)
%85 = load i32, i32* %22
%86 = tail call i32 @NLMSG_ALIGN(i32 %85)
%87 = tail call i32 @RTA_ALIGN(i64 %78)
%88 = add nsw i32 %87, %86
store i32 %88, i32* %22
%89 = tail call i32 @NLMSG_ALIGN(i32 %88)
%90 = sext i32 %89 to i64
%91 = getelementptr i8, i8* %39, i64 %90
%92 = load i32, i32* %22
%93 = tail call i32 @NLMSG_ALIGN(i32 %92)
%94 = sext i32 %93 to i64
%95 = getelementptr i8, i8* %39, i64 %94
%96 = load i32, i32* @IFLA_INFO_DATA
%97 = bitcast i8* %95 to i32*
store i32 %96, i32* %97
%98 = tail call i64 @RTA_LENGTH(i64 0)
%99 = getelementptr inbounds i8, i8* %95, i64 8
%100 = bitcast i8* %99 to i64*
store i64 %98, i64* %100
%101 = load i32, i32* %22
%102 = tail call i32 @NLMSG_ALIGN(i32 %101)
%103 = tail call i32 @RTA_ALIGN(i64 %98)
%104 = add nsw i32 %103, %102
store i32 %104, i32* %22
%105 = tail call i32 @NLMSG_ALIGN(i32 %104)
%106 = sext i32 %105 to i64
%107 = getelementptr i8, i8* %39, i64 %106
%108 = load i32, i32* %22
%109 = tail call i32 @NLMSG_ALIGN(i32 %108)
%110 = sext i32 %109 to i64
%111 = getelementptr i8, i8* %39, i64 %110
%112 = bitcast i8* %111 to i32*
store i32 1, i32* %112
%113 = tail call i64 @RTA_LENGTH(i64 0)
%114 = getelementptr inbounds i8, i8* %111, i64 8
%115 = bitcast i8* %114 to i64*
store i64 %113, i64* %115
%116 = load i32, i32* %22
%117 = tail call i32 @NLMSG_ALIGN(i32 %116)
%118 = tail call i32 @RTA_ALIGN(i64 %113)
%119 = add i32 %117, 4
%120 = add i32 %119, %118
store i32 %120, i32* %22
%121 = tail call i32 @NLMSG_ALIGN(i32 %120)
%122 = sext i32 %121 to i64
%123 = getelementptr i8, i8* %39, i64 %122
%124 = bitcast i8* %123 to %struct.rtattr*
%125 = tail call i64 @RTA_LENGTH(i64 7)
%126 = load i8*, i8** @IFLA_IFNAME
%127 = ptrtoint i8* %126 to i64
%128 = trunc i64 %127 to i32
%129 = bitcast i8* %123 to i32*
store i32 %128, i32* %129
%130 = getelementptr inbounds i8, i8* %123, i64 8
%131 = bitcast i8* %130 to i64*
store i64 %125, i64* %131
%132 = tail call i32 @RTA_DATA(%struct.rtattr* %124)
%133 = tail call i32 @memcpy(i32 %132, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%134 = load i32, i32* %22
%135 = tail call i32 @NLMSG_ALIGN(i32 %134)
%136 = tail call i32 @RTA_ALIGN(i64 %125)
%137 = add nsw i32 %136, %135
store i32 %137, i32* %22
%138 = tail call i32 @NLMSG_ALIGN(i32 %137)
%139 = sext i32 %138 to i64
%140 = getelementptr i8, i8* %39, i64 %139
%141 = ptrtoint i8* %140 to i64
%142 = ptrtoint i8* %107 to i64
%143 = sub i64 %141, %142
%144 = getelementptr inbounds i8, i8* %107, i64 8
%145 = bitcast i8* %144 to i64*
store i64 %143, i64* %145
%146 = load i32, i32* %22
%147 = tail call i32 @NLMSG_ALIGN(i32 %146)
%148 = sext i32 %147 to i64
%149 = getelementptr i8, i8* %39, i64 %148
%150 = ptrtoint i8* %149 to i64
%151 = ptrtoint i8* %91 to i64
%152 = sub i64 %150, %151
%153 = getelementptr inbounds i8, i8* %91, i64 8
%154 = bitcast i8* %153 to i64*
store i64 %152, i64* %154
%155 = load i32, i32* %22
%156 = tail call i32 @NLMSG_ALIGN(i32 %155)
%157 = sext i32 %156 to i64
%158 = getelementptr i8, i8* %39, i64 %157
%159 = ptrtoint i8* %158 to i64
%160 = ptrtoint i8* %60 to i64
%161 = sub i64 %159, %160
%162 = getelementptr inbounds i8, i8* %60, i64 8
%163 = bitcast i8* %162 to i64*
store i64 %161, i64* %163
%164 = bitcast %struct.iovec* %1 to i8*
%165 = getelementptr inbounds %struct.iovec, %struct.iovec* %1, i64 0, i32 0
%166 = ptrtoint %struct.sockaddr_nl* %19 to i64
%167 = trunc i64 %166 to i32
store i32 %167, i32* %165
%168 = getelementptr inbounds %struct.iovec, %struct.iovec* %1, i64 0, i32 1
%169 = load i32, i32* %22
%170 = sext i32 %169 to i64
%171 = inttoptr i64 %170 to i8*
store i8* %171, i8** %168
%172 = getelementptr inbounds %struct.iovec, %struct.iovec* %1, i64 0, i32 2
store i32 0, i32* %172
%173 = getelementptr inbounds %struct.iovec, %struct.iovec* %1, i64 0, i32 3
store %struct.sockaddr_nl* null, %struct.sockaddr_nl** %173
%174 = bitcast %struct.msghdr* %2 to i8*
%175 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 0
%176 = ptrtoint %struct.sockaddr_nl* %15 to i64
%177 = trunc i64 %176 to i32
store i32 %177, i32* %175
%178 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 1
store i64 96, i64* %178
%179 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 2
%180 = ptrtoint %struct.iovec* %1 to i64
%181 = trunc i64 %180 to i32
store i32 %181, i32* %179
%182 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 3
store i32 1, i32* %182
%183 = bitcast %struct.msghdr* %2 to %struct.sockaddr_nl*
%184 = call i64 @sendmsg(i32 %6, %struct.sockaddr_nl* %183, i32 0)
%185 = icmp slt i64 %184, 0
br i1 %185, label %186, label %192
186: ; preds = %14
%187 = load i32, i32* @stderr
%188 = load i32, i32* @errno
%189 = call i8* @strerror(i32 %188)
%190 = call i32 @fprintf(i32 %187, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %189)
%191 = call i32 @exit(i32 1)
unreachable
192: ; preds = %14
%193 = call i8* @llvm.stacksave()
%194 = alloca [4096 x i8]
%195 = getelementptr inbounds [4096 x i8], [4096 x i8]* %194, i64 0, i64 0
store i8* %195, i8** %168
store i32 4096, i32* %172
%196 = call i32 @memset(%struct.sockaddr_nl* %183, i32 0, i32 96)
%197 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 8
%198 = bitcast %struct.msghdr** %197 to %struct.sockaddr_nl**
store %struct.sockaddr_nl* %15, %struct.sockaddr_nl** %198
%199 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 5
store i32 96, i32* %199
%200 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 7
store %struct.iovec* %1, %struct.iovec** %200
%201 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %2, i64 0, i32 6
store i32 1, i32* %201
%202 = call i32 @recvmsg(i32 %6, %struct.sockaddr_nl* %183, i32 0)
%203 = call i32 @close(i32 %6)
%204 = getelementptr inbounds [4096 x i8], [4096 x i8]* %194, i64 0, i64 8
%205 = bitcast i8* %204 to i64*
%206 = load i64, i64* %205
%207 = load i64, i64* @NLMSG_ERROR
%208 = icmp eq i64 %206, %207
br i1 %208, label %209, label %218
209: ; preds = %192
%210 = bitcast [4096 x i8]* %194 to %struct.sockaddr_nl*
%211 = call i64 @NLMSG_DATA(%struct.sockaddr_nl* %210)
%212 = inttoptr i64 %211 to %struct.nlmsgerr*
%213 = getelementptr inbounds %struct.nlmsgerr, %struct.nlmsgerr* %212, i64 0, i32 0
%214 = load i64, i64* %213
%215 = icmp slt i64 %214, 0
br i1 %215, label %216, label %220
216: ; preds = %209
%217 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i64 %214)
br label %220
218: ; preds = %192
%219 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %220
220: ; preds = %216, %209, %218
%221 = phi i32 [ 1, %218 ], [ 0, %209 ], [ 1, %216 ]
ret i32 %221
}