// File: /workspace/github_c_makefile_star2_O1/orangeduck[P]mpc/tests/grammar.c
// Function: test_digits_file
void test_digits_file(void) {
  
  FILE *f;
  mpc_result_t r;
  mpc_parser_t *Digit = mpc_new("digit");
  mpc_parser_t *Program = mpc_new("program");
  mpc_ast_t* t0;
  
  mpc_err_t* err = mpca_lang(MPCA_LANG_DEFAULT,
    " digit   : /[0-9]/ ;"
    " program : /^/ <digit>+ /$/ ;"
    , Digit, Program, NULL);
  
  PT_ASSERT(err == NULL);

  t0 = mpc_ast_build(5, ">", 
    mpc_ast_new("regex", ""),
    mpc_ast_new("digit|regex", "1"),
    mpc_ast_new("digit|regex", "2"),
    mpc_ast_new("digit|regex", "3"),
    mpc_ast_new("regex", ""));
  
  if (mpc_parse_contents("tests/digits.txt", Program, &r)) {
    PT_ASSERT(1);
    PT_ASSERT(mpc_ast_eq(t0, r.output));
    mpc_ast_delete(r.output);
  } else {
    PT_ASSERT(0);
    mpc_err_print(r.error);
    mpc_err_delete(r.error);
  }
  
  f = fopen("tests/digits.txt", "r");
  PT_ASSERT(f != NULL);

  if (mpc_parse_file("tests/digits.txt", f, Program, &r)) {
    PT_ASSERT(1);
    PT_ASSERT(mpc_ast_eq(t0, r.output));
    mpc_ast_delete(r.output);
  } else {
    PT_ASSERT(0);
    mpc_err_print(r.error);
    mpc_err_delete(r.error);
  }
    
  fclose(f);
    
  if (mpc_parse("tests/digits.txt", "123", Program, &r)) {
    PT_ASSERT(1);
    PT_ASSERT(mpc_ast_eq(t0, r.output));
    mpc_ast_delete(r.output);
  } else {
    PT_ASSERT(0);
    mpc_err_print(r.error);
    mpc_err_delete(r.error);
  }
  
  mpc_ast_delete(t0);
    
  mpc_cleanup(2, Digit, Program);
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xe55b(%rip), %rdi      # 0x121c3
callq 0x7191
movq %rax, %rbx
leaq 0xd156(%rip), %rdi      # 0x10dcd
callq 0x7191
movq %rax, %r12
leaq 0xd14f(%rip), %rsi      # 0x10dd5
xorl %edi, %edi
movq %rbx, 0x10(%rsp)
movq %rbx, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xcd98
xorl %edi, %edi
testq %rax, %rax
sete %dil
leaq 0xc71f(%rip), %rsi      # 0x103cc
leaq 0xc086(%rip), %rdx      # 0xfd3a
movl $0x161, %ecx            # imm = 0x161
callq 0x4050
leaq 0xcbb3(%rip), %rdi      # 0x10878
leaq 0xe7a6(%rip), %r13      # 0x12472
movq %r13, %rsi
callq 0xab6f
movq %rax, %r15
leaq 0xd129(%rip), %rbp      # 0x10e07
leaq 0xbfbd(%rip), %rsi      # 0xfca2
movq %rbp, %rdi
callq 0xab6f
movq %rax, %rbx
leaq 0xb8c3(%rip), %rsi      # 0xf5ba
movq %rbp, %rdi
callq 0xab6f
movq %rax, %r14
leaq 0xd140(%rip), %rsi      # 0x10e49
movq %rbp, %rdi
callq 0xab6f
movq %rax, %rbp
leaq 0xcb5d(%rip), %rdi      # 0x10878
movq %r13, %rsi
callq 0xab6f
movq %rax, (%rsp)
leaq 0xe784(%rip), %rsi      # 0x124b2
movl $0x5, %edi
movq %r15, %rdx
movq %rbx, %rcx
movq %r14, %r8
movq %r12, %r14
movq %rbp, %r9
xorl %eax, %eax
callq 0xabe9
movq %rax, %r15
leaq 0xd0c0(%rip), %rdi      # 0x10e13
leaq 0x8(%rsp), %rdx
movq %r12, %rsi
callq 0x6f59
testl %eax, %eax
je 0x3db3
leaq 0xbf37(%rip), %rsi      # 0xfca2
leaq 0xbfc8(%rip), %rbx      # 0xfd3a
movl $0x1, %edi
movq %rbx, %rdx
movl $0x16b, %ecx            # imm = 0x16B
callq 0x4050
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xad99
leaq 0xd08c(%rip), %rsi      # 0x10e24
movl %eax, %edi
movq %rbx, %rdx
movl $0x16c, %ecx            # imm = 0x16C
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0xab17
jmp 0x3de1
leaq 0xb2c4(%rip), %rsi      # 0xf07e
leaq 0xbf79(%rip), %rdx      # 0xfd3a
xorl %edi, %edi
movl $0x16f, %ecx            # imm = 0x16F
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0x56bf
movq 0x8(%rsp), %rdi
callq 0x566c
leaq 0xd02b(%rip), %rbx      # 0x10e13
leaq 0xe696(%rip), %rsi      # 0x12485
movq %rbx, %rdi
callq 0x1200
movq %rax, %r12
xorl %edi, %edi
testq %rax, %rax
setne %dil
leaq 0xd033(%rip), %rsi      # 0x10e3d
leaq 0xbf29(%rip), %rdx      # 0xfd3a
movl $0x175, %ecx            # imm = 0x175
callq 0x4050
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x6dc9
testl %eax, %eax
je 0x3e81
leaq 0xbe69(%rip), %rsi      # 0xfca2
leaq 0xbefa(%rip), %rbx      # 0xfd3a
movl $0x1, %edi
movq %rbx, %rdx
movl $0x178, %ecx            # imm = 0x178
callq 0x4050
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xad99
leaq 0xcfbe(%rip), %rsi      # 0x10e24
movl %eax, %edi
movq %rbx, %rdx
movl $0x179, %ecx            # imm = 0x179
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0xab17
jmp 0x3eaf
leaq 0xb1f6(%rip), %rsi      # 0xf07e
leaq 0xbeab(%rip), %rdx      # 0xfd3a
xorl %edi, %edi
movl $0x17c, %ecx            # imm = 0x17C
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0x56bf
movq 0x8(%rsp), %rdi
callq 0x566c
movq %r12, %rdi
callq 0x10a0
leaq 0xcf55(%rip), %rdi      # 0x10e13
leaq 0xcf82(%rip), %rsi      # 0x10e47
leaq 0x8(%rsp), %rcx
movq %r14, %rdx
callq 0x6ba1
testl %eax, %eax
je 0x3f25
leaq 0xbdc5(%rip), %rsi      # 0xfca2
leaq 0xbe56(%rip), %rbx      # 0xfd3a
movl $0x1, %edi
movq %rbx, %rdx
movl $0x184, %ecx            # imm = 0x184
callq 0x4050
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xad99
leaq 0xcf1a(%rip), %rsi      # 0x10e24
movl %eax, %edi
movq %rbx, %rdx
movl $0x185, %ecx            # imm = 0x185
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0xab17
jmp 0x3f53
leaq 0xb152(%rip), %rsi      # 0xf07e
leaq 0xbe07(%rip), %rdx      # 0xfd3a
xorl %edi, %edi
movl $0x188, %ecx            # imm = 0x188
callq 0x4050
movq 0x8(%rsp), %rdi
callq 0x56bf
movq 0x8(%rsp), %rdi
callq 0x566c
movq %r15, %rdi
callq 0xab17
movl $0x2, %edi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x75e0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq