// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/signal.c
// Function: luaopen__cqueues_signal
int luaopen__cqueues_signal(lua_State *L) {
	static const struct {
		const char *name;
		int value;
	} siglist[] = {
		{ "SIGALRM", SIGALRM },
		{ "SIGCHLD", SIGCHLD },
		{ "SIGHUP",  SIGHUP  },
		{ "SIGINT",  SIGINT  },
		{ "SIGKILL", SIGKILL },
		{ "SIGPIPE", SIGPIPE },
		{ "SIGQUIT", SIGQUIT },
		{ "SIGTERM", SIGTERM },
		{ "SIGUSR1", SIGUSR1 },
		{ "SIGUSR2", SIGUSR2 },
	}, flag[] = {
		{ "SIGNALFD",      SIGNAL_SIGNALFD },
		{ "EVFILT_SIGNAL", SIGNAL_EVFILT_SIGNAL },
		{ "SIGTIMEDWAIT",  SIGNAL_SIGTIMEDWAIT },
		{ "KQUEUE",        SIGNAL_KQUEUE },
		{ "KQUEUE1",       SIGNAL_KQUEUE1 },
	};
	unsigned i;

	if (luaL_newmetatable(L, LSL_CLASS)) {
		luaL_setfuncs(L, lsl_metatable, 0);

		luaL_newlib(L, lsl_methods);
		lua_setfield(L, -2, "__index");
	}

	luaL_newlib(L, ls_globals);

	for (i = 0; i < sizeof siglist / sizeof *siglist; i++) {
		lua_pushinteger(L, siglist[i].value);
		lua_setfield(L, -2, siglist[i].name);

		lua_pushstring(L, siglist[i].name);
		lua_rawseti(L, -2, siglist[i].value);
	}

	for (i = 0; i < sizeof flag / sizeof *flag; i++) {
		lua_pushinteger(L, flag[i].value);
		lua_setfield(L, -2, flag[i].name);

		lua_pushstring(L, flag[i].name);
		lua_rawseti(L, -2, flag[i].value);
	}

	lua_pushinteger(L, signal_features());
	lua_setfield(L, -2, "FEATURES");

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x1a296(%rip), %rsi     # 0x35e5d
callq 0x10180
testl %eax, %eax
je 0x1bc2a
leaq 0x29039(%rip), %rsi     # 0x44c10
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10240
movsd 0x19417(%rip), %xmm0    # 0x35000
movl $0x88, %esi
movq %rbx, %rdi
callq 0x10530
movq %rbx, %rdi
xorl %esi, %esi
movl $0x6, %edx
callq 0x101e0
leaq 0x29024(%rip), %rsi     # 0x44c30
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10240
leaq 0x1950a(%rip), %rdx     # 0x35127
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xf530
movsd 0x193ce(%rip), %xmm0    # 0x35000
movl $0x88, %esi
movq %rbx, %rdi
callq 0x10530
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0x101e0
leaq 0x2904b(%rip), %rsi     # 0x44ca0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10240
movl $0x8, %r12d
leaq 0x28eb4(%rip), %r13     # 0x44b20
movslq (%r12,%r13), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf910
movq -0x8(%r12,%r13), %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0xf530
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfbd0
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r14, %rdx
callq 0xfb20
addq $0x10, %r12
cmpq $0xa8, %r12
jne 0x1bc6c
movl $0x8, %r12d
leaq 0x28efb(%rip), %r13     # 0x44bc0
movslq (%r12,%r13), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf910
movq -0x8(%r12,%r13), %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0xf530
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfbd0
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r14, %rdx
callq 0xfb20
addq $0x10, %r12
cmpq $0x58, %r12
jne 0x1bcc5
movl $0x5, %esi
movq %rbx, %rdi
callq 0xf910
leaq 0x1a146(%rip), %rdx     # 0x35e68
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xf530
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq