// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/cqueues.c
// Function: luaopen__cqueues
int luaopen__cqueues(lua_State *L) {
	/* initialize our dependencies used for fast metatable lookup */
	cqs_requiref(L, "_cqueues.socket", &luaopen__cqueues_socket, 0);
	cqs_requiref(L, "_cqueues.condition", &luaopen__cqueues_condition, 0);
	lua_pop(L, 2);

	/* push functions with shared upvalues for fast metatable lookup */
	cqs_pushnils(L, 3); /* initial upvalues */
	cqs_newmetatable(L, CQUEUE_CLASS, cqueue_methods, cqueue_metatable, 3);
	lua_pushvalue(L, -1); /* push self as replacement upvalue */
	cqs_setmetaupvalue(L, -2, 1); /* insert self as 1st upvalue */
	luaL_getmetatable(L, CQS_SOCKET);
	cqs_setmetaupvalue(L, -2, 2); /* insert socket as 2nd upvalue */
	luaL_getmetatable(L, CQS_CONDITION);
	cqs_setmetaupvalue(L, -2, 3); /* insert condition as 3rd upvalue */

	luaL_newlibtable(L, cqueues_globals);
	lua_pushvalue(L, -2); /* capture metatable as upvalue */
	luaL_getmetatable(L, CQS_SOCKET);
	luaL_getmetatable(L, CQS_CONDITION);
	luaL_setfuncs(L, cqueues_globals, 3);

	/* add magic value used to accomplish multilevel yielding */
	lua_pushlightuserdata(L, CQUEUE__POLL);
	lua_setfield(L, -2, "_POLL");

	/* add our version constants */
	lua_pushliteral(L, CQUEUES_VENDOR);
	lua_setfield(L, -2, "VENDOR");

	lua_pushinteger(L, CQUEUES_VERSION);
	lua_setfield(L, -2, "VERSION");

#if defined CQUEUES_COMMIT
	if (sizeof CQUEUES_COMMIT > 1) {
		lua_pushliteral(L, CQUEUES_COMMIT);
		lua_setfield(L, -2, "COMMIT");
	}
#endif

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1f14f(%rip), %rsi     # 0x30069
movq 0x3407f(%rip), %rdx     # 0x44fa0
callq 0x110cb
leaq 0x1f14c(%rip), %rsi     # 0x30079
movq 0x34084(%rip), %rdx     # 0x44fb8
movq %rbx, %rdi
callq 0x110cb
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x106f0
leaq 0x1f211(%rip), %rdx     # 0x3015f
pushq $0x3
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xfd30
subl $0x1, %ebp
jb 0x10f6a
movq %rbx, %rdi
callq 0xf9d0
jmp 0x10f5b
leaq 0x1f11b(%rip), %rsi     # 0x3008c
leaq 0x310d8(%rip), %rdx     # 0x42050
leaq 0x311b1(%rip), %rcx     # 0x42130
pushq $0x3
popq %r14
movq %rbx, %rdi
movl %r14d, %r8d
callq 0x10ce2
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xfa10
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10dbc
leaq 0x1f0f2(%rip), %r12     # 0x3009f
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r12, %rdx
callq 0xf1f0
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x10dbc
leaq 0x1f081(%rip), %r13     # 0x30050
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r13, %rdx
callq 0xf1f0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x10dbc
pushq $0x7
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10270
pushq $-0x2
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0xfa10
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r12, %rdx
callq 0xf1f0
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r13, %rdx
callq 0xf1f0
leaq 0x31123(%rip), %rsi     # 0x42150
movq %rbx, %rdi
movl %r14d, %edx
callq 0x102d0
movq 0x33f21(%rip), %rsi     # 0x44f60
movq %rbx, %rdi
callq 0x101e0
leaq 0x1f05c(%rip), %rdx     # 0x300aa
movq %rbx, %rdi
movl %r15d, %esi
callq 0xf550
leaq 0x1f050(%rip), %rsi     # 0x300b0
movq %rbx, %rdi
callq 0xfc50
leaq 0x1f056(%rip), %rdx     # 0x300c5
movq %rbx, %rdi
movl %r15d, %esi
callq 0xf550
movl $0x1343d16, %esi        # imm = 0x1343D16
movq %rbx, %rdi
callq 0xf960
leaq 0x1f03e(%rip), %rdx     # 0x300cc
movq %rbx, %rdi
movl %r15d, %esi
callq 0xf550
leaq 0x1f034(%rip), %rsi     # 0x300d4
movq %rbx, %rdi
callq 0xfc50
leaq 0x1f04e(%rip), %rdx     # 0x300fd
movq %rbx, %rdi
movl %r15d, %esi
callq 0xf550
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq