#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 */
scalar_t__ dhrystones_test(char *, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *grideye_plugin_init_v2(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char *str = NULL;
  if (argc != 2) {
    fprintf(stderr, "usage %s <dhrystones>\n", argv[0]);
    return -1;
  }
  if (grideye_plugin_init_v2(2) == NULL)
    return -1;
  if (dhrystones_test(argv[1], &str) < 0)
    return -1;
  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   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1200 <main+0xc0>
mov    $0x2,%edi
call   1040 <grideye_plugin_init_v2@plt>
cmp    $0x0,%rax
jne    11b0 <main+0x70>
movl   $0xffffffff,-0x4(%rbp)
jmp    1200 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <dhrystones_test@plt>
cmp    $0x0,%rax
jge    11d7 <main+0x97>
movl   $0xffffffff,-0x4(%rbp)
jmp    1200 <main+0xc0>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe2c(%rip),%rsi
call   1050 <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   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
movq   $0x0,(%rsp)
cmp    $0x2,%edi
jne    119f <main+0x5f>
mov    $0x2,%edi
call   1040 <grideye_plugin_init_v2@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     11bc <main+0x7c>
mov    0x8(%r14),%rdi
mov    %rsp,%rsi
call   1060 <dhrystones_test@plt>
test   %rax,%rax
js     11bc <main+0x7c>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    (%rsp),%rdx
lea    0xe8a(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
jmp    11bc <main+0x7c>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe4e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage %s <dhrystones>\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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 -1, i32* %3
br label %32
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 %32
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @dhrystones_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 %32
26: ; preds = %19
%27 = load i32, i32* @stdout
%28 = load i8*, i8** %6
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = load i8*, i8** %6
%31 = call i32 @free(i8* %30)
store i32 0, i32* %3
br label %32
32: ; preds = %26, %25, %18, %9
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage %s <dhrystones>\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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %24
10: ; preds = %2
%11 = tail call i32* @grideye_plugin_init_v2(i32 2)
%12 = icmp eq i32* %11, null
br i1 %12, label %24, label %13
13: ; preds = %10
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @dhrystones_test(i8* %15, i8** %3)
%17 = icmp slt i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %13
%19 = load i32, i32* @stdout
%20 = load i8*, i8** %3
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %3
%23 = call i32 @free(i8* %22)
br label %24
24: ; preds = %13, %10, %18, %6
%25 = phi i32 [ -1, %6 ], [ 0, %18 ], [ -1, %10 ], [ -1, %13 ]
ret i32 %25
}