// File: /workspace/github_c_makefile_star2_O2/orangeduck[P]mpc/examples/lispy.c
// Function: main
int main(int argc, char **argv) {
  
  mpc_result_t r;  
  
  mpc_parser_t* Number  = mpc_new("number");
  mpc_parser_t* Symbol  = mpc_new("symbol");
  mpc_parser_t* String  = mpc_new("string");
  mpc_parser_t* Comment = mpc_new("comment");
  mpc_parser_t* Sexpr   = mpc_new("sexpr");
  mpc_parser_t* Qexpr   = mpc_new("qexpr");
  mpc_parser_t* Expr    = mpc_new("expr");
  mpc_parser_t* Lispy   = mpc_new("lispy");

  mpca_lang(MPCA_LANG_PREDICTIVE,
    " number  \"number\"  : /[0-9]+/ ;                         "
    " symbol  \"symbol\"  : /[a-zA-Z0-9_+\\-*\\/\\\\=<>!&]+/ ; "
    " string  \"string\"  : /\"(\\\\.|[^\"])*\"/ ;             "
    " comment             : /;[^\\r\\n]*/ ;                    "
    " sexpr               : '(' <expr>* ')' ;                  "
    " qexpr               : '{' <expr>* '}' ;                  "
    " expr                : <number>  | <symbol> | <string>    "
    "                     | <comment> | <sexpr>  | <qexpr> ;   "
    " lispy               : /^/ <expr>* /$/ ;                  ",
    Number, Symbol, String, Comment, Sexpr, Qexpr, Expr, Lispy, NULL);
  
  if (argc > 1) {

    if (mpc_parse_contents(argv[1], Lispy, &r)) {
      mpc_ast_print(r.output);
      mpc_ast_delete(r.output);
    } else {
      mpc_err_print(r.error);
      mpc_err_delete(r.error);
    }
        
  } else {
    
    if (mpc_parse_pipe("<stdin>", stdin, Lispy, &r)) {
      mpc_ast_print(r.output);
      mpc_ast_delete(r.output);
    } else {
      mpc_err_print(r.error);
      mpc_err_delete(r.error);
    }
  
  }

  mpc_cleanup(8, Number, Symbol, String, Comment, Sexpr, Qexpr, Expr, Lispy);
  
  return 0;
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, 0x38(%rsp)
movl %edi, 0x34(%rsp)
leaq 0x7cca(%rip), %rdi      # 0x9004
callq 0x2c6a
movq %rax, %r12
leaq 0x7cc2(%rip), %rdi      # 0x900b
callq 0x2c6a
movq %rax, 0x48(%rsp)
leaq 0x7cb8(%rip), %rdi      # 0x9012
callq 0x2c6a
movq %rax, 0x40(%rsp)
leaq 0x7cae(%rip), %rdi      # 0x9019
callq 0x2c6a
movq %rax, %rbp
leaq 0x7ca7(%rip), %rdi      # 0x9021
callq 0x2c6a
movq %rax, %rbx
leaq 0x7c9e(%rip), %rdi      # 0x9027
callq 0x2c6a
movq %rax, %r15
leaq 0x7c90(%rip), %rdi      # 0x9028
callq 0x2c6a
movq %rax, %r13
leaq 0x7c86(%rip), %rdi      # 0x902d
callq 0x2c6a
movq %rax, %r14
movq %rax, 0x18(%rsp)
movq %r13, 0x50(%rsp)
movq %r13, 0x10(%rsp)
movq %r15, 0x58(%rsp)
movq %r15, 0x8(%rsp)
movq %rbx, 0x60(%rsp)
movq %rbx, (%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x7c55(%rip), %rsi      # 0x9033
pushq $0x1
popq %rdi
movq %r12, 0x70(%rsp)
movq %r12, %rdx
movq 0x48(%rsp), %r12
movq 0x40(%rsp), %r13
movq %r12, %rcx
movq %r13, %r8
movq %rbp, 0x68(%rsp)
movq %rbp, %r9
xorl %eax, %eax
callq 0x71ee
cmpl $0x2, 0x34(%rsp)
jl 0x142a
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x28(%rsp), %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x2a63
jmp 0x144b
movq 0xdbaf(%rip), %rax      # 0xefe0
movq (%rax), %rsi
leaq 0x7df2(%rip), %rdi      # 0x922d
leaq 0x28(%rsp), %r15
movq %r14, %rdx
movq %r15, %rcx
callq 0x299d
movq (%r15), %rdi
testl %eax, %eax
je 0x1463
callq 0x5d41
movq 0x28(%rsp), %rdi
callq 0x593f
jmp 0x1472
callq 0x1507
movq 0x28(%rsp), %rdi
callq 0x14bc
movq %r14, 0x10(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
pushq $0x8
popq %rdi
movq 0x70(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
movq 0x68(%rsp), %r8
movq 0x60(%rsp), %r9
xorl %eax, %eax
callq 0x305e
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop