#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*/ begin_definitions();
int /*<<< orphan*/ digest_definitions(int);
int /*<<< orphan*/ init();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ write_decoder(char *, char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("arguments: ./decoder_gen inst|dis intermediates/");
    return 0;
  }
  init();
  begin_definitions();
  digest_definitions(2);
  write_decoder(argv[1], argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11bc <main+0x6c>
mov    $0x0,%al
call   1050 <init@plt>
mov    $0x0,%al
call   1070 <begin_definitions@plt>
mov    $0x2,%edi
call   1060 <digest_definitions@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <write_decoder@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1180 <main+0x30>
mov    %rsi,%rbx
xor    %eax,%eax
call   1050 <init@plt>
xor    %eax,%eax
call   1070 <begin_definitions@plt>
mov    $0x2,%edi
call   1060 <digest_definitions@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1030 <write_decoder@plt>
jmp    118c <main+0x3c>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"arguments: ./decoder_gen inst|dis intermediates/\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %21
10: ; preds = %2
%11 = call i32 (...) @init()
%12 = call i32 (...) @begin_definitions()
%13 = call i32 @digest_definitions(i32 2)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @write_decoder(i8* %16, i8* %19)
store i32 0, i32* %3
br label %21
21: ; preds = %10, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [49 x i8] c"arguments: ./decoder_gen inst|dis intermediates/\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %2
%7 = tail call i32 (...) @init()
%8 = tail call i32 (...) @begin_definitions()
%9 = tail call i32 @digest_definitions(i32 2)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @write_decoder(i8* %11, i8* %13)
br label %15
15: ; preds = %6, %4
ret i32 0
}