#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 registerFileFormat(void *, char const *, char const **, int);
int registerImportFunc(void *, char const *, char *);
int initPlugin(void *handle) {
  const char *name = "Hookie AM20 Activity Meter";
  const char *exts[1] = {".DAT"};
  int err;
  err = registerFileFormat(handle, name, exts, 1);
  if (!err)
    err = registerImportFunc(handle, name, "readFile");
  return err;
}


x86 assembly (clang, -O0):
<initPlugin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <registerFileFormat@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    117c <initPlugin+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdx
call   1030 <registerImportFunc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initPlugin>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xeec(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xec5(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    $0x1,%ecx
call   1040 <registerFileFormat@plt>
test   %eax,%eax
jne    1164 <initPlugin+0x44>
lea    0xeab(%rip),%rsi
lea    0xec4(%rip),%rdx
mov    %rbx,%rdi
call   1030 <registerImportFunc@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Hookie AM20 Activity Meter\00"
@.str.1 = [5 x i8] c".DAT\00"
@__const.initPlugin.exts = [1 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [9 x i8] c"readFile\00"
define i32 @initPlugin(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [1 x i8*]
%5 = alloca i32
store i8* %0, i8** %2
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = bitcast [1 x i8*]* %4 to i8*
%7 = load i8*, i8** %2
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
%10 = call i32 @registerFileFormat(i8* %7, i8* %8, i8** %9, i32 1)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = load i8*, i8** %3
%16 = call i32 @registerImportFunc(i8* %14, i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i32 %16, i32* %5
br label %17
17: ; preds = %13, %1
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
@.str = [27 x i8] c"Hookie AM20 Activity Meter\00"
@.str.1 = [5 x i8] c".DAT\00"
@.str.2 = [9 x i8] c"readFile\00"
define i32 @initPlugin(i8* %0) {
%2 = alloca [1 x i8*]
%3 = bitcast [1 x i8*]* %2 to i8*
%4 = bitcast [1 x i8*]* %2 to i64*
store i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64* %4
%5 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
%6 = call i32 @registerFileFormat(i8* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %5, i32 1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @registerImportFunc(i8* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = phi i32 [ %6, %1 ], [ %9, %8 ]
ret i32 %11
}