// File: /workspace/github_c_makefile_star2_O3/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
movl $0x2, %esi
callq 0x10640
movq %rbx, %rdi
callq 0x12de1
movq %rax, %r14
movq %rbx, %rdi
movl $0x1, %esi
callq 0xf280
movl %eax, 0x8(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0xc(%rsp)
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x218(%r14)
jne 0x1225d
xorpd %xmm1, %xmm1
cmpl $0x0, 0x220(%r14)
je 0x11e9f
cmpq $0x0, 0x210(%r14)
jne 0x11e9f
movq 0x231d8(%rip), %xmm0    # 0x35008
movq %rbx, %rdi
movl $0x2, %esi
callq 0xf780
movq %xmm0, (%rsp)
movq 0x228(%r14), %rdi
callq 0x129d6
movsd (%rsp), %xmm1
movq %xmm0, %rcx
ucomisd %xmm1, %xmm0
setae %dl
btrq $0x3f, %rcx
movabsq $0x7fefffffffffffff, %rax # imm = 0x7FEFFFFFFFFFFFFF
cmpq %rax, %rcx
setg %cl
orb %dl, %cl
jne 0x11e9f
movq %xmm1, %rcx
btrq $0x3f, %rcx
cmpq %rax, %rcx
jg 0x11e9b
ucomisd %xmm0, %xmm1
movapd %xmm0, %xmm1
jae 0x11e9f
movsd 0x2316f(%rip), %xmm1    # 0x35008
jmp 0x11e9f
movapd %xmm0, %xmm1
movl (%r14), %ebp
leaq 0x8(%r14), %r15
movsd %xmm1, (%rsp)
movapd %xmm1, %xmm0
callq 0xf060
cmpl $0x2, %eax
je 0x11ef1
cmpl $0x3, %eax
je 0x11ef5
cmpl $0x4, %eax
jne 0x11efc
movq (%rsp), %xmm0
movq %xmm0, %rax
testq %rax, %rax
js 0x11ef1
mulsd 0x23136(%rip), %xmm0    # 0x35010
callq 0xf1c0
movsd 0x23131(%rip), %xmm1    # 0x35018
minsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
jmp 0x11f01
xorl %ecx, %ecx
jmp 0x11f01
movl $0x1, %ecx
jmp 0x11f01
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ebp, %edi
movq %r15, %rsi
movl $0x20, %edx
callq 0xf5d0
cmpl $-0x1, %eax
je 0x11f20
cltq
movq %rax, 0x188(%r14)
jmp 0x11f33
callq 0xf0a0
movl (%rax), %ebp
testl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
jne 0x1219f
movq 0x188(%r14), %rax
testq %rax, %rax
jle 0x11f88
leaq 0x190(%r14), %r12
xorl %ebp, %ebp
movq %r15, %r13
movq 0x4(%r13), %rsi
cmpq %rsi, %r12
je 0x11f6a
movswl (%r13), %edx
movq %r14, %rdi
callq 0x11b30
movq 0x188(%r14), %rax
jmp 0x11f6f
movl $0x1, %ebp
addq $0xc, %r13
leaq (%rax,%rax,2), %rcx
leaq (%r15,%rcx,4), %rcx
cmpq %rcx, %r13
jb 0x11f4b
testl %ebp, %ebp
sete %bpl
jmp 0x11f8b
movb $0x1, %bpl
leaq 0x20(%rsp), %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0xfbf0
xorps %xmm1, %xmm1
cvtsi2sdq (%r15), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%r15), %xmm0
divsd 0x2306a(%rip), %xmm0    # 0x35020
addsd %xmm1, %xmm0
movq 0x228(%r14), %rcx
testq %rcx, %rcx
je 0x11fe0
movq %rcx, %rax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x11fc1
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x120f0
cmpq $0x0, 0x218(%r14)
jne 0x1223e
movq 0x210(%r14), %rax
movq %rax, 0x218(%r14)
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12e20
testl %eax, %eax
setne %cl
orb %bpl, %cl
testb $0x1, %cl
je 0x12076
testl %eax, %eax
je 0x120d9
cmpl $0x1, %eax
jne 0x12204
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10640
movq 0x218(%r14), %rax
movq (%rax), %rdi
callq 0xf920
movl %eax, %ebp
movq 0x218(%r14), %rax
movq (%rax), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x10230
leaq 0xae9(%rip), %rcx       # 0x12b4c
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xf0b0
movl %eax, %ebp
jmp 0x1222a
leaq 0x190(%r14), %r15
leaq 0x20(%rsp), %r12
movl (%r15), %edi
movl $0x8, %edx
movq %r12, %rsi
callq 0x10310
cmpq $-0x1, %rax
jne 0x120a9
callq 0xf0a0
movl (%rax), %eax
cmpl $0x4, %eax
je 0x12082
cmpl $0xb, %eax
jne 0x120d9
movl 0x190(%r14), %esi
movq %r14, %rdx
addq $0x198, %rdx            # imm = 0x198
movq %r14, %rdi
movl $0x1, %ecx
movq %r15, %r8
callq 0x11d4f
testl %eax, %eax
jne 0x120d9
movl $0x0, 0x19c(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10800
jmp 0x1222a
leaq 0x210(%r14), %rcx
movq -0x38(%rax), %rdx
testq %rdx, %rdx
je 0x12111
ucomisd 0x8(%rdx), %xmm0
jb 0x1210b
movb $0x1, 0x10(%rdx)
movq 0x20(%rdx), %rdx
jmp 0x120fb
cmpq %rcx, -0x20(%rax)
je 0x1214d
movq -0x18(%rax), %rdx
movq -0x10(%rax), %rdi
testq %rdx, %rdx
je 0x12128
movq %rdi, 0x30(%rdx)
leaq -0x18(%rax), %rsi
movq %rdx, (%rdi)
movq (%rcx), %rdx
movq %rdx, (%rsi)
testq %rdx, %rdx
je 0x1213e
movq %rsi, 0x30(%rdx)
leaq -0x40(%rax), %rdx
movq %rdx, (%rcx)
movq %rcx, -0x10(%rax)
movq %rcx, -0x20(%rax)
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x12174
movq %rsi, %rdx
movq 0x8(%rsi), %rsi
testq %rsi, %rsi
jne 0x12156
movsd (%rdx), %xmm1
ucomisd %xmm0, %xmm1
movq %rdx, %rax
jbe 0x120f7
jmp 0x11fe0
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x11fe0
cmpq %rax, 0x8(%rdx)
je 0x12162
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x11fe0
cmpq 0x10(%rdx), %rax
movq %rdx, %rax
je 0x12187
jmp 0x12162
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 0xf250
leaq 0x22fde(%rip), %rdx     # 0x351c0
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x12a40
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x12add
movq $0x0, 0x218(%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10800
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x12ca0
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 0x22f9b(%rip), %rdi     # 0x351e0
leaq 0x22fae(%rip), %rsi     # 0x351fa
leaq 0x22fec(%rip), %rcx     # 0x3523f
movl $0x886, %edx            # imm = 0x886
callq 0xf890
leaq 0x22f44(%rip), %rsi     # 0x351a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfd60