// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/lua/lvm.c
// Function: luaV_finishset
void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
                     StkId val, const TValue *slot) {
  int loop;  /* counter to avoid infinite loops */
  for (loop = 0; loop < MAXTAGLOOP; loop++) {
    const TValue *tm;  /* '__newindex' metamethod */
    if (slot != NULL) {  /* is 't' a table? */
      Table *h = hvalue(t);  /* save 't' table */
      lua_assert(ttisnil(slot));  /* old value must be nil */
      tm = fasttm(L, h->metatable, TM_NEWINDEX);  /* get metamethod */
      if (tm == NULL) {  /* no metamethod? */
        if (slot == luaO_nilobject)  /* no previous entry? */
          slot = luaH_newkey(L, h, key);  /* create one */
        /* no metamethod and (now) there is an entry with given key */
        setobj2t(L, cast(TValue *, slot), val);  /* set its new value */
        invalidateTMcache(h);
        luaC_barrierback(L, h, val);
        return;
      }
      /* else will try the metamethod */
    }
    else {  /* not a table; check metamethod */
      if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
        luaG_typeerror(L, t, "index");
    }
    /* try the metamethod */
    if (ttisfunction(tm)) {
      luaT_callTM(L, tm, t, key, val, 0);
      return;
    }
    t = tm;  /* else repeat assignment over 'tm' */
    if (luaV_fastset(L, t, key, slot, luaH_get, val))
      return;  /* done */
    /* else loop */
  }
  luaG_runerror(L, "'__newindex' chain too long; possible loop");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movl $0x7d0, %ebp            # imm = 0x7D0
subl $0x1, %ebp
jb 0x1025b
testq %r12, %r12
je 0x10139
movq (%r14), %r15
movq 0x28(%r15), %rdi
testq %rdi, %rdi
je 0x1018f
testb $0x2, 0xa(%rdi)
jne 0x1018f
movq 0x18(%rbx), %rax
movq 0xe8(%rax), %rdx
pushq $0x1
popq %rsi
callq 0xf48b
testq %rax, %rax
je 0x1018f
movq %rax, %r13
movl 0x8(%rax), %eax
jmp 0x10155
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
callq 0xf4b4
movq %rax, %r13
movl 0x8(%rax), %eax
testl %eax, %eax
je 0x1026c
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x6, %ecx
je 0x101f3
cmpl $0x45, %eax
jne 0x10184
movq (%r13), %rdi
movq 0x10(%rsp), %rsi
callq 0xf29c
movq %rax, %r12
cmpl $0x0, 0x8(%rax)
je 0x10187
jmp 0x1021c
xorl %r12d, %r12d
movq %r13, %r14
jmp 0x100f9
leaq 0xf4da(%rip), %rax      # 0x1f670
cmpq %rax, %r12
jne 0x101ae
movq %rbx, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
callq 0xed98
movq %rax, %r12
movq 0x8(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, (%r12)
movb $0x0, 0xa(%r15)
testb $0x40, 0x8(%rax)
je 0x1024c
testb $0x4, 0x9(%r15)
je 0x1024c
movq (%rax), %rax
testb $0x3, 0x9(%rax)
je 0x1024c
movq %rbx, %rdi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9823
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
xorl %r9d, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf585
movq 0x8(%rsp), %r14
testb $0x40, 0x8(%r14)
je 0x10243
movq (%r13), %rsi
testb $0x4, 0x9(%rsi)
je 0x10243
movq (%r14), %rax
testb $0x3, 0x9(%rax)
je 0x10243
movq %rbx, %rdi
callq 0x9823
movups (%r14), %xmm0
movups %xmm0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xff36(%rip), %rsi      # 0x20198
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7930
leaq 0x10cb4(%rip), %rdx     # 0x20f27
movq %rbx, %rdi
movq %r14, %rsi
callq 0x78f2