#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*/ airport_exit();
scalar_t__ airport_test(int /*<<< orphan*/, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *grideye_plugin_init_v2(int);
int /*<<< orphan*/ stdout;
int main() {
  char *str = NULL;
  if (grideye_plugin_init_v2(2) == NULL)
    return -1;
  if (airport_test(0, &str) < 0)
    return -1;
  if (str) {
    fprintf(stdout, "%s\n", str);
    free(str);
  }
  airport_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    1187 <main+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <main+0x93>
xor    %edi,%edi
lea    -0x10(%rbp),%rsi
call   1070 <airport_test@plt>
cmp    $0x0,%rax
jge    11a8 <main+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <main+0x93>
cmpq   $0x0,-0x10(%rbp)
je     11d5 <main+0x85>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe39(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <airport_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     11b5 <main+0x65>
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1070 <airport_test@plt>
test   %rax,%rax
js     11b5 <main+0x65>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     11ac <main+0x5c>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <airport_exit@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [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 %21
6: ; preds = %0
%7 = call i64 @airport_test(i32 0, i8** %2)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 -1, i32* %1
br label %21
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i32, i32* @stdout
%15 = load i8*, i8** %2
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %13, %10
%20 = call i32 (...) @airport_exit()
store i32 0, i32* %1
br label %21
21: ; preds = %19, %9, %5
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [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 %18, label %5
5: ; preds = %0
%6 = call i64 @airport_test(i32 0, i8** %1)
%7 = icmp slt i64 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %5
%9 = load i8*, i8** %1
%10 = icmp eq i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%14 = load i8*, i8** %1
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %11, %8
%17 = call i32 (...) @airport_exit()
br label %18
18: ; preds = %5, %0, %16
%19 = phi i32 [ 0, %16 ], [ -1, %0 ], [ -1, %5 ]
ret i32 %19
}