// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/lua-5.1.5/src/lgc.c
// Function: singlestep
static l_mem singlestep (lua_State *L) {
  global_State *g = G(L);
  /*lua_checkmemory(L);*/
  switch (g->gcstate) {
    case GCSpause: {
      markroot(L);  /* start a new collection */
      return 0;
    }
    case GCSpropagate: {
      if (g->gray)
        return propagatemark(g);
      else {  /* no more `gray' objects */
        atomic(L);  /* finish mark phase */
        return 0;
      }
    }
    case GCSsweepstring: {
      lu_mem old = g->totalbytes;
      sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]);
      if (g->sweepstrgc >= g->strt.size)  /* nothing more to sweep? */
        g->gcstate = GCSsweep;  /* end sweep-string phase */
      lua_assert(old >= g->totalbytes);
      g->estimate -= old - g->totalbytes;
      return GCSWEEPCOST;
    }
    case GCSsweep: {
      lu_mem old = g->totalbytes;
      g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);
      if (*g->sweepgc == NULL) {  /* nothing more to sweep? */
        checkSizes(L);
        g->gcstate = GCSfinalize;  /* end sweep phase */
      }
      lua_assert(old >= g->totalbytes);
      g->estimate -= old - g->totalbytes;
      return GCSWEEPMAX*GCSWEEPCOST;
    }
    case GCSfinalize: {
      if (g->tmudata) {
        GCTM(L);
        if (g->estimate > GCFINALIZECOST)
          g->estimate -= GCFINALIZECOST;
        return GCFINALIZECOST;
      }
      else {
        g->gcstate = GCSpause;  /* end collection */
        g->gcdept = 0;
        return 0;
      }
    }
    default: lua_assert(0); return 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x20(%rdi), %rbx
movzbl 0x21(%rbx), %eax
cmpq $0x4, %rax
ja 0x66009
movq %rdi, %r14
leaq 0x878aa(%rip), %rcx     # 0xed55c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x6601a
jmp 0x66009
cmpq $0x0, 0x50(%rbx)
je 0x65df0
movq %r14, %rdi
callq 0x66983
movq 0x80(%rbx), %rcx
movl $0x64, %eax
cmpq $0x65, %rcx
jb 0x6600b
addq $-0x64, %rcx
movq %rcx, 0x80(%rbx)
jmp 0x6600b
movq 0x78(%rbx), %r15
movslq 0x24(%rbx), %rsi
leal 0x1(%rsi), %eax
movl %eax, 0x24(%rbx)
shlq $0x3, %rsi
addq (%rbx), %rsi
movq %r14, %rdi
movq $-0x3, %rdx
callq 0x66687
movl 0x24(%rbx), %eax
cmpl 0xc(%rbx), %eax
jl 0x65d31
movb $0x3, 0x21(%rbx)
movq 0x78(%rbx), %rax
subq %r15, %rax
addq %rax, 0x80(%rbx)
movl $0xa, %eax
jmp 0x6600b
movq 0x30(%rbx), %rsi
movq 0x78(%rbx), %r12
movl $0x28, %edx
movq %r14, %rdi
callq 0x66687
movq %rax, 0x30(%rbx)
cmpq $0x0, (%rax)
jne 0x65dbb
movq 0x20(%r14), %r13
movl 0xc(%r13), %esi
leal 0x3(%rsi), %eax
testl %esi, %esi
cmovnsl %esi, %eax
cmpl $0x41, %esi
jl 0x65d90
sarl $0x2, %eax
cmpl %eax, 0x8(%r13)
jae 0x65d90
shrl %esi
movq %r14, %rdi
callq 0x66c7b
movq 0x68(%r13), %rdx
cmpq $0x41, %rdx
jb 0x65db7
movq %rdx, %r15
shrq %r15
movq 0x58(%r13), %rsi
movq %r14, %rdi
movq %r15, %rcx
callq 0x5d2f2
movq %rax, 0x58(%r13)
movq %r15, 0x68(%r13)
movb $0x4, 0x21(%rbx)
movq 0x78(%rbx), %rax
subq %r12, %rax
addq %rax, 0x80(%rbx)
movl $0x190, %eax            # imm = 0x190
jmp 0x6600b
cmpq $0x0, 0x38(%rbx)
je 0x65e04
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x660a1
movb $0x0, 0x21(%rbx)
movq $0x0, 0x88(%rbx)
jmp 0x66009
leaq 0xb8(%rbx), %r15
movq 0xd8(%rbx), %r12
cmpq %r15, %r12
je 0x65e4a
testb $0x7, 0x9(%r12)
jne 0x65e3b
movq 0x10(%r12), %rax
cmpl $0x4, 0x8(%rax)
jl 0x65e3b
movq (%rax), %rsi
testb $0x3, 0x9(%rsi)
je 0x65e3b
movq %rbx, %rdi
callq 0x66a62
movq 0x20(%r12), %r12
jmp 0x65e12
movq %rbx, %rdi
callq 0x660a1
cmpq $0x0, 0x38(%rbx)
jne 0x65e42
movq 0x48(%rbx), %rax
movq %rax, 0x38(%rbx)
movq $0x0, 0x48(%rbx)
testb $0x3, 0x9(%r14)
je 0x65e73
movq %rbx, %rdi
movq %r14, %rsi
callq 0x66a62
movq %rbx, %rdi
callq 0x66b1d
cmpq $0x0, 0x38(%rbx)
je 0x65e8c
movq %rbx, %rdi
callq 0x660a1
jmp 0x65e7b
movq 0x40(%rbx), %rax
movq %rax, 0x38(%rbx)
movq $0x0, 0x40(%rbx)
testq %rax, %rax
je 0x65eb0
movq %rbx, %rdi
callq 0x660a1
cmpq $0x0, 0x38(%rbx)
jne 0x65ea1
movq %r14, %rdi
xorl %esi, %esi
callq 0x5adba
movq %rax, (%rsp)
movq 0x50(%rbx), %r15
testq %r15, %r15
je 0x65eed
movq (%r15), %r15
movb 0x9(%r15), %al
andb $-0x8, %al
movb 0x20(%rbx), %cl
andb $0x3, %cl
orb %al, %cl
movb %cl, 0x9(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x66a62
cmpq 0x50(%rbx), %r15
jne 0x65ec7
cmpq $0x0, 0x38(%rbx)
je 0x65f0b
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x660a1
addq %rax, %r15
cmpq $0x0, 0x38(%rbx)
jne 0x65ef7
jmp 0x65f0e
xorl %r15d, %r15d
movq 0x48(%rbx), %r12
testq %r12, %r12
je 0x65fe0
testb $0x10, 0x9(%r12)
je 0x65f61
movslq 0x38(%r12), %r13
testq %r13, %r13
je 0x65f61
movq %r13, %rbp
shlq $0x4, %rbp
addq $-0x10, %rbp
movq 0x18(%r12), %r14
leaq (%r14,%rbp), %rdi
xorl %esi, %esi
callq 0x66ba2
testl %eax, %eax
je 0x65f55
movl $0x0, 0x8(%r14,%rbp)
decq %r13
addq $-0x10, %rbp
testq %r13, %r13
jne 0x65f38
movb 0xb(%r12), %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
notl %eax
shlq $0x3, %rax
leaq (%rax,%rax,4), %r13
movq 0x20(%r12), %rbp
cmpl $0x0, 0x8(%rbp,%r13)
je 0x65fcc
cmpl $0x4, 0x18(%rbp,%r13)
jl 0x65fa1
movq 0x10(%rbp,%r13), %rcx
movb 0x9(%rcx), %al
jne 0x65f9d
andb $-0x4, %al
movb %al, 0x9(%rcx)
jmp 0x65fa1
testb $0x3, %al
jne 0x65fb2
movq %rbp, %rdi
addq %r13, %rdi
xorl %esi, %esi
callq 0x66ba2
testl %eax, %eax
je 0x65fcc
movl $0x0, 0x8(%rbp,%r13)
cmpl $0x4, 0x18(%rbp,%r13)
jl 0x65fcc
movl $0xb, 0x18(%rbp,%r13)
addq $-0x28, %r13
cmpq $-0x28, %r13
jne 0x65f77
movq 0x30(%r12), %r12
jmp 0x65f12
xorb $0x3, 0x20(%rbx)
movl $0x0, 0x24(%rbx)
leaq 0x28(%rbx), %rax
movq %rax, 0x30(%rbx)
movb $0x2, 0x21(%rbx)
movq 0x78(%rbx), %rax
addq (%rsp), %r15
subq %r15, %rax
movq %rax, 0x80(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq