#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ addfile(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ compile();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ print_accessor_header(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_accessor_table(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_accessors(int /*<<< orphan*/);
int /*<<< orphan*/ print_operator_header(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_operator_table(int /*<<< orphan*/ *);
int /*<<< orphan*/ *safeopen(char *, char *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc == 1) {
    compile();
    print_accessors(stdout);
    return 0;
  }
  FILE *source = safeopen("datagen.c", "w");
  FILE *header = safeopen("datagen.h", "w");
  if (!source || !header)
    (fprintf(stderr, "failed to open datagen.c and/or datagen.h for writing\n"),
     exit(1));
  fprintf(source, "/* Generated file.\n   Created by dataparser contains "
                  "reflection data */\n\n");
  fprintf(source, "#define COMPILE_DATAGEN\n");
  fprintf(source, "#include <data/data.h>\n");
  fprintf(source, "#include \"datagen.h\"\n\n");
  int i;
  for (i = 1; i < argc; i++)
    addfile(argv[i], source);
  print_operator_table(source);
  print_accessor_table(source);
  fprintf(header, "/* Generated file.\n   To be included if direct access "
                  "to data reflection data is required */\n\n");
  print_operator_header(header);
  print_accessor_header(header);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11e1 <main+0x41>
mov    $0x0,%al
call   1030 <compile@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
call   1080 <print_accessors@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f6 <main+0x156>
lea    0xe18(%rip),%rdi
lea    0xe1b(%rip),%rsi
call   1060 <safeopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe0d(%rip),%rdi
lea    0xe04(%rip),%rsi
call   1060 <safeopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1225 <main+0x85>
cmpq   $0x0,-0x20(%rbp)
jne    1245 <main+0xa5>
mov    0x2db4(%rip),%rax
mov    (%rax),%rdi
lea    0xde0(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12bb <main+0x11b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <addfile@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    128c <main+0xec>
mov    -0x18(%rbp),%rdi
call   1070 <print_operator_table@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <print_accessor_table@plt>
mov    -0x20(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   10a0 <print_operator_header@plt>
mov    -0x20(%rbp),%rdi
call   1090 <print_accessor_header@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    11ca <main+0x2a>
xor    %eax,%eax
call   1030 <compile@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   1070 <print_accessors@plt>
jmp    12ce <main+0x12e>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xe29(%rip),%rdi
lea    0xe2c(%rip),%r14
mov    %r14,%rsi
call   1050 <safeopen@plt>
mov    %rax,%r13
lea    0xe1c(%rip),%rdi
mov    %r14,%rsi
call   1050 <safeopen@plt>
test   %r13,%r13
je     12df <main+0x13f>
mov    %rax,%r14
test   %rax,%rax
je     12df <main+0x13f>
lea    0xe39(%rip),%rdi
mov    $0x1,%ebp
mov    $0x49,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
lea    0xe65(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
lea    0xe65(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
lea    0xe64(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
cmp    $0x2,%r12d
jl     1295 <main+0xf5>
mov    %r12d,%ebx
nop
mov    (%r15,%rbp,8),%rdi
mov    %r13,%rsi
call   1040 <addfile@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1280 <main+0xe0>
mov    %r13,%rdi
call   1060 <print_operator_table@plt>
mov    %r13,%rdi
call   10c0 <print_accessor_table@plt>
lea    0xe33(%rip),%rdi
mov    $0x5e,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r14,%rdi
call   1090 <print_operator_header@plt>
mov    %r14,%rdi
call   1080 <print_accessor_header@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cfa(%rip),%rax
mov    (%rax),%rcx
lea    0xd26(%rip),%rdi
mov    $0x36,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [10 x i8] c"datagen.c\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"datagen.h\00"
@stderr = global i32* null
@.str.3 = [55 x i8] c"failed to open datagen.c and/or datagen.h for writing\0A\00"
@.str.4 = [74 x i8] c"/* Generated file.\0A Created by dataparser contains reflection data */\0A\0A\00"
@.str.5 = [25 x i8] c"#define COMPILE_DATAGEN\0A\00"
@.str.6 = [24 x i8] c"#include <data/data.h>\0A\00"
@.str.7 = [23 x i8] c"#include \22datagen.h\22\0A\0A\00"
@.str.8 = [95 x i8] c"/* Generated file.\0A To be included if direct access to data reflection data is required */\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = call i32 (...) @compile()
%13 = load i32, i32* @stdout
%14 = call i32 @print_accessors(i32 %13)
store i32 0, i32* %3
br label %62
15: ; preds = %2
%16 = call i32* @safeopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = call i32* @safeopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %7
%18 = load i32*, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32*, i32** %7
%22 = icmp ne i32* %21, null
br i1 %22, label %27, label %23
23: ; preds = %20, %15
%24 = load i32*, i32** @stderr
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %20
%28 = load i32*, i32** %6
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32*, i32** %6
%31 = call i32 @fprintf(i32* %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32*, i32** %6
%33 = call i32 @fprintf(i32* %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32*, i32** %6
%35 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %8
br label %36
36: ; preds = %48, %27
%37 = load i32, i32* %8
%38 = load i32, i32* %4
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = load i8**, i8*** %5
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = load i32*, i32** %6
%47 = call i32 @addfile(i8* %45, i32* %46)
br label %48
48: ; preds = %40
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %36
51: ; preds = %36
%52 = load i32*, i32** %6
%53 = call i32 @print_operator_table(i32* %52)
%54 = load i32*, i32** %6
%55 = call i32 @print_accessor_table(i32* %54)
%56 = load i32*, i32** %7
%57 = call i32 @fprintf(i32* %56, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.8, i64 0, i64 0))
%58 = load i32*, i32** %7
%59 = call i32 @print_operator_header(i32* %58)
%60 = load i32*, i32** %7
%61 = call i32 @print_accessor_header(i32* %60)
store i32 0, i32* %3
br label %62
62: ; preds = %51, %11
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [10 x i8] c"datagen.c\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"datagen.h\00"
@stderr = global i32* null
@.str.3 = [55 x i8] c"failed to open datagen.c and/or datagen.h for writing\0A\00"
@.str.4 = [74 x i8] c"/* Generated file.\0A Created by dataparser contains reflection data */\0A\0A\00"
@.str.5 = [25 x i8] c"#define COMPILE_DATAGEN\0A\00"
@.str.6 = [24 x i8] c"#include <data/data.h>\0A\00"
@.str.7 = [23 x i8] c"#include \22datagen.h\22\0A\0A\00"
@.str.8 = [95 x i8] c"/* Generated file.\0A To be included if direct access to data reflection data is required */\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (...) @compile()
%6 = load i32, i32* @stdout
%7 = tail call i32 @print_accessors(i32 %6)
br label %39
8: ; preds = %2
%9 = tail call i32* @safeopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @safeopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32* %9, null
%12 = icmp ne i32* %10, null
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %18, label %14
14: ; preds = %8
%15 = load i32*, i32** @stderr
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i64 54, i64 1, i32* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %8
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0), i64 73, i64 1, i32* %9)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i64 24, i64 1, i32* %9)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %9)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i64 22, i64 1, i32* %9)
%23 = icmp sgt i32 %0, 1
br i1 %23, label %24, label %33
24: ; preds = %18
%25 = zext i32 %0 to i64
br label %26
26: ; preds = %24, %26
%27 = phi i64 [ 1, %24 ], [ %31, %26 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 @addfile(i8* %29, i32* %9)
%31 = add nuw nsw i64 %27, 1
%32 = icmp eq i64 %31, %25
br i1 %32, label %33, label %26
33: ; preds = %26, %18
%34 = tail call i32 @print_operator_table(i32* %9)
%35 = tail call i32 @print_accessor_table(i32* %9)
%36 = tail call i64 @fwrite(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.8, i64 0, i64 0), i64 94, i64 1, i32* %10)
%37 = tail call i32 @print_operator_header(i32* %10)
%38 = tail call i32 @print_accessor_header(i32* %10)
br label %39
39: ; preds = %33, %4
ret i32 0
}