// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/lua-5.1.5/src/lvm.c
// Function: luaV_settable
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
  int loop;
  TValue temp;
  for (loop = 0; loop < MAXTAGLOOP; loop++) {
    const TValue *tm;
    if (ttistable(t)) {  /* `t' is a table? */
      Table *h = hvalue(t);
      TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
      if (!ttisnil(oldval) ||  /* result is no nil? */
          (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
        setobj2t(L, oldval, val);
        h->flags = 0;
        luaC_barriert(L, h, val);
        return;
      }
      /* else will try the tag method */
    }
    else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
      luaG_typeerror(L, t, "index");
    if (ttisfunction(tm)) {
      callTM(L, tm, t, key, val);
      return;
    }
    /* else repeat with `tm' */
    setobj(L, &temp, tm);  /* avoid pointing inside table (may rehash) */
    t = &temp;
  }
  luaG_runerror(L, "loop in settable");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, 0x10(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
movl $0x64, %r14d
movq %rcx, 0x8(%rsp)
cmpl $0x5, 0x8(%r13)
jne 0x58fe0
movq (%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq 0x59204
movq %rax, %r15
cmpl $0x0, 0x8(%rax)
je 0x5900d
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq %rax, (%r15)
movl 0x8(%rcx), %eax
movl %eax, 0x8(%r15)
movb $0x0, 0xa(%r12)
cmpl $0x4, 0x8(%rcx)
jl 0x58fdc
movq (%rcx), %rax
testb $0x3, 0x9(%rax)
je 0x58fdc
movb 0x9(%r12), %al
testb $0x4, %al
je 0x58fdc
movq 0x20(%rbx), %rcx
andb $-0x5, %al
movb %al, 0x9(%r12)
movq 0x40(%rcx), %rax
movq %rax, 0x30(%r12)
movq %r12, 0x40(%rcx)
xorl %eax, %eax
jmp 0x59044
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x5f010
movq %rax, %rbp
cmpl $0x0, 0x8(%rax)
jne 0x59051
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x95e13(%rip), %rdx     # 0xeee19
callq 0x5f08c
jmp 0x59051
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x59037
testb $0x2, 0xa(%rdi)
jne 0x59037
movq 0x20(%rbx), %rax
movq 0x130(%rax), %rdx
movl $0x1, %esi
callq 0x66b52
movq %rax, %rbp
jmp 0x59039
xorl %ebp, %ebp
movb $0x1, %al
testq %rbp, %rbp
je 0x59110
testb %al, %al
je 0x590f8
movq 0x8(%rsp), %r12
movl 0x8(%rbp), %eax
cmpl $0x6, %eax
jne 0x590e1
movq 0x10(%rbx), %rax
movq (%rbp), %rcx
movq %rcx, (%rax)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq 0x10(%rbx), %rax
movq (%r13), %rcx
movq %rcx, 0x10(%rax)
movl 0x8(%r13), %ecx
movl %ecx, 0x18(%rax)
movq 0x10(%rbx), %rax
movq 0x10(%rsp), %rdx
movq (%rdx), %rcx
movq %rcx, 0x20(%rax)
movl 0x8(%rdx), %ecx
movl %ecx, 0x28(%rax)
movq 0x10(%rbx), %rax
movq (%r12), %rcx
movq %rcx, 0x30(%rax)
movl 0x8(%r12), %ecx
movl %ecx, 0x38(%rax)
movq 0x38(%rbx), %rax
subq 0x10(%rbx), %rax
cmpq $0x40, %rax
jg 0x590c6
movq %rbx, %rdi
movl $0x4, %esi
callq 0x576ac
movq 0x10(%rbx), %rsi
leaq 0x40(%rsi), %rax
movq %rax, 0x10(%rbx)
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x594c2
jmp 0x59100
movq (%rbp), %rcx
movq %rcx, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x1, %r15b
leaq 0x18(%rsp), %r13
jmp 0x59100
xorl %r15d, %r15d
movq 0x8(%rsp), %r12
testb %r15b, %r15b
je 0x59117
decl %r14d
jne 0x58f70
jmp 0x59126
xorl %ebp, %ebp
jmp 0x58f94
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x952ad(%rip), %rsi     # 0xee3da
movq %rbx, %rdi
xorl %eax, %eax
callq 0x57b1c