#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 in_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mib_set(scalar_t__, void *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ restart_lanip();
int setLanIpAddr(struct in_addr *pIp1, struct in_addr *pMask1, int enIp2,
                 struct in_addr *pIp2, struct in_addr *pMask2, int dhcp_pool) {
  unsigned char vChar;
  if (!mib_set(0 + 1, (void *)pIp1)) {
    printf("%s\n", "Set IP-address error!");
    return -1;
  }
  if (!mib_set(0 + 2, (void *)pMask1)) {
    printf("%s\n", "Set subnet-mask error!");
    return -1;
  }
  if (enIp2 == 1)
    vChar = 1;
  else
    vChar = 0;
  if (!mib_set(0 + 12, (void *)&vChar)) {
    printf("Set secondary IP error!");
    return -1;
  }
  if (enIp2 == 1) {
    if (!mib_set(0 + 3, (void *)pIp2)) {
      printf("%s\n", "Set IP-address error!");
      return -1;
    }
    if (!mib_set(0 + 4, (void *)pMask2)) {
      printf("%s\n", "Set subnet-mask error!");
      return -1;
    }
    if (dhcp_pool == 1)
      vChar = 1;
    else
      vChar = 0;
    if (!mib_set(0 + 13, (void *)&vChar)) {
      printf("Set DHCP pool error!");
      return -1;
    }
  }
  restart_lanip();
  return 0;
}


x86 assembly (clang, -O0):
<setLanIpAddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    1187 <setLanIpAddr+0x57>
lea    0xe93(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
mov    -0x18(%rbp),%rsi
mov    $0x2,%edi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    11bf <setLanIpAddr+0x8f>
lea    0xe5b(%rip),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
cmpl   $0x1,-0x1c(%rbp)
jne    11d2 <setLanIpAddr+0xa2>
movb   $0x1,-0x35(%rbp)
jmp    11d6 <setLanIpAddr+0xa6>
movb   $0x0,-0x35(%rbp)
mov    $0xc,%edi
lea    -0x35(%rbp),%rsi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    1207 <setLanIpAddr+0xd7>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
cmpl   $0x1,-0x1c(%rbp)
jne    12ce <setLanIpAddr+0x19e>
mov    -0x28(%rbp),%rsi
mov    $0x3,%edi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    1249 <setLanIpAddr+0x119>
lea    0xdd1(%rip),%rdi
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
mov    -0x30(%rbp),%rsi
mov    $0x4,%edi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    1281 <setLanIpAddr+0x151>
lea    0xd99(%rip),%rdi
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
cmpl   $0x1,-0x34(%rbp)
jne    1294 <setLanIpAddr+0x164>
movb   $0x1,-0x35(%rbp)
jmp    1298 <setLanIpAddr+0x168>
movb   $0x0,-0x35(%rbp)
mov    $0xd,%edi
lea    -0x35(%rbp),%rsi
call   1030 <mib_set@plt>
cmp    $0x0,%eax
jne    12c9 <setLanIpAddr+0x199>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12dc <setLanIpAddr+0x1ac>
jmp    12ce <setLanIpAddr+0x19e>
mov    $0x0,%al
call   1050 <restart_lanip@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setLanIpAddr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rcx,%r12
mov    %edx,%ebx
mov    %rsi,%rbp
mov    %rdi,%rsi
mov    $0x1,%edi
call   1040 <mib_set@plt>
test   %eax,%eax
je     11e5 <setLanIpAddr+0xa5>
mov    $0x2,%edi
mov    %rbp,%rsi
call   1040 <mib_set@plt>
test   %eax,%eax
je     11ee <setLanIpAddr+0xae>
cmp    $0x1,%ebx
sete   0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    $0xc,%edi
call   1040 <mib_set@plt>
test   %eax,%eax
je     120e <setLanIpAddr+0xce>
cmp    $0x1,%ebx
jne    11da <setLanIpAddr+0x9a>
mov    $0x3,%edi
mov    %r12,%rsi
call   1040 <mib_set@plt>
test   %eax,%eax
je     11e5 <setLanIpAddr+0xa5>
mov    $0x4,%edi
mov    %r15,%rsi
call   1040 <mib_set@plt>
test   %eax,%eax
je     11ee <setLanIpAddr+0xae>
cmp    $0x1,%r14d
sete   0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    $0xd,%edi
call   1040 <mib_set@plt>
test   %eax,%eax
je     121e <setLanIpAddr+0xde>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <restart_lanip@plt>
jmp    11ff <setLanIpAddr+0xbf>
lea    0xe14(%rip),%rdi
jmp    11f5 <setLanIpAddr+0xb5>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11fa <setLanIpAddr+0xba>
lea    0xe20(%rip),%rdi
jmp    1215 <setLanIpAddr+0xd5>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [22 x i8] c"Set IP-address error!\00"
@.str.2 = [23 x i8] c"Set subnet-mask error!\00"
@.str.3 = [24 x i8] c"Set secondary IP error!\00"
@.str.4 = [21 x i8] c"Set DHCP pool error!\00"
define i32 @setLanIpAddr(%struct.in_addr* %0, %struct.in_addr* %1, i32 %2, %struct.in_addr* %3, %struct.in_addr* %4, i32 %5) {
%7 = alloca i32
%8 = alloca %struct.in_addr*
%9 = alloca %struct.in_addr*
%10 = alloca i32
%11 = alloca %struct.in_addr*
%12 = alloca %struct.in_addr*
%13 = alloca i32
%14 = alloca i8
store %struct.in_addr* %0, %struct.in_addr** %8
store %struct.in_addr* %1, %struct.in_addr** %9
store i32 %2, i32* %10
store %struct.in_addr* %3, %struct.in_addr** %11
store %struct.in_addr* %4, %struct.in_addr** %12
store i32 %5, i32* %13
%15 = load %struct.in_addr*, %struct.in_addr** %8
%16 = bitcast %struct.in_addr* %15 to i8*
%17 = call i32 @mib_set(i64 1, i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
21: ; preds = %6
%22 = load %struct.in_addr*, %struct.in_addr** %9
%23 = bitcast %struct.in_addr* %22 to i8*
%24 = call i32 @mib_set(i64 2, i8* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
28: ; preds = %21
%29 = load i32, i32* %10
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %28
store i8 1, i8* %14
br label %33
32: ; preds = %28
store i8 0, i8* %14
br label %33
33: ; preds = %32, %31
%34 = call i32 @mib_set(i64 12, i8* %14)
%35 = icmp ne i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
38: ; preds = %33
%39 = load i32, i32* %10
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %66
41: ; preds = %38
%42 = load %struct.in_addr*, %struct.in_addr** %11
%43 = bitcast %struct.in_addr* %42 to i8*
%44 = call i32 @mib_set(i64 3, i8* %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
48: ; preds = %41
%49 = load %struct.in_addr*, %struct.in_addr** %12
%50 = bitcast %struct.in_addr* %49 to i8*
%51 = call i32 @mib_set(i64 4, i8* %50)
%52 = icmp ne i32 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %48
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
55: ; preds = %48
%56 = load i32, i32* %13
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %59
58: ; preds = %55
store i8 1, i8* %14
br label %60
59: ; preds = %55
store i8 0, i8* %14
br label %60
60: ; preds = %59, %58
%61 = call i32 @mib_set(i64 13, i8* %14)
%62 = icmp ne i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %7
br label %68
65: ; preds = %60
br label %66
66: ; preds = %65, %38
%67 = call i32 (...) @restart_lanip()
store i32 0, i32* %7
br label %68
68: ; preds = %66, %63, %53, %46, %36, %26, %19
%69 = load i32, i32* %7
ret i32 %69
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@.str.1 = [22 x i8] c"Set IP-address error!\00"
@.str.2 = [23 x i8] c"Set subnet-mask error!\00"
@.str.3 = [24 x i8] c"Set secondary IP error!\00"
@.str.4 = [21 x i8] c"Set DHCP pool error!\00"
define i32 @setLanIpAddr(%struct.in_addr* %0, %struct.in_addr* %1, i32 %2, %struct.in_addr* %3, %struct.in_addr* %4, i32 %5) {
%7 = alloca i8
%8 = bitcast %struct.in_addr* %0 to i8*
%9 = tail call i32 @mib_set(i64 1, i8* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %48
13: ; preds = %6
%14 = bitcast %struct.in_addr* %1 to i8*
%15 = tail call i32 @mib_set(i64 2, i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %48
19: ; preds = %13
%20 = icmp eq i32 %2, 1
%21 = zext i1 %20 to i8
store i8 %21, i8* %7
%22 = call i32 @mib_set(i64 12, i8* %7)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %48
26: ; preds = %19
br i1 %20, label %27, label %46
27: ; preds = %26
%28 = bitcast %struct.in_addr* %3 to i8*
%29 = call i32 @mib_set(i64 3, i8* %28)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %48
33: ; preds = %27
%34 = bitcast %struct.in_addr* %4 to i8*
%35 = call i32 @mib_set(i64 4, i8* %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %48
39: ; preds = %33
%40 = icmp eq i32 %5, 1
%41 = zext i1 %40 to i8
store i8 %41, i8* %7
%42 = call i32 @mib_set(i64 13, i8* %7)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %48
46: ; preds = %39, %26
%47 = call i32 (...) @restart_lanip()
br label %48
48: ; preds = %46, %44, %37, %31, %24, %17, %11
%49 = phi i32 [ 0, %46 ], [ -1, %44 ], [ -1, %37 ], [ -1, %31 ], [ -1, %24 ], [ -1, %17 ], [ -1, %11 ]
ret i32 %49
}