// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lgc.c
// Function: luaC_checkfinalizer
void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
  global_State *g = G(L);
  if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */
      isfinalized(o) ||                           /* ... or is finalized... */
      gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */
    return;  /* nothing to be done */
  else {  /* move 'o' to 'finobj' list */
    GCObject **p;
    GCheader *ho = gch(o);
    if (g->sweepgc == &ho->next) {  /* avoid removing current sweep object */
      lua_assert(issweepphase(g));
      g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
    }
    /* search for pointer pointing to 'o' */
    for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
    *p = ho->next;  /* remove 'o' from root list */
    ho->next = g->finobj;  /* link it in list 'finobj' */
    g->finobj = o;
    l_setbit(ho->marked, SEPARATED);  /* mark it as such */
    if (!keepinvariantout(g))  /* not keeping invariant? */
      makewhite(g, o);  /* "sweep" object */
    else
      resetoldbit(o);  /* see MOVE OLD rule */
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rsp), %rax
movzbl 0x9(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x130c3
movq 0x38(%rsp), %rax
movzbl 0x9(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x130c3
cmpq $0x0, 0x30(%rsp)
jne 0x13074
xorl %eax, %eax
movq %rax, 0x10(%rsp)
jmp 0x130b8
movq 0x30(%rsp), %rax
movzbl 0xa(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1308e
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x130ae
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x130(%rax), %rdx
movl $0x2, %esi
callq 0x264d0
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq $0x0, %rax
jne 0x130c8
jmp 0x131bf
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
jne 0x13108
movq 0x40(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x131d0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x70(%rax)
movq 0x28(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
cmpq 0x38(%rsp), %rax
je 0x13136
jmp 0x13127
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x13116
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x28(%rsp), %rax
movq 0x68(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0x18(%rsp), %rax
movzbl 0x9(%rax), %ecx
orl $0x10, %ecx
movb %cl, 0x9(%rax)
movq 0x28(%rsp), %rax
movzbl 0x55(%rax), %eax
cmpl $0x1, %eax
jle 0x131ab
movq 0x38(%rsp), %rax
movzbl 0x9(%rax), %eax
andl $-0x48, %eax
movq 0x28(%rsp), %rcx
movzbl 0x54(%rcx), %ecx
andl $0x3, %ecx
movzbl %cl, %ecx
orl %ecx, %eax
movb %al, %cl
movq 0x38(%rsp), %rax
movb %cl, 0x9(%rax)
jmp 0x131bd
movq 0x38(%rsp), %rax
movzbl 0x9(%rax), %ecx
andl $0xbf, %ecx
movb %cl, 0x9(%rax)
jmp 0x131bf
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)