#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 */
int /*<<< orphan*/ DnsBindPvcRoute(int);
int /*<<< orphan*/ addStaticRoute();
int /*<<< orphan*/ printf(char *);
int setupFirewall();
int /*<<< orphan*/ setup_ipforwarding(int /*<<< orphan*/);
int startRip();
int startWanServiceDependency(int ipEnabled) {
  char vChar = -1;
  int ret = 0;
  addStaticRoute();
  if (ipEnabled) {
  } else if (ipEnabled != 1) {
    setup_ipforwarding(0);
  }
  if (startRip() == -1) {
    printf("start RIP failed !\n");
    ret = -1;
  }
  if (setupFirewall() == -1) {
    printf("execute firewall rules failed !\n");
    ret = -1;
  }
  DnsBindPvcRoute(1);
  DnsBindPvcRoute(0);
  return ret;
}


x86 assembly (clang, -O0):
<startWanServiceDependency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0xff,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1080 <addStaticRoute@plt>
cmpl   $0x0,-0x4(%rbp)
je     118c <startWanServiceDependency+0x2c>
jmp    11a2 <startWanServiceDependency+0x42>
cmpl   $0x1,-0x4(%rbp)
je     119d <startWanServiceDependency+0x3d>
xor    %edi,%edi
call   1040 <setup_ipforwarding@plt>
jmp    11a2 <startWanServiceDependency+0x42>
mov    $0x0,%al
call   1030 <startRip@plt>
cmp    $0xffffffff,%eax
jne    11c5 <startWanServiceDependency+0x65>
lea    0xe47(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0xc(%rbp)
mov    $0x0,%al
call   1060 <setupFirewall@plt>
cmp    $0xffffffff,%eax
jne    11e8 <startWanServiceDependency+0x88>
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0xc(%rbp)
mov    $0x1,%edi
call   1070 <DnsBindPvcRoute@plt>
xor    %edi,%edi
call   1070 <DnsBindPvcRoute@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startWanServiceDependency>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <addStaticRoute@plt>
test   %ebp,%ebp
jne    1179 <startWanServiceDependency+0x19>
xor    %edi,%edi
call   1050 <setup_ipforwarding@plt>
xor    %eax,%eax
call   1040 <startRip@plt>
cmp    $0xffffffff,%eax
jne    1196 <startWanServiceDependency+0x36>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1060 <setupFirewall@plt>
cmp    $0xffffffff,%eax
jne    11b3 <startWanServiceDependency+0x53>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    $0x1,%edi
call   1070 <DnsBindPvcRoute@plt>
xor    %edi,%edi
call   1070 <DnsBindPvcRoute@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"start RIP failed !\0A\00"
@.str.1 = [33 x i8] c"execute firewall rules failed !\0A\00"
define i32 @startWanServiceDependency(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 %0, i32* %2
store i8 -1, i8* %3
store i32 0, i32* %4
%5 = call i32 (...) @addStaticRoute()
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
br label %15
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @setup_ipforwarding(i32 0)
br label %14
14: ; preds = %12, %9
br label %15
15: ; preds = %14, %8
%16 = call i32 (...) @startRip()
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %20
20: ; preds = %18, %15
%21 = call i32 (...) @setupFirewall()
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %4
br label %25
25: ; preds = %23, %20
%26 = call i32 @DnsBindPvcRoute(i32 1)
%27 = call i32 @DnsBindPvcRoute(i32 0)
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@str = [32 x i8] c"execute firewall rules failed !\00"
@str.2 = [19 x i8] c"start RIP failed !\00"
define i32 @startWanServiceDependency(i32 %0) {
%2 = tail call i32 (...) @addStaticRoute()
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @setup_ipforwarding(i32 0)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (...) @startRip()
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ -1, %9 ], [ 0, %6 ]
%13 = tail call i32 (...) @setupFirewall()
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
%18 = phi i32 [ -1, %15 ], [ %12, %11 ]
%19 = tail call i32 @DnsBindPvcRoute(i32 1)
%20 = tail call i32 @DnsBindPvcRoute(i32 0)
ret i32 %18
}