#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 rtmsg {
  int rtm_family;
  int /*<<< orphan*/ rtm_type;
  int /*<<< orphan*/ rtm_scope;
};
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;
};

/* Variables and functions */
int NLMSG_ALIGN(int);
scalar_t__ NLMSG_DATA(struct nlmsghdr *);
int NLMSG_LENGTH(int);
int NLM_F_ACK;
int NLM_F_REQUEST;
scalar_t__ RTA_DATA(struct rtattr *);
int /*<<< orphan*/ RTA_GATEWAY;
void *RTA_LENGTH(int);
scalar_t__ RTA_NEXT(struct rtattr *, int);
int /*<<< orphan*/ RTA_OIF;
int /*<<< orphan*/ RTM_DELROUTE;
scalar_t__ RTM_RTA(struct rtmsg *);
int /*<<< orphan*/ RTN_UNICAST;
int /*<<< orphan*/ RT_SCOPE_UNIVERSE;
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int pton(int, scalar_t__, char const *);
int sendmsg(int, struct msghdr *, int /*<<< orphan*/);
int del_gateway(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 rtmsg));
  nl->nlmsg_type = RTM_DELROUTE;
  nl->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
  struct rtmsg *rt;
  rt = (struct rtmsg *)NLMSG_DATA(nl);
  rt->rtm_family = domain;
  rt->rtm_scope = RT_SCOPE_UNIVERSE;
  rt->rtm_type = RTN_UNICAST;
  struct rtattr *rta = (struct rtattr *)RTM_RTA(rt);
  rta->rta_type = RTA_GATEWAY;
  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 = RTA_OIF;
  rta->rta_len = RTA_LENGTH(sizeof(int));
  *((int *)RTA_DATA(rta)) = 2;
  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):
<del_gateway>:
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   1080 <memset@plt>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1030(%rbp)
mov    $0xc,%edi
call   1060 <NLMSG_LENGTH@plt>
mov    %eax,%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2df8(%rip),%rax
mov    (%rax),%ecx
mov    -0x1030(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2dbd(%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   1090 <NLMSG_DATA@plt>
mov    %rax,-0x1038(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x1038(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2d6a(%rip),%rax
mov    (%rax),%ecx
mov    -0x1038(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2d77(%rip),%rax
mov    (%rax),%ecx
mov    -0x1038(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x1038(%rbp),%rdi
call   1040 <RTM_RTA@plt>
mov    %rax,-0x1040(%rbp)
mov    0x2d61(%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    %rax,%rsi
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   1070 <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    0x2c7c(%rip),%rax
mov    (%rax),%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0x4,%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1040(%rbp),%rdi
call   10a0 <RTA_DATA@plt>
movl   $0x2,(%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   1050 <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):
<del_gateway>:
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   1080 <memset@plt>
mov    $0xc,%edi
call   1060 <NLMSG_LENGTH@plt>
mov    %eax,0x40(%rsp)
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x48(%rsp)
mov    0x2dd8(%rip),%rax
mov    0x2dc9(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x44(%rsp)
mov    %r12,%rdi
call   1090 <NLMSG_DATA@plt>
mov    %ebp,(%rax)
mov    0x2da0(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x8(%rax)
mov    0x2db4(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rax)
mov    %rax,%rdi
call   1040 <RTM_RTA@plt>
mov    %rax,%r14
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%r14)
mov    %r14,%rdi
call   10a0 <RTA_DATA@plt>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %r13,%rdx
call   10c0 <pton@plt>
mov    %eax,%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,(%r14)
mov    0x40(%rsp),%edi
call   1070 <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    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rbx)
mov    $0x4,%edi
call   10b0 <RTA_LENGTH@plt>
mov    %eax,(%rbx)
mov    %rbx,%rdi
call   10a0 <RTA_DATA@plt>
movl   $0x2,(%rax)
movslq (%rbx),%rax
movslq 0x40(%rsp),%rcx
add    %rax,%rcx
mov    %ecx,0x40(%rsp)
mov    %r12d,0x8(%rsp)
mov    %rcx,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   1050 <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.rtmsg = type { i32, i32, 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_DELROUTE = global i32 0
@NLM_F_REQUEST = global i32 0
@NLM_F_ACK = global i32 0
@RT_SCOPE_UNIVERSE = global i32 0
@RTN_UNICAST = global i32 0
@RTA_GATEWAY = global i32 0
@RTA_OIF = global i32 0
define i32 @del_gateway(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.rtmsg*
%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 12)
%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_DELROUTE
%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.rtmsg*
store %struct.rtmsg* %35, %struct.rtmsg** %12
%36 = load i32, i32* %7
%37 = load %struct.rtmsg*, %struct.rtmsg** %12
%38 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %37, i32 0, i32 0
store i32 %36, i32* %38
%39 = load i32, i32* @RT_SCOPE_UNIVERSE
%40 = load %struct.rtmsg*, %struct.rtmsg** %12
%41 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %40, i32 0, i32 2
store i32 %39, i32* %41
%42 = load i32, i32* @RTN_UNICAST
%43 = load %struct.rtmsg*, %struct.rtmsg** %12
%44 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %43, i32 0, i32 1
store i32 %42, i32* %44
%45 = load %struct.rtmsg*, %struct.rtmsg** %12
%46 = call i64 @RTM_RTA(%struct.rtmsg* %45)
%47 = inttoptr i64 %46 to %struct.rtattr*
store %struct.rtattr* %47, %struct.rtattr** %13
%48 = load i32, i32* @RTA_GATEWAY
%49 = load %struct.rtattr*, %struct.rtattr** %13
%50 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %49, i32 0, i32 1
store i32 %48, i32* %50
%51 = load i32, i32* %7
%52 = load %struct.rtattr*, %struct.rtattr** %13
%53 = call i64 @RTA_DATA(%struct.rtattr* %52)
%54 = load i8*, i8** %8
%55 = call i32 @pton(i32 %51, i64 %53, i8* %54)
store i32 %55, i32* %10
%56 = load i32, i32* %10
%57 = call i8* @RTA_LENGTH(i32 %56)
%58 = ptrtoint i8* %57 to i32
%59 = load %struct.rtattr*, %struct.rtattr** %13
%60 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %59, i32 0, i32 0
store i32 %58, i32* %60
%61 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%62 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %61, i32 0, i32 0
%63 = load i32, i32* %62
%64 = call i32 @NLMSG_ALIGN(i32 %63)
%65 = load %struct.rtattr*, %struct.rtattr** %13
%66 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %65, i32 0, i32 0
%67 = load i32, i32* %66
%68 = add nsw i32 %64, %67
%69 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%70 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %69, i32 0, i32 0
store i32 %68, i32* %70
%71 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%72 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = sub nsw i32 4096, %73
store i32 %74, i32* %14
%75 = load %struct.rtattr*, %struct.rtattr** %13
%76 = load i32, i32* %14
%77 = call i64 @RTA_NEXT(%struct.rtattr* %75, i32 %76)
%78 = inttoptr i64 %77 to %struct.rtattr*
store %struct.rtattr* %78, %struct.rtattr** %13
%79 = load i32, i32* @RTA_OIF
%80 = load %struct.rtattr*, %struct.rtattr** %13
%81 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %80, i32 0, i32 1
store i32 %79, i32* %81
%82 = call i8* @RTA_LENGTH(i32 4)
%83 = ptrtoint i8* %82 to i32
%84 = load %struct.rtattr*, %struct.rtattr** %13
%85 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %84, i32 0, i32 0
store i32 %83, i32* %85
%86 = load %struct.rtattr*, %struct.rtattr** %13
%87 = call i64 @RTA_DATA(%struct.rtattr* %86)
%88 = inttoptr i64 %87 to i32*
store i32 2, i32* %88
%89 = load %struct.rtattr*, %struct.rtattr** %13
%90 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %89, i32 0, i32 0
%91 = load i32, i32* %90
%92 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%93 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %92, i32 0, i32 0
%94 = load i32, i32* %93
%95 = add nsw i32 %94, %91
store i32 %95, i32* %93
%96 = getelementptr inbounds %struct.iovec, %struct.iovec* %15, i32 0, i32 0
%97 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%98 = ptrtoint %struct.nlmsghdr* %97 to i32
store i32 %98, i32* %96
%99 = getelementptr inbounds %struct.iovec, %struct.iovec* %15, i32 0, i32 1
%100 = load %struct.nlmsghdr*, %struct.nlmsghdr** %11
%101 = getelementptr inbounds %struct.nlmsghdr, %struct.nlmsghdr* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = sext i32 %102 to i64
%104 = inttoptr i64 %103 to %struct.nlmsghdr*
store %struct.nlmsghdr* %104, %struct.nlmsghdr** %99
%105 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 0
%106 = load %struct.sockaddr_nl*, %struct.sockaddr_nl** %6
%107 = ptrtoint %struct.sockaddr_nl* %106 to i32
store i32 %107, i32* %105
%108 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 1
store i32 4, i32* %108
%109 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 2
%110 = ptrtoint %struct.iovec* %15 to i32
store i32 %110, i32* %109
%111 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 3
store i32 1, i32* %111
%112 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 4
store i32* null, i32** %112
%113 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 5
store %struct.iovec* null, %struct.iovec** %113
%114 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %16, i32 0, i32 6
store %struct.sockaddr_nl* null, %struct.sockaddr_nl** %114
%115 = load i32, i32* %5
%116 = call i32 @sendmsg(i32 %115, %struct.msghdr* %16, i32 0)
store i32 %116, i32* %17
%117 = load i32, i32* %17
%118 = icmp slt i32 %117, 0
%119 = zext i1 %118 to i64
%120 = select i1 %118, i32 -1, i32 0
ret i32 %120
}

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.rtmsg = type { i32, i32, i32 }
%struct.rtattr = type { i32, i32 }
@RTM_DELROUTE = global i32 0
@NLM_F_REQUEST = global i32 0
@NLM_F_ACK = global i32 0
@RT_SCOPE_UNIVERSE = global i32 0
@RTN_UNICAST = global i32 0
@RTA_GATEWAY = global i32 0
@RTA_OIF = global i32 0
define i32 @del_gateway(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 12)
%12 = bitcast [4096 x i8]* %5 to i32*
store i32 %11, i32* %12
%13 = load i32, i32* @RTM_DELROUTE
%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.rtmsg*
%23 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %22, i64 0, i32 0
store i32 %2, i32* %23
%24 = load i32, i32* @RT_SCOPE_UNIVERSE
%25 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %22, i64 0, i32 2
store i32 %24, i32* %25
%26 = load i32, i32* @RTN_UNICAST
%27 = getelementptr inbounds %struct.rtmsg, %struct.rtmsg* %22, i64 0, i32 1
store i32 %26, i32* %27
%28 = call i64 @RTM_RTA(%struct.rtmsg* %22)
%29 = inttoptr i64 %28 to %struct.rtattr*
%30 = load i32, i32* @RTA_GATEWAY
%31 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %29, i64 0, i32 1
store i32 %30, i32* %31
%32 = call i64 @RTA_DATA(%struct.rtattr* %29)
%33 = call i32 @pton(i32 %2, i64 %32, i8* %3)
%34 = call i8* @RTA_LENGTH(i32 %33)
%35 = ptrtoint i8* %34 to i64
%36 = trunc i64 %35 to i32
%37 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %29, i64 0, i32 0
store i32 %36, i32* %37
%38 = load i32, i32* %12
%39 = call i32 @NLMSG_ALIGN(i32 %38)
%40 = load i32, i32* %37
%41 = add nsw i32 %40, %39
store i32 %41, i32* %12
%42 = sub nsw i32 4096, %41
%43 = call i64 @RTA_NEXT(%struct.rtattr* %29, i32 %42)
%44 = inttoptr i64 %43 to %struct.rtattr*
%45 = load i32, i32* @RTA_OIF
%46 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %44, i64 0, i32 1
store i32 %45, i32* %46
%47 = call i8* @RTA_LENGTH(i32 4)
%48 = ptrtoint i8* %47 to i64
%49 = trunc i64 %48 to i32
%50 = getelementptr inbounds %struct.rtattr, %struct.rtattr* %44, i64 0, i32 0
store i32 %49, i32* %50
%51 = call i64 @RTA_DATA(%struct.rtattr* %44)
%52 = inttoptr i64 %51 to i32*
store i32 2, i32* %52
%53 = load i32, i32* %50
%54 = load i32, i32* %12
%55 = add nsw i32 %54, %53
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
}