#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*/ do_iptables_cmd(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
void fw_del_allow_mac(char *ip, char *mac) {
  char cmd[512];
  sprintf(cmd,
          "-t nat -D "
          "FW_ALLOW_MAC"
          " -m mac --mac-source %s -j ACCEPT",
          mac);
  do_iptables_cmd(cmd);
  sprintf(cmd,
          "-t mangle -D "
          "FW_USER_OUT"
          "  -p all -s %s -m mac --mac-source %s -j MARK --set-mark 110",
          ip, mac);
  do_iptables_cmd(cmd);
  sprintf(cmd,
          "-t mangle -D "
          "FW_USER_IN"
          "  -d %s -j ACCEPT",
          ip);
  do_iptables_cmd(cmd);
}


x86 assembly (clang, -O0):
<fw_del_allow_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1030 <do_iptables_cmd@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1030 <do_iptables_cmd@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xefa(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1030 <do_iptables_cmd@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fw_del_allow_mac>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xec7(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <do_iptables_cmd@plt>
lea    0xee0(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <do_iptables_cmd@plt>
lea    0xf16(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1030 <do_iptables_cmd@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [56 x i8] c"-t nat -D FW_ALLOW_MAC -m mac --mac-source %s -j ACCEPT\00"
@.str.1 = [85 x i8] c"-t mangle -D FW_USER_OUT -p all -s %s -m mac --mac-source %s -j MARK --set-mark 110\00"
@.str.2 = [41 x i8] c"-t mangle -D FW_USER_IN -d %s -j ACCEPT\00"
define void @fw_del_allow_mac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [512 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = call i32 @do_iptables_cmd(i8* %9)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%16 = call i32 @do_iptables_cmd(i8* %15)
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%18 = load i8*, i8** %3
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%21 = call i32 @do_iptables_cmd(i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"-t nat -D FW_ALLOW_MAC -m mac --mac-source %s -j ACCEPT\00"
@.str.1 = [85 x i8] c"-t mangle -D FW_USER_OUT -p all -s %s -m mac --mac-source %s -j MARK --set-mark 110\00"
@.str.2 = [41 x i8] c"-t mangle -D FW_USER_IN -d %s -j ACCEPT\00"
define void @fw_del_allow_mac(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i32 @do_iptables_cmd(i8* %4)
%7 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%8 = call i32 @do_iptables_cmd(i8* %4)
%9 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%10 = call i32 @do_iptables_cmd(i8* %4)
ret void
}