#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 atoi(char *);
int /*<<< orphan*/ ezplib_get_attr_val(char *, int /*<<< orphan*/, char *,
                                       char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
int set_sta_mac_repeater(int radio) {
  char buf_addrmode[32];
  char buf_repeater[32];
  int addrmode;
  int mac_repeater;
  char mac_repeater_s[32];
  char addrmode_s[32];
  char cmd[128];
  char TempBuf_opmode[32];
  if (!strcmp(TempBuf_opmode, "wisp0")) {
    fprintf(stderr,
            "MAC Repeater setting is not needed in WISP Mode,disable it.\n");
    sprintf(cmd, "iwpriv apclii0 set MACRepeaterEn=0");
    do {
      printf("\033[1;33;40m");
      printf(cmd);
      printf("\033[0m");
      printf("\n");
      system(cmd);
    } while (0);
    return 0;
  }
  ezplib_get_attr_val("wl0_apcli_rule", 0, "addrmode", buf_addrmode, 32, 0);
  strcpy(addrmode_s, buf_addrmode);
  addrmode = atoi(addrmode_s);
  ezplib_get_attr_val("wl0_apcli_rule", 0, "macrepeater", buf_repeater, 32, 0);
  strcpy(mac_repeater_s, buf_repeater);
  mac_repeater = atoi(mac_repeater_s);
  if (0 == addrmode) {
    if (1 == mac_repeater) {
      sprintf(cmd, "iwpriv apclii0 set MACRepeaterEn=%d", 1);
    } else {
      sprintf(cmd, "iwpriv apclii0 set MACRepeaterEn=%d", 0);
    }
  } else {
    sprintf(cmd, "iwpriv apclii0 set MACRepeaterEn=%d", 0);
  }
  do {
    printf("\033[1;33;40m");
    printf(cmd);
    printf("\033[0m");
    printf("\n");
    system(cmd);
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<set_sta_mac_repeater>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x140(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    121c <set_sta_mac_repeater+0x9c>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1080 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    0xe8b(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1060 <printf@plt>
lea    0xe7e(%rip),%rdi
call   1060 <printf@plt>
lea    0xe42(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    134d <set_sta_mac_repeater+0x1cd>
lea    -0x30(%rbp),%rcx
lea    0xe4f(%rip),%rdi
xor    %r9d,%r9d
lea    0xe54(%rip),%rdx
mov    $0x20,%r8d
mov    %r9d,%esi
call   1030 <ezplib_get_attr_val@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rcx
lea    0xe0d(%rip),%rdi
xor    %r9d,%r9d
lea    0xe1b(%rip),%rdx
mov    $0x20,%r8d
mov    %r9d,%esi
call   1030 <ezplib_get_attr_val@plt>
lea    -0x80(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x80(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x58(%rbp)
xor    %eax,%eax
cmp    -0x54(%rbp),%eax
jne    12ee <set_sta_mac_repeater+0x16e>
mov    $0x1,%eax
cmp    -0x58(%rbp),%eax
jne    12d2 <set_sta_mac_repeater+0x152>
lea    -0x120(%rbp),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   10a0 <sprintf@plt>
jmp    12e9 <set_sta_mac_repeater+0x169>
lea    -0x120(%rbp),%rdi
lea    0xdba(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   10a0 <sprintf@plt>
jmp    1305 <set_sta_mac_repeater+0x185>
lea    -0x120(%rbp),%rdi
lea    0xd9e(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   10a0 <sprintf@plt>
jmp    130a <set_sta_mac_repeater+0x18a>
lea    0xd55(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1060 <printf@plt>
lea    0xd48(%rip),%rdi
call   1060 <printf@plt>
lea    0xd0c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x120(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_sta_mac_repeater>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x120,%rsp
mov    $0x70736977,%eax
xor    (%rsp),%eax
movzwl 0x4(%rsp),%ecx
xor    $0x30,%ecx
or     %eax,%ecx
je     1267 <set_sta_mac_repeater+0xe7>
lea    0xec8(%rip),%r14
lea    0xed0(%rip),%rdx
lea    0x100(%rsp),%r15
xor    %r12d,%r12d
mov    %r14,%rdi
xor    %esi,%esi
mov    %r15,%rcx
mov    $0x20,%r8d
xor    %r9d,%r9d
call   1030 <ezplib_get_attr_val@plt>
lea    0xc0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
lea    0xe94(%rip),%rdx
lea    0xe0(%rsp),%rbp
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbp,%rcx
mov    $0x20,%r8d
xor    %r9d,%r9d
call   1030 <ezplib_get_attr_val@plt>
lea    0x20(%rsp),%rdi
mov    %rbp,%rsi
call   1050 <strcpy@plt>
test   %ebx,%ebx
jne    123d <set_sta_mac_repeater+0xbd>
lea    0x20(%rsp),%rdi
call   1090 <atoi@plt>
xor    %r12d,%r12d
cmp    $0x1,%eax
sete   %r12b
lea    0xe56(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xe09(%rip),%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
jmp    12ad <set_sta_mac_repeater+0x12d>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
call   1080 <fprintf@plt>
movups 0xdc0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xdc4(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movl   $0x303d6e,0x5f(%rsp)
lea    0xdc3(%rip),%rdi
call   1070 <printf@plt>
lea    0x40(%rsp),%rdi
call   1070 <printf@plt>
lea    0xdb8(%rip),%rdi
call   1070 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0x40(%rsp),%rdi
call   1060 <system@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"wisp0\00"
@stderr = global i32 0
@.str.1 = [61 x i8] c"MAC Repeater setting is not needed in WISP Mode,disable it.\0A\00"
@.str.2 = [35 x i8] c"iwpriv apclii0 set MACRepeaterEn=0\00"
@.str.3 = [11 x i8] c"\1B[1;33;40m\00"
@.str.4 = [5 x i8] c"\1B[0m\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [15 x i8] c"wl0_apcli_rule\00"
@.str.7 = [9 x i8] c"addrmode\00"
@.str.8 = [12 x i8] c"macrepeater\00"
@.str.9 = [36 x i8] c"iwpriv apclii0 set MACRepeaterEn=%d\00"
define i32 @set_sta_mac_repeater(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca [32 x i8]
%9 = alloca [32 x i8]
%10 = alloca [128 x i8]
%11 = alloca [32 x i8]
store i32 %0, i32* %3
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %29, label %15
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %15
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%23 = call i32 @printf(i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%27 = call i32 @system(i8* %26)
br label %28
28: ; preds = %20
store i32 0, i32* %2
br label %69
29: ; preds = %1
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%31 = call i32 @ezplib_get_attr_val(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %30, i32 32, i32 0)
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%34 = call i32 @strcpy(i8* %32, i8* %33)
%35 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %6
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%38 = call i32 @ezplib_get_attr_val(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %37, i32 32, i32 0)
%39 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%40 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%41 = call i32 @strcpy(i8* %39, i8* %40)
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %7
%44 = load i32, i32* %6
%45 = icmp eq i32 0, %44
br i1 %45, label %46, label %56
46: ; preds = %29
%47 = load i32, i32* %7
%48 = icmp eq i32 1, %47
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %50, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %55
52: ; preds = %46
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %53, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 0)
br label %55
55: ; preds = %52, %49
br label %59
56: ; preds = %29
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* %57, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 0)
br label %59
59: ; preds = %56, %55
br label %60
60: ; preds = %59
%61 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%62 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%63 = call i32 @printf(i8* %62)
%64 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%65 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%66 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%67 = call i32 @system(i8* %66)
br label %68
68: ; preds = %60
store i32 0, i32* %2
br label %69
69: ; preds = %68, %28
%70 = load i32, i32* %2
ret i32 %70
}

LLVM IR (-O2):
@.str = [6 x i8] c"wisp0\00"
@stderr = global i32 0
@.str.1 = [61 x i8] c"MAC Repeater setting is not needed in WISP Mode,disable it.\0A\00"
@.str.2 = [35 x i8] c"iwpriv apclii0 set MACRepeaterEn=0\00"
@.str.3 = [11 x i8] c"\1B[1;33;40m\00"
@.str.4 = [5 x i8] c"\1B[0m\00"
@.str.6 = [15 x i8] c"wl0_apcli_rule\00"
@.str.7 = [9 x i8] c"addrmode\00"
@.str.8 = [12 x i8] c"macrepeater\00"
@.str.9 = [36 x i8] c"iwpriv apclii0 set MACRepeaterEn=%d\00"
define i32 @set_sta_mac_repeater(i32 %0) {
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = alloca [128 x i8]
%7 = alloca [32 x i8]
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%14 = call i32 @bcmp(i8* dereferenceable(6) %13, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 6)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @printf(i8* %12)
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 @putchar(i32 10)
br label %41
23: ; preds = %1
%24 = call i32 @ezplib_get_attr_val(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %8, i32 32, i32 0)
%25 = call i32 @strcpy(i8* %11, i8* %8)
%26 = call i32 @atoi(i8* %11)
%27 = call i32 @ezplib_get_attr_val(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %9, i32 32, i32 0)
%28 = call i32 @strcpy(i8* %10, i8* %9)
%29 = icmp eq i32 %26, 0
br i1 %29, label %30, label %34
30: ; preds = %23
%31 = call i32 @atoi(i8* %10)
%32 = icmp eq i32 %31, 1
%33 = zext i1 %32 to i32
br label %34
34: ; preds = %23, %30
%35 = phi i32 [ %33, %30 ], [ 0, %23 ]
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 %35)
%37 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 @printf(i8* %12)
%39 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 @putchar(i32 10)
br label %41
41: ; preds = %34, %16
%42 = call i32 @system(i8* %12)
ret i32 0
}