// File: /workspace/github_c_makefile_star2_O3/orangeduck[P]mpc/tests/core.c
// Function: test_sepby
void test_sepby(void) {
  mpc_parser_t* CommaSepIdent = mpc_sepby1(mpcf_strfold, mpc_char(','), mpc_ident());

  PT_ASSERT(mpc_test_fail(CommaSepIdent, "", "", streq, free, strprint));
  PT_ASSERT(mpc_test_pass(CommaSepIdent, "one", "one", streq, free, strprint));
  PT_ASSERT(mpc_test_pass(CommaSepIdent, "one,", "one", streq, free, strprint));
  PT_ASSERT(mpc_test_pass(CommaSepIdent, "one,two,", "onetwo", streq, free, strprint));
  PT_ASSERT(mpc_test_pass(CommaSepIdent, "one,two,three", "onetwothree", streq, free, strprint));

  mpc_delete(CommaSepIdent);

  mpc_parser_t* CommaSepIdent1 = mpc_sepby1(fold_vals, mpc_char(','), mpc_ident());
  mpc_result_t r;

  mpc_parse("<test>", "uno,dos,tres,cuatro", CommaSepIdent1, &r);
  char **vals = r.output;
  PT_ASSERT(strcmp("uno",    vals[0]) == 0);
  PT_ASSERT(strcmp("dos",    vals[1]) == 0);
  PT_ASSERT(strcmp("tres",   vals[2]) == 0);
  PT_ASSERT(strcmp("cuatro", vals[3]) == 0);

  free(vals);
  mpc_delete(CommaSepIdent1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x2c, %edi
callq 0x794e
movq %rax, %rbx
callq 0x8d57
leaq 0x5bfe(%rip), %rdi      # 0x83c6
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7f4d
movq %rax, %r14
leaq 0xfcc5(%rip), %rdx      # 0x124a2
leaq -0xc2d(%rip), %r15      # 0x1bb7
movq 0x157dd(%rip), %r12     # 0x17fc8
leaq -0xc2a(%rip), %r13      # 0x1bc8
movq %rax, %rdi
movq %rdx, %rsi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xa8c1
leaq 0xd120(%rip), %rsi      # 0xf92d
leaq 0xc930(%rip), %rbx      # 0xf144
movl %eax, %edi
movq %rbx, %rdx
movl $0xfd, %ecx
callq 0x4094
leaq 0xd13f(%rip), %rbp      # 0xf969
movq %r14, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xa93d
leaq 0xd125(%rip), %rsi      # 0xf96d
movl %eax, %edi
movq %rbx, %rdx
movl $0xfe, %ecx
callq 0x4094
leaq 0xd151(%rip), %rsi      # 0xf9af
movq %r14, %rdi
movq %rbp, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xa93d
leaq 0xd13b(%rip), %rsi      # 0xf9b4
movl %eax, %edi
movq %rbx, %rdx
movl $0xff, %ecx
callq 0x4094
leaq 0xd168(%rip), %rsi      # 0xf9f7
leaq 0xd16a(%rip), %rdx      # 0xfa00
movq %r14, %rdi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xa93d
leaq 0xd159(%rip), %rsi      # 0xfa07
movl %eax, %edi
movq %rbx, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x4094
leaq 0xd18d(%rip), %rsi      # 0xfa51
leaq 0xd194(%rip), %rdx      # 0xfa5f
movq %r14, %rdi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
callq 0xa93d
leaq 0xd188(%rip), %rsi      # 0xfa6b
movl %eax, %edi
movq %rbx, %rdx
movl $0x101, %ecx            # imm = 0x101
callq 0x4094
movq %r14, %rdi
callq 0x708b
movl $0x2c, %edi
callq 0x794e
movq %rax, %r14
callq 0x8d57
leaq 0xfb(%rip), %rdi        # 0x2a0e
movq %r14, %rsi
movq %rax, %rdx
callq 0x7f4d
movq %rax, %r14
leaq 0xd197(%rip), %rdi      # 0xfabf
leaq 0xd197(%rip), %rsi      # 0xfac6
movq %rsp, %r15
movq %rax, %rdx
movq %r15, %rcx
callq 0x6bd7
movq (%r15), %r15
movq (%r15), %rsi
leaq 0xd190(%rip), %rdi      # 0xfada
callq 0x1130
xorl %edi, %edi
testl %eax, %eax
sete %dil
leaq 0xd180(%rip), %rsi      # 0xfade
movq %rbx, %rdx
movl $0x10a, %ecx            # imm = 0x10A
callq 0x4094
movq 0x8(%r15), %rsi
leaq 0xd184(%rip), %rdi      # 0xfafa
callq 0x1130
xorl %edi, %edi
testl %eax, %eax
sete %dil
leaq 0xd174(%rip), %rsi      # 0xfafe
movq %rbx, %rdx
movl $0x10b, %ecx            # imm = 0x10B
callq 0x4094
movq 0x10(%r15), %rsi
leaq 0xd178(%rip), %rdi      # 0xfb1a
callq 0x1130
xorl %edi, %edi
testl %eax, %eax
sete %dil
leaq 0xd169(%rip), %rsi      # 0xfb1f
movq %rbx, %rdx
movl $0x10c, %ecx            # imm = 0x10C
callq 0x4094
movq 0x18(%r15), %rsi
leaq 0xd105(%rip), %rdi      # 0xfad3
callq 0x1130
xorl %edi, %edi
testl %eax, %eax
sete %dil
leaq 0xd15a(%rip), %rsi      # 0xfb3c
movq %rbx, %rdx
movl $0x10d, %ecx            # imm = 0x10D
callq 0x4094
movq %r15, %rdi
callq 0x1270
movq %r14, %rdi
callq 0x708b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq