// File: /workspace/github_c_makefile_star2_O0/orangeduck[P]mpc/tests/core.c
// Function: test_maths
void test_maths(void) {

  mpc_parser_t *Expr, *Factor, *Term, *Maths;
  int r0 = 1, r1 = 5, r2 = 13, r3 = 0, r4 = 2;

  Expr   = mpc_new("expr");
  Factor = mpc_new("factor");
  Term   = mpc_new("term");
  Maths  = mpc_new("maths");

  mpc_define(Expr, mpc_or(2,
    mpc_and(3, mpcf_maths, Factor, mpc_oneof("+-"), Factor, free, free),
    Factor
  ));

  mpc_define(Factor, mpc_or(2,
    mpc_and(3, mpcf_maths, Term, mpc_oneof("*/"), Term, free, free),
    Term
  ));

  mpc_define(Term, mpc_or(2,
    mpc_int(),
    mpc_parens(Expr, free)
  ));

  mpc_define(Maths, mpc_whole(Expr, free));

  PT_ASSERT(mpc_test_pass(Maths, "1", &r0, int_eq, free, int_print));
  PT_ASSERT(mpc_test_pass(Maths, "(5)", &r1, int_eq, free, int_print));
  PT_ASSERT(mpc_test_pass(Maths, "(4*2)+5", &r2, int_eq, free, int_print));
  PT_ASSERT(mpc_test_pass(Maths, "4*2+5", &r2, int_eq, free, int_print));
  PT_ASSERT(mpc_test_fail(Maths, "a", &r3, int_eq, free, int_print));
  PT_ASSERT(mpc_test_fail(Maths, "2b+4", &r4, int_eq, free, int_print));

  mpc_cleanup(4, Expr, Factor, Term, Maths);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x1, -0x24(%rbp)
movl $0x5, -0x28(%rbp)
movl $0xd, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x2, -0x34(%rbp)
leaq 0x11554(%rip), %rdi     # 0x142e9
callq 0x9350
movq %rax, -0x8(%rbp)
leaq 0x11549(%rip), %rdi     # 0x142ee
callq 0x9350
movq %rax, -0x10(%rbp)
leaq 0x11540(%rip), %rdi     # 0x142f5
callq 0x9350
movq %rax, -0x18(%rbp)
leaq 0x11535(%rip), %rdi     # 0x142fa
callq 0x9350
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x1151b(%rip), %rdi     # 0x14300
callq 0x9fd0
movq -0x70(%rbp), %rdx
movq %rax, %rcx
movq -0x10(%rbp), %r8
movl $0x3, %edi
leaq 0x2bf(%rip), %rsi       # 0x30c0
movq 0x191c0(%rip), %rax     # 0x1bfc8
movq %rax, %r9
movq %rax, (%rsp)
movb $0x0, %al
callq 0xa910
movq %rax, %rsi
movq -0x10(%rbp), %rdx
movl $0x2, %edi
movb $0x0, %al
callq 0xa7b0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x9890
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x114b7(%rip), %rdi     # 0x14303
callq 0x9fd0
movq -0x60(%rbp), %rdx
movq %rax, %rcx
movq -0x18(%rbp), %r8
movl $0x3, %edi
leaq 0x258(%rip), %rsi       # 0x30c0
movq 0x19159(%rip), %rax     # 0x1bfc8
movq %rax, %r9
movq %rax, (%rsp)
movb $0x0, %al
callq 0xa910
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movl $0x2, %edi
movb $0x0, %al
callq 0xa7b0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x9890
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0xb140
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq 0x19110(%rip), %rsi     # 0x1bfc8
callq 0xba20
movq -0x50(%rbp), %rsi
movq %rax, %rdx
movl $0x2, %edi
movb $0x0, %al
callq 0xa7b0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x9890
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq 0x190d9(%rip), %rsi     # 0x1bfc8
callq 0xb810
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x9890
movq -0x20(%rbp), %rdi
leaq 0x11d97(%rip), %rsi     # 0x14ca2
leaq -0x24(%rbp), %rdx
leaq 0x2aa(%rip), %rcx       # 0x31c0
movq 0x190ab(%rip), %r8      # 0x1bfc8
leaq 0x2cc(%rip), %r9        # 0x31f0
callq 0xd780
movl %eax, %edi
leaq 0x113d4(%rip), %rsi     # 0x14306
leaq 0x1120b(%rip), %rdx     # 0x14144
movl $0x57, %ecx
callq 0x5780
movq -0x20(%rbp), %rdi
leaq 0x113f0(%rip), %rsi     # 0x1433e
leaq -0x28(%rbp), %rdx
leaq 0x267(%rip), %rcx       # 0x31c0
movq 0x19068(%rip), %r8      # 0x1bfc8
leaq 0x289(%rip), %r9        # 0x31f0
callq 0xd780
movl %eax, %edi
leaq 0x113cd(%rip), %rsi     # 0x14342
leaq 0x111c8(%rip), %rdx     # 0x14144
movl $0x58, %ecx
callq 0x5780
movq -0x20(%rbp), %rdi
leaq 0x113eb(%rip), %rsi     # 0x1437c
leaq -0x2c(%rbp), %rdx
leaq 0x224(%rip), %rcx       # 0x31c0
movq 0x19025(%rip), %r8      # 0x1bfc8
leaq 0x246(%rip), %r9        # 0x31f0
callq 0xd780
movl %eax, %edi
leaq 0x113cc(%rip), %rsi     # 0x14384
leaq 0x11185(%rip), %rdx     # 0x14144
movl $0x59, %ecx
callq 0x5780
movq -0x20(%rbp), %rdi
leaq 0x113ee(%rip), %rsi     # 0x143c2
leaq -0x2c(%rbp), %rdx
leaq 0x1e1(%rip), %rcx       # 0x31c0
movq 0x18fe2(%rip), %r8      # 0x1bfc8
leaq 0x203(%rip), %r9        # 0x31f0
callq 0xd780
movl %eax, %edi
leaq 0x113cd(%rip), %rsi     # 0x143c8
leaq 0x11142(%rip), %rdx     # 0x14144
movl $0x5a, %ecx
callq 0x5780
movq -0x20(%rbp), %rdi
leaq 0x145dd(%rip), %rsi     # 0x175f4
leaq -0x30(%rbp), %rdx
leaq 0x19e(%rip), %rcx       # 0x31c0
movq 0x18f9f(%rip), %r8      # 0x1bfc8
leaq 0x1c0(%rip), %r9        # 0x31f0
callq 0xd6f0
movl %eax, %edi
leaq 0x113c6(%rip), %rsi     # 0x14404
leaq 0x110ff(%rip), %rdx     # 0x14144
movl $0x5b, %ecx
callq 0x5780
movq -0x20(%rbp), %rdi
leaq 0x113e2(%rip), %rsi     # 0x1443c
leaq -0x34(%rbp), %rdx
leaq 0x15b(%rip), %rcx       # 0x31c0
movq 0x18f5c(%rip), %r8      # 0x1bfc8
leaq 0x17d(%rip), %r9        # 0x31f0
callq 0xd6f0
movl %eax, %edi
leaq 0x113c0(%rip), %rsi     # 0x14441
leaq 0x110bc(%rip), %rdx     # 0x14144
movl $0x5c, %ecx
callq 0x5780
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x4, %edi
movb $0x0, %al
callq 0x9a50
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)