#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 dummy;
};
struct rtattr {
  int rta_len;
  int /*<<< orphan*/ rta_type;
};
struct nlmsghdr {
  int nlmsg_len;
  int nlmsg_flags;
  int /*<<< orphan*/ nlmsg_type;
};
struct msghdr {
  int member_1;
  int member_3;
  int /*<<< orphan*/ member_6;
  int /*<<< orphan*/ member_5;
  int /*<<< orphan*/ *member_4;
  struct iovec *member_2;
  struct sockaddr_nl *member_0;
};
struct iovec {
  int member_1;
  struct nlmsghdr *member_0;
};
struct ifaddrmsg {
  int ifa_family;
  int ifa_prefixlen;
  int ifa_index;
  scalar_t__ ifa_scope;
  int /*<<< orphan*/ ifa_flags;
};

/* Variables and functions */
int /*<<< orphan*/ IFA_ADDRESS;
int /*<<< orphan*/ IFA_F_PERMANENT;
int /*<<< orphan*/ IFA_LOCAL;
scalar_t__ IFA_RTA(struct ifaddrmsg *);
int NLMSG_ALIGN(int);
scalar_t__ NLMSG_DATA(struct nlmsghdr *);
int NLMSG_LENGTH(int);
int NLM_F_ACK;
int NLM_F_REQUEST;
int /*<<< orphan*/ RTA_DATA(struct rtattr *);
void *RTA_LENGTH(int);
scalar_t__ RTA_NEXT(struct rtattr *, int);
int /*<<< orphan*/ RTM_NEWADDR;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int pton(int, int /*<<< orphan*/, char const *);
int sendmsg(int, struct msghdr *, int /*<<< orphan*/);
int add_ip(int fd, struct sockaddr_nl *sa, int domain, const char *ip) {
  char buf[4096];
  int ip_len = 0;
  memset(buf, 0, 4096);
  struct nlmsghdr *nl;
  nl = (struct nlmsghdr *)buf;
  nl->nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
  nl->nlmsg_type = RTM_NEWADDR;
  nl->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
  struct ifaddrmsg *ifa;
  ifa = (struct ifaddrmsg *)NLMSG_DATA(nl);
  ifa->ifa_family = domain;
  ifa->ifa_prefixlen = 16;
  ifa->ifa_flags = IFA_F_PERMANENT;
  ifa->ifa_scope = 0;
  ifa->ifa_index = 2;
  struct rtattr *rta = (struct rtattr *)IFA_RTA(ifa);
  rta->rta_type = IFA_LOCAL;
  ip_len = pton(domain, RTA_DATA(rta), ip);
  rta->rta_len = RTA_LENGTH(ip_len);
  nl->nlmsg_len = NLMSG_ALIGN(nl->nlmsg_len) + rta->rta_len;
  int l = 4096 - nl->nlmsg_len;
  rta = (struct rtattr *)RTA_NEXT(rta, l);
  rta->rta_type = IFA_ADDRESS;
  ip_len = pton(domain, RTA_DATA(rta), ip);
  rta->rta_len = RTA_LENGTH(ip_len);
  nl->nlmsg_len += rta->rta_len;
  struct iovec iov = {nl, nl->nlmsg_len};
  struct msghdr msg = {sa, sizeof(*sa), &iov, 1, NULL, 0, 0};
  int r = sendmsg(fd, &msg, 0);
  return (r < 0) ? -1 : 0;
}


x86 assembly (clang, -O0):
<add_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1090,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x1024(%rbp)
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1070 <memset@plt>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1030(%rbp)
mov    $0x20,%edi
call   1050 <NLMSG_LENGTH@plt>
mov    %eax,%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2de8(%rip),%rax
mov    (%rax),%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2dc5(%rip),%rax
mov    (%rax),%ecx
mov    0x2dac(%rip),%rax
or     (%rax),%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x1030(%rbp),%rdi
call   1080 <NLMSG_DATA@plt>
mov    %rax,-0x1038(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x1038(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1038(%rbp),%rax
movl   $0x10,0x4(%rax)
mov    0x2d5c(%rip),%rax
mov    (%rax),%ecx
mov    -0x1038(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x1038(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x1038(%rbp),%rax
movl   $0x2,0x8(%rax)
mov    -0x1038(%rbp),%rdi
call   1090 <IFA_RTA@plt>
mov    %rax,-0x1040(%rbp)
mov    0x2d31(%rip),%rax
mov    (%rax),%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x108c(%rbp)
mov    -0x1040(%rbp),%rdi
call   10a0 <RTA_DATA@plt>
mov    -0x108c(%rbp),%edi
mov    %eax,%esi
mov    -0x20(%rbp),%rdx
call   10c0 <pton@plt>
mov    %eax,-0x1024(%rbp)
mov    -0x1024(%rbp),%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1030(%rbp),%rax
mov    (%rax),%edi
call   1060 <NLMSG_ALIGN@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
add    (%rax),%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1030(%rbp),%rcx
mov    $0x1000,%eax
sub    (%rcx),%eax
mov    %eax,-0x1044(%rbp)
mov    -0x1040(%rbp),%rdi
mov    -0x1044(%rbp),%esi
call   1030 <RTA_NEXT@plt>
mov    %rax,-0x1040(%rbp)
mov    0x2c9d(%rip),%rax
mov    (%rax),%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1088(%rbp)
mov    -0x1040(%rbp),%rdi
call   10a0 <RTA_DATA@plt>
mov    -0x1088(%rbp),%edi
mov    %eax,%esi
mov    -0x20(%rbp),%rdx
call   10c0 <pton@plt>
mov    %eax,-0x1024(%rbp)
mov    -0x1024(%rbp),%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1040(%rbp),%rax
mov    (%rax),%ecx
mov    -0x1030(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x1030(%rbp),%rax
mov    %eax,-0x1058(%rbp)
mov    -0x1030(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x1050(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x1080(%rbp)
movl   $0x4,-0x107c(%rbp)
lea    -0x1058(%rbp),%rax
mov    %eax,-0x1078(%rbp)
movl   $0x1,-0x1074(%rbp)
movq   $0x0,-0x1070(%rbp)
movq   $0x0,-0x1068(%rbp)
movq   $0x0,-0x1060(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1080(%rbp),%rsi
xor    %edx,%edx
call   1040 <sendmsg@plt>
mov    %eax,-0x1084(%rbp)
mov    -0x1084(%rbp),%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
add    $0x1090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_ip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1048,%rsp
mov    %rcx,%r13
mov    %edx,%ebp
mov    %rsi,%r15
mov    %edi,0x4(%rsp)
lea    0x40(%rsp),%r12
mov    $0x1000,%ebx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1070 <memset@plt>
mov    $0x20,%edi
call   1050 <NLMSG_LENGTH@plt>
mov    %eax,0x40(%rsp)
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x48(%rsp)
mov    0x2de0(%rip),%rax
mov    0x2dc9(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x44(%rsp)
mov    %r12,%rdi
call   1080 <NLMSG_DATA@plt>
mov    %ebp,(%rax)
movl   $0x10,0x4(%rax)
mov    0x2d99(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x18(%rax)
movq   $0x0,0x10(%rax)
movl   $0x2,0x8(%rax)
mov    %rax,%rdi
call   1090 <IFA_RTA@plt>
mov    %rax,%r14
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%r14)
mov    %r14,%rdi
call   10a0 <RTA_DATA@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r13,%rdx
call   10c0 <pton@plt>
mov    %eax,%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,(%r14)
mov    0x40(%rsp),%edi
call   1060 <NLMSG_ALIGN@plt>
add    (%r14),%eax
mov    %eax,0x40(%rsp)
sub    %eax,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <RTA_NEXT@plt>
mov    %rax,%rbx
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rbx)
mov    %rbx,%rdi
call   10a0 <RTA_DATA@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r13,%rdx
call   10c0 <pton@plt>
mov    %eax,%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,(%rbx)
movslq 0x40(%rsp),%rcx
cltq
add    %rcx,%rax
mov    %eax,0x40(%rsp)
mov    %r12d,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %r15d,0x18(%rsp)
movl   $0x4,0x1c(%rsp)
lea    0x8(%rsp),%rax
mov    %eax,0x20(%rsp)
movl   $0x1,0x24(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x28(%rsp)
movq   $0x0,0x38(%rsp)
lea    0x18(%rsp),%rsi
mov    0x4(%rsp),%edi
xor    %edx,%edx
call   1040 <sendmsg@plt>
sar    $0x1f,%eax
add    $0x1048,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_nl = type { i32 }
%struct.nlmsghdr = type { i32, i32, i32 }
%struct.ifaddrmsg = type { i32, i32, i32, i64, i32 }
%struct.rtattr = type { i32, i32 }
%struct.iovec = type { i32, %struct.nlmsghdr* }
%struct.msghdr = type { i32, i32, i32, i32, i32*, %struct.iovec*, %struct.sockaddr_nl* }
@RTM_NEWADDR = global i32 0
@NLM_F_REQUEST = global i32 0
@NLM_F_ACK = global i32 0
@IFA_F_PERMANENT = global i32 0
@IFA_LOCAL = global i32 0
@IFA_ADDRESS = global i32 0
define i32 @add_ip(i32 %0, %struct.sockaddr_nl* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca %struct.sockaddr_nl*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [4096 x i8]
%10 = alloca i32
%11 = alloca %struct.nlmsghdr*
%12 = alloca %struct.ifaddrmsg*
%13 = alloca %struct.rtattr*
%14 = alloca i32
%15 = alloca %struct.iovec
%16 = alloca %struct.msghdr
%17 = alloca i32
store i32 %0, i32* %5
store %struct.sockaddr_nl* %1, %struct.sockaddr_nl** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i32 0, i32* %10
%18 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 4096)
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%21 = bitcast i8* %20 to %struct.nlmsghdr*
store %struct.nlmsghdr* %21, %struct.nlmsghdr** %11
%22 = call i32 @NLMSG_LENGTH(i32 32)
%23 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%24 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %23, i32 0, i32 0
store i32 %22, i32* %24
%25 = load i32, i32* @RTM_NEWADDR
%26 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%27 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %26, i32 0, i32 2
store i32 %25, i32* %27
%28 = load i32, i32* @NLM_F_REQUEST
%29 = load i32, i32* @NLM_F_ACK
%30 = or i32 %28, %29
%31 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%32 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %31, i32 0, i32 1
store i32 %30, i32* %32
%33 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%34 = call i64 @NLMSG_DATA(%struct.nlmsghdr* %33)
%35 = inttoptr i64 %34 to %struct.ifaddrmsg*
store %struct.ifaddrmsg* %35, %struct.ifaddrmsg** %12
%36 = load i32, i32* %7
%37 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%38 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %37, i32 0, i32 0
store i32 %36, i32* %38
%39 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%40 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %39, i32 0, i32 1
store i32 16, i32* %40
%41 = load i32, i32* @IFA_F_PERMANENT
%42 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%43 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %42, i32 0, i32 4
store i32 %41, i32* %43
%44 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%45 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %44, i32 0, i32 3
store i64 0, i64* %45
%46 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%47 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %46, i32 0, i32 2
store i32 2, i32* %47
%48 = load %struct.ifaddrmsg*, %struct.ifaddrmsg** %12
%49 = call i64 @IFA_RTA(%struct.ifaddrmsg* %48)
%50 = inttoptr i64 %49 to %struct.rtattr*
store %struct.rtattr* %50, %struct.rtattr** %13
%51 = load i32, i32* @IFA_LOCAL
%52 = load %struct.rtattr*, %struct.rtattr** %13
%53 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %52, i32 0, i32 1
store i32 %51, i32* %53
%54 = load i32, i32* %7
%55 = load %struct.rtattr*, %struct.rtattr** %13
%56 = call i32 @RTA_DATA(%struct.rtattr* %55)
%57 = load i8*, i8** %8
%58 = call i32 @pton(i32 %54, i32 %56, i8* %57)
store i32 %58, i32* %10
%59 = load i32, i32* %10
%60 = call i8* @RTA_LENGTH(i32 %59)
%61 = ptrtoint i8* %60 to i32
%62 = load %struct.rtattr*, %struct.rtattr** %13
%63 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %62, i32 0, i32 0
store i32 %61, i32* %63
%64 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%65 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %64, i32 0, i32 0
%66 = load i32, i32* %65
%67 = call i32 @NLMSG_ALIGN(i32 %66)
%68 = load %struct.rtattr*, %struct.rtattr** %13
%69 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %68, i32 0, i32 0
%70 = load i32, i32* %69
%71 = add nsw i32 %67, %70
%72 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%73 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %72, i32 0, i32 0
store i32 %71, i32* %73
%74 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%75 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %74, i32 0, i32 0
%76 = load i32, i32* %75
%77 = sub nsw i32 4096, %76
store i32 %77, i32* %14
%78 = load %struct.rtattr*, %struct.rtattr** %13
%79 = load i32, i32* %14
%80 = call i64 @RTA_NEXT(%struct.rtattr* %78, i32 %79)
%81 = inttoptr i64 %80 to %struct.rtattr*
store %struct.rtattr* %81, %struct.rtattr** %13
%82 = load i32, i32* @IFA_ADDRESS
%83 = load %struct.rtattr*, %struct.rtattr** %13
%84 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %83, i32 0, i32 1
store i32 %82, i32* %84
%85 = load i32, i32* %7
%86 = load %struct.rtattr*, %struct.rtattr** %13
%87 = call i32 @RTA_DATA(%struct.rtattr* %86)
%88 = load i8*, i8** %8
%89 = call i32 @pton(i32 %85, i32 %87, i8* %88)
store i32 %89, i32* %10
%90 = load i32, i32* %10
%91 = call i8* @RTA_LENGTH(i32 %90)
%92 = ptrtoint i8* %91 to i32
%93 = load %struct.rtattr*, %struct.rtattr** %13
%94 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %93, i32 0, i32 0
store i32 %92, i32* %94
%95 = load %struct.rtattr*, %struct.rtattr** %13
%96 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %95, i32 0, i32 0
%97 = load i32, i32* %96
%98 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%99 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %98, i32 0, i32 0
%100 = load i32, i32* %99
%101 = add nsw i32 %100, %97
store i32 %101, i32* %99
%102 = getelementptr inbounds %struct.iovec, %struct.iovec* %15, i32 0, i32 0
%103 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%104 = ptrtoint %struct.nlmsghdr* %103 to i32
store i32 %104, i32* %102
%105 = getelementptr inbounds %struct.iovec, %struct.iovec* %15, i32 0, i32 1
%106 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%107 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %106, i32 0, i32 0
%108 = load i32, i32* %107
%109 = sext i32 %108 to i64
%110 = inttoptr i64 %109 to %struct.nlmsghdr*
store %struct.nlmsghdr* %110, %struct.nlmsghdr** %105
%111 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 0
%112 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %6
%113 = ptrtoint %struct.sockaddr_nl* %112 to i32
store i32 %113, i32* %111
%114 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 1
store i32 4, i32* %114
%115 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 2
%116 = ptrtoint %struct.iovec* %15 to i32
store i32 %116, i32* %115
%117 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 3
store i32 1, i32* %117
%118 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 4
store i32* null, i32** %118
%119 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 5
store %struct.iovec* null, %struct.iovec** %119
%120 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 6
store %struct.sockaddr_nl* null, %struct.sockaddr_nl** %120
%121 = load i32, i32* %5
%122 = call i32 @sendmsg(i32 %121, %struct.msghdr* %16, i32 0)
store i32 %122, i32* %17
%123 = load i32, i32* %17
%124 = icmp slt i32 %123, 0
%125 = zext i1 %124 to i64
%126 = select i1 %124, i32 -1, i32 0
ret i32 %126
}

LLVM IR (-O2):
%struct.sockaddr_nl = type { i32 }
%struct.iovec = type { i32, %struct.nlmsghdr* }
%struct.nlmsghdr = type { i32, i32, i32 }
%struct.msghdr = type { i32, i32, i32, i32, i32*, %struct.iovec*, %struct.sockaddr_nl* }
%struct.ifaddrmsg = type { i32, i32, i32, i64, i32 }
%struct.rtattr = type { i32, i32 }
@RTM_NEWADDR = global i32 0
@NLM_F_REQUEST = global i32 0
@NLM_F_ACK = global i32 0
@IFA_F_PERMANENT = global i32 0
@IFA_LOCAL = global i32 0
@IFA_ADDRESS = global i32 0
define i32 @add_ip(i32 %0, %struct.sockaddr_nl* %1, i32 %2, i8* %3) {
%5 = alloca [4096 x i8]
%6 = alloca %struct.iovec
%7 = alloca %struct.msghdr
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 4096)
%10 = bitcast [4096 x i8]* %5 to %struct.nlmsghdr*
%11 = call i32 @NLMSG_LENGTH(i32 32)
%12 = bitcast [4096 x i8]* %5 to i32*
store i32 %11, i32* %12
%13 = load i32, i32* @RTM_NEWADDR
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 8
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
%16 = load i32, i32* @NLM_F_REQUEST
%17 = load i32, i32* @NLM_F_ACK
%18 = or i32 %17, %16
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 4
%20 = bitcast i8* %19 to i32*
store i32 %18, i32* %20
%21 = call i64 @NLMSG_DATA(%struct.nlmsghdr* %10)
%22 = inttoptr i64 %21 to %struct.ifaddrmsg*
%23 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %22, i64 0, i32 0
store i32 %2, i32* %23
%24 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %22, i64 0, i32 1
store i32 16, i32* %24
%25 = load i32, i32* @IFA_F_PERMANENT
%26 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %22, i64 0, i32 4
store i32 %25, i32* %26
%27 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %22, i64 0, i32 3
store i64 0, i64* %27
%28 = getelementptr inbounds %struct.ifaddrmsg, %struct.ifaddrmsg* %22, i64 0, i32 2
store i32 2, i32* %28
%29 = call i64 @IFA_RTA(%struct.ifaddrmsg* %22)
%30 = inttoptr i64 %29 to %struct.rtattr*
%31 = load i32, i32* @IFA_LOCAL
%32 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %30, i64 0, i32 1
store i32 %31, i32* %32
%33 = call i32 @RTA_DATA(%struct.rtattr* %30)
%34 = call i32 @pton(i32 %2, i32 %33, i8* %3)
%35 = call i8* @RTA_LENGTH(i32 %34)
%36 = ptrtoint i8* %35 to i64
%37 = trunc i64 %36 to i32
%38 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %30, i64 0, i32 0
store i32 %37, i32* %38
%39 = load i32, i32* %12
%40 = call i32 @NLMSG_ALIGN(i32 %39)
%41 = load i32, i32* %38
%42 = add nsw i32 %41, %40
store i32 %42, i32* %12
%43 = sub nsw i32 4096, %42
%44 = call i64 @RTA_NEXT(%struct.rtattr* %30, i32 %43)
%45 = inttoptr i64 %44 to %struct.rtattr*
%46 = load i32, i32* @IFA_ADDRESS
%47 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %45, i64 0, i32 1
store i32 %46, i32* %47
%48 = call i32 @RTA_DATA(%struct.rtattr* %45)
%49 = call i32 @pton(i32 %2, i32 %48, i8* %3)
%50 = call i8* @RTA_LENGTH(i32 %49)
%51 = ptrtoint i8* %50 to i64
%52 = trunc i64 %51 to i32
%53 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %45, i64 0, i32 0
store i32 %52, i32* %53
%54 = load i32, i32* %12
%55 = add nsw i32 %54, %52
store i32 %55, i32* %12
%56 = bitcast %struct.iovec* %6 to i8*
%57 = getelementptr inbounds %struct.iovec, %struct.iovec* %6, i64 0, i32 0
%58 = ptrtoint [4096 x i8]* %5 to i64
%59 = trunc i64 %58 to i32
store i32 %59, i32* %57
%60 = getelementptr inbounds %struct.iovec, %struct.iovec* %6, i64 0, i32 1
%61 = sext i32 %55 to i64
%62 = inttoptr i64 %61 to %struct.nlmsghdr*
store %struct.nlmsghdr* %62, %struct.nlmsghdr** %60
%63 = bitcast %struct.msghdr* %7 to i8*
%64 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 0
%65 = ptrtoint %struct.sockaddr_nl* %1 to i64
%66 = trunc i64 %65 to i32
store i32 %66, i32* %64
%67 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 1
store i32 4, i32* %67
%68 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 2
%69 = ptrtoint %struct.iovec* %6 to i64
%70 = trunc i64 %69 to i32
store i32 %70, i32* %68
%71 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 3
store i32 1, i32* %71
%72 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 4
%73 = bitcast i32** %72 to i8*
%74 = call i32 @sendmsg(i32 %0, %struct.msghdr* %7, i32 0)
%75 = ashr i32 %74, 31
ret i32 %75
}