// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x3ff, -0x1c(%rbp)     # imm = 0x3FF
movl $0x1, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x4390
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x4abf
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x30(%rax), %r9
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd9c3(%rip), %rcx      # 0x1246e
movb $0x0, %al
callq 0x4c90
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4c81
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %r9
addq $0x1, %r9
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x1, %rax
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd98b(%rip), %rcx      # 0x1247d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x4c90
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x4b21
movq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd980(%rip), %rcx      # 0x1249a
movb $0x0, %al
callq 0x4c90
movq -0x10(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x4b50
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %r8
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xdc50(%rip), %rcx      # 0x12799
movb $0x0, %al
callq 0x4c90
movq -0x10(%rbp), %rax
cmpl $0x2, 0x20(%rax)
jl 0x4bf7
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x4bab
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %r8
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd919(%rip), %rcx      # 0x124b2
movb $0x0, %al
callq 0x4c90
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4b65
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r8
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r9
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd8c7(%rip), %rcx      # 0x124b7
movb $0x0, %al
callq 0x4c90
movq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xd8b6(%rip), %rcx      # 0x124c0
movb $0x0, %al
callq 0x4c90
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movb 0x40(%rax), %al
leaq -0x2c(%rbp), %rsi
movsbl %al, %edi
callq 0x4d60
movq -0x40(%rbp), %rdi
movq %rax, %rcx
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
movb $0x0, %al
callq 0x4c90
movq -0x28(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq 0xdd51(%rip), %rcx      # 0x129a6
movb $0x0, %al
callq 0x4c90
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41b0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
addq $0x1, %rsi
callq 0x45e0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)