// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/socket.c
// Function: so_trace
static void so_trace(enum so_trace event, int fd, const struct addrinfo *host, ...) {
	struct sockaddr_storage saddr = {0};
	socklen_t saddr_len = sizeof saddr;
	char addr[64], who[256];
	in_port_t port;
	va_list ap;
	SSL *ctx;
	const void *data;
	size_t count;
	const char *fmt;
	int error;

	if (!socket_debug)
		return;

	if (host) {
		sa_ntop(addr, sizeof addr, host->ai_addr, NULL, &error);
		port = *sa_port(host->ai_addr, SA_PORT_NONE, NULL);

		if (host->ai_canonname)
			snprintf(who, sizeof who, "%.96s/[%s]:%hu", host->ai_canonname, addr, ntohs(port));
		else
			snprintf(who, sizeof who, "[%s]:%hu", addr, ntohs(port));
	} else if (fd != -1 && 0 == getpeername(fd, (struct sockaddr *)&saddr, &saddr_len)) {
		sa_ntop(addr, saddr_len, &saddr, NULL, &error);
		port = *sa_port(&saddr, SA_PORT_NONE, NULL);

		snprintf(who, sizeof who, "[%s]:%hu", addr, ntohs(port));
	} else
		dns_strlcpy(who, "[unknown]", sizeof who);

	va_start(ap, host);

	flockfile(stderr);

	switch (event) {
	case SO_T_CONNECT:
		fmt = va_arg(ap, char *);

		fprintf(stderr, "connect(%s): ", who);
		vfprintf(stderr, fmt, ap);
		fputc('\n', stderr);

		break;
	case SO_T_STARTTLS:
		ctx = va_arg(ap, SSL *);
		fmt = va_arg(ap, char *);

		(void)ctx; /* unused for now */
		fprintf(stderr, "starttls(%s): ", who);
		vfprintf(stderr, fmt, ap);
		fputc('\n', stderr);

		break;
	case SO_T_READ:
		data  = va_arg(ap, void *);
		count = va_arg(ap, size_t);
		fmt   = va_arg(ap, char *);

		fprintf(stderr, "read(%s): ", who);
		vfprintf(stderr, fmt, ap);
		fputc('\n', stderr);

		so_dump(data, count, stderr);

		break;
	case SO_T_WRITE:
		data  = va_arg(ap, void *);
		count = va_arg(ap, size_t);
		fmt   = va_arg(ap, char *);

		fprintf(stderr, "write(%s): ", who);
		vfprintf(stderr, fmt, ap);
		fputc('\n', stderr);

		so_dump(data, count, stderr);

		break;
	} /* switch(event) */

	funlockfile(stderr);

	va_end(ap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
testb %al, %al
je 0x2ebd7
movaps %xmm0, -0x2d0(%rbp)
movaps %xmm1, -0x2c0(%rbp)
movaps %xmm2, -0x2b0(%rbp)
movaps %xmm3, -0x2a0(%rbp)
movaps %xmm4, -0x290(%rbp)
movaps %xmm5, -0x280(%rbp)
movaps %xmm6, -0x270(%rbp)
movaps %xmm7, -0x260(%rbp)
movq %r9, -0x2d8(%rbp)
movq %r8, -0x2e0(%rbp)
movq %rcx, -0x2e8(%rbp)
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xf7d0
movl $0x80, -0x94(%rbp)
movq 0x2d38e(%rip), %rax     # 0x5bfa8
cmpl $0x0, (%rax)
jne 0x2ec24
jmp 0x2f43c
cmpq $0x0, -0x10(%rbp)
je 0x2ed4e
leaq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
movl $0x40, %esi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x224(%rbp), %r8
callq 0xf220
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x230(%rbp)
movw $0x0, -0x232(%rbp)
movq -0x230(%rbp), %rdi
leaq -0x232(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2c470
movw (%rax), %ax
movw %ax, -0x1e2(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2ecfc
leaq -0x1e0(%rbp), %rax
movq %rax, -0x318(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x310(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x308(%rbp)
movzwl -0x1e2(%rbp), %edi
callq 0x10a80
movq -0x318(%rbp), %rdi
movq -0x310(%rbp), %rcx
movq -0x308(%rbp), %r8
movzwl %ax, %r9d
movl $0x100, %esi            # imm = 0x100
leaq 0x1b088(%rip), %rdx     # 0x49d7b
movb $0x0, %al
callq 0x10770
jmp 0x2ed49
leaq -0x1e0(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x320(%rbp)
movzwl -0x1e2(%rbp), %edi
callq 0x10a80
movq -0x328(%rbp), %rdi
movq -0x320(%rbp), %rcx
movzwl %ax, %r8d
movl $0x100, %esi            # imm = 0x100
leaq 0x1b03f(%rip), %rdx     # 0x49d81
movb $0x0, %al
callq 0x10770
jmp 0x2ee4f
cmpl $-0x1, -0x8(%rbp)
je 0x2ee35
movl -0x8(%rbp), %edi
leaq -0x90(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rsi
leaq -0x94(%rbp), %rdx
callq 0xfa00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2ee35
leaq -0xe0(%rbp), %rdi
movl -0x94(%rbp), %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
leaq -0x224(%rbp), %r8
callq 0xf220
leaq -0x90(%rbp), %rax
movq %rax, -0x248(%rbp)
movw $0x0, -0x24a(%rbp)
movq -0x248(%rbp), %rdi
leaq -0x24a(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2c470
movw (%rax), %ax
movw %ax, -0x1e2(%rbp)
leaq -0x1e0(%rbp), %rax
movq %rax, -0x338(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x330(%rbp)
movzwl -0x1e2(%rbp), %edi
callq 0x10a80
movq -0x338(%rbp), %rdi
movq -0x330(%rbp), %rcx
movzwl %ax, %r8d
movl $0x100, %esi            # imm = 0x100
leaq 0x1af55(%rip), %rdx     # 0x49d81
movb $0x0, %al
callq 0x10770
jmp 0x2ee4d
leaq -0x1e0(%rbp), %rdi
leaq 0x1af47(%rip), %rsi     # 0x49d8a
movl $0x100, %edx            # imm = 0x100
callq 0xf520
jmp 0x2ee4f
leaq -0x300(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movl $0x30, -0x1fc(%rbp)
movl $0x18, -0x200(%rbp)
movq 0x2d135(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
callq 0xf4d0
movl -0x4(%rbp), %eax
movq %rax, -0x340(%rbp)
subq $0x3, %rax
ja 0x2f426
movq -0x340(%rbp), %rax
leaq 0x1a8c3(%rip), %rcx     # 0x49770
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x200(%rbp), %rax
movq %rax, -0x350(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x344(%rbp)
cmpl $0x28, %eax
ja 0x2eef7
movq -0x350(%rbp), %rcx
movl -0x344(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x358(%rbp)
jmp 0x2ef14
movq -0x350(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x358(%rbp)
movq -0x358(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x220(%rbp)
movq 0x2d08c(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
leaq -0x1e0(%rbp), %rdx
leaq 0x1ae57(%rip), %rsi     # 0x49d94
movb $0x0, %al
callq 0x10440
movq 0x2d06d(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
movq -0x220(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x10270
movq 0x2d050(%rip), %rax     # 0x5bfb8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10140
jmp 0x2f426
leaq -0x200(%rbp), %rax
movq %rax, -0x368(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x35c(%rbp)
cmpl $0x28, %eax
ja 0x2efbb
movq -0x368(%rbp), %rcx
movl -0x35c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x370(%rbp)
jmp 0x2efd8
movq -0x368(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x370(%rbp)
movq -0x370(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x380(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x374(%rbp)
cmpl $0x28, %eax
ja 0x2f02a
movq -0x380(%rbp), %rcx
movl -0x374(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x388(%rbp)
jmp 0x2f047
movq -0x380(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x388(%rbp)
movq -0x388(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x220(%rbp)
movq 0x2cf59(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
leaq -0x1e0(%rbp), %rdx
leaq 0x1ad32(%rip), %rsi     # 0x49da2
movb $0x0, %al
callq 0x10440
movq 0x2cf3a(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
movq -0x220(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x10270
movq 0x2cf1d(%rip), %rax     # 0x5bfb8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10140
jmp 0x2f426
leaq -0x200(%rbp), %rax
movq %rax, -0x398(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x38c(%rbp)
cmpl $0x28, %eax
ja 0x2f0ee
movq -0x398(%rbp), %rcx
movl -0x38c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x3a0(%rbp)
jmp 0x2f10b
movq -0x398(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x3a0(%rbp)
movq -0x3a0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x210(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x3b0(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x3a4(%rbp)
cmpl $0x28, %eax
ja 0x2f15d
movq -0x3b0(%rbp), %rcx
movl -0x3a4(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x3b8(%rbp)
jmp 0x2f17a
movq -0x3b0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x3b8(%rbp)
movq -0x3b8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x218(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x3c8(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x3bc(%rbp)
cmpl $0x28, %eax
ja 0x2f1cc
movq -0x3c8(%rbp), %rcx
movl -0x3bc(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x3d0(%rbp)
jmp 0x2f1e9
movq -0x3c8(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x3d0(%rbp)
movq -0x3d0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x220(%rbp)
movq 0x2cdb7(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
leaq -0x1e0(%rbp), %rdx
leaq 0x1ab9f(%rip), %rsi     # 0x49db1
movb $0x0, %al
callq 0x10440
movq 0x2cd98(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
movq -0x220(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x10270
movq 0x2cd7b(%rip), %rax     # 0x5bfb8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10140
movq -0x210(%rbp), %rdi
movq -0x218(%rbp), %rsi
movq 0x2cd59(%rip), %rax     # 0x5bfb8
movq (%rax), %rdx
callq 0x314e0
jmp 0x2f426
leaq -0x200(%rbp), %rax
movq %rax, -0x3e0(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x3d4(%rbp)
cmpl $0x28, %eax
ja 0x2f2ad
movq -0x3e0(%rbp), %rcx
movl -0x3d4(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x3e8(%rbp)
jmp 0x2f2ca
movq -0x3e0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x3e8(%rbp)
movq -0x3e8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x210(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x3f8(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x3ec(%rbp)
cmpl $0x28, %eax
ja 0x2f31c
movq -0x3f8(%rbp), %rcx
movl -0x3ec(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x400(%rbp)
jmp 0x2f339
movq -0x3f8(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x400(%rbp)
movq -0x400(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x218(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x410(%rbp)
movl -0x200(%rbp), %eax
movl %eax, -0x404(%rbp)
cmpl $0x28, %eax
ja 0x2f38b
movq -0x410(%rbp), %rcx
movl -0x404(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x418(%rbp)
jmp 0x2f3a8
movq -0x410(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x418(%rbp)
movq -0x418(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x220(%rbp)
movq 0x2cbf8(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
leaq -0x1e0(%rbp), %rdx
leaq 0x1a9eb(%rip), %rsi     # 0x49dbc
movb $0x0, %al
callq 0x10440
movq 0x2cbd9(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
movq -0x220(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x10270
movq 0x2cbbc(%rip), %rax     # 0x5bfb8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10140
movq -0x210(%rbp), %rdi
movq -0x218(%rbp), %rsi
movq 0x2cb9a(%rip), %rax     # 0x5bfb8
movq (%rax), %rdx
callq 0x314e0
movq 0x2cb8b(%rip), %rax     # 0x5bfb8
movq (%rax), %rdi
callq 0xfb50
leaq -0x200(%rbp), %rax
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
nopw %cs:(%rax,%rax)