// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lgc.c
// Function: sweeplist
static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
  global_State *g = G(L);
  int ow = otherwhite(g);
  int toclear, toset;  /* bits to clear and to set in all live objects */
  int tostop;  /* stop sweep when this is true */
  if (isgenerational(g)) {  /* generational mode? */
    toclear = ~0;  /* clear nothing */
    toset = bitmask(OLDBIT);  /* set the old bit of all surviving objects */
    tostop = bitmask(OLDBIT);  /* do not sweep old generation */
  }
  else {  /* normal mode */
    toclear = maskcolors;  /* clear all color bits + old bit */
    toset = luaC_white(g);  /* make object white */
    tostop = 0;  /* do not stop */
  }
  while (*p != NULL && count-- > 0) {
    GCObject *curr = *p;
    int marked = gch(curr)->marked;
    if (isdeadm(ow, marked)) {  /* is 'curr' dead? */
      *p = gch(curr)->next;  /* remove 'curr' from list */
      freeobj(L, curr);  /* erase 'curr' */
    }
    else {
      if (testbits(marked, tostop))
        return NULL;  /* stop sweeping this list */
      if (gch(curr)->tt == LUA_TTHREAD)
        sweepthread(L, gco2th(curr));  /* sweep thread's upvalues */
      /* update marks */
      gch(curr)->marked = cast_byte((marked & toclear) | toset);
      p = &gch(curr)->next;  /* go to next element */
    }
  }
  return (*p == NULL) ? NULL : p;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x54(%rax), %eax
xorl $0x3, %eax
movl %eax, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x56(%rax), %eax
cmpl $0x2, %eax
jne 0x13629
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movl $0x40, 0x24(%rsp)
movl $0x40, 0x20(%rsp)
jmp 0x1364c
movl $0xffffffb8, 0x28(%rsp) # imm = 0xFFFFFFB8
movq 0x30(%rsp), %rax
movzbl 0x54(%rax), %eax
andl $0x3, %eax
movzbl %al, %eax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
jmp 0x1364e
movq 0x40(%rsp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, 0x13(%rsp)
je 0x1367b
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, 0x38(%rsp)
cmpq $0x0, %rax
seta %al
movb %al, 0x13(%rsp)
movb 0x13(%rsp), %al
testb $0x1, %al
jne 0x13688
jmp 0x1372d
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x9(%rax), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
xorl $0x3, %eax
andl 0x2c(%rsp), %eax
cmpl $0x0, %eax
jne 0x136d3
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x141a0
jmp 0x13728
movl 0x14(%rsp), %eax
andl 0x20(%rsp), %eax
cmpl $0x0, %eax
je 0x136eb
movq $0x0, 0x50(%rsp)
jmp 0x13755
movq 0x18(%rsp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x8, %eax
jne 0x13708
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x142f0
movl 0x14(%rsp), %eax
andl 0x28(%rsp), %eax
orl 0x24(%rsp), %eax
movb %al, %cl
movq 0x18(%rsp), %rax
movb %cl, 0x9(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x1364e
movq 0x40(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x13741
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x1374b
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nop