#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*/ iwget_exit();
scalar_t__ iwget_setopt(char *, char *);
scalar_t__ iwget_test(int /*<<< orphan*/ *, char **);
int /*<<< orphan*/ stdout;
int main() {
  char *str = NULL;
  if (grideye_plugin_init_v2(2) == NULL)
    return -1;
  if (iwget_setopt("device", "wlan0") < 0)
    return -1;
  if (iwget_test(NULL, &str) < 0)
    return -1;
  if (str) {
    fprintf(stdout, "%s\n", str);
    free(str);
  }
  iwget_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   1060 <grideye_plugin_init_v2@plt>
cmp    $0x0,%rax
jne    1197 <main+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    121e <main+0xbe>
lea    0xe62(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1050 <iwget_setopt@plt>
cmp    $0x0,%rax
jge    11c0 <main+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    121e <main+0xbe>
xor    %eax,%eax
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1080 <iwget_test@plt>
cmp    $0x0,%rax
jge    11e3 <main+0x83>
movl   $0xffffffff,-0x4(%rbp)
jmp    121e <main+0xbe>
cmpq   $0x0,-0x10(%rbp)
je     1210 <main+0xb0>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe0b(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <iwget_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   1060 <grideye_plugin_init_v2@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     11dd <main+0x7d>
lea    0xe77(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1050 <iwget_setopt@plt>
test   %rax,%rax
js     11dd <main+0x7d>
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1080 <iwget_test@plt>
test   %rax,%rax
js     11dd <main+0x7d>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     11d4 <main+0x74>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe48(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <iwget_exit@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"device\00"
@.str.1 = [6 x i8] c"wlan0\00"
@stdout = global i32 0
@.str.2 = [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 @iwget_setopt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, 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 @iwget_test(i32* null, 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.2, 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 (...) @iwget_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 = [7 x i8] c"device\00"
@.str.1 = [6 x i8] c"wlan0\00"
@stdout = global i32 0
@.str.2 = [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 @iwget_setopt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp slt i64 %6, 0
br i1 %7, label %21, label %8
8: ; preds = %5
%9 = call i64 @iwget_test(i32* null, 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.2, 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 (...) @iwget_exit()
br label %21
21: ; preds = %8, %5, %0, %19
%22 = phi i32 [ 0, %19 ], [ -1, %0 ], [ -1, %5 ], [ -1, %8 ]
ret i32 %22
}