#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 mib_chain_delete(int, int);
unsigned int mib_chain_total(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ restart_IPFilter_DMZ_MACFilter();
int ipPortFilterDel(int index) {
  unsigned int totalEntry;
  totalEntry = mib_chain_total(350 + 1);
  if (totalEntry == 0) {
    printf("Empty table!\n");
    return -1;
  }
  if (index > totalEntry || index <= 0) {
    printf("index is error!\n");
    return -1;
  }
  if (mib_chain_delete(350 + 1, index - 1) != 1) {
    printf("Delete chain record error!\n");
    return -1;
  }
  restart_IPFilter_DMZ_MACFilter();
  return 0;
}


x86 assembly (clang, -O0):
<ipPortFilterDel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x15f,%edi
call   1040 <mib_chain_total@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    117a <ipPortFilterDel+0x3a>
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e7 <ipPortFilterDel+0xa7>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
ja     1190 <ipPortFilterDel+0x50>
cmpl   $0x0,-0x8(%rbp)
jg     11a8 <ipPortFilterDel+0x68>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e7 <ipPortFilterDel+0xa7>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
mov    $0x15f,%edi
call   1030 <mib_chain_delete@plt>
cmp    $0x1,%eax
je     11d9 <ipPortFilterDel+0x99>
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e7 <ipPortFilterDel+0xa7>
mov    $0x0,%al
call   1060 <restart_IPFilter_DMZ_MACFilter@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipPortFilterDel>:
push   %rbx
mov    %edi,%ebx
mov    $0x15f,%edi
call   1050 <mib_chain_total@plt>
test   %eax,%eax
je     1178 <ipPortFilterDel+0x38>
test   %ebx,%ebx
jle    1181 <ipPortFilterDel+0x41>
cmp    %ebx,%eax
jb     1181 <ipPortFilterDel+0x41>
add    $0xffffffff,%ebx
mov    $0x15f,%edi
mov    %ebx,%esi
call   1040 <mib_chain_delete@plt>
cmp    $0x1,%eax
jne    118a <ipPortFilterDel+0x4a>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <restart_IPFilter_DMZ_MACFilter@plt>
jmp    119b <ipPortFilterDel+0x5b>
lea    0xeac(%rip),%rdi
jmp    1191 <ipPortFilterDel+0x51>
lea    0xe93(%rip),%rdi
jmp    1191 <ipPortFilterDel+0x51>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Empty table!\0A\00"
@.str.1 = [17 x i8] c"index is error!\0A\00"
@.str.2 = [28 x i8] c"Delete chain record error!\0A\00"
define i32 @ipPortFilterDel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 @mib_chain_total(i32 351)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %28
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp ugt i32 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = icmp sle i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14, %10
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %28
19: ; preds = %14
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = call i32 @mib_chain_delete(i32 351, i32 %21)
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
br label %28
26: ; preds = %19
%27 = call i32 (...) @restart_IPFilter_DMZ_MACFilter()
store i32 0, i32* %2
br label %28
28: ; preds = %26, %24, %17, %8
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@str = [27 x i8] c"Delete chain record error!\00"
@str.3 = [16 x i8] c"index is error!\00"
@str.4 = [13 x i8] c"Empty table!\00"
define i32 @ipPortFilterDel(i32 %0) {
%2 = tail call i32 @mib_chain_total(i32 351)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
br label %20
6: ; preds = %1
%7 = icmp ult i32 %2, %0
%8 = icmp slt i32 %0, 1
%9 = or i1 %8, %7
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
br label %20
12: ; preds = %6
%13 = add nsw i32 %0, -1
%14 = tail call i32 @mib_chain_delete(i32 351, i32 %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %20
18: ; preds = %12
%19 = tail call i32 (...) @restart_IPFilter_DMZ_MACFilter()
br label %20
20: ; preds = %18, %16, %10, %4
%21 = phi i32 [ -1, %4 ], [ -1, %10 ], [ -1, %16 ], [ 0, %18 ]
ret i32 %21
}