// File: /workspace/github_c_makefile_star2_O2/orangeduck[P]mpc/examples/smallc.c
// Function: main
int main(int argc, char **argv) {

  mpc_parser_t* Ident     = mpc_new("ident");
  mpc_parser_t* Number    = mpc_new("number");
  mpc_parser_t* Character = mpc_new("character");
  mpc_parser_t* String    = mpc_new("string");
  mpc_parser_t* Factor    = mpc_new("factor");
  mpc_parser_t* Term      = mpc_new("term");
  mpc_parser_t* Lexp      = mpc_new("lexp");
  mpc_parser_t* Stmt      = mpc_new("stmt");
  mpc_parser_t* Exp       = mpc_new("exp");
  mpc_parser_t* Typeident = mpc_new("typeident");
  mpc_parser_t* Decls     = mpc_new("decls");
  mpc_parser_t* Args      = mpc_new("args");
  mpc_parser_t* Body      = mpc_new("body");
  mpc_parser_t* Procedure = mpc_new("procedure");
  mpc_parser_t* Main      = mpc_new("main");
  mpc_parser_t* Includes  = mpc_new("includes");
  mpc_parser_t* Smallc    = mpc_new("smallc");

  mpc_err_t* err = mpca_lang(MPCA_LANG_DEFAULT,
    " ident     : /[a-zA-Z_][a-zA-Z0-9_]*/ ;                           \n"
    " number    : /[0-9]+/ ;                                           \n"
    " character : /'.'/ ;                                              \n"
    " string    : /\"(\\\\.|[^\"])*\"/ ;                               \n"
    "                                                                  \n"
    " factor    : '(' <lexp> ')'                                       \n"
    "           | <number>                                             \n"
    "           | <character>                                          \n"
    "           | <string>                                             \n"
    "           | <ident> '(' <lexp>? (',' <lexp>)* ')'                \n"
    "           | <ident> ;                                            \n"
    "                                                                  \n"
    " term      : <factor> (('*' | '/' | '%') <factor>)* ;             \n"
    " lexp      : <term> (('+' | '-') <term>)* ;                       \n"
    "                                                                  \n"
    " stmt      : '{' <stmt>* '}'                                      \n"
    "           | \"while\" '(' <exp> ')' <stmt>                       \n"
    "           | \"if\"    '(' <exp> ')' <stmt>                       \n"
    "           | <ident> '=' <lexp> ';'                               \n"
    "           | \"print\" '(' <lexp>? ')' ';'                        \n"
    "           | \"return\" <lexp>? ';'                               \n"
    "           | <ident> '(' <ident>? (',' <ident>)* ')' ';' ;        \n"
    "                                                                  \n"
    " exp       : <lexp> '>' <lexp>                                    \n"
    "           | <lexp> '<' <lexp>                                    \n"
    "           | <lexp> \">=\" <lexp>                                 \n"
    "           | <lexp> \"<=\" <lexp>                                 \n"
    "           | <lexp> \"!=\" <lexp>                                 \n"
    "           | <lexp> \"==\" <lexp> ;                               \n"
    "                                                                  \n"
    " typeident : (\"int\" | \"char\") <ident> ;                       \n"
    " decls     : (<typeident> ';')* ;                                 \n"
    " args      : <typeident>? (',' <typeident>)* ;                    \n"
    " body      : '{' <decls> <stmt>* '}' ;                            \n"
    " procedure : (\"int\" | \"char\") <ident> '(' <args> ')' <body> ; \n"
    " main      : \"main\" '(' ')' <body> ;                            \n"
    " includes  : (\"#include\" <string>)* ;                           \n"
    " smallc    : /^/ <includes> <decls> <procedure>* <main> /$/ ;     \n",
    Ident, Number, Character, String, Factor, Term, Lexp, Stmt, Exp, 
    Typeident, Decls, Args, Body, Procedure, Main, Includes, Smallc, NULL);
  
  if (err != NULL) {
    mpc_err_print(err);
    mpc_err_delete(err);
    exit(1);
  }
    
  if (argc > 1) {
    
    mpc_result_t r;
    if (mpc_parse_contents(argv[1], Smallc, &r)) {
      mpc_ast_print(r.output);
      mpc_ast_delete(r.output);
    } else {
      mpc_err_print(r.error);
      mpc_err_delete(r.error);
    }
    
  } else {
    
    mpc_result_t r;
    if (mpc_parse_pipe("<stdin>", stdin, Smallc, &r)) {
      mpc_ast_print(r.output);
      mpc_ast_delete(r.output);
    } else {
      mpc_err_print(r.error);
      mpc_err_delete(r.error);
    }
  
  }

  mpc_cleanup(17, Ident, Number, Character, String, Factor, Term, Lexp, Stmt, Exp,
                  Typeident, Decls, Args, Body, Procedure, Main, Includes, Smallc);
  
  return 0;
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, 0x58(%rsp)
movl %edi, 0x14(%rsp)
leaq 0x7cdf(%rip), %rdi      # 0x902c
callq 0x2e0a
movq %rax, 0x50(%rsp)
leaq 0x7ca6(%rip), %rdi      # 0x9004
callq 0x2e0a
movq %rax, 0xa0(%rsp)
leaq 0x8a5e(%rip), %rdi      # 0x9dd0
callq 0x2e0a
movq %rax, 0x40(%rsp)
leaq 0x7c88(%rip), %rdi      # 0x900b
callq 0x2e0a
movq %rax, 0x98(%rsp)
leaq 0x7c7b(%rip), %rdi      # 0x9012
callq 0x2e0a
movq %rax, 0x90(%rsp)
leaq 0x7c6e(%rip), %rdi      # 0x9019
callq 0x2e0a
movq %rax, 0x48(%rsp)
leaq 0x7c62(%rip), %rdi      # 0x901e
callq 0x2e0a
movq %rax, 0x38(%rsp)
leaq 0x7c56(%rip), %rdi      # 0x9023
callq 0x2e0a
movq %rax, 0x30(%rsp)
leaq 0x7c41(%rip), %rdi      # 0x901f
callq 0x2e0a
movq %rax, 0x28(%rsp)
leaq 0x7c39(%rip), %rdi      # 0x9028
callq 0x2e0a
movq %rax, 0x20(%rsp)
leaq 0x7c32(%rip), %rdi      # 0x9032
callq 0x2e0a
movq %rax, %r13
leaq 0x7c29(%rip), %rdi      # 0x9038
callq 0x2e0a
movq %rax, %rbx
leaq 0x7c1f(%rip), %rdi      # 0x903d
callq 0x2e0a
movq %rax, %r15
leaq 0x7c15(%rip), %rdi      # 0x9042
callq 0x2e0a
movq %rax, %r12
leaq 0x7c10(%rip), %rdi      # 0x904c
callq 0x2e0a
movq %rax, %rbp
leaq 0x7c06(%rip), %rdi      # 0x9051
callq 0x2e0a
movq %rax, %r14
leaq 0x7c00(%rip), %rdi      # 0x905a
callq 0x2e0a
subq $0x70, %rsp
movq %rax, 0x88(%rsp)
movq %rax, 0x60(%rsp)
movq %r14, 0xd0(%rsp)
movq %r14, 0x58(%rsp)
movq %rbp, 0xd8(%rsp)
movq %rbp, 0x50(%rsp)
movq %r12, 0xe0(%rsp)
movq %r12, 0x48(%rsp)
movq %r15, 0xe8(%rsp)
movq %r15, 0x40(%rsp)
movq %rbx, 0xf0(%rsp)
movq %rbx, 0x38(%rsp)
movq %r13, 0xf8(%rsp)
movq %r13, 0x30(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x100(%rsp), %r15
movq 0xb8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x110(%rsp), %rbx
movq %r15, (%rsp)
andq $0x0, 0x68(%rsp)
leaq 0x7b41(%rip), %rsi      # 0x9061
xorl %edi, %edi
movq 0xc0(%rsp), %rdx
movq %rbx, %rcx
movq 0xb0(%rsp), %r8
movq 0x108(%rsp), %r14
movq %r14, %r9
xorl %eax, %eax
callq 0x738e
addq $0x70, %rsp
testq %rax, %rax
jne 0x163e
cmpl $0x2, 0x14(%rsp)
jl 0x157b
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %r12
movq %r12, %rsi
movq %rbp, %rdx
callq 0x2c03
jmp 0x15a1
movq 0xda5e(%rip), %rax      # 0xefe0
movq (%rax), %rsi
leaq 0x84a7(%rip), %rdi      # 0x9a33
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %r12
movq %r12, %rdx
movq %rbp, %rcx
callq 0x2b3d
movq (%rbp), %rdi
testl %eax, %eax
je 0x15ba
callq 0x5ee1
movq 0x8(%rsp), %rdi
callq 0x5adf
jmp 0x15c9
callq 0x16a7
movq 0x8(%rsp), %rdi
callq 0x165c
pushq $0x11
popq %rdi
movq 0x50(%rsp), %rsi
movq %rbx, %rdx
movq 0x40(%rsp), %rcx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
pushq %r12
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq 0x88(%rsp)
pushq 0x98(%rsp)
pushq 0xa8(%rsp)
pushq 0xb8(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq 0x88(%rsp)
pushq 0xa0(%rsp)
callq 0x31fe
addq $0x60, %rsp
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
movq %rax, %rdi
callq 0x16a7
movq %rbp, %rdi
callq 0x165c
pushq $0x1
popq %rdi
callq 0x11f0
nopl (%rax)