// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movq %rsi, 0x18(%rsp)
movl %edi, 0x14(%rsp)
leaq 0x9cca(%rip), %rdi      # 0xb004
callq 0x2fca
movq %rax, %r12
leaq 0x9cc2(%rip), %rdi      # 0xb00b
callq 0x2fca
movq %rax, 0x28(%rsp)
leaq 0x9cb8(%rip), %rdi      # 0xb012
callq 0x2fca
movq %rax, 0x20(%rsp)
leaq 0x9cae(%rip), %rdi      # 0xb019
callq 0x2fca
movq %rax, %rbp
leaq 0x9ca7(%rip), %rdi      # 0xb021
callq 0x2fca
movq %rax, %rbx
leaq 0x9c9e(%rip), %rdi      # 0xb027
callq 0x2fca
movq %rax, %r15
leaq 0x9c90(%rip), %rdi      # 0xb028
callq 0x2fca
movq %rax, %r14
leaq 0x9c86(%rip), %rdi      # 0xb02d
callq 0x2fca
movq %rax, %r13
subq $0x8, %rsp
leaq 0x9c79(%rip), %rsi      # 0xb033
movl $0x1, %edi
movq %r12, 0x58(%rsp)
movq %r12, %rdx
movq 0x30(%rsp), %r12
movq %rbp, %r9
movq 0x28(%rsp), %rbp
movq %r12, %rcx
movq %rbp, %r8
movq %r9, 0x38(%rsp)
xorl %eax, %eax
pushq $0x0
pushq %r13
movq %r14, 0x50(%rsp)
pushq %r14
movq %r15, 0x60(%rsp)
pushq %r15
movq %rbx, 0x70(%rsp)
pushq %rbx
callq 0x8ac2
addq $0x30, %rsp
cmpl $0x2, 0x14(%rsp)
jl 0x1424
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x8(%rsp), %r15
movq %r13, %rsi
movq %r15, %rdx
callq 0x2d92
jmp 0x1445
movq 0xebb5(%rip), %rax      # 0xffe0
movq (%rax), %rsi
leaq 0x9df8(%rip), %rdi      # 0xb22d
leaq 0x8(%rsp), %r15
movq %r13, %rdx
movq %r15, %rcx
callq 0x2cca
movq (%r15), %rdi
testl %eax, %eax
je 0x145d
callq 0x6c77
movq 0x8(%rsp), %rdi
callq 0x6818
jmp 0x146c
callq 0x1503
movq 0x8(%rsp), %rdi
callq 0x14b0
subq $0x8, %rsp
movl $0x8, %edi
movq 0x58(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x38(%rsp), %r8
movq 0x50(%rsp), %r9
xorl %eax, %eax
pushq %r13
pushq 0x48(%rsp)
pushq 0x58(%rsp)
callq 0x33de
addq $0x20, %rsp
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq