// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
leal 0x1(%r15), %esi
movl %ebp, %edx
callq 0x9d9b
movq %rax, (%rbx)
testq %rax, %rax
je 0x81da
leaq 0x1aad6(%rip), %rax     # 0x22cab
jmp 0x841a
testl %ebp, %ebp
jle 0x82a6
movl %ebp, %eax
movq 0x38(%r14), %rcx
xorl %edx, %edx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x196ba(%rip), %rsi     # 0x218b0
xorl %edi, %edi
movl (%rcx,%rdx,4), %r9d
movl %r9d, %r10d
andl $0x3f, %r10d
movl %r9d, %r8d
shrl $0x6, %r8d
movzbl %r8b, %r8d
cmpl $0x23, %r10d
jle 0x822f
leal -0x24(%r10), %r9d
cmpl $0x2, %r9d
jb 0x8228
cmpl $0x29, %r10d
jne 0x827a
addl $0x2, %r8d
cmpl %r15d, %r8d
jle 0x8289
jmp 0x8298
cmpl $0x4, %r10d
je 0x8267
cmpl $0x1e, %r10d
jne 0x827a
shrl $0xe, %r9d
leaq (%rdx,%r9), %r8
addq $-0x1fffe, %r8          # imm = 0xFFFE0002
movslq %r8d, %r8
cmpl %edi, %r8d
movl %edi, %r9d
cmovgl %r8d, %r9d
cmpq %r8, %rdx
cmovgel %edi, %r9d
cmpl %eax, %r8d
cmovlel %r9d, %edi
jmp 0x8298
cmpl %r15d, %r8d
jg 0x8298
shrl $0x17, %r9d
addl %r9d, %r8d
cmpl %r15d, %r8d
jge 0x8289
jmp 0x8298
cmpl %r15d, %r8d
jne 0x8298
movb (%r10,%rsi), %r8b
andb $0x40, %r8b
je 0x8298
movslq %edi, %r8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %r8, %rdx
jl 0x8298
movl %edx, %ebp
incq %rdx
cmpq %rdx, %rax
jne 0x81f8
jmp 0x82ab
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
je 0x8418
movq 0x38(%r14), %rcx
movslq %ebp, %rsi
movl (%rcx,%rsi,4), %edx
movl %edx, %eax
andl $0x3f, %eax
movb $0x1, %r15b
cmpl $0xc, %eax
ja 0x8328
leaq 0x18faa(%rip), %rdi     # 0x2127c
movslq (%rdi,%rax,4), %r8
addq %rdi, %r8
jmpq *%r8
movl %edx, %r15d
shrl $0xe, %r15d
andl $0x1ff, %r15d           # imm = 0x1FF
shrl $0x17, %edx
cmpl $0x7, %eax
jne 0x8386
incl %edx
movq %r14, %rdi
movl %edx, %esi
movl %ebp, %edx
callq 0x9d9b
movq %rax, %r12
jmp 0x83a3
shrl $0xe, %edx
jmp 0x8356
movl %edx, %eax
shrl $0x17, %eax
shrl $0x6, %edx
movzbl %dl, %ecx
cmpl %ecx, %eax
setae %r15b
jb 0x8423
jmp 0x8413
shrl $0xe, %edx
andl $0x1ff, %edx            # imm = 0x1FF
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x8434
leaq 0x19034(%rip), %rax     # 0x2137e
jmp 0x8410
movl 0x4(%rcx,%rsi,4), %edx
shrl $0x6, %edx
movq 0x30(%r14), %rcx
shll $0x4, %edx
movl 0x8(%rcx,%rdx), %esi
andl $0xf, %esi
leaq 0x1902c(%rip), %rax     # 0x21397
cmpl $0x4, %esi
jne 0x8413
addq %rdx, %rcx
movq (%rcx), %rcx
addq $0x18, %rcx
movq %rcx, (%rbx)
jmp 0x8410
movq 0x58(%r14), %rax
shll $0x4, %edx
movq (%rax,%rdx), %rax
leaq 0x18(%rax), %rcx
testq %rax, %rax
leaq 0x18fc7(%rip), %r12     # 0x21366
cmovneq %rcx, %r12
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
movq %rbx, %rcx
callq 0x8434
testq %r12, %r12
je 0x8409
leaq 0x18fc6(%rip), %rsi     # 0x21385
movq %r12, %rdi
callq 0x5290
testl %eax, %eax
leaq 0x18fba(%rip), %rcx     # 0x2138a
leaq 0x18fba(%rip), %rax     # 0x21391
cmoveq %rcx, %rax
jmp 0x8410
movq 0x58(%r14), %rax
shrl $0x13, %edx
andl $-0x10, %edx
movq (%rax,%rdx), %rax
leaq 0x18(%rax), %rcx
testq %rax, %rax
leaq 0x18f6d(%rip), %rax     # 0x21366
cmovneq %rcx, %rax
movq %rax, (%rbx)
leaq 0x1a8b9(%rip), %rax     # 0x22cc0
jmp 0x8410
leaq 0x18f81(%rip), %rax     # 0x21391
xorl %r15d, %r15d
testb %r15b, %r15b
je 0x841a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
movq %rbx, %rcx
callq 0x81a8
jmp 0x8413