// File: /workspace/github_c_makefile_star2_O3/orangeduck[P]mpc/mpc.c
// Function: mpc_err_string
char *mpc_err_string(mpc_err_t *x) {

  int i;
  int pos = 0;
  int max = 1023;
  char *buffer = calloc(1, 1024);
  char char_unescape_buffer[4];

  if (x->failure) {
    mpc_err_string_cat(buffer, &pos, &max,
    "%s: error: %s\n", x->filename, x->failure);
    return buffer;
  }

  mpc_err_string_cat(buffer, &pos, &max,
    "%s:%li:%li: error: expected ", x->filename, x->state.row+1, x->state.col+1);

  if (x->expected_num == 0) { mpc_err_string_cat(buffer, &pos, &max, "ERROR: NOTHING EXPECTED"); }
  if (x->expected_num == 1) { mpc_err_string_cat(buffer, &pos, &max, "%s", x->expected[0]); }
  if (x->expected_num >= 2) {

    for (i = 0; i < x->expected_num-2; i++) {
      mpc_err_string_cat(buffer, &pos, &max, "%s, ", x->expected[i]);
    }

    mpc_err_string_cat(buffer, &pos, &max, "%s or %s",
      x->expected[x->expected_num-2],
      x->expected[x->expected_num-1]);
  }

  mpc_err_string_cat(buffer, &pos, &max, " at ");
  mpc_err_string_cat(buffer, &pos, &max, mpc_err_char_unescape(x->received, char_unescape_buffer));
  mpc_err_string_cat(buffer, &pos, &max, "\n");

  return realloc(buffer, strlen(buffer) + 1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movl $0x0, 0x8(%rsp)
movl $0x1, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x4280
movq %rax, %rbx
movq 0x28(%r14), %r8
movq 0x30(%r14), %r9
testq %r9, %r9
je 0x4766
leaq 0x9baa(%rip), %rcx      # 0xe2f0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x8(%r14), %r9
movq 0x10(%r14), %rax
incq %r9
incq %rax
movq %rax, (%rsp)
leaq 0x9b80(%rip), %rcx      # 0xe2ff
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
movl 0x20(%r14), %eax
testl %eax, %eax
jne 0x47b0
leaq 0x9b7f(%rip), %rcx      # 0xe31c
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
movl 0x20(%r14), %eax
cmpl $0x1, %eax
jne 0x47d6
movq 0x38(%r14), %rax
movq (%rax), %r8
leaq 0x9e58(%rip), %rcx      # 0xe61b
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
movl 0x20(%r14), %eax
cmpl $0x2, %eax
jl 0x4840
jne 0x47e6
movl $0x2, %eax
xorl %ecx, %ecx
jmp 0x481d
leaq 0x9b47(%rip), %r15      # 0xe334
leaq 0x8(%rsp), %r12
xorl %r13d, %r13d
movq 0x38(%r14), %rax
movq (%rax,%r13,8), %r8
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x491e
incq %r13
movslq 0x20(%r14), %rax
leaq -0x2(%rax), %rcx
cmpq %rcx, %r13
jl 0x47f5
movq 0x38(%r14), %rdx
movq (%rdx,%rcx,8), %r8
movq -0x8(%rdx,%rax,8), %r9
leaq 0x9b08(%rip), %rcx      # 0xe339
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
leaq 0x9afb(%rip), %rcx      # 0xe342
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x491e
movzbl 0x40(%r14), %eax
movl $0x272027, 0xc(%rsp)    # imm = 0x272027
cmpq $0xd, %rax
ja 0x4882
leaq 0x9790(%rip), %rcx      # 0xe000
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
leaq 0x9b8c(%rip), %rcx      # 0xe40c
jmp 0x48d7
cmpl $0x20, %eax
jne 0x4890
leaq 0x9bb6(%rip), %rcx      # 0xe444
jmp 0x48d7
leaq 0xc(%rsp), %rcx
movb %al, 0x1(%rcx)
jmp 0x48d7
leaq 0x9dd3(%rip), %rcx      # 0xe674
jmp 0x48d7
leaq 0x9dc1(%rip), %rcx      # 0xe66b
jmp 0x48d7
leaq 0x9dae(%rip), %rcx      # 0xe661
jmp 0x48d7
leaq 0x9da0(%rip), %rcx      # 0xe65c
jmp 0x48d7
leaq 0x9e94(%rip), %rcx      # 0xe759
jmp 0x48d7
leaq 0x9dbf(%rip), %rcx      # 0xe68d
jmp 0x48d7
leaq 0x9dad(%rip), %rcx      # 0xe684
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x491e
leaq 0x9f2a(%rip), %rcx      # 0xe81a
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x491e
movq %rbx, %rdi
callq 0x4130
leaq 0x1(%rax), %rsi
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x43f0