// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x107f0
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x12ff0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x218(%rax)
je 0x12516
movq -0x10(%rbp), %rdi
leaq 0x35d10(%rip), %rsi     # 0x4821c
movb $0x0, %al
callq 0xfe70
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x220(%rax)
je 0x1256f
movq -0x30(%rbp), %rax
cmpq $0x0, 0x210(%rax)
jne 0x1256f
movq -0x10(%rbp), %rdi
movl $0x2, %esi
movsd 0x35ac6(%rip), %xmm0    # 0x48008
callq 0xf800
movsd %xmm0, -0xd0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x130f0
movaps %xmm0, %xmm1
movsd -0xd0(%rbp), %xmm0
callq 0x13040
movsd %xmm0, -0x38(%rbp)
jmp 0x12577
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x13180
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x125fc
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0xdc(%rbp)
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xf7d0
movl -0xdc(%rbp), %edi
leaq -0xc8(%rbp), %rsi
movl $0x80, %edx
callq 0xf270
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
leaq -0x28(%rbp), %rsi
leaq 0x35c54(%rip), %rdx     # 0x48234
movb $0x0, %al
callq 0x13220
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %edx
leaq -0x28(%rbp), %rsi
callq 0x132c0
jmp 0x1269d
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x13360
movl %eax, %ecx
movl %ecx, -0xe0(%rbp)
testl %eax, %eax
je 0x12628
jmp 0x1261b
movl -0xe0(%rbp), %eax
subl $0x1, %eax
je 0x1262a
jmp 0x12684
jmp 0x12686
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x107f0
movq -0x30(%rbp), %rax
movq 0x218(%rax), %rax
movq (%rax), %rdi
callq 0xf9b0
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq 0x218(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x10380
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
leaq 0xee6(%rip), %rcx       # 0x13560
callq 0xf0b0
movl %eax, -0x4(%rbp)
jmp 0x126ca
jmp 0x1269d
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x109d0
movl $0x1, -0x4(%rbp)
jmp 0x126ca
movq -0x30(%rbp), %rax
movq $0x0, 0x218(%rax)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x109d0
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x13720
addl $0x1, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)