// File: /workspace/github_c_makefile_star2_O1/mattn[P]orelang/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);
  
  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:%i:%i: 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->recieved));
  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, 0xc(%rsp)
movl $0x1, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x2140
movq %rax, %rbx
movq 0x20(%r14), %r8
movq 0x28(%r14), %r9
testq %r9, %r9
je 0x2c26
leaq 0x1168a(%rip), %rcx     # 0x14290
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
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 0x11660(%rip), %rcx     # 0x1429f
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
cmpl $0x0, 0x18(%r14)
jne 0x2c6b
leaq 0x1165e(%rip), %rcx     # 0x142ba
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
cmpl $0x1, 0x18(%r14)
jne 0x2c8f
movq 0x30(%r14), %rax
movq (%rax), %r8
leaq 0x11925(%rip), %rcx     # 0x145a5
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
cmpl $0x2, 0x18(%r14)
jl 0x2d03
movl 0x18(%r14), %eax
cmpl $0x3, %eax
jl 0x2cd8
leaq 0x1162c(%rip), %r15     # 0x142d2
leaq 0xc(%rsp), %r12
xorl %r13d, %r13d
movq 0x30(%r14), %rax
movq (%rax,%r13,8), %r8
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2de8
incq %r13
movslq 0x18(%r14), %rax
leaq -0x2(%rax), %rcx
cmpq %rcx, %r13
jl 0x2cae
jmp 0x2cdb
leal -0x2(%rax), %ecx
movq 0x30(%r14), %rdx
movslq %ecx, %rcx
movq (%rdx,%rcx,8), %r8
cltq
movq -0x8(%rdx,%rax,8), %r9
leaq 0x115e3(%rip), %rcx     # 0x142d7
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
leaq 0x115d6(%rip), %rcx     # 0x142e0
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2de8
movzbl 0x38(%r14), %eax
movl $0x272027, 0x194d9(%rip) # imm = 0x272027
cmpq $0xd, %rax
ja 0x2d47
leaq 0x112cf(%rip), %rcx     # 0x14004
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
leaq 0x11665(%rip), %rcx     # 0x143aa
jmp 0x2da1
cmpl $0x20, %eax
jne 0x2d55
leaq 0x11679(%rip), %rcx     # 0x143cc
jmp 0x2da1
movb %al, 0x194a7(%rip)      # 0x1c202
leaq 0x1949f(%rip), %rcx     # 0x1c201
jmp 0x2da1
leaq 0x11893(%rip), %rcx     # 0x145fe
jmp 0x2da1
leaq 0x11881(%rip), %rcx     # 0x145f5
jmp 0x2da1
leaq 0x1186e(%rip), %rcx     # 0x145eb
jmp 0x2da1
leaq 0x11860(%rip), %rcx     # 0x145e6
jmp 0x2da1
leaq 0x1164a(%rip), %rcx     # 0x143d9
jmp 0x2da1
leaq 0x1187f(%rip), %rcx     # 0x14617
jmp 0x2da1
leaq 0x1186d(%rip), %rcx     # 0x1460e
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2de8
leaq 0x1315e(%rip), %rcx     # 0x15f18
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2de8
movq %rbx, %rdi
callq 0x20c0
leaq 0x1(%rax), %rsi
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x21e0