// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movl $0x0, -0x2c(%rbp)
movl %edi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
leaq 0xdd23(%rip), %rdi      # 0xf02c
callq 0x3b90
movq %rax, -0x40(%rbp)
leaq 0xdceb(%rip), %rdi      # 0xf004
callq 0x3b90
movq %rax, -0x48(%rbp)
leaq 0xec31(%rip), %rdi      # 0xff5a
callq 0x3b90
movq %rax, -0x50(%rbp)
leaq 0xdcd2(%rip), %rdi      # 0xf00b
callq 0x3b90
movq %rax, -0x58(%rbp)
leaq 0xdcc9(%rip), %rdi      # 0xf012
callq 0x3b90
movq %rax, -0x60(%rbp)
leaq 0xdcc0(%rip), %rdi      # 0xf019
callq 0x3b90
movq %rax, -0x68(%rbp)
leaq 0xdcb5(%rip), %rdi      # 0xf01e
callq 0x3b90
movq %rax, -0x70(%rbp)
leaq 0xdcaa(%rip), %rdi      # 0xf023
callq 0x3b90
movq %rax, -0x78(%rbp)
leaq 0xdc96(%rip), %rdi      # 0xf01f
callq 0x3b90
movq %rax, -0x80(%rbp)
leaq 0xdc8f(%rip), %rdi      # 0xf028
callq 0x3b90
movq %rax, -0x88(%rbp)
leaq 0xdc86(%rip), %rdi      # 0xf032
callq 0x3b90
movq %rax, -0x90(%rbp)
leaq 0xdc79(%rip), %rdi      # 0xf038
callq 0x3b90
movq %rax, -0x98(%rbp)
leaq 0xdc6b(%rip), %rdi      # 0xf03d
callq 0x3b90
movq %rax, -0xa0(%rbp)
leaq 0xdc5d(%rip), %rdi      # 0xf042
callq 0x3b90
movq %rax, -0xa8(%rbp)
leaq 0xdc54(%rip), %rdi      # 0xf04c
callq 0x3b90
movq %rax, -0xb0(%rbp)
leaq 0xdc46(%rip), %rdi      # 0xf051
callq 0x3b90
movq %rax, -0xb8(%rbp)
leaq 0xdc3c(%rip), %rdi      # 0xf05a
callq 0x3b90
movq %rax, -0xc0(%rbp)
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %r9
movq -0x60(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x88(%rbp), %r13
movq -0x90(%rbp), %r12
movq -0x98(%rbp), %r15
movq -0xa0(%rbp), %r14
movq -0xa8(%rbp), %rbx
movq -0xb0(%rbp), %r11
movq -0xb8(%rbp), %r10
movq -0xc0(%rbp), %rax
movq %rax, -0xe0(%rbp)
xorl %edi, %edi
leaq 0xdba8(%rip), %rsi      # 0xf061
xorl %eax, %eax
movq -0x108(%rbp), %rax
movq %rax, (%rsp)
movq -0x100(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xf8(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0xf0(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0xe8(%rbp), %rax
movq %rax, 0x20(%rsp)
movq -0xe0(%rbp), %rax
movq %r13, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq %r15, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %rbx, 0x48(%rsp)
movq %r11, 0x50(%rsp)
movq %r10, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movb $0x0, %al
callq 0xa7b0
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x1568
movq -0xc8(%rbp), %rdi
callq 0x1790
movq -0xc8(%rbp), %rdi
callq 0x1710
movl $0x1, %edi
callq 0x11b0
cmpl $0x1, -0x30(%rbp)
jle 0x15c2
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0xc0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x3830
cmpl $0x0, %eax
je 0x15a8
movq -0xd0(%rbp), %rdi
callq 0x8830
movq -0xd0(%rbp), %rdi
callq 0x80b0
jmp 0x15c0
movq -0xd0(%rbp), %rdi
callq 0x1790
movq -0xd0(%rbp), %rdi
callq 0x1710
jmp 0x161f
movq 0x13a17(%rip), %rax     # 0x14fe0
movq (%rax), %rsi
movq -0xc0(%rbp), %rdx
leaq 0xe459(%rip), %rdi      # 0xfa33
leaq -0xd8(%rbp), %rcx
callq 0x3690
cmpl $0x0, %eax
je 0x1605
movq -0xd8(%rbp), %rdi
callq 0x8830
movq -0xd8(%rbp), %rdi
callq 0x80b0
jmp 0x161d
movq -0xd8(%rbp), %rdi
callq 0x1790
movq -0xd8(%rbp), %rdi
callq 0x1710
jmp 0x161f
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %r9
movq -0x68(%rbp), %rax
movq -0x70(%rbp), %rdi
movq %rdi, -0x128(%rbp)
movq -0x78(%rbp), %rdi
movq %rdi, -0x120(%rbp)
movq -0x80(%rbp), %rdi
movq %rdi, -0x118(%rbp)
movq -0x88(%rbp), %r13
movq -0x90(%rbp), %r12
movq -0x98(%rbp), %r15
movq -0xa0(%rbp), %r14
movq -0xa8(%rbp), %rbx
movq -0xb0(%rbp), %r11
movq -0xb8(%rbp), %r10
movq -0xc0(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movl $0x11, %edi
movq %rax, (%rsp)
movq -0x128(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x120(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x118(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0x110(%rbp), %rax
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
movq %r11, 0x48(%rsp)
movq %r10, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movb $0x0, %al
callq 0x4290
xorl %eax, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop