#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *grideye_plugin_init_v2(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ wlan_exit();
scalar_t__ wlan_file(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *);
scalar_t__ wlan_test(int /*<<< orphan*/, char **);
int main() {
  char *str = NULL;
  if (grideye_plugin_init_v2(2) == NULL)
    return -1;
  if (wlan_file(NULL, NULL, "wlan0") < 0)
    return -1;
  if (wlan_test(0, &str) < 0)
    return -1;
  if (str) {
    fprintf(stdout, "%s\n", str);
    free(str);
  }
  wlan_exit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x2,%edi
call   1050 <grideye_plugin_init_v2@plt>
cmp    $0x0,%rax
jne    1197 <main+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    121c <main+0xbc>
xor    %eax,%eax
mov    %eax,%esi
lea    0xe5e(%rip),%rdx
mov    %rsi,%rdi
call   1060 <wlan_file@plt>
cmp    $0x0,%rax
jge    11c0 <main+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    121c <main+0xbc>
xor    %edi,%edi
lea    -0x10(%rbp),%rsi
call   1040 <wlan_test@plt>
cmp    $0x0,%rax
jge    11e1 <main+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    121c <main+0xbc>
cmpq   $0x0,-0x10(%rbp)
je     120e <main+0xae>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe06(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1080 <wlan_exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
mov    $0x2,%edi
call   1050 <grideye_plugin_init_v2@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     11da <main+0x7a>
lea    0xe77(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <wlan_file@plt>
test   %rax,%rax
js     11da <main+0x7a>
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1040 <wlan_test@plt>
test   %rax,%rax
js     11da <main+0x7a>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     11d1 <main+0x71>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <wlan_exit@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"wlan0\00"
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
%3 = call i32* @grideye_plugin_init_v2(i32 2)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %25
6: ; preds = %0
%7 = call i64 @wlan_file(i32* null, i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 -1, i32* %1
br label %25
10: ; preds = %6
%11 = call i64 @wlan_test(i32 0, i8** %2)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 -1, i32* %1
br label %25
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* @stdout
%19 = load i8*, i8** %2
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %2
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %17, %14
%24 = call i32 (...) @wlan_exit()
store i32 0, i32* %1
br label %25
25: ; preds = %23, %13, %9, %5
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [6 x i8] c"wlan0\00"
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = tail call i32* @grideye_plugin_init_v2(i32 2)
%4 = icmp eq i32* %3, null
br i1 %4, label %21, label %5
5: ; preds = %0
%6 = tail call i64 @wlan_file(i32* null, i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp slt i64 %6, 0
br i1 %7, label %21, label %8
8: ; preds = %5
%9 = call i64 @wlan_test(i32 0, i8** %1)
%10 = icmp slt i64 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = load i8*, i8** %1
%13 = icmp eq i8* %12, null
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%17 = load i8*, i8** %1
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %14, %11
%20 = call i32 (...) @wlan_exit()
br label %21
21: ; preds = %8, %5, %0, %19
%22 = phi i32 [ 0, %19 ], [ -1, %0 ], [ -1, %5 ], [ -1, %8 ]
ret i32 %22
}