#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 */
struct state {
  int dummy;
};
struct scanner_token {
  int dummy;
};
struct class_t {
  int dummy;
};

/* Variables and functions */
struct class_t *class_new(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ class_print(struct state *, struct class_t *);
int /*<<< orphan*/ compile(struct state *, struct scanner_token *,
                           struct class_t *);
int /*<<< orphan*/ register_builtin_types(struct state *, struct class_t *);
int /*<<< orphan*/ run_class(struct class_t *);
struct scanner_token *scan_file(int /*<<< orphan*/);
struct scanner_token *scan_filename(char *);
struct state *state_new();
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  struct scanner_token *in = NULL;
  struct state *S = state_new();
  struct class_t *main_namespace = class_new("__main__", NULL);
  if (argc > 1)
    in = scan_filename(argv[1]);
  else
    in = scan_file(stdin);
  register_builtin_types(S, main_namespace);
  compile(S, in, main_namespace);
  class_print(S, main_namespace);
  run_class(main_namespace);
  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)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <state_new@plt>
mov    %rax,-0x20(%rbp)
lea    0xe50(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <class_new@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11dd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <scan_filename@plt>
mov    %rax,-0x18(%rbp)
jmp    11ef <main+0x6f>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
call   10a0 <scan_file@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <register_builtin_types@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <compile@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <class_print@plt>
mov    -0x28(%rbp),%rdi
call   1070 <run_class@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <state_new@plt>
mov    %rax,%r14
lea    0xe63(%rip),%rdi
xor    %esi,%esi
call   1080 <class_new@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
jl     11b7 <main+0x37>
mov    0x8(%r15),%rdi
call   1040 <scan_filename@plt>
jmp    11c5 <main+0x45>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   10a0 <scan_file@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <register_builtin_types@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <compile@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <class_print@plt>
mov    %rbx,%rdi
call   1070 <run_class@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.scanner_token = type { i32 }
%struct.state = type { i32 }
%struct.class_t = type { i32 }
@.str = [9 x i8] c"__main__\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.scanner_token*
%7 = alloca %struct.state*
%8 = alloca %struct.class_t*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.scanner_token* null, %struct.scanner_token** %6
%9 = call %struct.state* (...) @state_new()
store %struct.state* %9, %struct.state** %7
%10 = call %struct.class_t* @class_new(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* null)
store %struct.class_t* %10, %struct.class_t** %8
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call %struct.scanner_token* @scan_filename(i8* %16)
store %struct.scanner_token* %17, %struct.scanner_token** %6
br label %21
18: ; preds = %2
%19 = load i32, i32* @stdin
%20 = call %struct.scanner_token* @scan_file(i32 %19)
store %struct.scanner_token* %20, %struct.scanner_token** %6
br label %21
21: ; preds = %18, %13
%22 = load %struct.state*, %struct.state** %7
%23 = load %struct.class_t*, %struct.class_t** %8
%24 = call i32 @register_builtin_types(%struct.state* %22, %struct.class_t* %23)
%25 = load %struct.state*, %struct.state** %7
%26 = load %struct.scanner_token*, %struct.scanner_token** %6
%27 = load %struct.class_t*, %struct.class_t** %8
%28 = call i32 @compile(%struct.state* %25, %struct.scanner_token* %26, %struct.class_t* %27)
%29 = load %struct.state*, %struct.state** %7
%30 = load %struct.class_t*, %struct.class_t** %8
%31 = call i32 @class_print(%struct.state* %29, %struct.class_t* %30)
%32 = load %struct.class_t*, %struct.class_t** %8
%33 = call i32 @run_class(%struct.class_t* %32)
ret i32 0
}

LLVM IR (-O2):
%struct.scanner_token = type { i32 }
%struct.state = type { i32 }
%struct.class_t = type { i32 }
@.str = [9 x i8] c"__main__\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call %struct.state* (...) @state_new()
%4 = tail call %struct.class_t* @class_new(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* null)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call %struct.scanner_token* @scan_filename(i8* %8)
br label %13
10: ; preds = %2
%11 = load i32, i32* @stdin
%12 = tail call %struct.scanner_token* @scan_file(i32 %11)
br label %13
13: ; preds = %10, %6
%14 = phi %struct.scanner_token* [ %9, %6 ], [ %12, %10 ]
%15 = tail call i32 @register_builtin_types(%struct.state* %3, %struct.class_t* %4)
%16 = tail call i32 @compile(%struct.state* %3, %struct.scanner_token* %14, %struct.class_t* %4)
%17 = tail call i32 @class_print(%struct.state* %3, %struct.class_t* %4)
%18 = tail call i32 @run_class(%struct.class_t* %4)
ret i32 0
}