// File: /workspace/github_c_makefile_star2_O1/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 0x12e12
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 0x12261
xorpd %xmm0, %xmm0
cmpl $0x0, 0x220(%r14)
je 0x11ec2
cmpq $0x0, 0x210(%r14)
jne 0x11ec2
movq 0x231b3(%rip), %xmm0    # 0x35008
movq %rbx, %rdi
movl $0x2, %esi
callq 0xf780
movq %xmm0, (%rsp)
movq %r14, %rdi
callq 0x129e2
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
je 0x11e9f
movapd %xmm1, %xmm0
jmp 0x11ec2
ucomisd %xmm0, %xmm1
setae %cl
movq %xmm1, %rdx
btrq $0x3f, %rdx
cmpq %rax, %rdx
setg %al
orb %cl, %al
jne 0x11ec2
movsd 0x23146(%rip), %xmm0    # 0x35008
movl (%r14), %ebp
leaq 0x8(%r14), %r15
movsd %xmm0, (%rsp)
callq 0xf060
cmpl $0x2, %eax
je 0x11f10
cmpl $0x3, %eax
je 0x11f14
cmpl $0x4, %eax
jne 0x11f1b
movq (%rsp), %xmm0
movq %xmm0, %rax
testq %rax, %rax
js 0x11f10
mulsd 0x23117(%rip), %xmm0    # 0x35010
callq 0xf1c0
movsd 0x23112(%rip), %xmm1    # 0x35018
minsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
jmp 0x11f20
xorl %ecx, %ecx
jmp 0x11f20
movl $0x1, %ecx
jmp 0x11f20
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ebp, %edi
movq %r15, %rsi
movl $0x20, %edx
callq 0xf5d0
cmpl $-0x1, %eax
je 0x11f41
cltq
movq %rax, 0x188(%r14)
xorl %ebp, %ebp
jmp 0x11f50
callq 0xf0a0
movl (%rax), %eax
xorl %ebp, %ebp
cmpl $0x4, %eax
cmovnel %eax, %ebp
testl %ebp, %ebp
je 0x11ff7
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 0x23225(%rip), %rdx     # 0x351c0
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
xorl %eax, %eax
callq 0x12a58
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x12af5
movq $0x0, 0x218(%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10800
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x12cd2
movl %eax, %ebp
incl %ebp
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x188(%r14)
jle 0x1204a
leaq 0x190(%r14), %r12
xorl %ebp, %ebp
movq %r15, %r13
movq 0x4(%r13), %rsi
cmpq %r12, %rsi
je 0x12025
movswl (%r13), %edx
movq %r14, %rdi
callq 0x11b35
jmp 0x1202a
movl $0x1, %ebp
addq $0xc, %r13
movq 0x188(%r14), %rax
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,4), %rax
cmpq %rax, %r13
jb 0x1200d
testl %ebp, %ebp
sete %bpl
jmp 0x1204d
movb $0x1, %bpl
leaq 0x20(%rsp), %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0xfbf0
xorps %xmm0, %xmm0
cvtsi2sdq (%r15), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x8(%r15), %xmm1
divsd 0x22fa8(%rip), %xmm1    # 0x35020
addsd %xmm0, %xmm1
movq 0x228(%r14), %rax
testq %rax, %rax
je 0x12134
movq %rax, %r12
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x12083
leaq 0x210(%r14), %r15
movsd %xmm1, (%rsp)
movsd (%r12), %xmm0
ucomisd %xmm1, %xmm0
ja 0x12134
movq -0x38(%r12), %rax
testq %rax, %rax
je 0x120cf
ucomisd 0x8(%rax), %xmm1
jb 0x120c9
movb $0x1, 0x10(%rax)
movq 0x20(%rax), %rax
jmp 0x120b9
leaq -0x40(%r12), %rdi
movq %r15, %rsi
callq 0x11c11
movq 0x10(%r12), %rcx
testq %rcx, %rcx
je 0x12101
movsd (%rsp), %xmm1
movq %rcx, %rax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x120eb
movq %rax, %r12
testq %rax, %rax
jne 0x120a4
jmp 0x12134
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x1212b
cmpq %r12, 0x8(%rax)
movsd (%rsp), %xmm1
je 0x120f7
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x120f7
cmpq 0x10(%rax), %r12
movq %rax, %r12
je 0x12116
jmp 0x120f7
xorl %eax, %eax
movsd (%rsp), %xmm1
jmp 0x120f7
cmpq $0x0, 0x218(%r14)
jne 0x12242
movq 0x210(%r14), %rax
movq %rax, 0x218(%r14)
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12e51
testl %eax, %eax
setne %cl
orb %bpl, %cl
testb $0x1, %cl
jne 0x121d2
leaq 0x190(%r14), %r15
leaq 0x20(%rsp), %r12
movl (%r15), %edi
movl $0x8, %edx
movq %r12, %rsi
callq 0x10310
cmpq $-0x1, %rax
jne 0x121a0
callq 0xf0a0
movl (%rax), %eax
cmpl $0x4, %eax
je 0x12179
cmpl $0xb, %eax
jne 0x121d0
movl 0x190(%r14), %esi
movq %r14, %rdx
addq $0x198, %rdx            # imm = 0x198
movq %r14, %rdi
movl $0x1, %ecx
movq %r15, %r8
callq 0x11d6c
testl %eax, %eax
jne 0x121d0
movl $0x0, 0x19c(%r14)
xorl %eax, %eax
testl %eax, %eax
je 0x1222b
cmpl $0x1, %eax
jne 0x11fbd
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 0x94c(%rip), %rcx       # 0x12b64
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xf0b0
movl %eax, %ebp
jmp 0x11fe3
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10800
jmp 0x11fe3
leaq 0x22f97(%rip), %rdi     # 0x351e0
leaq 0x22faa(%rip), %rsi     # 0x351fa
leaq 0x22fe8(%rip), %rcx     # 0x3523f
movl $0x886, %edx            # imm = 0x886
callq 0xf890
leaq 0x22f40(%rip), %rsi     # 0x351a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfd60