#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*/ printf(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ wlan_disable(int);
scalar_t__ wlan_enabled();
void handle_wifi_onoff(char *arg) {
  char *state;
  if (arg) {
    if (!strcmp(arg, "enable")) {
      wlan_disable(0);
    } else if (!strcmp(arg, "disable")) {
      wlan_disable(1);
    } else {
      printf("unknown wifi state, ignoring: '%s'\n", arg);
      return;
    }
  }
  if (wlan_enabled()) {
    state = "enabled";
  } else {
    state = "disabled";
  }
  printf("wifi radio status: %s\n", state);
}


x86 assembly (clang, -O0):
<handle_wifi_onoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11c3 <handle_wifi_onoff+0x83>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    117c <handle_wifi_onoff+0x3c>
xor    %edi,%edi
call   1060 <wlan_disable@plt>
jmp    11be <handle_wifi_onoff+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11a4 <handle_wifi_onoff+0x64>
mov    $0x1,%edi
call   1060 <wlan_disable@plt>
jmp    11b9 <handle_wifi_onoff+0x79>
mov    -0x8(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
jmp    11ff <handle_wifi_onoff+0xbf>
jmp    11be <handle_wifi_onoff+0x7e>
jmp    11c3 <handle_wifi_onoff+0x83>
mov    $0x0,%al
call   1030 <wlan_enabled@plt>
cmp    $0x0,%rax
je     11e4 <handle_wifi_onoff+0xa4>
lea    0xe58(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11ef <handle_wifi_onoff+0xaf>
lea    0xe50(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_wifi_onoff>:
push   %rbx
test   %rdi,%rdi
je     118a <handle_wifi_onoff+0x4a>
mov    %rdi,%rbx
lea    0xeb0(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     117c <handle_wifi_onoff+0x3c>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1180 <handle_wifi_onoff+0x40>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <printf@plt>
xor    %edi,%edi
jmp    1185 <handle_wifi_onoff+0x45>
mov    $0x1,%edi
call   1060 <wlan_disable@plt>
xor    %eax,%eax
call   1030 <wlan_enabled@plt>
test   %rax,%rax
lea    0xea0(%rip),%rax
lea    0xe91(%rip),%rsi
cmove  %rax,%rsi
lea    0xe97(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"enable\00"
@.str.1 = [8 x i8] c"disable\00"
@.str.2 = [36 x i8] c"unknown wifi state, ignoring: '%s'\0A\00"
@.str.3 = [8 x i8] c"enabled\00"
@.str.4 = [9 x i8] c"disabled\00"
@.str.5 = [23 x i8] c"wifi radio status: %s\0A\00"
define void @handle_wifi_onoff(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %23
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = call i32 @wlan_disable(i32 0)
br label %22
12: ; preds = %6
%13 = load i8*, i8** %2
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @wlan_disable(i32 1)
br label %21
18: ; preds = %12
%19 = load i8*, i8** %2
%20 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %31
21: ; preds = %16
br label %22
22: ; preds = %21, %10
br label %23
23: ; preds = %22, %1
%24 = call i64 (...) @wlan_enabled()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %28
27: ; preds = %23
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %28
28: ; preds = %27, %26
%29 = load i8*, i8** %3
%30 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %18
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"enable\00"
@.str.1 = [8 x i8] c"disable\00"
@.str.2 = [36 x i8] c"unknown wifi state, ignoring: '%s'\0A\00"
@.str.3 = [8 x i8] c"enabled\00"
@.str.4 = [9 x i8] c"disabled\00"
@.str.5 = [23 x i8] c"wifi radio status: %s\0A\00"
define void @handle_wifi_onoff(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %19
11: ; preds = %6, %3
%12 = phi i32 [ 0, %3 ], [ 1, %6 ]
%13 = tail call i32 @wlan_disable(i32 %12)
br label %14
14: ; preds = %11, %1
%15 = tail call i64 (...) @wlan_enabled()
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %14, %9
ret void
}