#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 */
typedef int /*<<< orphan*/ band;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ set_24g_led();
int /*<<< orphan*/ set_5g_led();
void wifi_status_check() {
  FILE *fp;
  char band[16];
  memset(band, '\0', sizeof(band));
  fp = popen("sysconf get wl_band", "r");
  fread(band, sizeof(char), sizeof(band), fp);
  if (band[1] == '5') {
    set_5g_led();
  } else {
    set_24g_led();
  }
  pclose(fp);
}


x86 assembly (clang, -O0):
<wifi_status_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    0xe81(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10,%edx
call   1030 <fread@plt>
movsbl -0x1f(%rbp),%eax
cmp    $0x35,%eax
jne    11bf <wifi_status_check+0x5f>
mov    $0x0,%al
call   1040 <set_5g_led@plt>
jmp    11c6 <wifi_status_check+0x66>
mov    $0x0,%al
call   1070 <set_24g_led@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wifi_status_check>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    0xe80(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
cmpb   $0x35,0x1(%rsp)
jne    11b4 <wifi_status_check+0x54>
xor    %eax,%eax
call   1040 <set_5g_led@plt>
jmp    11bb <wifi_status_check+0x5b>
xor    %eax,%eax
call   1070 <set_24g_led@plt>
mov    %rbx,%rdi
call   1050 <pclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"sysconf get wl_band\00"
@.str.1 = [2 x i8] c"r\00"
define void @wifi_status_check() {
%1 = alloca i32*
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i8 signext 0, i32 16)
%5 = call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %1
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = load i32*, i32** %1
%8 = call i32 @fread(i8* %6, i32 1, i32 16, i32* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 53
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (...) @set_5g_led()
br label %17
15: ; preds = %0
%16 = call i32 (...) @set_24g_led()
br label %17
17: ; preds = %15, %13
%18 = load i32*, i32** %1
%19 = call i32 @pclose(i32* %18)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"sysconf get wl_band\00"
@.str.1 = [2 x i8] c"r\00"
define void @wifi_status_check() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i8 signext 0, i32 16)
%4 = call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @fread(i8* %2, i32 1, i32 16, i32* %4)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 53
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @set_5g_led()
br label %13
11: ; preds = %0
%12 = call i32 (...) @set_24g_led()
br label %13
13: ; preds = %11, %9
%14 = call i32 @pclose(i32* %4)
ret void
}