#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 */

/* Variables and functions */
#define AF_INET 128
int linux_configure_arp(char const *, int);
int linux_icmp_redirect_off(char const *);
int netlink_configure_arp(unsigned int, int);
int os_configure_dmvpn(unsigned int ifindex, const char *ifname, int af) {
  int ret = 0;
  switch (af) {
  case AF_INET:
    ret |= linux_icmp_redirect_off("all");
    ret |= linux_icmp_redirect_off(ifname);
    break;
  }
  ret |= linux_configure_arp(ifname, 1);
  ret |= netlink_configure_arp(ifindex, af);
  return ret;
}


x86 assembly (clang, -O0):
<os_configure_dmvpn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    117d <os_configure_dmvpn+0x4d>
jmp    115c <os_configure_dmvpn+0x2c>
lea    0xe9d(%rip),%rdi
call   1030 <linux_icmp_redirect_off@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <linux_icmp_redirect_off@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <linux_configure_arp@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <netlink_configure_arp@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_configure_dmvpn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %rsi,%r15
mov    %edi,%r14d
xor    %ebp,%ebp
cmp    $0x80,%edx
jne    116a <os_configure_dmvpn+0x3a>
lea    0xeab(%rip),%rdi
call   1030 <linux_icmp_redirect_off@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1030 <linux_icmp_redirect_off@plt>
mov    %eax,%ebp
or     %r12d,%ebp
mov    %r15,%rdi
mov    $0x1,%esi
call   1050 <linux_configure_arp@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %r13d,%esi
call   1040 <netlink_configure_arp@plt>
or     %ebp,%eax
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"all\00"
define i32 @os_configure_dmvpn(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %6
switch i32 %8, label %17 [
i32 128, label %9
]
9: ; preds = %3
%10 = call i32 @linux_icmp_redirect_off(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %7
%12 = or i32 %11, %10
store i32 %12, i32* %7
%13 = load i8*, i8** %5
%14 = call i32 @linux_icmp_redirect_off(i8* %13)
%15 = load i32, i32* %7
%16 = or i32 %15, %14
store i32 %16, i32* %7
br label %17
17: ; preds = %3, %9
%18 = load i8*, i8** %5
%19 = call i32 @linux_configure_arp(i8* %18, i32 1)
%20 = load i32, i32* %7
%21 = or i32 %20, %19
store i32 %21, i32* %7
%22 = load i32, i32* %4
%23 = load i32, i32* %6
%24 = call i32 @netlink_configure_arp(i32 %22, i32 %23)
%25 = load i32, i32* %7
%26 = or i32 %25, %24
store i32 %26, i32* %7
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"all\00"
define i32 @os_configure_dmvpn(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 128
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = tail call i32 @linux_icmp_redirect_off(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @linux_icmp_redirect_off(i8* %1)
%8 = or i32 %7, %6
br label %9
9: ; preds = %3, %5
%10 = phi i32 [ %8, %5 ], [ 0, %3 ]
%11 = tail call i32 @linux_configure_arp(i8* %1, i32 1)
%12 = or i32 %11, %10
%13 = tail call i32 @netlink_configure_arp(i32 %0, i32 %2)
%14 = or i32 %12, %13
ret i32 %14
}