// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/socket.c
// Function: lso_pair
static lso_nargs_t lso_pair(lua_State *L) {
	struct luasocket *a = NULL, *b = NULL;
	struct so_options opts;
	int fd[2] = { -1, -1 };
	int type, error;

	if (lua_istable(L, 1)) {
		opts = lso_checkopts(L, 1);

		lua_getfield(L, 1, "type");
		type = luaL_optinteger(L, -1, SOCK_STREAM);
		lua_pop(L, 1);
	} else {
		opts = *so_opts();
		type = luaL_optinteger(L, 1, SOCK_STREAM);
	}

	a = lso_newsocket(L, type);
	b = lso_newsocket(L, type);

#if defined SOCK_CLOEXEC
	if (0 != socketpair(AF_UNIX, type|SOCK_CLOEXEC, PF_UNSPEC, fd))
		goto syerr;
#else
	if (0 != socketpair(AF_UNIX, type, PF_UNSPEC, fd))
		goto syerr;
#endif

	opts.fd_close.arg = a;
	opts.fd_close.cb = &lso_closefd;

	if (!(a->socket = so_fdopen(fd[0], &opts, &error)))
		goto error;

	fd[0] = -1;

	if ((error = lso_prepsocket(a)))
		goto error;

	opts.fd_close.arg = b;
	opts.fd_close.cb = &lso_closefd;

	if (!(b->socket = so_fdopen(fd[1], &opts, &error)))
		goto error;

	fd[1] = -1;

	if ((error = lso_prepsocket(b)))
		goto error;

	return 2;
syerr:
	error = errno;
error:
	cqs_closefd(&fd[0]);
	cqs_closefd(&fd[1]);

	lua_pushnil(L);
	lua_pushnil(L);
	lua_pushinteger(L, error);

	return 3;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
orq $-0x1, 0x8(%rsp)
pushq $0x1
popq %rsi
callq 0xf270
cmpl $0x5, %eax
jne 0x1982a
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rbp
movq %rbx, %rsi
movl %ebp, %edx
callq 0x185e2
leaq 0x1a5bc(%rip), %rdx     # 0x33dbe
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf1f0
pushq $-0x1
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xf420
movq %rax, %r12
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x106f0
jmp 0x1988d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movw $0x100, 0x20(%rsp)      # imm = 0x100
andl $0x0, 0x22(%rsp)
andw $0x0, 0x26(%rsp)
movups %xmm0, 0x2f(%rsp)
movups %xmm0, 0x3f(%rsp)
movb $0x0, 0x4f(%rsp)
andl $0x0, 0x59(%rsp)
andl $0x0, 0x5c(%rsp)
andl $0x0, 0x28(%rsp)
movw $0x101, 0x2c(%rsp)      # imm = 0x101
movb $0x1, %al
movb %al, 0x2e(%rsp)
movq $0x1, 0x50(%rsp)
movb %al, 0x58(%rsp)
pushq $0x1
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xf420
movq %rax, %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0x14c41
movq %rax, %r15
movq %rbx, %rdi
movl %r12d, %esi
callq 0x14c41
movq %rax, %r14
orl $0x80000, %r12d         # imm = 0x80000
pushq $0x1
popq %rdi
leaq 0x8(%rsp), %rcx
movl %r12d, %esi
xorl %edx, %edx
callq 0xfbd0
testl %eax, %eax
je 0x19912
callq 0xf0a0
movl (%rax), %eax
movl %eax, 0x4(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x1531b
leaq 0xc(%rsp), %rdi
callq 0x1531b
movq %rbx, %rdi
callq 0xf9d0
movq %rbx, %rdi
callq 0xf9d0
movslq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0xf960
pushq $0x3
popq %rax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rsi
movq %r15, 0x28(%rsi)
leaq -0x4be4(%rip), %r12     # 0x14d3e
movq %r12, 0x30(%rsi)
movl 0x8(%rsp), %edi
leaq 0x4(%rsp), %rdx
callq 0xf300
movq %rax, 0x128(%r15)
testq %rax, %rax
je 0x198d1
orl $-0x1, 0x8(%rsp)
movq %r15, %rdi
callq 0x1518e
movl %eax, 0x4(%rsp)
testl %eax, %eax
jne 0x198d1
leaq 0x10(%rsp), %rsi
movq %r14, 0x28(%rsi)
movq %r12, 0x30(%rsi)
movl 0xc(%rsp), %edi
leaq 0x4(%rsp), %rdx
callq 0xf300
movq %rax, 0x128(%r14)
testq %rax, %rax
je 0x198d1
orl $-0x1, 0xc(%rsp)
movq %r14, %rdi
callq 0x1518e
movl %eax, 0x4(%rsp)
testl %eax, %eax
jne 0x198d1
pushq $0x2
jmp 0x19904