#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 construct_vap(char *, int, int, int);
int /*<<< orphan*/ nvram_get_ap_hidden(int, int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ system(char *);
int set_hidden_ssid(int radio, int mode, int vap_id) {
  char cmd[128] = {0};
  int hidden;
  char vap_name[8];
  int ret;
  nvram_get_ap_hidden(radio, &hidden, vap_id);
  ret = construct_vap(vap_name, radio, vap_id, mode);
  sprintf(cmd, "iwpriv %s hide_ssid %d", vap_name, hidden);
  do {
    printf("\033[1;33;40m");
    printf(cmd);
    printf("\033[0m");
    printf("\n");
    system(cmd);
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<set_hidden_ssid>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1070 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%edx
lea    -0x94(%rbp),%rsi
call   1030 <nvram_get_ap_hidden@plt>
lea    -0x9c(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1040 <construct_vap@plt>
mov    %eax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x9c(%rbp),%rdx
mov    -0x94(%rbp),%ecx
lea    0xe31(%rip),%rsi
call   1080 <sprintf@plt>
lea    0xe3c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1060 <printf@plt>
lea    0xe2f(%rip),%rdi
call   1060 <printf@plt>
lea    0xe28(%rip),%rdi
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_hidden_ssid>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <nvram_get_ap_hidden@plt>
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1050 <construct_vap@plt>
mov    0x4(%rsp),%ecx
lea    0xe35(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
call   1080 <sprintf@plt>
lea    0xe35(%rip),%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1070 <printf@plt>
lea    0xe2c(%rip),%rdi
call   1070 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"iwpriv %s hide_ssid %d\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 @set_hidden_ssid(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [128 x i8]
%8 = alloca i32
%9 = alloca [8 x i8]
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = bitcast [128 x i8]* %7 to i8*
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = call i32 @nvram_get_ap_hidden(i32 %12, i32* %8, i32 %13)
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%16 = load i32, i32* %4
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = call i32 @construct_vap(i8* %15, i32 %16, i32 %17, i32 %18)
store i32 %19, i32* %10
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%22 = load i32, i32* %8
%23 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %22)
br label %24
24: ; preds = %3
%25 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%27 = call i32 @printf(i8* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%31 = call i32 @system(i8* %30)
br label %32
32: ; preds = %24
ret i32 0
}

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