// File: /workspace/github_c_makefile_star2_O1/wahern[P]cqueues/src/lib/dns.c
// Function: dns_txt_print
size_t dns_txt_print(void *_dst, size_t lim, struct dns_txt *txt) {
	struct dns_buf src = DNS_B_FROM(txt->data, txt->len);
	struct dns_buf dst = DNS_B_INTO(_dst, lim);
	unsigned i;

	if (src.p < src.pe) {
		do {
			dns_b_putc(&dst, '"');

			for (i = 0; i < 256 && src.p < src.pe; i++, src.p++) {
				if (*src.p < 32 || *src.p > 126 || *src.p == '"' || *src.p == '\\') {
					dns_b_putc(&dst, '\\');
					dns_b_fmtju(&dst, *src.p, 3);
				} else {
					dns_b_putc(&dst, *src.p);
				}
			}

			dns_b_putc(&dst, '"');
			dns_b_putc(&dst, ' ');
		} while (src.p < src.pe);

		dns_b_popc(&dst);
	} else {
		dns_b_putc(&dst, '"');
		dns_b_putc(&dst, '"');
	}

	return dns_b_strllen(&dst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x8(%rdx), %rax
leaq (%rdi,%rsi), %r9
testq %rax, %rax
jle 0x2b0c1
movq %rdx, %rcx
leaq (%rdx,%rax), %rbx
addq $0x10, %rbx
addq $0x10, %rcx
xorl %r11d, %r11d
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rdi, %r10
movl $0x3, %edi
movq %r10, -0x8(%rsp)
cmpq %r9, %r10
jae 0x2af16
movb $0x22, (%r10)
incq %r10
jmp 0x2af19
incq %r11
cmpq %rbx, %rcx
setb %al
jae 0x2b07f
xorl %ebp, %ebp
movb (%rcx), %al
leal -0x7f(%rax), %edx
cmpb $-0x5f, %dl
jb 0x2af41
cmpb $0x5c, %al
je 0x2af41
movzbl %al, %edx
cmpl $0x22, %edx
jne 0x2b06d
cmpq %r9, %r10
jae 0x2af4f
movb $0x5c, (%r10)
incq %r10
jmp 0x2af52
incq %r11
movzbl (%rcx), %esi
movl $0x3, %r12d
movl $0x1, %eax
movq %rsi, %r8
xorl %r13d, %r13d
movq %rax, %r15
incq %r13
movq %r8, %rax
mulq %r14
shrq $0x3, %rdx
incq %r12
leaq 0x1(%r15), %rax
cmpq $0x9, %r8
movq %rdx, %r8
ja 0x2af66
movq %r9, %rdx
subq %r10, %rdx
cmpq $0x3, %r13
movl $0x3, %eax
cmovbq %r13, %rax
subq %rax, %r12
cmpq %r12, %rdx
cmovbq %rdx, %r12
cmpq $0x2, %r13
ja 0x2afcb
cmpq $0x3, %r15
cmovaeq %rdi, %r15
addq $-0x3, %r15
cmpq %r9, %r10
jae 0x2afc3
movb $0x30, (%r10)
incq %r10
jmp 0x2afc6
incq %r11
incq %r15
jne 0x2afb5
addq %rax, %r12
negq %r12
leaq (%r12,%r13), %r15
addq $0x3, %r15
movl $0x1, %r12d
movq %r10, %r8
cmpq %r12, %r15
jae 0x2b00d
cmpq %r9, %r8
jae 0x2b00a
movq %rsi, %rax
mulq %r14
shrl $0x2, %edx
andl $-0x2, %edx
leal (%rdx,%rdx,4), %eax
movl %esi, %edx
subl %eax, %edx
orb $0x30, %dl
movb %dl, (%r8)
incq %r8
jmp 0x2b00d
incq %r11
movq %rsi, %rax
mulq %r14
shrq $0x3, %rdx
incq %r12
cmpq $0x9, %rsi
movq %rdx, %rsi
ja 0x2afe2
cmpq %r8, %r10
jae 0x2b04c
incq %r10
movq %r8, %rax
movb -0x1(%rax), %dl
movb -0x1(%r10), %sil
movb %sil, -0x1(%rax)
decq %rax
movb %dl, -0x1(%r10)
leaq 0x1(%r10), %rdx
cmpq %rax, %r10
movq %rdx, %r10
jb 0x2b02e
movq %r8, %r10
incq %rcx
cmpq %rbx, %rcx
setb %al
cmpl $0xfe, %ebp
ja 0x2b07f
incl %ebp
cmpq %rbx, %rcx
jb 0x2af27
jmp 0x2b07f
cmpq %r9, %r10
jae 0x2b07a
movb %al, (%r10)
incq %r10
jmp 0x2b04f
incq %r11
jmp 0x2b04f
cmpq %r9, %r10
jae 0x2b08d
movb $0x22, (%r10)
incq %r10
jmp 0x2b090
incq %r11
cmpq %r9, %r10
jae 0x2b09e
movb $0x20, (%r10)
incq %r10
jmp 0x2b0a1
incq %r11
testb %al, %al
jne 0x2af08
xorl %eax, %eax
subq $0x1, %r11
cmovaeq %r11, %rax
movq -0x8(%rsp), %rdi
cmpq %r10, %rdi
sbbq $0x0, %r10
jmp 0x2b0ea
testq %rsi, %rsi
jle 0x2b0d1
leaq 0x1(%rdi), %r10
movb $0x22, (%rdi)
xorl %eax, %eax
jmp 0x2b0d9
movl $0x1, %eax
movq %rdi, %r10
cmpq %r9, %r10
jae 0x2b0e7
movb $0x22, (%r10)
incq %r10
jmp 0x2b0ea
incq %rax
cmpq %r9, %r10
jae 0x2b0fb
movb $0x0, (%r10)
subq %rdi, %r10
movq %r10, %rcx
jmp 0x2b118
cmpq %rdi, %r10
jbe 0x2b116
leaq -0x1(%r10), %rcx
cmpb $0x0, -0x1(%r10)
je 0x2b111
incq %rax
movb $0x0, (%rcx)
subq %rdi, %rcx
jmp 0x2b118
xorl %ecx, %ecx
addq %rcx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq