#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*/ add_command(unsigned int *, int, int);
int /*<<< orphan*/ ipfw_init(int, char **, unsigned int, char const *,
                             unsigned int);
scalar_t__ optind;
int ipfw_insert(int args, char **arglist, const char *chain,
                unsigned int rulenum) {
  unsigned int command = 0;
  add_command(&command, 0x0001U, 0x0000U);
  if (!rulenum)
    rulenum = 1;
  ipfw_init(args, arglist, command, chain, rulenum);
  optind = 0;
  return (0);
}


x86 assembly (clang, -O0):
<ipfw_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    115e <ipfw_insert+0x3e>
movl   $0x1,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <ipfw_init@plt>
mov    0x2e6c(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipfw_insert>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x1,%r12d
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
test   %ebx,%ebx
cmove  %r12d,%ebx
mov    0xc(%rsp),%edx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rcx
mov    %ebx,%r8d
call   1030 <ipfw_init@plt>
mov    0x2e72(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@optind = global i64 0
define i32 @ipfw_insert(i32 %0, i8** %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
%10 = call i32 @add_command(i32* %9, i32 1, i32 0)
%11 = load i32, i32* %8
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %4
store i32 1, i32* %8
br label %14
14: ; preds = %13, %4
%15 = load i32, i32* %5
%16 = load i8**, i8*** %6
%17 = load i32, i32* %9
%18 = load i8*, i8** %7
%19 = load i32, i32* %8
%20 = call i32 @ipfw_init(i32 %15, i8** %16, i32 %17, i8* %18, i32 %19)
store i64 0, i64* @optind
ret i32 0
}

LLVM IR (-O2):
@optind = global i64 0
define i32 @ipfw_insert(i32 %0, i8** %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%7 = call i32 @add_command(i32* %5, i32 1, i32 0)
%8 = icmp eq i32 %3, 0
%9 = select i1 %8, i32 1, i32 %3
%10 = load i32, i32* %5
%11 = call i32 @ipfw_init(i32 %0, i8** %1, i32 %10, i8* %2, i32 %9)
store i64 0, i64* @optind
ret i32 0
}