// File: /workspace/github_c_makefile_star2_O3/orangeduck[P]mpc/mpc.c
// Function: mpc_err_repeat
static mpc_err_t *mpc_err_repeat(mpc_input_t *i, mpc_err_t *x, const char *prefix) {

  int j = 0;
  size_t l = 0;
  char *expect = NULL;

  if (x == NULL) { return NULL; }

  if (x->expected_num == 0) {
    expect = mpc_calloc(i, 1, 1);
    x->expected_num = 1;
    x->expected = mpc_realloc(i, x->expected, sizeof(char*) * x->expected_num);
    x->expected[0] = expect;
    return x;
  }

  else if (x->expected_num == 1) {
    expect = mpc_malloc(i, strlen(prefix) + strlen(x->expected[0]) + 1);
    strcpy(expect, prefix);
    strcat(expect, x->expected[0]);
    mpc_free(i, x->expected[0]);
    x->expected[0] = expect;
    return x;
  }

  else if (x->expected_num > 1) {

    l += strlen(prefix);
    for (j = 0; j < x->expected_num-2; j++) {
      l += strlen(x->expected[j]) + strlen(", ");
    }
    l += strlen(x->expected[x->expected_num-2]);
    l += strlen(" or ");
    l += strlen(x->expected[x->expected_num-1]);

    expect = mpc_malloc(i, l + 1);

    strcpy(expect, prefix);
    for (j = 0; j < x->expected_num-2; j++) {
      strcat(expect, x->expected[j]); strcat(expect, ", ");
    }
    strcat(expect, x->expected[x->expected_num-2]);
    strcat(expect, " or ");
    strcat(expect, x->expected[x->expected_num-1]);

    for (j = 0; j < x->expected_num; j++) { mpc_free(i, x->expected[j]); }

    x->expected_num = 1;
    x->expected = mpc_realloc(i, x->expected, sizeof(char*) * x->expected_num);
    x->expected[0] = expect;
    return x;
  }

  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0xd568
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x20(%rsi), %rbp
cmpq $0x1, %rbp
je 0xd424
testl %ebp, %ebp
jne 0xd49d
movl $0x1, %esi
movq %r14, %rdi
callq 0xc5d1
movq %rax, %r15
movb $0x0, (%rax)
jmp 0xd615
movq %r12, %rdi
callq 0x4130
movq %rax, %r15
movq 0x38(%rbx), %rax
movq (%rax), %rdi
callq 0x4130
leaq (%r15,%rax), %rsi
incq %rsi
movq %r14, %rdi
callq 0xc5d1
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
movq 0x38(%rbx), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x44b0
movq 0x38(%rbx), %rax
movq (%rax), %rdi
leaq 0x278(%r14), %rax
cmpq %rdi, %rax
seta %cl
leaq 0x8278(%r14), %rdx
cmpq %rdi, %rdx
setbe %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0xd56f
callq 0x4580
jmp 0xd57c
cmpl $0x2, %ebp
jl 0xd568
movq %r14, 0x10(%rsp)
movq %r12, 0x8(%rsp)
movq %r12, %rdi
callq 0x4130
movq %rax, %r15
movq 0x38(%rbx), %r12
cmpl $0x2, %ebp
je 0xd4e5
leal -0x2(%rbp), %eax
movl %eax, %r13d
xorl %r14d, %r14d
movq (%r12,%r14,8), %rdi
callq 0x4130
addq %rax, %r15
addq $0x2, %r15
incq %r14
cmpq %r14, %r13
jne 0xd4cd
movq -0x10(%r12,%rbp,8), %rdi
callq 0x4130
movq %rax, %r13
movq -0x8(%r12,%rbp,8), %rdi
callq 0x4130
addq %r15, %r13
leaq (%rax,%r13), %rsi
addq $0x5, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xc5d1
movq %rax, %r15
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x40b0
movslq 0x20(%rbx), %rax
cmpq $0x3, %rax
jl 0xd585
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x44b0
movq %r15, %rdi
callq 0x4130
movw $0x202c, (%r15,%rax)    # imm = 0x202C
movb $0x0, 0x2(%r15,%rax)
incq %r12
movslq 0x20(%rbx), %rax
addq $-0x2, %rax
cmpq %rax, %r12
jl 0xd531
jmp 0xd589
xorl %ebx, %ebx
jmp 0xd655
subq %rax, %rdi
shrq $0x6, %rdi
movb $0x0, 0x78(%r14,%rdi)
movq 0x38(%rbx), %rax
jmp 0xd652
addq $-0x2, %rax
movq 0x38(%rbx), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x44b0
movq %r15, %rdi
callq 0x4130
movl $0x20726f20, (%r15,%rax) # imm = 0x20726F20
movb $0x0, 0x4(%r15,%rax)
movq 0x38(%rbx), %rax
movslq 0x20(%rbx), %rcx
movq -0x8(%rax,%rcx,8), %rsi
movq %r15, %rdi
callq 0x44b0
cmpl $0x0, 0x20(%rbx)
jle 0xd615
leaq 0x278(%r14), %r12
leaq 0x8278(%r14), %r13
xorl %ebp, %ebp
movq 0x38(%rbx), %rax
movq (%rax,%rbp,8), %rdi
cmpq %rdi, %r12
seta %al
cmpq %rdi, %r13
setbe %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xd5fc
callq 0x4580
jmp 0xd609
subq %r12, %rdi
shrq $0x6, %rdi
movb $0x0, 0x78(%r14,%rdi)
incq %rbp
movslq 0x20(%rbx), %rax
cmpq %rax, %rbp
jl 0xd5da
movl $0x1, 0x20(%rbx)
movq 0x38(%rbx), %rax
leaq 0x278(%r14), %rcx
cmpq %rax, %rcx
seta %cl
addq $0x8278, %r14           # imm = 0x8278
cmpq %rax, %r14
setbe %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0xd64e
movl $0x8, %esi
movq %rax, %rdi
callq 0x43f0
movq %rax, 0x38(%rbx)
movq %r15, (%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq