// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/ldebug.c
// Function: getobjname
static const char *getobjname (Proto *p, int lastpc, int reg,
                               const char **name) {
  int pc;
  *name = luaF_getlocalname(p, reg + 1, lastpc);
  if (*name)  /* is a local? */
    return "local";
  /* else try symbolic execution */
  pc = findsetreg(p, lastpc, reg);
  if (pc != -1) {  /* could find instruction? */
    Instruction i = p->code[pc];
    OpCode op = GET_OPCODE(i);
    switch (op) {
      case OP_MOVE: {
        int b = GETARG_B(i);  /* move from 'b' to 'a' */
        if (b < GETARG_A(i))
          return getobjname(p, pc, b, name);  /* get name for 'b' */
        break;
      }
      case OP_GETTABUP:
      case OP_GETTABLE: {
        int k = GETARG_C(i);  /* key index */
        int t = GETARG_B(i);  /* table index */
        const char *vn = (op == OP_GETTABLE)  /* name of indexed variable */
                         ? luaF_getlocalname(p, t + 1, pc)
                         : upvalname(p, t);
        kname(p, pc, k, name);
        return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field";
      }
      case OP_GETUPVAL: {
        *name = upvalname(p, GETARG_B(i));
        return "upvalue";
      }
      case OP_LOADK:
      case OP_LOADKX: {
        int b = (op == OP_LOADK) ? GETARG_Bx(i)
                                 : GETARG_Ax(p->code[pc + 1]);
        if (ttisstring(&p->k[b])) {
          *name = svalue(&p->k[b]);
          return "constant";
        }
        break;
      }
      case OP_SELF: {
        int k = GETARG_C(i);  /* key index */
        kname(p, pc, k, name);
        return "method";
      }
      default: break;  /* go through to return NULL */
    }
  }
  return NULL;  /* could not find reasonable name */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
addl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xd4e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa41c
leaq 0x2c018(%rip), %rax     # 0x3642b
movq %rax, -0x8(%rbp)
jmp 0xa657
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0xa670
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0xa64f
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
andl $0x3f, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq %rax, -0x50(%rbp)
subq $0xc, %rax
ja 0xa64b
movq -0x50(%rbp), %rax
leaq 0x29f45(%rip), %rcx     # 0x343b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x28(%rbp), %eax
shrl $0x17, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x28(%rbp), %ecx
shrl $0x6, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
jge 0xa4b5
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x30(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0xa3d0
movq %rax, -0x8(%rbp)
jmp 0xa657
jmp 0xa64d
movl -0x28(%rbp), %eax
shrl $0xe, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x34(%rbp)
movl -0x28(%rbp), %eax
shrl $0x17, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x38(%rbp)
cmpl $0x7, -0x2c(%rbp)
jne 0xa4f4
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
addl $0x1, %esi
movl -0x24(%rbp), %edx
callq 0xd4e0
movq %rax, -0x58(%rbp)
jmp 0xa504
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0xa7f0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x34(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0xa840
xorl %eax, %eax
cmpq $0x0, -0x40(%rbp)
movb %al, -0x59(%rbp)
je 0xa544
movq -0x40(%rbp), %rdi
leaq 0x2a01f(%rip), %rsi     # 0x34555
callq 0x5270
cmpl $0x0, %eax
sete %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %dl
leaq 0x2a013(%rip), %rax     # 0x34561
leaq 0x2a005(%rip), %rcx     # 0x3455a
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0xa657
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
shrl $0x17, %esi
andl $0x1ff, %esi            # imm = 0x1FF
callq 0xa7f0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0x2beb5(%rip), %rax     # 0x36440
movq %rax, -0x8(%rbp)
jmp 0xa657
cmpl $0x1, -0x2c(%rbp)
jne 0xa5aa
movl -0x28(%rbp), %eax
shrl $0xe, %eax
andl $0x3ffff, %eax          # imm = 0x3FFFF
movl %eax, -0x60(%rbp)
jmp 0xa5c9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
shrl $0x6, %eax
andl $0x3ffffff, %eax        # imm = 0x3FFFFFF
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0xa61b
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
addq $0x18, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0x29f52(%rip), %rax     # 0x34567
movq %rax, -0x8(%rbp)
jmp 0xa657
jmp 0xa64d
movl -0x28(%rbp), %eax
shrl $0xe, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x48(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0xa840
leaq 0x29f09(%rip), %rax     # 0x3454e
movq %rax, -0x8(%rbp)
jmp 0xa657
jmp 0xa64d
jmp 0xa64f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)