// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/cqueues.c
// Function: cqueue_step
static int cqueue_step(lua_State *L) {
	struct callinfo I;
	struct cqueue *Q;
	double timeout;
	int error;
	int nargs;

	lua_settop(L, 2);

	Q = cqueue_enter(L, &I, 1);

	if (Q->thread.current) {
		return luaL_error(L, "cannot step live cqueue");
	}

	if (Q->thread.count && LIST_EMPTY(&Q->thread.pending)) {
		timeout = mintimeout(luaL_optnumber(L, 2, NAN), cqueue_timeout_(Q));
	} else {
		timeout = 0.0;
	}

	if ((error = kpoll_wait(&Q->kp, timeout))) {
		err_setfstring(L, &I, "error polling: %s", cqs_strerror(error));
		err_setcode(L, &I, error);
		goto oops;
	}

	switch(cqueue_process(L, Q, &I)) {
	case LUA_OK:
		break;
	case LUA_YIELD:
		/* clear everything off the stack except for cqueue object; `I` now invalid */
		lua_settop(L, 1);
#if LUA_VERSION_NUM >= 502
		/* move arguments onto 'main' stack to return them from this yield */
		nargs = lua_gettop(Q->thread.current->L);
		lua_xmove(Q->thread.current->L, L, nargs);
		return lua_yieldk(L, nargs, 0, cqueue_step_cont);
#else
		lua_pushliteral(L, "yielded");
		/* move arguments onto 'main' stack to return them from this yield */
		nargs = lua_gettop(Q->thread.current->L);
		lua_xmove(Q->thread.current->L, L, nargs);
		return nargs+1;
#endif
	default:
		goto oops;
	}

	lua_pushboolean(L, 1);

	return 1;
oops:
	Q->thread.current = NULL;
	lua_pushboolean(L, 0);
	return 1 + err_pushinfo(L, &I);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
pushq $0x2
popq %rsi
callq 0x106f0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x122cf
cmpq $0x0, 0x218(%rax)
jne 0x11cfe
movq %rax, %r14
xorpd %xmm0, %xmm0
cmpl $0x0, 0x220(%rax)
je 0x11a16
cmpq $0x0, 0x210(%r14)
jne 0x11a16
pushq $0x2
popq %rsi
movsd 0x1e615(%rip), %xmm0    # 0x30008
movq %rbx, %rdi
callq 0xf7c0
movsd %xmm0, (%rsp)
movq %r14, %rdi
callq 0x12356
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
callq 0x12303
movq %rbx, 0x8(%rsp)
movl (%r14), %ebp
leaq 0x8(%r14), %rbx
callq 0x12780
pushq $0x20
popq %rdx
movl %ebp, %edi
movq %rbx, %rsi
movl %eax, %ecx
callq 0xf610
cmpl $-0x1, %eax
je 0x11a46
cltq
movq %rax, 0x188(%r14)
jmp 0x11a59
callq 0xf0a0
movl (%rax), %ebp
testl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
jne 0x11c3e
leaq 0x190(%r14), %r13
xorl %ebp, %ebp
pushq $0x1
popq %r12
movq %rbx, %r15
imulq $0xc, 0x188(%r14), %rax
addq %rbx, %rax
cmpq %rax, %r15
jae 0x11a9b
movq 0x4(%r15), %rsi
movl %r12d, %eax
cmpq %r13, %rsi
je 0x11a93
movswl (%r15), %edx
movq %r14, %rdi
callq 0x1171a
movl %ebp, %eax
addq $0xc, %r15
movl %eax, %ebp
jmp 0x11a69
callq 0x12750
movsd %xmm0, (%rsp)
movq 0x228(%r14), %rdi
callq 0x1273e
movsd (%rsp), %xmm1
movq %r14, %r15
addq $0x210, %r15            # imm = 0x210
movq 0x8(%rsp), %rbx
testq %rax, %rax
je 0x11b58
movq %rax, %r12
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
ja 0x11b58
leaq -0x38(%r12), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x11af9
ucomisd 0x8(%rax), %xmm1
jb 0x11af3
movb $0x1, 0x10(%rax)
addq $0x20, %rax
jmp 0x11ae0
leaq -0x40(%r12), %rdi
movq %r15, %rsi
callq 0x117eb
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x11b1c
callq 0x1273e
movsd (%rsp), %xmm1
jmp 0x11ac5
movq 0x18(%r12), %rcx
movl $0x0, %eax
testq %rcx, %rcx
movsd (%rsp), %xmm1
je 0x11ac5
movq %rcx, %rax
cmpq %r12, 0x8(%rcx)
je 0x11ac5
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x11b51
cmpq 0x10(%rax), %r12
movq %rax, %r12
je 0x11b39
jmp 0x11ac5
xorl %eax, %eax
jmp 0x11ac5
cmpq $0x0, 0x218(%r14)
jne 0x11cdf
movq 0x210(%r14), %rax
movq %rax, 0x218(%r14)
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x127fd
cmpl $0x1, %eax
je 0x11bea
testl %eax, %eax
jne 0x11ca8
testl %ebp, %ebp
je 0x11bd8
leaq 0x28(%rsp), %r15
pushq $0x8
popq %r12
movl (%r13), %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x103b0
cmpq $-0x1, %rax
jne 0x11bc4
callq 0xf0a0
movl (%rax), %eax
cmpl $0x4, %eax
je 0x11b9e
cmpl $0xb, %eax
jne 0x11bd8
movq %r14, %rdi
callq 0x1191f
testl %eax, %eax
jne 0x11bd8
andl $0x0, 0x19c(%r14)
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x108d0
jmp 0x11ccb
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x106f0
movq 0x218(%r14), %rax
movq (%rax), %rdi
callq 0xf970
movl %eax, %ebp
movq 0x218(%r14), %rax
movq (%rax), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x102c0
leaq 0x863(%rip), %rcx       # 0x12484
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf0b0
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rsi
movapd %xmm0, 0x70(%rsi)
movapd %xmm0, 0x60(%rsi)
movapd %xmm0, 0x50(%rsi)
movapd %xmm0, 0x40(%rsi)
movapd %xmm0, 0x30(%rsi)
movapd %xmm0, 0x20(%rsi)
movapd %xmm0, 0x10(%rsi)
movapd %xmm0, (%rsi)
movl $0x80, %edx
movl %ebp, %edi
callq 0xf260
leaq 0x1e53f(%rip), %rdx     # 0x301c0
leaq 0x10(%rsp), %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x12395
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x12415
andq $0x0, 0x218(%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x108d0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x125cd
movl %eax, %ebp
incl %ebp
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e4fa(%rip), %rdi     # 0x301e0
leaq 0x1e50d(%rip), %rsi     # 0x301fa
leaq 0x1e54b(%rip), %rcx     # 0x3023f
movl $0x886, %edx            # imm = 0x886
callq 0xf8e0
leaq 0x1e4a3(%rip), %rsi     # 0x301a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfdf0