#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*/ construct_vap(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
int acl_add_mac(int radio, int vap_id, char *mac) {
  char cmd[256];
  char mac_addr[32] = {0};
  char vap_name[8] = {0};
  construct_vap(vap_name, radio, vap_id, 0);
  strcpy(mac_addr, mac);
  sprintf(cmd, "iwpriv %s addmac %s", vap_name, mac_addr);
  do {
    printf("\033[1;33;40m");
    printf(cmd);
    printf("\033[0m");
    printf("\n");
    system(cmd);
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<acl_add_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
lea    -0x138(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
lea    -0x138(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
call   1040 <construct_vap@plt>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
lea    -0x138(%rbp),%rdx
lea    -0x130(%rbp),%rcx
lea    0xe25(%rip),%rsi
call   1080 <sprintf@plt>
lea    0xe2d(%rip),%rdi
call   1060 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <printf@plt>
lea    0xe20(%rip),%rdi
call   1060 <printf@plt>
lea    0xe19(%rip),%rdi
call   1060 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acl_add_mac>:
push   %r15
push   %r14
push   %rbx
sub    $0x130,%rsp
mov    %rdx,%rbx
mov    %esi,%edx
mov    %edi,%esi
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %ecx,%ecx
call   1050 <construct_vap@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
lea    0xe51(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1080 <sprintf@plt>
lea    0xe4b(%rip),%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1070 <printf@plt>
lea    0xe42(%rip),%rdi
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"iwpriv %s addmac %s\00"
@.str.1 = [11 x i8] c"\1B[1;33;40m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @acl_add_mac(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [256 x i8]
%8 = alloca [32 x i8]
%9 = alloca [8 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%10 = bitcast [32 x i8]* %8 to i8*
%11 = bitcast [8 x i8]* %9 to i8*
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @construct_vap(i8* %12, i32 %13, i32 %14, i32 0)
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%17 = load i8*, i8** %6
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%22 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %21)
br label %23
23: ; preds = %3
%24 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%26 = call i32 @printf(i8* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%30 = call i32 @system(i8* %29)
br label %31
31: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"iwpriv %s addmac %s\00"
@.str.1 = [11 x i8] c"\1B[1;33;40m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define i32 @acl_add_mac(i32 %0, i32 %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = alloca [32 x i8]
%6 = alloca i64
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%10 = call i32 @construct_vap(i8* %9, i32 %0, i32 %1, i32 0)
%11 = call i32 @strcpy(i8* %8, i8* %2)
%12 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %8)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @printf(i8* %7)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @putchar(i32 10)
%17 = call i32 @system(i8* %7)
ret i32 0
}