LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: hints_stub
static int hints_stub(lua_State *L) {
	struct dns_resolv_conf *resconf = resconf_test(L, 1);
	struct dns_hints **hints;
	int error;

	hints = lua_newuserdata(L, sizeof *hints);
	*hints = 0;

	if (!(*hints = dns_hints_local(resconf, &error)))
		return lua_pushboolean(L, 0), lua_pushinteger(L, error), 2;

	luaL_setmetatable(L, HINTS_CLASS);

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x13ffb(%rip), %rdx     # 0x361cf
movl $0x1, %esi
callq 0x10720
testq %rax, %rax
je 0x221e8
movq (%rax), %r14
jmp 0x221eb
xorl %r14d, %r14d
movl $0x8, %esi
movq %rbx, %rdi
callq 0xfb00
movq %rax, %r15
movq $0x0, (%rax)
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0xf240
movq %rax, (%r15)
testq %rax, %rax
je 0x2222d
leaq 0x14000(%rip), %rsi     # 0x3621e
movq %rbx, %rdi
callq 0x101f0
movl $0x1, %eax
jmp 0x22249
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10800
movslq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xf910
movl $0x2, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: hints_type
static int hints_type(lua_State *L) {
	if (hints_test(L, 1)) {
		lua_pushstring(L, "dns hints");
	} else {
		lua_pushnil(L);
	}

	return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x13f42(%rip), %rdx     # 0x3621e
movl $0x1, %esi
callq 0x10720
testq %rax, %rax
je 0x22302
cmpq $0x0, (%rax)
je 0x22302
leaq 0x141f6(%rip), %rsi     # 0x364ee
movq %rbx, %rdi
callq 0xfbd0
jmp 0x2230a
movq %rbx, %rdi
callq 0xf980
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_submit
static int res_submit(lua_State *L) {
	struct dns_resolver *R = res_check(L, 1);
	const char *name = luaL_checkstring(L, 2);
	int type = luaL_optint(L, 3, DNS_T_A);
	int class = luaL_optint(L, 4, DNS_C_IN);
	int error;

	if (!(error = dns_res_submit(R, name, type, class))) {
		lua_pushboolean(L, 1);

		return 1;
	} else {
		lua_pushboolean(L, 0);
		lua_pushinteger(L, error);

		return 2;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x13f19(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0xfcf0
movq (%rax), %r14
testq %r14, %r14
jne 0x2234f
movq %rax, %r15
leaq 0x141c6(%rip), %rdx     # 0x36505
movq %rbx, %rdi
movl $0x1, %esi
callq 0xf3f0
movq (%r15), %r14
movl $0x2, %ebp
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0xf620
movq %rax, %r15
movl $0x1, %edx
movq %rbx, %rdi
movl $0x3, %esi
callq 0xf400
movq %rax, %r12
movl $0x1, %edx
movq %rbx, %rdi
movl $0x4, %esi
callq 0xf400
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
movl %eax, %ecx
callq 0xf340
testl %eax, %eax
je 0x223bb
movl %eax, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10800
movslq %r14d, %rsi
movq %rbx, %rdi
callq 0xf910
jmp 0x223cd
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10800
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_fetch
static int res_fetch(lua_State *L) {
	struct dns_resolver *R = res_check(L, 1);
	struct dns_packet *pkt;
	size_t size;
	int error;

	if ((error = dns_res_check(R)) || !(pkt = dns_res_fetch(R, &error))) {
error:
		lua_pushboolean(L, 0);
		lua_pushinteger(L, error);

		return 2;
	}

	/* FIXME: Leaks packet if lua_newuserdata throws */
	size = dns_p_sizeof(pkt);
	error = dns_p_study(dns_p_copy(dns_p_init(lua_newuserdata(L, size), size), pkt));
	free(pkt);

	if (error)
		goto error;

	luaL_setmetatable(L, PACKET_CLASS);

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x13e51(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0xfcf0
movq (%rax), %r14
testq %r14, %r14
jne 0x22417
movq %rax, %r15
leaq 0x140fe(%rip), %rdx     # 0x36505
movq %rbx, %rdi
movl $0x1, %esi
callq 0xf3f0
movq (%r15), %r14
movq %r14, %rdi
callq 0xf510
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x2244d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10800
movslq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xf910
movl $0x2, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x10070
testq %rax, %rax
je 0x22427
movq %rax, %r14
movq 0x50(%rax), %rax
leaq 0x5c(%rax), %rcx
cmpq $0xc, %rax
movl $0x68, %r15d
cmovaeq %rcx, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfb00
movq %rax, %rdi
movq %r15, %rsi
callq 0x10a30
movq %rax, %rdi
movq %r14, %rsi
callq 0x101b0
movq %rax, %rdi
callq 0xf7a0
movl %eax, 0xc(%rsp)
movq %r14, %rdi
callq 0xff30
cmpl $0x0, 0xc(%rsp)
jne 0x22427
leaq 0x13cf0(%rip), %rsi     # 0x361af
movq %rbx, %rdi
callq 0x101f0
movl $0x1, %eax
jmp 0x22443
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_events
static int res_events(lua_State *L) {
	struct dns_resolver *R = res_check(L, 1);

	switch (dns_res_events(R)) {
	case POLLIN|POLLOUT:
		lua_pushliteral(L, "rw");
		break;
	case POLLIN:
		lua_pushliteral(L, "r");
		break;
	case POLLOUT:
		lua_pushliteral(L, "w");
		break;
	default:
		lua_pushnil(L);
		break;
	}

	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x13d06(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0xfcf0
movq (%rax), %rdi
testq %rdi, %rdi
jne 0x22562
movq %rax, %r14
leaq 0x13fb3(%rip), %rdx     # 0x36505
movq %rbx, %rdi
movl $0x1, %esi
callq 0xf3f0
movq (%r14), %rdi
callq 0xf800
cmpl $0x1, %eax
je 0x22588
cmpl $0x4, %eax
je 0x2257f
cmpl $0x5, %eax
jne 0x22599
leaq 0x13190(%rip), %rsi     # 0x3570d
jmp 0x2258f
leaq 0x12bc5(%rip), %rsi     # 0x3514b
jmp 0x2258f
leaq 0x130ed(%rip), %rsi     # 0x3567c
movq %rbx, %rdi
callq 0xfbd0
jmp 0x225a1
movq %rbx, %rdi
callq 0xf980
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_close
static int res_close(lua_State *L) {
	struct resolver *R = luaL_checkudata(L, 1, RESOLVER_CLASS);

	if (!R->mainthread) {
		R->mainthread = L;
		dns_res_close(R->res);
		R->res = 0;
		R->mainthread = 0;
	} else {
		dns_res_close(R->res);
		R->res = 0;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x139f3(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0xfcf0
movq %rax, %rbx
cmpq $0x0, 0x8(%rax)
je 0x22867
movq (%rbx), %rdi
callq 0xfde0
jmp 0x2287b
movq %r14, 0x8(%rbx)
movq (%rbx), %rdi
callq 0xfde0
movq $0x0, 0x8(%rbx)
movq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res__gc
static int res__gc(lua_State *L) {
	struct resolver *R = luaL_checkudata(L, 1, RESOLVER_CLASS);

	R->mainthread = 0;

	dns_res_close(R->res);
	R->res = 0;

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x139a5(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0xfcf0
movq %rax, %rbx
xorl %r14d, %r14d
movq %r14, 0x8(%rax)
movq (%rax), %rdi
callq 0xfde0
movq %r14, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_type
static int res_type(lua_State *L) {
	struct resolver *R;

	if ((R = luaL_testudata(L, 1, RESOLVER_CLASS))) {
		lua_pushstring(L, (R->res)? "dns resolver" : "closed dns resolver");
	} else {
		lua_pushnil(L);
	}

	return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x136e7(%rip), %rdx     # 0x3623c
movl $0x1, %esi
callq 0x10720
testq %rax, %rax
je 0x22b84
cmpq $0x0, (%rax)
leaq 0x139b3(%rip), %rax     # 0x36522
leaq 0x139b3(%rip), %rsi     # 0x36529
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xfbd0
jmp 0x22b8c
movq %rbx, %rdi
callq 0xf980
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: res_closefd
static int res_closefd(int *fd, void *arg) {
	struct resolver *R = arg;

	if (R->mainthread) {
		cqs_cancelfd(R->mainthread, *fd);
		cqs_closefd(fd);
	}

	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %rdi
testq %rdi, %rdi
je 0x22bb9
movl (%rbx), %esi
callq 0xfc10
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x22bb9
callq 0x10a10
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/dns.c
// Function: dnsL_random
static int dnsL_random(lua_State *L) {
	lua_Number modn = luaL_optnumber(L, 1, UINT_MAX + 1.0);

	if (modn >= (UINT_MAX + 1.0)) {
		lua_pushnumber(L, dns_random());
	} else {
		unsigned n = (unsigned)modn;
		unsigned r, min;

		luaL_argcheck(L, n > 1, 1, lua_pushfstring(L, "[0, %d): interval is empty", (int)n));

		min = -n % n;

		for (;;) {
			r = dns_random();

			if (r >= min)
				break;
		}

		lua_pushinteger(L, r % n);
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movsd 0x134e9(%rip), %xmm0    # 0x360f0
movl $0x1, %esi
callq 0xf780
ucomisd 0x134d7(%rip), %xmm0    # 0x360f0
jae 0x22c73
cvttsd2si %xmm0, %r14
cmpl $0x1, %r14d
ja 0x22c4a
leaq 0x13910(%rip), %rsi     # 0x3653d
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xfff0
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0xf3f0
movl %r14d, %eax
negl %eax
xorl %edx, %edx
divl %r14d
movl %edx, %ebp
callq 0x10560
callq *(%rax)
cmpl %ebp, %eax
jb 0x22c56
xorl %edx, %edx
divl %r14d
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xf910
jmp 0x22c8c
callq 0x10560
callq *(%rax)
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %rbx, %rdi
callq 0xf2c0
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_strerror
const char *so_strerror(int error) {
	static const char *errlist[] = {
		[SO_EOPENSSL - SO_ERRNO0] = "TLS/SSL error",
		[SO_EX509INT - SO_ERRNO0] = "X.509 certificate lookup interrupt",
		[SO_ENOTVRFD - SO_ERRNO0] = "Absent or unverified peer certificate",
		[SO_ECLOSURE - SO_ERRNO0] = "Peers elected to shutdown secure transport",
		[SO_ENOHOST - SO_ERRNO0]  = "No host address available to complete operation",
	};

	if (error >= 0)
		return strerror(error);

	if (error == SO_EOPENSSL) {
#if SO_THREAD_SAFE && (!defined __NetBSD__ || __NetBSD_Version__ > 600000000)
		static __thread char sslstr[256];
#else
		static char sslstr[256];
#endif
		unsigned long code = ERR_peek_last_error();

		if (!code)
			return "Unknown TLS/SSL error";

		ERR_error_string_n(code, sslstr, sizeof sslstr);

		return sslstr;
	} else {
		int index = error - SO_ERRNO0;

		if (index >= 0 && index < (int)countof(errlist) && errlist[index])
			return errlist[index];
		else
			return "Unknown socket error";
	}
}

// Assembly:
testl %edi, %edi
jns 0xf470
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x8c9c94c7, %edi       # imm = 0x8C9C94C7
jne 0x22cf8
callq 0xf090
testq %rax, %rax
je 0x22d1e
movq %rax, %r14
leaq 0x24276(%rip), %rdi     # 0x46f50
callq 0x10740
leaq (%rax), %rbx
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10670
jmp 0x22d25
addl $0x73636b39, %edi       # imm = 0x73636B39
cmpl $0x4, %edi
ja 0x22d15
movl %edi, %eax
leaq 0x138a0(%rip), %rcx     # 0x365ac
movslq (%rcx,%rax,4), %rbx
addq %rcx, %rbx
jmp 0x22d25
leaq 0x13ba5(%rip), %rbx     # 0x368c1
jmp 0x22d25
leaq 0x13b86(%rip), %rbx     # 0x368ab
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: sa_ntop
char *sa_ntop(char *dst, size_t lim, const void *src, const char *def, int *_error) {
	union sockaddr_any *any = (void *)src;
	const char *unspec = "0.0.0.0";
	char text[SA_ADDRSTRLEN];
	int error;

	switch (*sa_family(&any->sa)) {
	case AF_INET:
		unspec = "0.0.0.0";

		if (!inet_ntop(AF_INET, &any->sin.sin_addr, text, sizeof text))
			goto syerr;

		break;
	case AF_INET6:
		unspec = "::";

		if (!inet_ntop(AF_INET6, &any->sin6.sin6_addr, text, sizeof text))
			goto syerr;

		break;
#if SA_UNIX
	case AF_UNIX:
		unspec = "/nonexistent";

		memset(text, 0, sizeof text);
		memcpy(text, any->sun.sun_path, SO_MIN(sizeof text - 1, sizeof any->sun.sun_path));

		break;
#endif
	default:
		error = EAFNOSUPPORT;

		goto error;
	} /* switch() */

	if (dns_strlcpy(dst, text, lim) >= lim) {
		error = ENOSPC;

		goto error;
	}

	return dst;
syerr:
	error = so_syerr();
error:
	if (_error)
		*_error = error;

	/*
	 * NOTE: Always write something in case caller ignores errors, such
	 * as when caller is using the sa_ntoa() macro.
	 */
	dns_strlcpy(dst, (def)? def : unspec, lim);

	return (char *)def;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %rax
movq %rsi, %r14
movq %rdi, %r15
movzwl (%rdx), %ecx
cmpl $0x1, %ecx
je 0x22db2
cmpl $0xa, %ecx
je 0x22d84
cmpl $0x2, %ecx
jne 0x22dee
addq $0x4, %rax
movq %rsp, %rdx
movl $0x2, %edi
movq %rax, %rsi
movl $0x6d, %ecx
callq 0xfda0
leaq 0x13b54(%rip), %r13     # 0x368d6
jmp 0x22da4
addq $0x8, %rax
movq %rsp, %rdx
movl $0xa, %edi
movq %rax, %rsi
movl $0x6d, %ecx
callq 0xfda0
leaq 0x13b3a(%rip), %r13     # 0x368de
testq %rax, %rax
jne 0x22dd1
callq 0xf0a0
movl (%rax), %ecx
jmp 0x22dfa
addq $0x2, %rax
movq %rsp, %rdi
movb $0x0, 0x6c(%rdi)
movl $0x6c, %edx
movq %rax, %rsi
callq 0xfa60
leaq 0x13b10(%rip), %r13     # 0x368e1
movq %rsp, %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0xf4d0
movl $0x1c, %ecx
cmpq %r14, %rax
jae 0x22dfa
movq %r15, %rbx
jmp 0x22e18
movl $0x61, %ecx
leaq 0x13adc(%rip), %r13     # 0x368d6
testq %r12, %r12
je 0x22e03
movl %ecx, (%r12)
testq %rbx, %rbx
cmovneq %rbx, %r13
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xf4d0
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: sa_pton
void *sa_pton(void *dst, size_t lim, const char *src, const void *def, int *_error) {
	union sockaddr_any family[] = { { { .sa_family = AF_INET } }, { { .sa_family = AF_INET6 } } }, *fp;
	int error;

	memset(dst, 0, lim);

	for (fp = family; fp < endof(family); fp++) {
		switch (inet_pton(*sa_family(fp), src, sa_addr(fp, NULL, NULL))) {
		case -1:
			goto syerr;
		case 1:
			if (lim < sa_len(fp)) {
				error = ENOSPC;

				goto error;
			}

			memcpy(dst, fp, sa_len(fp));

			return dst;
		}
	}

	error = EAFNOSUPPORT;

	goto error;
syerr:
	error = so_syerr();
error:
	if (_error)
		*_error = error;

	return (void *)def;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r8, 0x8(%rsp)
movq %rcx, (%rsp)
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0xf750
movw $0x2, (%r14)
leaq 0x90(%rsp), %r15
movw $0xa, (%r15)
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0xf750
movb $0x1, %r12b
movzwl (%r14), %edi
cmpl $0x1, %edi
je 0x22ea3
cmpl $0xa, %edi
je 0x22e9d
cmpl $0x2, %edi
jne 0x22ea9
leaq 0x4(%r14), %rdx
jmp 0x22eab
leaq 0x8(%r14), %rdx
jmp 0x22eab
leaq 0x2(%r14), %rdx
jmp 0x22eab
xorl %edx, %edx
movq %rbp, %rsi
callq 0x10960
cmpl $-0x1, %eax
je 0x22eed
cmpl $0x1, %eax
je 0x22ed3
movq %r15, %r14
testb $0x1, %r12b
movl $0x0, %r12d
jne 0x22e84
movl $0x61, %ecx
jmp 0x22f0c
movzwl (%r14), %eax
cmpl $0x1, %eax
je 0x22efd
cmpl $0x2, %eax
je 0x22ef6
cmpl $0xa, %eax
jne 0x22f34
movl $0x1c, %edx
jmp 0x22f02
callq 0xf0a0
movl (%rax), %ecx
jmp 0x22f0c
movl $0x10, %edx
jmp 0x22f02
movl $0x6e, %edx
movl $0x1c, %ecx
cmpq %r13, %rdx
jbe 0x22f1e
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x22f18
movl %ecx, (%rax)
movq (%rsp), %rbx
jmp 0x22f4f
cmpl $0x1, %eax
je 0x22f3f
cmpl $0x2, %eax
je 0x22f38
cmpl $0xa, %eax
jne 0x22f34
movl $0x1c, %edx
jmp 0x22f44
xorl %edx, %edx
jmp 0x22f44
movl $0x10, %edx
jmp 0x22f44
movl $0x6e, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfa60
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_cloexec
int so_cloexec(int fd, _Bool cloexec) {
#if _WIN32
	return 0;
#else
	if (-1 == fcntl(fd, F_SETFD, cloexec))
		return so_syerr();

	return 0;
#endif
}

// Assembly:
pushq %rbx
movl %esi, %edx
xorl %ebx, %ebx
movl $0x2, %esi
xorl %eax, %eax
callq 0xf7b0
cmpl $-0x1, %eax
jne 0x231c2
callq 0xf0a0
movl (%rax), %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_closesocket
void so_closesocket(int *fd, const struct so_options *opts) {
	if (opts && opts->fd_close.cb)
		opts->fd_close.cb(fd, opts->fd_close.arg);

	if (*fd != -1) {
#if _WIN32
		closesocket(*fd);
#else
		close(*fd);
#endif

		*fd = -1;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x231e1
movq 0x30(%rsi), %rax
testq %rax, %rax
je 0x231e1
movq 0x28(%rsi), %rsi
movq %rbx, %rdi
callq *%rax
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x231f3
callq 0x10a10
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_socket
int so_socket(int domain, int type, const struct so_options *opts, int *_error) {
	int error, fd, flags, mask, need;

#if defined SOCK_CLOEXEC
	if (-1 == (fd = socket(domain, type|SOCK_CLOEXEC, 0)))
		goto syerr;
#else
	if (-1 == (fd = socket(domain, type, 0)))
		goto syerr;
#endif

	flags = so_opts2flags(opts, &mask);
	mask &= so_type2mask(S_IFSOCK, domain, type, 0);
	need = ~(SO_F_NODELAY|SO_F_NOPUSH|SO_F_NOSIGPIPE|SO_F_OOBINLINE);

	if ((error = so_setfl(fd, flags, mask, need)))
		goto error;

	return fd;
syerr:
	error = so_syerr();

	goto error;
error:
	*_error = error;

	so_closesocket(&fd, opts);

	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r15d
movl %edi, %r13d
orl $0x80000, %esi          # imm = 0x80000
xorl %edx, %edx
callq 0xf300
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x23297
movl %eax, %ebp
leaq 0x10(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x232c4
movl %r13d, %ecx
andl $-0x9, %ecx
xorl $0x2, %ecx
movl %r15d, %edx
xorl $0x1, %edx
xorl %esi, %esi
cmpl $0xa, %r13d
sete %sil
shll $0x8, %esi
xorl %edi, %edi
cmpl $0x2, %r15d
sete %dil
shll $0x4, %edi
orl %esi, %edi
orl %ecx, %edx
movl $0x2ef, %edx            # imm = 0x2EF
movl $0x28f, %ecx            # imm = 0x28F
cmovel %edx, %ecx
orl %edi, %ecx
andl (%r12), %ecx
leaq 0x14(%rsp), %rsi
movl $0x0, (%rsi)
movl %ebp, %edi
movl %eax, %edx
movl $0xfffffd1f, %r8d       # imm = 0xFFFFFD1F
callq 0x10970
testl %eax, %eax
jne 0x2329e
jmp 0x232b3
callq 0xf0a0
movl (%rax), %eax
movl %eax, (%r14)
leaq 0xc(%rsp), %rdi
movq %rbx, %rsi
callq 0xf2b0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_opts2flags
static int so_opts2flags(const struct so_options *opts, int *mask) {
	const struct flops *f;
	int flags = 0;

	*mask = 0;

	for (f = fltable; f < endof(fltable); f++) {
		if (f->offset == NO_OFFSET)
			continue;

		flags |= (*(_Bool *)((char *)opts + f->offset))? f->flag : 0;
		*mask |= f->flag;
	}

	switch (opts->sin_v6only) {
	case SO_V6ONLY_DEFAULT:
		break;
	case SO_V6ONLY_ENABLE:
		flags |= SO_F_V6ONLY;
		*mask |= SO_F_V6ONLY;
		break;
	case SO_V6ONLY_DISABLE:
		*mask |= SO_F_V6ONLY;
		break;
	}

	return flags;
}

// Assembly:
movl $0x0, (%rsi)
xorl %ecx, %ecx
movq $-0x18, %rdx
leaq 0x23346(%rip), %r8      # 0x46620
xorl %eax, %eax
movq 0x28(%rdx,%r8), %r10
cmpq $-0x1, %r10
je 0x23301
movl 0x18(%rdx,%r8), %r9d
cmpb $0x0, (%rdi,%r10)
movl %r9d, %r10d
jne 0x232f9
xorl %r10d, %r10d
orl %r10d, %eax
orl %r9d, %ecx
movl %ecx, (%rsi)
addq $0x18, %rdx
cmpq $0xd8, %rdx
jb 0x232dc
movl 0x18(%rdi), %edx
cmpl $0x2, %edx
je 0x23320
cmpl $0x1, %edx
jne 0x23328
orl $0x100, %eax            # imm = 0x100
orl $0x100, %ecx            # imm = 0x100
movl %ecx, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_nonblock
int so_nonblock(int fd, _Bool nonblock) {
	int flags, mask = (nonblock)? ~0 : (~O_NONBLOCK);

	if (-1 == (flags = fcntl(fd, F_GETFL))
	||  -1 == fcntl(fd, F_SETFL, mask & (flags | O_NONBLOCK)))
		return so_syerr();

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movl %edi, %ebp
xorl %ebx, %ebx
movl $0x3, %esi
xorl %eax, %eax
callq 0xf7b0
cmpl $-0x1, %eax
je 0x2352e
movzbl %r14b, %ecx
negl %ecx
orl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
orl $0x800, %eax            # imm = 0x800
andl %ecx, %eax
movl %ebp, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0xf7b0
cmpl $-0x1, %eax
jne 0x23535
callq 0xf0a0
movl (%rax), %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_setboolopt
static int so_setboolopt(int fd, int lvl, int opt, _Bool enable) {
	if (0 != setsockopt(fd, lvl, opt, &(int){ enable }, sizeof (int))) {
		switch (errno) {
		case ENOTSOCK:
			/* FALL THROUGH */
		case ENOPROTOOPT:
			return EOPNOTSUPP;
		default:
			return errno;
		}
	}

	return 0;
}

// Assembly:
pushq %rax
leaq 0x4(%rsp), %rax
movl %ecx, (%rax)
movq %rax, %rcx
movl $0x4, %r8d
callq 0x10820
testl %eax, %eax
je 0x2357e
callq 0xf0a0
movl (%rax), %ecx
movl $0x5f, %eax
movl %ecx, %edx
orl $0x4, %edx
cmpl $0x5c, %edx
je 0x23580
movl %ecx, %eax
jmp 0x23580
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_reuseport
int so_reuseport(int fd, _Bool reuseport) {
	int error;
#if defined SO_REUSEPORT
	error = so_setboolopt(fd, SOL_SOCKET, SO_REUSEPORT, reuseport);
#else
	(void)fd;
	error = EOPNOTSUPP;
#endif
	if (error == EOPNOTSUPP && !reuseport)
		error = 0; /* already disabled */

	return error;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
movl $0x1, %esi
movl $0xf, %edx
movl %ebx, %ecx
callq 0x2354a
testl %ebx, %ebx
movl $0x5f, %ecx
cmovel %ebx, %ecx
cmpl $0x5f, %eax
cmovel %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_rstfl
int so_rstfl(int fd, int *oflags, int flags, int mask, int require) {
	const struct flops *f;
	int error;

	for (f = fltable; f < endof(fltable); f++) {
		if (!(f->flag & mask))
			continue;

		if ((error = f->set(fd, !!(f->flag & flags)))) {
			if ((f->flag & require) || error != EOPNOTSUPP)
				return error;

			*oflags &= ~f->flag;
		} else {
			*oflags &= ~f->flag;
			*oflags |= (f->flag & flags);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0xc(%rsp)
movl %ecx, %ebp
movl %edx, 0x14(%rsp)
movq %rsi, %r15
movl %edi, 0x10(%rsp)
movq $-0x18, %r13
leaq 0x22dd7(%rip), %rbx     # 0x46620
movl 0x18(%r13,%rbx), %r14d
testl %ebp, %r14d
je 0x2388e
xorl %esi, %esi
movl %r14d, %r12d
andl 0x14(%rsp), %r12d
setne %sil
movl 0x10(%rsp), %edi
callq *0x20(%r13,%rbx)
testl %eax, %eax
je 0x23882
testl %r14d, 0xc(%rsp)
jne 0x2389d
cmpl $0x5f, %eax
jne 0x2389d
notl %r14d
andl (%r15), %r14d
jmp 0x2388b
notl %r14d
andl (%r15), %r14d
orl %r12d, %r14d
movl %r14d, (%r15)
addq $0x18, %r13
cmpq $0xd8, %r13
jb 0x23849
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_make
static struct socket *so_make(const struct so_options *opts, int *error) {
	static const struct socket so_initializer = {
		.fd = -1,
		.domain = PF_UNSPEC,
		.cred = { (pid_t)-1, (uid_t)-1, (gid_t)-1, }
	};
	struct socket *so;
	size_t len;

	if (!(so = malloc(sizeof *so)))
		goto syerr;

	*so = so_initializer;
	so->opts = *opts;

	if (opts->sa_bind) {
		if (!(len = sa_len((void *)opts->sa_bind))) {
			*error = EAFNOSUPPORT;
			goto error;
		}

		if (!(so->opts.sa_bind = malloc(len)))
			goto syerr;

		memcpy((void *)so->opts.sa_bind, opts->sa_bind, len);
	}

	if (opts->tls_sendname && opts->tls_sendname != SO_OPTS_TLS_HOSTNAME) {
		if (!(so->opts.tls_sendname = strdup(opts->tls_sendname)))
			goto syerr;
	}

	return so;
syerr:
	*error = so_syerr();
error:
	if (so) {
		if (so->opts.tls_sendname != opts->tls_sendname)
			free((void *)so->opts.tls_sendname);

		if (so->opts.sa_bind != opts->sa_bind)
			free((void *)so->opts.sa_bind);

		free(so);
	}

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x220, %edi            # imm = 0x220
callq 0x10110
testq %rax, %rax
je 0x23acc
movq %rax, %rbx
leaq 0x12b38(%rip), %rsi     # 0x365c0
movl $0x220, %edx            # imm = 0x220
movq %rax, %rdi
callq 0xfa60
movl $0xa, %ecx
movq %rbx, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq (%r14), %r12
testq %r12, %r12
je 0x23b04
movzwl (%r12), %ecx
cmpl $0x1, %ecx
je 0x23ae0
cmpl $0x2, %ecx
je 0x23ad8
movl $0x61, %eax
cmpl $0xa, %ecx
jne 0x23b23
movl $0x1c, %r13d
jmp 0x23ae6
callq 0xf0a0
movl (%rax), %eax
movl %eax, (%r15)
jmp 0x23b4d
movl $0x10, %r13d
jmp 0x23ae6
movl $0x6e, %r13d
movq %r13, %rdi
callq 0x10110
movq %rax, (%rbx)
testq %rax, %rax
je 0x23b1c
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xfa60
movq 0x40(%r14), %rdi
cmpq $0x2, %rdi
jb 0x23b4f
callq 0x10890
movq %rax, 0x40(%rbx)
testq %rax, %rax
jne 0x23b4f
callq 0xf0a0
movl (%rax), %eax
movl %eax, (%r15)
movq 0x40(%rbx), %rdi
cmpq 0x40(%r14), %rdi
je 0x23b38
callq 0xff30
movq (%r14), %r12
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x23b45
callq 0xff30
movq %rbx, %rdi
callq 0xff30
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_close
int so_close(struct socket *so) {
	if (!so)
		return EINVAL;

	so_destroy(so);

	free(so);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x23bce
movq %rdi, %rbx
callq 0x24bd4
movq 0x50(%rbx), %rdi
callq 0xff50
xorl %r14d, %r14d
movq %r14, 0x50(%rbx)
movq 0xa8(%rbx), %rdi
callq 0xff30
movq %r14, 0xa8(%rbx)
leaq 0x58(%rbx), %rdi
movq %rbx, %rsi
callq 0xf2b0
movw $0x0, 0xb0(%rbx)
movq 0x40(%rbx), %rdi
cmpq $0x2, %rdi
jb 0x23bbc
callq 0xff30
movq $0x0, 0x40(%rbx)
movq (%rbx), %rdi
callq 0xff30
movq %rbx, %rdi
callq 0xff30
jmp 0x23bd4
movl $0x16, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_dial
struct socket *so_dial(const struct sockaddr *sa, int type, const struct so_options *opts, int *error_) {
	struct { struct addrinfo ai; struct sockaddr_storage ss; } *host;
	struct socket *so;
	int error;

	if (!(so = so_make(opts, &error)))
		goto error;

	if (!(host = malloc(sizeof *host)))
		goto syerr;

	memset(&host->ai, 0, sizeof host->ai);
	memcpy(&host->ss, sa, SO_MIN(af_len(sa->sa_family), sizeof host->ss));

	so->host = &host->ai;
	so->host->ai_family = sa->sa_family;
	so->host->ai_socktype = type;
	so->host->ai_protocol = 0;
	so->host->ai_addrlen = af_len(sa->sa_family);
	so->host->ai_addr = (struct sockaddr *)&host->ss;

	so->todo = SO_S_SOCKET | SO_S_BIND;

	return so;
syerr:
	error = so_syerr();
error:
	so_close(so);

	*error_ = error;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movl %esi, %ebp
movq %rdi, %r12
leaq 0xc(%rsp), %rsi
movq %rdx, %rdi
callq 0x23a60
testq %rax, %rax
je 0x23c63
movq %rax, %rbx
movl $0xb0, %edi
callq 0x10110
testq %rax, %rax
je 0x23c69
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, %r15
addq $0x30, %r15
movzwl (%r12), %eax
cmpl $0x1, %eax
je 0x23ca6
cmpl $0xa, %eax
je 0x23c7f
cmpl $0x2, %eax
jne 0x23cc9
movups (%r12), %xmm0
movups %xmm0, (%r15)
movq %r14, 0xa8(%rbx)
movl $0x10, %ecx
movl $0x2, %eax
jmp 0x23cd2
movl 0xc(%rsp), %ebp
jmp 0x23c78
callq 0xf0a0
movl (%rax), %ebp
movq %rbx, %rdi
callq 0xf420
movl %ebp, (%r15)
xorl %ebx, %ebx
jmp 0x23cec
movups (%r12), %xmm0
movups 0xc(%r12), %xmm1
movups %xmm1, 0xc(%r15)
movups %xmm0, (%r15)
movq %r14, 0xa8(%rbx)
movl $0x1c, %ecx
movl $0xa, %eax
jmp 0x23cd2
movl $0x6e, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xfa60
movq %r14, 0xa8(%rbx)
movl $0x6e, %ecx
movl $0x1, %eax
jmp 0x23cd2
movq %r14, 0xa8(%rbx)
xorl %ecx, %ecx
movl %eax, 0x4(%r14)
movl %ebp, 0x8(%r14)
movl %ecx, 0x10(%r14)
movq %r15, 0x18(%r14)
movl $0xc, 0xb8(%rbx)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_fdopen
struct socket *so_fdopen(int fd, const struct so_options *opts, int *error_) {
	struct socket *so;
	int flags, mask, need, error;

	if (!(so = so_make(opts, &error)))
		goto error;

	if ((error = so_ftype(fd, &so->mode, &so->domain, &so->type, &so->protocol)))
		goto error;

	flags = so_opts2flags(opts, &mask);
	mask &= so_type2mask(so->mode, so->domain, so->type, so->protocol);
	need = ~(SO_F_NODELAY|SO_F_NOPUSH|SO_F_NOSIGPIPE|SO_F_OOBINLINE);

	if ((error = so_rstfl(fd, &so->flags, flags, mask, need)))
		goto error;

	so->fd = fd;

	return so;
error:
	so_close(so);

	*error_ = error;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movl %edi, %r15d
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x23a60
movq %rax, %r14
testq %rax, %rax
je 0x23e05
movq %r12, 0x8(%rsp)
leaq 0x5c(%r14), %rsi
leaq 0x60(%r14), %r12
leaq 0x64(%r14), %r13
leaq 0x68(%r14), %rbp
movl %r15d, %edi
movq %rsi, 0x10(%rsp)
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x23e30
testl %eax, %eax
jne 0x23dfb
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
movl %r15d, %ebx
callq 0x232c4
movl $0xf000, %edx           # imm = 0xF000
movq 0x10(%rsp), %rcx
andl (%rcx), %edx
movl $0x83, %ecx
cmpl $0xc000, %edx           # imm = 0xC000
jne 0x23ddd
movl (%r12), %esi
movl (%r13), %edx
movl (%rbp), %ecx
testl %ecx, %ecx
jne 0x23db1
movl %esi, %edi
andl $-0x9, %edi
xorl %ecx, %ecx
cmpl $0x2, %edi
jne 0x23db1
cmpl $0x1, %edx
movl $0x6, %edi
movl $0x11, %ecx
cmovel %edi, %ecx
xorl %edi, %edi
cmpl $0xa, %esi
sete %dil
shll $0x8, %edi
xorl %esi, %esi
cmpl $0x2, %edx
sete %sil
shll $0x4, %esi
orl %edi, %esi
cmpl $0x6, %ecx
movl $0x2ef, %edx            # imm = 0x2EF
movl $0x28f, %ecx            # imm = 0x28F
cmovel %edx, %ecx
orl %esi, %ecx
andl 0x4(%rsp), %ecx
movq %r14, %rsi
addq $0x6c, %rsi
movl %ebx, %edi
movl %eax, %edx
movl $0xfffffd1f, %r8d       # imm = 0xFFFFFD1F
callq 0x10970
testl %eax, %eax
je 0x23e2a
movl %eax, %r15d
movq 0x8(%rsp), %r12
jmp 0x23e09
movl (%rsp), %r15d
movq %r14, %rdi
callq 0xf420
movl %r15d, (%r12)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, 0x58(%r14)
jmp 0x23e18
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_ftype
static so_error_t so_ftype(int fd, mode_t *mode, int *domain, int *type, int *protocol) {
	struct stat st;
	int error;

	if (0 != fstat(fd, &st))
		return errno;

	*mode = S_IFMT & st.st_mode;

	if (!S_ISSOCK(*mode))
		return 0;

#if defined SO_DOMAIN
	if (0 != getsockopt(fd, SOL_SOCKET, SO_DOMAIN, domain, &(socklen_t){ sizeof *domain })) {
		if (errno != ENOPROTOOPT)
			return errno;

		if ((error = so_ffamily(fd, domain)))
			return error;
	}
#else
	if ((error = so_ffamily(fd, domain)))
		return error;
#endif

	if (0 != getsockopt(fd, SOL_SOCKET, SO_TYPE, type, &(socklen_t){ sizeof *type }))
		return errno;

#if defined SO_PROTOCOL
	if (0 != getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, protocol, &(socklen_t){ sizeof *protocol })) {
		if (errno != ENOPROTOOPT)
			return errno;
	}
#else
	(void)protocol;
#endif

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %ebp
leaq 0x90(%rsp), %rsi
callq 0x106e0
testl %eax, %eax
je 0x23e6a
callq 0xf0a0
movl (%rax), %eax
jmp 0x23f44
movl $0xf000, %ecx           # imm = 0xF000
andl 0xa8(%rsp), %ecx
movl %ecx, (%r12)
xorl %eax, %eax
cmpl $0xc000, %ecx           # imm = 0xC000
jne 0x23f44
leaq 0x8(%rsp), %r8
movl $0x4, (%r8)
movl %ebp, %edi
movl $0x1, %esi
movl $0x27, %edx
movq %r15, %rcx
callq 0xf9a0
testl %eax, %eax
je 0x23eec
callq 0xf0a0
movq %rax, %r12
movl (%rax), %eax
cmpl $0x5c, %eax
jne 0x23f44
leaq 0xc(%rsp), %rdx
movl $0x80, (%rdx)
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
callq 0xfc30
testl %eax, %eax
je 0x23ee4
movl (%r12), %eax
testl %eax, %eax
jne 0x23f44
jmp 0x23eec
movzwl 0x10(%rsp), %eax
movl %eax, (%r15)
leaq 0x4(%rsp), %r8
movl $0x4, (%r8)
movl %ebp, %edi
movl $0x1, %esi
movl $0x3, %edx
movq %r14, %rcx
callq 0xf9a0
testl %eax, %eax
jne 0x23e5e
movq %rsp, %r8
movl $0x4, (%r8)
movl %ebp, %edi
movl $0x1, %esi
movl $0x26, %edx
movq %rbx, %rcx
callq 0xf9a0
testl %eax, %eax
je 0x23f42
callq 0xf0a0
movl (%rax), %eax
cmpl $0x5c, %eax
jne 0x23f44
xorl %eax, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_family
int so_family(struct socket *so, int *error_) {
	struct sockaddr_storage saddr;
	socklen_t slen = sizeof saddr;
	int error;

	if ((error = so_localaddr(so, (void *)&saddr, &slen)))
		{ *error_ = error; return AF_UNSPEC; }

	return *sa_family(&saddr);
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rbx
leaq 0xc(%rsp), %rdx
movl $0x80, (%rdx)
leaq 0x10(%rsp), %rsi
callq 0x100b0
testl %eax, %eax
je 0x23f7e
movl %eax, (%rbx)
xorl %eax, %eax
jmp 0x23f83
movzwl 0x10(%rsp), %eax
addq $0x90, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_localaddr
int so_localaddr(struct socket *so, void *saddr, socklen_t *slen) {
	int error;

	if ((so_state(so) < SO_S_STARTTLS) && (error = so_exec(so)))
		return error;

	if (0 != getsockname(so->fd, saddr, slen))
		return errno;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0xb4(%rdi), %eax
notl %eax
andl 0xb8(%rdi), %eax
je 0x23fc4
movl $0x1, %ecx
testl %eax, %ecx
jne 0x23fbf
addl %ecx, %ecx
cmpl $0x801, %ecx            # imm = 0x801
jl 0x23faf
jmp 0x23fc4
cmpl $0x3f, %ecx
jg 0x23fd0
movq %r15, %rdi
callq 0x23ff4
testl %eax, %eax
jne 0x23fee
movl 0x58(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xfc30
testl %eax, %eax
je 0x23fec
callq 0xf0a0
movl (%rax), %eax
jmp 0x23fee
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_remoteaddr
int so_remoteaddr(struct socket *so, void *saddr, socklen_t *slen) {
	int error;

	if ((so_state(so) < SO_S_STARTTLS) && (error = so_exec(so)))
		return error;

	if (0 != getpeername(so->fd, saddr, slen))
		return errno;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0xb4(%rdi), %eax
notl %eax
andl 0xb8(%rdi), %eax
je 0x24885
movl $0x1, %ecx
testl %eax, %ecx
jne 0x24880
addl %ecx, %ecx
cmpl $0x801, %ecx            # imm = 0x801
jl 0x24870
jmp 0x24885
cmpl $0x3f, %ecx
jg 0x24891
movq %r15, %rdi
callq 0x23ff4
testl %eax, %eax
jne 0x248af
movl 0x58(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xf970
testl %eax, %eax
je 0x248ad
callq 0xf0a0
movl (%rax), %eax
jmp 0x248af
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_resetssl
static void so_resetssl(struct socket *so) {
	ssl_discard(&so->ssl.ctx);
	so->ssl.state  = 0;
	so->ssl.error  = 0;
	so->ssl.accept = 0;
	so->ssl.vrfd   = 0;

	if (so->bio.ctx) {
		BIO_free(so->bio.ctx);
		so->bio.ctx = NULL;
	}

	free(so->bio.ahead.data);
	so->bio.ahead.data = NULL;
	so->bio.ahead.p = NULL;
	so->bio.ahead.pe = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xc8(%rdi), %r14
movq 0xc8(%rdi), %rdi
testq %rdi, %rdi
je 0x24bf3
callq 0xf770
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movw $0x0, 0x10(%r14)
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x24c1d
callq 0xfd90
movq $0x0, 0xe0(%rbx)
movq 0xf0(%rbx), %rdi
callq 0xff30
xorps %xmm0, %xmm0
movups %xmm0, 0xf0(%rbx)
movq $0x0, 0x100(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_read
size_t so_read(struct socket *so, void *dst, size_t lim, int *error_) {
	size_t len;
	int error;

	so_pipeign(so, 1);

	so->todo |= SO_S_SETREAD;

	if ((error = so_exec(so)))
		goto error;

	if (so->fd == -1) {
		error = ENOTCONN;
		goto error;
	}

	so->events &= ~POLLIN;
retry:
	if (so->ssl.ctx) {
		int n;

		ERR_clear_error();

		if ((n = SSL_read(so->ssl.ctx, dst, SO_MIN(lim, INT_MAX))) < 0) {
			if (SO_EINTR == (error = ssl_error(so->ssl.ctx, n, &so->events)))
				goto retry;
			goto error;
		} else if (n == 0) {
			error = EPIPE; /* FIXME: differentiate clean from unclean shutdown? */
			so->st.rcvd.eof = 1;
			goto error;
		}

		len = n;
	} else {
		if (!(len = so_sysread(so, dst, lim, &error)))
			goto error;
	}

	so_trace(SO_T_READ, so->fd, so->host, dst, (size_t)len, "rcvd %zu bytes", (size_t)len);
	st_update(&so->st.rcvd, len, &so->opts);

	so_pipeok(so, 1);

	return len;
error:
	*error_ = error;

	if (error != SO_EAGAIN)
		so_trace(SO_T_READ, so->fd, so->host, (void *)0, (size_t)0, "%s", so_strerror(error));

	so_pipeok(so, 1);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movl $0x1, %esi
callq 0x24e27
orb $-0x80, 0xb8(%rbx)
movq %rbx, %rdi
callq 0x23ff4
testl %eax, %eax
je 0x24cb9
movl %eax, (%r14)
cmpl $0xb, %eax
jne 0x24d36
xorl %r12d, %r12d
jmp 0x24d6b
cmpl $-0x1, 0x58(%rbx)
je 0x24d2e
andb $-0x2, 0xb0(%rbx)
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
cmpq %r13, %r12
cmovbq %r12, %r13
cmpq $0x0, 0xc8(%rbx)
je 0x24d8a
leaq 0xb0(%rbx), %rbp
callq 0x10130
movq 0xc8(%rbx), %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0xf0d0
testl %eax, %eax
jns 0x24db2
movq 0xc8(%rbx), %rdi
movl %eax, %esi
movq %rbp, %rdx
callq 0x24f03
cmpl $0x4, %eax
jne 0x24ca5
cmpq $0x0, 0xc8(%rbx)
jne 0x24ce8
movl $0x4, %eax
jmp 0x24d8c
movl $0x6b, %eax
movl %eax, (%r14)
movl 0x58(%rbx), %ebp
movq 0xa8(%rbx), %r14
movl %eax, %edi
callq 0xfbe0
movq %rax, (%rsp)
leaq 0x111fb(%rip), %r9      # 0x35f4d
xorl %r12d, %r12d
movl $0x2, %edi
movl %ebp, %esi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x25004
movq %rbx, %rdi
movl $0x1, %esi
callq 0x252cb
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
leaq 0x14(%rsp), %rcx
movl %eax, (%rcx)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x24f87
movq %rax, %r12
testq %rax, %rax
jne 0x24db7
movl 0x14(%rsp), %eax
jmp 0x24ca5
je 0x24e16
movl %eax, %r12d
movl 0x58(%rbx), %esi
movq 0xa8(%rbx), %rdx
movq %r12, (%rsp)
leaq 0x11b6a(%rip), %r9      # 0x36936
movl $0x2, %edi
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25004
movb 0x48(%rbx), %al
movq 0x88(%rbx), %rcx
addq %r12, %rcx
movq $-0x1, %rdx
cmovaeq %rcx, %rdx
movq %rdx, 0x88(%rbx)
cmpb $0x1, %al
jne 0x24d6b
leaq 0x98(%rbx), %rdi
callq 0xfc20
jmp 0x24d6b
movb $0x1, 0x90(%rbx)
movl $0x20, %eax
jmp 0x24d33
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_pipeign
static int so_pipeign(struct socket *so, _Bool rdonly) {
	if (!so_needign(so, rdonly))
		return 0;

#if _POSIX_REALTIME_SIGNALS > 0
	if (so->pipeign.ncalls++ > 0)
		return 0;

	sigemptyset(&so->pipeign.pending);
	sigpending(&so->pipeign.pending);

	if (sigismember(&so->pipeign.pending, SIGPIPE))
		return 0;

	sigset_t piped;
	sigemptyset(&piped);
	sigaddset(&piped, SIGPIPE);
	sigemptyset(&so->pipeign.blocked);

	return thr_sigmask(SIG_BLOCK, &piped, &so->pipeign.blocked);
#else
	return EOPNOTSUPP;
#endif
}

// Assembly:
cmpb $0x1, 0x1e(%rdi)
jne 0x24f02
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
testb $-0x80, 0x6c(%rdi)
jne 0x24ef8
cmpq $0x0, 0xc8(%rbx)
je 0x24e6f
movq 0xe0(%rbx), %rax
testq %rax, %rax
sete %cl
orb %sil, %cl
je 0x24e78
testq %rax, %rax
jne 0x24ef8
jmp 0x24e87
testb %sil, %sil
jne 0x24ef8
movl $0xf000, %eax           # imm = 0xF000
andl 0x5c(%rbx), %eax
cmpl $0xc000, %eax           # imm = 0xC000
je 0x24ef8
movl 0x108(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x108(%rbx)
testl %eax, %eax
jg 0x24ef8
leaq 0x110(%rbx), %r14
movq %r14, %rdi
callq 0x10010
movq %r14, %rdi
callq 0xf310
movq %r14, %rdi
movl $0xd, %esi
callq 0xf610
testl %eax, %eax
jne 0x24ef8
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x10010
movq %r14, %rdi
movl $0xd, %esi
callq 0x104c0
addq $0x190, %rbx            # imm = 0x190
movq %rbx, %rdi
callq 0x10010
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xf350
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: ssl_error
static int ssl_error(SSL *ctx, int rval, short *events) {
	unsigned long code;

	switch (SSL_get_error(ctx, rval)) {
	case SSL_ERROR_ZERO_RETURN:
		return SO_ECLOSURE;
	case SSL_ERROR_WANT_READ:
		*events |= POLLIN;

		return SO_EAGAIN;
	case SSL_ERROR_WANT_WRITE:
		*events |= POLLOUT;

		return SO_EAGAIN;
	case SSL_ERROR_WANT_CONNECT:
		*events |= POLLOUT;

		return SO_EAGAIN;
	case SSL_ERROR_WANT_ACCEPT:
		*events |= POLLIN;

		return SO_EAGAIN;
	case SSL_ERROR_WANT_X509_LOOKUP:
		return SO_EX509INT;
	case SSL_ERROR_SYSCALL:
		if ((code = ERR_peek_last_error()))
			return SO_EOPENSSL;
		else if (rval == 0)
			return ECONNRESET;
		else if (rval == -1 && so_soerr() && so_soerr() != SO_EAGAIN)
			return so_soerr();
		else
			return SO_EOPENSSL;
	case SSL_ERROR_SSL:
		/* FALL THROUGH */
	default:
		return SO_EOPENSSL;
	} /* switch(SSL_get_error()) */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebx
callq 0xf070
addl $-0x2, %eax
cmpl $0x6, %eax
ja 0x24f73
leaq 0x11660(%rip), %rcx     # 0x36580
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
orb $0x1, (%r14)
jmp 0x24f33
orb $0x4, (%r14)
movl $0xb, %eax
jmp 0x24f78
movl $0x8c9c94ca, %eax       # imm = 0x8C9C94CA
jmp 0x24f78
movl $0x8c9c94c8, %eax       # imm = 0x8C9C94C8
jmp 0x24f78
callq 0xf090
movq %rax, %rcx
movl $0x8c9c94c7, %eax       # imm = 0x8C9C94C7
testq %rcx, %rcx
jne 0x24f78
testl %ebx, %ebx
je 0x24f80
cmpl $-0x1, %ebx
jne 0x24f73
callq 0xf0a0
movl (%rax), %eax
cmpl $0xb, %eax
je 0x24f73
testl %eax, %eax
jne 0x24f78
movl $0x8c9c94c7, %eax       # imm = 0x8C9C94C7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x68, %eax
jmp 0x24f78
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_sysread
static size_t so_sysread(struct socket *so, void *dst, size_t lim, int *error) {
	long len;

retry:
#if _WIN32
	len = recv(so->fd, dst, SO_MIN(lim, LONG_MAX), 0);
#else
	len = read(so->fd, dst, SO_MIN(lim, LONG_MAX));
#endif

	if (len == -1)
		goto error;
	if (len == 0)
		goto epipe;

	return len;
epipe:
	*error = EPIPE;
	so->st.rcvd.eof = 1;

	return 0;
error:
	*error = so_soerr();

	switch (*error) {
	case SO_EINTR:
		goto retry;
#if SO_EWOULDBLOCK != SO_EAGAIN
	case SO_EWOULDBLOCK:
		*error = SO_EAGAIN;
		/* FALL THROUGH */
#endif
	case SO_EAGAIN:
		so->events |= POLLIN;
		break;
	} /* switch() */

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movabsq $0x7fffffffffffffff, %r13 # imm = 0x7FFFFFFFFFFFFFFF
cmpq %r13, %rdx
cmovbq %rdx, %r13
xorl %r14d, %r14d
movl 0x58(%rbx), %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x10310
cmpq $-0x1, %rax
jne 0x24fde
callq 0xf0a0
movl (%rax), %eax
movl %eax, (%r15)
cmpl $0x4, %eax
je 0x24fad
cmpl $0xb, %eax
jne 0x24ff7
orb $0x1, 0xb0(%rbx)
jmp 0x24ff4
movq %rax, %r14
testq %rax, %rax
jne 0x24ff7
movl $0x20, (%r15)
movb $0x1, 0x90(%rbx)
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/socket.c
// Function: so_pipeok
static int so_pipeok(struct socket *so, _Bool rdonly) {
	if (!so_needign(so, rdonly))
		return 0;

#if _POSIX_REALTIME_SIGNALS > 0
	assert(so->pipeign.ncalls > 0);

	if (--so->pipeign.ncalls)
		return 0;

	if (sigismember(&so->pipeign.pending, SIGPIPE))
		return 0;

	sigset_t piped;
	sigemptyset(&piped);
	sigaddset(&piped, SIGPIPE);

	while (-1 == sigtimedwait(&piped, NULL, &(struct timespec){ 0, 0 }) && errno == EINTR)
		;;

	return thr_sigmask(SIG_SETMASK, &so->pipeign.blocked, NULL);
#else
	return EOPNOTSUPP;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
cmpb $0x1, 0x1e(%rdi)
jne 0x253b4
movq %rdi, %rbx
testb $-0x80, 0x6c(%rdi)
jne 0x253b4
cmpq $0x0, 0xc8(%rbx)
je 0x25315
movq 0xe0(%rbx), %rax
testq %rax, %rax
sete %cl
orb %sil, %cl
je 0x2531e
testq %rax, %rax
jne 0x253b4
jmp 0x25331
testb %sil, %sil
jne 0x253b4
movl $0xf000, %eax           # imm = 0xF000
andl 0x5c(%rbx), %eax
cmpl $0xc000, %eax           # imm = 0xC000
je 0x253b4
movl 0x108(%rbx), %eax
testl %eax, %eax
jle 0x253c1
decl %eax
movl %eax, 0x108(%rbx)
jne 0x253b4
leaq 0x110(%rbx), %rdi
movl $0xd, %esi
callq 0xf610
testl %eax, %eax
jne 0x253b4
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x10010
movq %r14, %rdi
movl $0xd, %esi
callq 0x104c0
movq %rsp, %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xf6f0
cmpl $-0x1, %eax
jne 0x2539e
callq 0xf0a0
cmpl $0x4, (%rax)
je 0x2537b
addq $0x190, %rbx            # imm = 0x190
movl $0x2, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xf350
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1164c(%rip), %rdi     # 0x36a14
leaq 0x1151f(%rip), %rsi     # 0x368ee
leaq 0x11655(%rip), %rcx     # 0x36a2b
movl $0x56e, %edx            # imm = 0x56E
callq 0xf890