// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lvm.c
// Function: luaV_finishget
void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val,
                      const TValue *slot) {
  int loop;  /* counter to avoid infinite loops */
  const TValue *tm;  /* metamethod */
  for (loop = 0; loop < MAXTAGLOOP; loop++) {
    if (slot == NULL) {  /* 't' is not a table? */
      lua_assert(!ttistable(t));
      tm = luaT_gettmbyobj(L, t, TM_INDEX);
      if (ttisnil(tm))
        luaG_typeerror(L, t, "index");  /* no metamethod */
      /* else will try the metamethod */
    }
    else {  /* 't' is a table */
      lua_assert(ttisnil(slot));
      tm = fasttm(L, hvalue(t)->metatable, TM_INDEX);  /* table's metamethod */
      if (tm == NULL) {  /* no metamethod? */
        setnilvalue(val);  /* result is nil */
        return;
      }
      /* else will try the metamethod */
    }
    if (ttisfunction(tm)) {  /* is metamethod a function? */
      luaT_callTM(L, tm, t, key, val, 1);  /* call it */
      return;
    }
    t = tm;  /* else try to access 'tm[key]' */
    if (luaV_fastget(L,t,key,slot,luaH_get)) {  /* fast track? */
      setobj2s(L, val, slot);  /* done */
      return;
    }
    /* else repeat (tail call 'luaV_finishget') */
  }
  luaG_runerror(L, "'__index' chain too long; possible loop");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x7d0, -0x2c(%rbp)     # imm = 0x7D0
jge 0x19b8c
cmpq $0x0, -0x28(%rbp)
jne 0x19a5d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x18640
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x19a58
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x1cb34(%rip), %rdx     # 0x36587
callq 0x9870
jmp 0x19ae0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x28(%rax)
jne 0x19a73
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x19abf
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movzbl 0xa(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19a92
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x19ab7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0xe0(%rax), %rdx
xorl %esi, %esi
callq 0x185d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x19ade
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x19b9e
jmp 0x19ae0
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x6, %eax
jne 0x19b13
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x1, %r9d
callq 0x187d0
jmp 0x19b9e
movq -0x38(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x45, 0x8(%rax)
je 0x19b35
movq $0x0, -0x28(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x19b5c
jmp 0x19b7c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x17f80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x19b5c
jmp 0x19b7c
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x19b9e
jmp 0x19b7e
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x19a13
movq -0x8(%rbp), %rdi
leaq 0x1b959(%rip), %rsi     # 0x354f0
movb $0x0, %al
callq 0x98e0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)