// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_res_open
struct dns_resolver *dns_res_open(struct dns_resolv_conf *resconf, struct dns_hosts *hosts, struct dns_hints *hints, struct dns_cache *cache, const struct dns_options *opts, int *_error) {
	static const struct dns_resolver R_initializer
		= { .refcount = 1, };
	struct dns_resolver *R	= 0;
	int type, error;

	/*
	 * Grab ref count early because the caller may have passed us a mortal
	 * reference, and we want to do the right thing if we return early
	 * from an error.
	 */
	if (resconf)
		dns_resconf_acquire(resconf);
	if (hosts)
		dns_hosts_acquire(hosts);
	if (hints)
		dns_hints_acquire(hints);
	if (cache)
		dns_cache_acquire(cache);

	/*
	 * Don't try to load it ourselves because a NULL object might be an
	 * error from, say, dns_resconf_root(), and loading
	 * dns_resconf_local() by default would create undesirable surpises.
	 */
	if (!resconf || !hosts || !hints) {
		if (!*_error)
			*_error = EINVAL;
		goto _error;
	}

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

	*R	= R_initializer;
	type	= dns_res_tcp2type(resconf->options.tcp);

	if (!dns_so_init(&R->so, (struct sockaddr *)&resconf->iface, type, opts, &error))
		goto error;

	R->resconf	= resconf;
	R->hosts	= hosts;
	R->hints	= hints;
	R->cache	= cache;

	return R;
syerr:
	error	= dns_syerr();
error:
	*_error	= error;
_error:
	dns_res_close(R);

	dns_resconf_close(resconf);
	dns_hosts_close(hosts);
	dns_hints_close(hints);
	dns_cache_close(cache);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3e858
movq -0x10(%rbp), %rdi
callq 0xfb90
cmpq $0x0, -0x18(%rbp)
je 0x3e868
movq -0x18(%rbp), %rdi
callq 0xfb70
cmpq $0x0, -0x20(%rbp)
je 0x3e878
movq -0x20(%rbp), %rdi
callq 0xf7b0
cmpq $0x0, -0x28(%rbp)
je 0x3e888
movq -0x28(%rbp), %rdi
callq 0x3ceb0
cmpq $0x0, -0x10(%rbp)
je 0x3e89d
cmpq $0x0, -0x18(%rbp)
je 0x3e89d
cmpq $0x0, -0x20(%rbp)
jne 0x3e8b5
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x3e8b0
movq -0x38(%rbp), %rax
movl $0x16, (%rax)
jmp 0x3e975
movl $0xd38, %edi            # imm = 0xD38
callq 0x10260
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x3e8ce
jmp 0x3e962
movq -0x40(%rbp), %rdi
leaq 0xcf67(%rip), %rsi      # 0x4b840
movl $0xd38, %edx            # imm = 0xD38
callq 0xfb40
movq -0x10(%rbp), %rax
movl 0x5c4(%rax), %edi
callq 0x3e9c0
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x5c8, %rsi            # imm = 0x5C8
movl -0x44(%rbp), %edx
movq -0x30(%rbp), %rcx
leaq -0x48(%rbp), %r8
callq 0x3d040
cmpq $0x0, %rax
jne 0x3e91c
jmp 0x3e96c
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x300(%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x308(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x310(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x318(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3e9aa
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x40(%rbp), %rdi
callq 0xfef0
movq -0x10(%rbp), %rdi
callq 0xfff0
movq -0x18(%rbp), %rdi
callq 0x108f0
movq -0x20(%rbp), %rdi
callq 0xfc90
movq -0x28(%rbp), %rdi
callq 0x10640
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)