// File: /workspace/github_c_makefile_star2_O1/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 0xd6c5
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x20(%rsi), %rbp
cmpq $0x1, %rbp
je 0xd57e
testl %ebp, %ebp
jne 0xd5f7
movl $0x1, %esi
movq %r14, %rdi
callq 0xc6fc
movq %rax, %r15
movb $0x0, (%rax)
jmp 0xd773
movq %r12, %rdi
callq 0x4120
movq %rax, %r15
movq 0x38(%rbx), %rax
movq (%rax), %rdi
callq 0x4120
leaq (%r15,%rax), %rsi
incq %rsi
movq %r14, %rdi
callq 0xc6fc
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
callq 0x40b0
movq 0x38(%rbx), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq 0x44c0
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 0xd6cc
callq 0x4580
jmp 0xd6d9
cmpl $0x2, %ebp
jl 0xd6c5
movq %r14, 0x10(%rsp)
movq %r12, 0x8(%rsp)
movq %r12, %rdi
callq 0x4120
movq %rax, %r15
cmpl $0x2, %ebp
je 0xd640
leal -0x2(%rbp), %eax
movq 0x38(%rbx), %r13
movl %eax, %r12d
xorl %r14d, %r14d
movq (%r13,%r14,8), %rdi
callq 0x4120
addq %rax, %r15
addq $0x2, %r15
incq %r14
cmpq %r14, %r12
jne 0xd627
movq 0x38(%rbx), %r14
movq -0x10(%r14,%rbp,8), %rdi
callq 0x4120
movq %rax, %r13
movq -0x8(%r14,%rbp,8), %rdi
callq 0x4120
addq %r15, %r13
leaq (%rax,%r13), %rsi
addq $0x5, %rsi
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xc6fc
movq %rax, %r15
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x40b0
movl 0x20(%rbx), %eax
cmpl $0x3, %eax
jl 0xd6e2
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x44c0
movq %r15, %rdi
callq 0x4120
movw $0x202c, (%r15,%rax)    # imm = 0x202C
movb $0x0, 0x2(%r15,%rax)
incq %r12
movslq 0x20(%rbx), %rax
addq $-0x2, %rax
cmpq %rax, %r12
jl 0xd68e
jmp 0xd6e5
xorl %ebx, %ebx
jmp 0xd7b3
subq %rax, %rdi
shrq $0x6, %rdi
movb $0x0, 0x78(%r14,%rdi)
movq 0x38(%rbx), %rax
jmp 0xd7b0
addl $-0x2, %eax
movq 0x38(%rbx), %rcx
cltq
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x44c0
movq %r15, %rdi
callq 0x4120
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 0x44c0
cmpl $0x0, 0x20(%rbx)
jle 0xd773
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 0xd75a
callq 0x4580
jmp 0xd767
subq %r12, %rdi
shrq $0x6, %rdi
movb $0x0, 0x78(%r14,%rdi)
incq %rbp
movslq 0x20(%rbx), %rax
cmpq %rax, %rbp
jl 0xd738
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 0xd7ac
movl $0x8, %esi
movq %rax, %rdi
callq 0x4400
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