// File: /workspace/github_c_makefile_star2_O3/orangeduck[P]mpc/mpc.c
// Function: mpc_re_mode
mpc_parser_t *mpc_re_mode(const char *re, int mode) {

  char *err_msg;
  mpc_parser_t *err_out;
  mpc_result_t r;
  mpc_parser_t *Regex, *Term, *Factor, *Base, *Range, *RegexEnclose;

  Regex  = mpc_new("regex");
  Term   = mpc_new("term");
  Factor = mpc_new("factor");
  Base   = mpc_new("base");
  Range  = mpc_new("range");

  mpc_define(Regex, mpc_and(2, mpcf_re_or,
    Term,
    mpc_maybe(mpc_and(2, mpcf_snd_free, mpc_char('|'), Regex, free)),
    (mpc_dtor_t)mpc_delete
  ));

  mpc_define(Term, mpc_many(mpcf_re_and, Factor));

  mpc_define(Factor, mpc_and(2, mpcf_re_repeat,
    Base,
    mpc_or(5,
      mpc_char('*'), mpc_char('+'), mpc_char('?'),
      mpc_brackets(mpc_int(), free),
      mpc_pass()),
    (mpc_dtor_t)mpc_delete
  ));

  mpc_define(Base, mpc_or(4,
    mpc_parens(Regex, (mpc_dtor_t)mpc_delete),
    mpc_squares(Range, (mpc_dtor_t)mpc_delete),
    mpc_apply_to(mpc_escape(), mpcf_re_escape, &mode),
    mpc_apply_to(mpc_noneof(")|"), mpcf_re_escape, &mode)
  ));

  mpc_define(Range, mpc_apply(
    mpc_many(mpcf_strfold, mpc_or(2, mpc_escape(), mpc_noneof("]"))),
    mpcf_re_range
  ));

  RegexEnclose = mpc_whole(mpc_predictive(Regex), (mpc_dtor_t)mpc_delete);

  mpc_optimise(RegexEnclose);
  mpc_optimise(Regex);
  mpc_optimise(Term);
  mpc_optimise(Factor);
  mpc_optimise(Base);
  mpc_optimise(Range);

  if(!mpc_parse("<mpc_re_compiler>", re, RegexEnclose, &r)) {
    err_msg = mpc_err_string(r.error);
    err_out = mpc_failf("Invalid Regex: %s", err_msg);
    mpc_err_delete(r.error);
    free(err_msg);
    r.output = err_out;
  }

  mpc_cleanup(6, RegexEnclose, Regex, Term, Factor, Base, Range);

  mpc_optimise(r.output);

  return r.output;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
leaq 0x1c(%rsp), %rax
movl %esi, (%rax)
leaq 0x644d(%rip), %rdi      # 0xe574
callq 0x40a0
movq %rax, %r15
movq %rax, 0x20(%rsp)
leaq 0x6447(%rip), %rdi      # 0xe582
callq 0x40a0
movq %rax, %r13
leaq 0x643d(%rip), %rdi      # 0xe587
callq 0x40a0
movq %rax, %rbx
movq %rax, 0x10(%rsp)
leaq 0x6430(%rip), %rdi      # 0xe58e
callq 0x40a0
movq %rax, 0x28(%rsp)
leaq 0x6424(%rip), %rdi      # 0xe593
callq 0x40a0
movq %rax, 0x30(%rsp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0x9, %r12b
movb %r12b, 0x30(%rax)
movb $0x7c, 0x8(%rax)
leaq 0x622b(%rip), %rbp      # 0xe3c5
movq %rax, %rdi
movq %rbp, %rsi
movl $0x7c, %edx
xorl %eax, %eax
callq 0x4290
movq 0xad5d(%rip), %rsi      # 0x12f10
movq 0xad66(%rip), %r8       # 0x12f20
movl $0x2, %edi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x4140
movq %rax, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0x13, 0x30(%rax)
movq %r14, 0x8(%rax)
movq 0xadab(%rip), %rcx      # 0x12f98
movq %rcx, 0x18(%rax)
leaq 0x3e7(%rip), %rsi       # 0x85df
movq 0xad71(%rip), %r8       # 0x12f70
movl $0x2, %edi
movq %r13, 0x38(%rsp)
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4140
movq %r15, %rdi
movq %rax, %rsi
callq 0x40c0
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0x14, %cl
movb %cl, 0x30(%rax)
movq %rbx, 0x18(%rax)
leaq 0x3be(%rip), %rcx       # 0x85fe
movq %rcx, 0x10(%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x40c0
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb %r12b, 0x30(%rax)
movb $0x2a, 0x8(%rax)
movq %rax, %rdi
movq %rbp, %rsi
movl $0x2a, %edx
xorl %eax, %eax
callq 0x4290
movq %rax, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb %r12b, 0x30(%rax)
movb $0x2b, 0x8(%rax)
movq %rax, %rdi
movq %rbp, %rsi
movl $0x2b, %edx
xorl %eax, %eax
callq 0x4290
movq %rax, %r15
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb %r12b, 0x30(%rax)
movb $0x3f, 0x8(%rax)
movq %rax, %rdi
movq %rbp, %rsi
movl $0x3f, %edx
xorl %eax, %eax
callq 0x4290
movq %rax, %rbp
callq 0x4220
leaq 0x629f(%rip), %rdx      # 0xe57e
leaq 0x650a(%rip), %rcx      # 0xe7f0
movq %rax, %rdi
movq 0xac30(%rip), %rsi      # 0x12f20
callq 0x40f0
movq %rax, %r12
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0x1, 0x30(%rax)
movl $0x5, %edi
movq %r14, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %r12, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x4500
leaq 0x347(%rip), %rsi       # 0x8674
movl $0x2, %edi
movq 0x28(%rsp), %rdx
movq %rax, %rcx
movq 0xac2f(%rip), %rbx      # 0x12f70
movq %rbx, %r8
xorl %eax, %eax
callq 0x4140
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x40c0
leaq 0x6494(%rip), %rdx      # 0xe7f3
leaq 0x6214(%rip), %rcx      # 0xe57a
movq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x40f0
movq %rax, 0x48(%rsp)
leaq 0x61fe(%rip), %rdx      # 0xe580
leaq 0x6457(%rip), %rcx      # 0xe7e0
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x40f0
movq %rax, 0x40(%rsp)
callq 0x4360
movq %rax, %r12
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movq %rax, %r13
movb $0x10, %bl
movb %bl, 0x30(%rax)
movq %r12, 0x8(%rax)
leaq 0x38d(%rip), %rbp       # 0x8752
movq %rbp, 0x10(%rax)
leaq 0x1c(%rsp), %r14
movq %r14, 0x18(%rax)
leaq 0x61c0(%rip), %rdi      # 0xe599
callq 0x4190
movq %rax, %r12
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb %bl, 0x30(%rax)
movq %r15, %rbx
movq %r12, 0x8(%rax)
movq %rbp, 0x10(%rax)
movq %r14, 0x18(%rax)
movl $0x4, %edi
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x4500
movq 0x28(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x40c0
callq 0x4360
movq %rax, %r14
leaq 0x63a3(%rip), %rdi      # 0xe7e0
callq 0x4190
movl $0x2, %edi
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4500
movq %rax, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movq %rax, %r15
movb $0x14, %al
movb %al, 0x30(%r15)
movq %r14, 0x18(%r15)
movq 0xab46(%rip), %rax      # 0x12fc0
movq %rax, 0x10(%r15)
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0xf, 0x30(%rax)
movq %r15, 0x8(%rax)
leaq 0x81a(%rip), %rcx       # 0x8cb6
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %r13
movq %r13, %rdi
movq %rax, %rsi
callq 0x40c0
movl $0x1, %edi
movl $0x38, %esi
callq 0x4280
movb $0x11, 0x30(%rax)
movq %rbx, 0x8(%rax)
movq %rax, %rdi
movq 0xaa9f(%rip), %rsi      # 0x12f70
callq 0x4040
movq %rax, %rbp
movq %rax, %rdi
movl $0x1, %esi
callq 0xbfc5
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbfc5
movq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0xbfc5
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0xbfc5
movq %r12, %rdi
movl $0x1, %esi
callq 0xbfc5
movq %r13, %rdi
movl $0x1, %esi
callq 0xbfc5
leaq 0x606a(%rip), %rdi      # 0xe59c
movq 0x50(%rsp), %rsi
callq 0x5bb6
movq %rax, %r14
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x4090
movl %eax, %r15d
movq %r14, %rdi
callq 0x5c78
testl %r15d, %r15d
jne 0x8597
movq 0x8(%rsp), %rdi
callq 0x4320
movq %rax, %r14
leaq 0x603b(%rip), %rdi      # 0xe5ae
movq %rax, %rsi
xorl %eax, %eax
callq 0x4240
movq %rax, %r15
movq 0x8(%rsp), %rdi
callq 0x4380
movq %r14, %rdi
callq 0x4580
movq %r15, 0x8(%rsp)
movq %r13, (%rsp)
movl $0x6, %edi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x10(%rsp), %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x44a0
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0xbfc5
movq 0x8(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq