// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: luaopen_xpio_c
int luaopen_xpio_c(lua_State *L)
{
   // POSIX fail: SIGPIPE will terminate a program when it writes to a socket
   // that a peer has closed, unless the program takes action to block or
   // ignore SIGPIPE. BSD provides SO_NOSIGPIPE, but that is not
   // portable. The following protects us from SIGPIPE, but it also disables
   // SIGPIPE behavior for stdin/stdout.  It is unfortunate to trigger
   // global side effects, but the default SIGPIPE behavior is essentially
   // incompatible with any network programming.
   signal(SIGPIPE, SIG_IGN);

   // create table
   lua_createtable(L, 0, ARRAY_LENGTH(xpio_regs)-1);

   // bind XPIO table to each function in a C closure, so they can
   // access the appropriate metatables for sockets, etc.
   xlua_register(L, -1, xpio_regs, -1);

   // create metatables

   XLUA_NEWMT(L, XPProc);
   lua_setfield(L, -2, "_XPProc");

   XLUA_NEWMT(L, XPQueue);
   lua_setfield(L, -2, "_XPQueue");

   XLUA_NEWMT(L, XPSocket);

   // make `socket:try_accept` a closure; it creates a socket
   lua_pushvalue(L, -2);
   lua_pushcclosure(L, xpsocket_try_accept, 1);
   lua_setfield(L, -2, "try_accept");

   lua_setfield(L, -2, "_XPSocket");

   // extract environment variables

   xpio_getenv(L);
   lua_setfield(L, -2, "env");

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
movl $0xd, %edi
callq 0x3240
movq %rbx, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x676c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5c0e
movl %eax, %ebp
leaq 0x1c1cd(%rip), %r15     # 0x1f838
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
movq -0x8(%r15), %r14
movq (%r15), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x6509
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x68eb
cmpq $0x0, 0x10(%r15)
leaq 0x10(%r15), %r15
jne 0x366b
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x676c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x1c1fc(%rip), %rsi     # 0x1f8c0
movq %rbx, %rdi
callq 0x65a7
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x6951
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x13ab2(%rip), %rdx     # 0x1719f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5c0e
movl %eax, %ebp
leaq 0x1c1b8(%rip), %r15     # 0x1f8c8
movq -0x8(%r15), %r14
movq (%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x6509
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x68eb
cmpq $0x0, 0x10(%r15)
leaq 0x10(%r15), %r15
jne 0x3710
leaq 0x138e8(%rip), %rdx     # 0x17028
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x676c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x1c1a3(%rip), %rsi     # 0x1f910
movq %rbx, %rdi
callq 0x65a7
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x6951
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x13a09(%rip), %rdx     # 0x1719f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5c0e
movl %eax, %ebp
leaq 0x1c15f(%rip), %r15     # 0x1f918
movq -0x8(%r15), %r14
movq (%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x6509
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x68eb
cmpq $0x0, 0x10(%r15)
leaq 0x10(%r15), %r15
jne 0x37b9
leaq 0x13847(%rip), %rdx     # 0x17030
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x676c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x1c13a(%rip), %rsi     # 0x1f950
movq %rbx, %rdi
callq 0x65a7
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x6951
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e15
leaq 0x13960(%rip), %rdx     # 0x1719f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5c0e
movl %eax, %ebp
leaq 0x1c0f6(%rip), %r15     # 0x1f958
movq -0x8(%r15), %r14
movq (%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x6509
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x68eb
cmpq $0x0, 0x10(%r15)
leaq 0x10(%r15), %r15
jne 0x3862
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x5e15
leaq 0xc8(%rip), %rsi        # 0x3967
movq %rbx, %rdi
movl $0x1, %edx
callq 0x6509
leaq 0x13786(%rip), %rdx     # 0x17039
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
leaq 0x1377d(%rip), %rdx     # 0x17044
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x676c
movq 0x1c6f1(%rip), %rax     # 0x1ffd8
movq (%rax), %r12
movq (%r12), %r14
testq %r14, %r14
je 0x3945
addq $0x8, %r12
movq %r14, %rdi
movl $0x3d, %esi
callq 0x3160
testq %rax, %rax
je 0x3938
movq %rax, %r15
movq %rax, %rdx
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6373
incq %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x63c2
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x6951
movq (%r12), %r14
addq $0x8, %r12
testq %r14, %r14
jne 0x38f7
leaq 0x13702(%rip), %rdx     # 0x1704e
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x68eb
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq