// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_resconf_search
size_t dns_resconf_search(void *dst, size_t lim, const void *qname, size_t qlen, struct dns_resolv_conf *resconf, dns_resconf_i_t *state) {
	unsigned pc, srchi, ndots, len;

	DNS_SM_ENTER;

	/* if FQDN then return as-is and finish */
	if (dns_d_isanchored(qname, qlen)) {
		len = dns_d_anchor(dst, lim, qname, qlen);
		DNS_SM_YIELD(len);
		DNS_SM_EXIT;
	}

	ndots = dns_d_ndots(qname, qlen);

	if (ndots >= resconf->options.ndots) {
		len = dns_d_anchor(dst, lim, qname, qlen);
		DNS_SM_YIELD(len);
	}

	while (srchi < lengthof(resconf->search) && resconf->search[srchi][0]) {
		struct dns_buf buf = DNS_B_INTO(dst, lim);
		const char *dn = resconf->search[srchi++];

		dns_b_put(&buf, qname, qlen);
		dns_b_putc(&buf, '.');
		dns_b_puts(&buf, dn);
		if (!dns_d_isanchored(dn, strlen(dn)))
			dns_b_putc(&buf, '.');
		len = dns_b_strllen(&buf);
		DNS_SM_YIELD(len);
	}

	if (ndots < resconf->options.ndots) {
		len = dns_d_anchor(dst, lim, qname, qlen);
		DNS_SM_YIELD(len);
	}

	DNS_SM_LEAVE;

	return dns_strlcpy(dst, "", lim);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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)
jmp 0x3b745
movq -0x38(%rbp), %rax
movq (%rax), %rax
shrq $0x0, %rax
andq $0xff, %rax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
shrq $0x8, %rax
andq $0xff, %rax
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
shrq $0x10, %rax
andq $0xff, %rax
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %eax
movq %rax, -0x80(%rbp)
subq $0x22, %rax
ja 0x3ba9c
movq -0x80(%rbp), %rax
leaq 0xe7cf(%rip), %rcx      # 0x49f6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3bad0
testb $0x1, %al
jne 0x3b7b9
jmp 0x3b81f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0xfc50
movl %eax, -0x48(%rbp)
movl $0x5, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
shll $0x0, %eax
movl -0x40(%rbp), %ecx
andl $0xff, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x44(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movq %rax, -0x8(%rbp)
jmp 0x3bab6
jmp 0x3b818
jmp 0x3b81a
jmp 0x3ba5b
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3bb10
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x5b4(%rcx), %eax
jb 0x3b89f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0xfc50
movl %eax, -0x48(%rbp)
movl $0xd, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
shll $0x0, %eax
movl -0x40(%rbp), %ecx
andl $0xff, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x44(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movq %rax, -0x8(%rbp)
jmp 0x3bab6
jmp 0x3b89d
jmp 0x3b89f
jmp 0x3b8a1
movl -0x40(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq $0x4, %rcx
movb %al, -0x81(%rbp)
jae 0x3b8d7
movq -0x30(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movl -0x40(%rbp), %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x3b8e6
jmp 0x3b9ec
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x30(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movl -0x40(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x40(%rbp)
movl %ecx, %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x35b80
leaq -0x70(%rbp), %rdi
movl $0x2e, %esi
callq 0x35b10
movq -0x78(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x35e00
movq -0x78(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x78(%rbp), %rdi
callq 0xf5c0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x3bad0
testb $0x1, %al
jne 0x3b994
leaq -0x70(%rbp), %rdi
movl $0x2e, %esi
callq 0x35b10
leaq -0x70(%rbp), %rdi
callq 0x360d0
movl %eax, -0x48(%rbp)
movl $0x1a, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
shll $0x0, %eax
movl -0x40(%rbp), %ecx
andl $0xff, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x44(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movq %rax, -0x8(%rbp)
jmp 0x3bab6
jmp 0x3b9e7
jmp 0x3b8a1
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x5b4(%rcx), %eax
jae 0x3ba59
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0xfc50
movl %eax, -0x48(%rbp)
movl $0x1f, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
shll $0x0, %eax
movl -0x40(%rbp), %ecx
andl $0xff, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x44(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x48(%rbp), %eax
movq %rax, -0x8(%rbp)
jmp 0x3bab6
jmp 0x3ba57
jmp 0x3ba59
jmp 0x3ba5b
jmp 0x3ba5d
movl $0x22, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0xff, %eax
shll $0x0, %eax
movl -0x40(%rbp), %ecx
andl $0xff, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x44(%rbp), %ecx
andl $0xff, %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x3ba9a
jmp 0x3ba9a
jmp 0x3ba9c
jmp 0x3ba9e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x11abe(%rip), %rsi     # 0x4d56b
callq 0xf520
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)