// File: /workspace/github_c_makefile_star2_O1/tylerneylon[P]APIsWithLua/lua/lgc.c
// Function: traverseephemeron
static int traverseephemeron (global_State *g, Table *h) {
  int marked = 0;  /* true if an object is marked in this traversal */
  int hasclears = 0;  /* true if table has white keys */
  int hasww = 0;  /* true if table has entry "white-key -> white-value" */
  Node *n, *limit = gnodelast(h);
  unsigned int i;
  /* traverse array part */
  for (i = 0; i < h->sizearray; i++) {
    if (valiswhite(&h->array[i])) {
      marked = 1;
      reallymarkobject(g, gcvalue(&h->array[i]));
    }
  }
  /* traverse hash part */
  for (n = gnode(h, 0); n < limit; n++) {
    checkdeadkey(n);
    if (ttisnil(gval(n)))  /* entry is empty? */
      removeentry(n);  /* remove it */
    else if (iscleared(g, gkey(n))) {  /* key is not marked (yet)? */
      hasclears = 1;  /* table must be cleared */
      if (valiswhite(gval(n)))  /* value not marked yet? */
        hasww = 1;  /* white-white entry */
    }
    else if (valiswhite(gval(n))) {  /* value not marked yet? */
      marked = 1;
      reallymarkobject(g, gcvalue(gval(n)));  /* mark it now */
    }
  }
  /* link table into proper list */
  if (g->gcstate == GCSpropagate)
    linkgclist(h, g->grayagain);  /* must retraverse it in atomic phase */
  else if (hasww)  /* table has white->white entries? */
    linkgclist(h, g->ephemeron);  /* have to propagate again */
  else if (hasclears)  /* table has white keys? */
    linkgclist(h, g->allweak);  /* may have to clean white keys */
  return marked;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb 0xb(%rsi), %cl
movl $0x1, %eax
shll %cl, %eax
movq %rdi, %r14
movslq %eax, %r15
shlq $0x5, %r15
addq 0x18(%rsi), %r15
cmpl $0x0, 0xc(%rsi)
je 0xb0b2
xorl %r12d, %r12d
movl $0x8, %r13d
xorl %eax, %eax
movq 0x10(%rbx), %rcx
testb $0x40, (%rcx,%r13)
je 0xb0a1
movq -0x8(%rcx,%r13), %rsi
testb $0x3, 0x9(%rsi)
je 0xb0a1
movq %r14, %rdi
callq 0x9dfc
movl $0x1, %eax
incq %r12
movl 0xc(%rbx), %ecx
addq $0x10, %r13
cmpq %rcx, %r12
jb 0xb07e
jmp 0xb0b4
xorl %eax, %eax
movq 0x18(%rbx), %r13
xorl %r12d, %r12d
cmpq %r15, %r13
jae 0xb153
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
cmpl $0x0, 0x8(%r13)
je 0xb0fd
leaq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0xb1a0
movl 0x8(%r13), %ecx
testl %eax, %eax
je 0xb118
movl $0x1, %ebp
testb $0x40, %cl
je 0xb137
movq (%r13), %rax
testb $0x3, 0x9(%rax)
cmovnel %ebp, %r12d
jmp 0xb137
testb $0x40, 0x18(%r13)
je 0xb137
movq 0x10(%r13), %rax
testb $0x3, 0x9(%rax)
je 0xb137
movl $0xa, 0x18(%r13)
jmp 0xb137
testb $0x40, %cl
je 0xb137
movq (%r13), %rsi
testb $0x3, 0x9(%rsi)
je 0xb137
movq %r14, %rdi
callq 0x9dfc
movl $0x1, 0x4(%rsp)
addq $0x20, %r13
cmpq %r15, %r13
jb 0xb0ca
testl %r12d, %r12d
setne %sil
testl %ebp, %ebp
setne %r12b
movl 0x4(%rsp), %eax
jmp 0xb155
xorl %esi, %esi
movb 0x55(%r14), %cl
testb %cl, %cl
sete %dl
orb %sil, %r12b
orb %dl, %r12b
testb $0x1, %r12b
je 0xb191
xorb $0x1, %sil
testb %cl, %cl
movzbl %sil, %ecx
leaq 0x88(,%rcx,8), %rdx
movl $0x78, %ecx
cmovneq %rdx, %rcx
movq (%r14,%rcx), %rdx
movq %rdx, 0x30(%rbx)
movq %rbx, (%r14,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq