#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);
scalar_t__ http_test(char *, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char *str = NULL;
  if (argc != 2) {
    fprintf(stderr, "usage %s <host>\n", argv[0]);
    return -1;
  }
  if (grideye_plugin_init_v2(2) == NULL)
    return -1;
  if (http_test(argv[1], &str) < 0)
    return -1;
  if (str) {
    fprintf(stdout, "%s\n", str);
    free(str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1190 <main+0x50>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe81(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <main+0xcb>
mov    $0x2,%edi
call   1050 <grideye_plugin_init_v2@plt>
cmp    $0x0,%rax
jne    11b0 <main+0x70>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <main+0xcb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <http_test@plt>
cmp    $0x0,%rax
jge    11d7 <main+0x97>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <main+0xcb>
cmpq   $0x0,-0x18(%rbp)
je     1204 <main+0xc4>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe1b(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
movq   $0x0,(%rsp)
cmp    $0x2,%edi
jne    11a3 <main+0x63>
mov    $0x2,%edi
call   1050 <grideye_plugin_init_v2@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     11c0 <main+0x80>
mov    0x8(%rbx),%rdi
mov    %rsp,%rsi
call   1040 <http_test@plt>
test   %rax,%rax
js     11c0 <main+0x80>
mov    (%rsp),%rdx
xor    %ebp,%ebp
test   %rdx,%rdx
je     11c0 <main+0x80>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
jmp    11c0 <main+0x80>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe4a(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"usage %s <host>\0A\00"
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 -1, i32* %3
br label %36
15: ; preds = %2
%16 = call i32* @grideye_plugin_init_v2(i32 2)
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 -1, i32* %3
br label %36
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @http_test(i8* %22, i8** %6)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 -1, i32* %3
br label %36
26: ; preds = %19
%27 = load i8*, i8** %6
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i32, i32* @stdout
%31 = load i8*, i8** %6
%32 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %6
%34 = call i32 @free(i8* %33)
br label %35
35: ; preds = %29, %26
store i32 0, i32* %3
br label %36
36: ; preds = %35, %25, %18, %9
%37 = load i32, i32* %3
ret i32 %37
}

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