// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_write_rdata
static int ns_write_rdata(serialize_ctx *ctx, stream_t *s, ns_rr_t *rr)
{
	switch (rr->type) {
	case NS_TYPE_HINFO:
		return ns_rdata_write_hinfo(ctx, s, rr);
	case NS_TYPE_CNAME:
	case NS_TYPE_MB:
	case NS_TYPE_MD:
	case NS_TYPE_MF:
	case NS_TYPE_MG:
	case NS_TYPE_MR:
	case NS_TYPE_NS:
	case NS_TYPE_PTR:
		return ns_rdata_write_domainname(ctx, s, rr);
	case NS_TYPE_MINFO:
		return ns_rdata_write_minfo(ctx, s, rr);
	case NS_TYPE_MX:
		return ns_rdata_write_mx(ctx, s, rr);
	case NS_TYPE_SOA:
		return ns_rdata_write_soa(ctx, s, rr);
	case NS_TYPE_OPT:
		return ns_rdata_write_opts(ctx, s, rr);
	case NS_TYPE_NULL:
	default:
		return ns_rdata_write_any(ctx, s, rr);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movzwl 0x8(%rdx), %ecx
leal -0x2(%rcx), %eax
cmpl $0xd, %eax
ja 0x1c332
movq %rdi, %r14
leaq 0x881c(%rip), %rcx      # 0x24b2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c057
movl %eax, %ebp
sarl $0x1f, %ebp
jmp 0x1c553
cmpl $0x29, %ecx
jne 0x1c3d3
movq 0x18(%r15), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x1c553
cmpl $0x0, 0x8(%r14)
jle 0x1c553
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%r14), %r13
movzwl (%r13,%r15), %esi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d916
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %eax
jne 0x1c553
movzwl 0x2(%r13,%r15), %esi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d916
cmpl $0x2, %eax
jne 0x1c553
movq 0x8(%r13,%r15), %rsi
movzwl 0x2(%r13,%r15), %edx
movq %rbx, %rdi
callq 0x1d7ad
movzwl 0x2(%r13,%r15), %ecx
cmpl %ecx, %eax
jne 0x1c553
incq %r12
movslq 0x8(%r14), %rax
addq $0x10, %r15
xorl %ebp, %ebp
cmpq %rax, %r12
jl 0x1c35b
jmp 0x1c553
movq 0x18(%r15), %rsi
testq %rsi, %rsi
je 0x1c551
movzwl 0x10(%r15), %edx
movq %rbx, %rdi
callq 0x1d7ad
movzwl 0x10(%r15), %ecx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
je 0x1c551
jmp 0x1c553
movq 0x18(%r15), %r14
testq %r14, %r14
je 0x1c551
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x1d0e1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1c553
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x1d0e1
jmp 0x1c54d
movq 0x18(%r15), %r15
testq %r15, %r15
je 0x1c551
movzwl (%r15), %esi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d916
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %eax
je 0x1c53e
jmp 0x1c553
movq 0x18(%r15), %r15
testq %r15, %r15
je 0x1c551
movq (%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c057
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1c553
movq 0x8(%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c057
testl %eax, %eax
jne 0x1c553
movl 0x10(%r15), %esi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x1d916
cmpl $0x4, %eax
jne 0x1c553
movl 0x14(%r15), %esi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x1d916
cmpl $0x4, %eax
jne 0x1c553
movl 0x18(%r15), %esi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x1d916
cmpl $0x4, %eax
jne 0x1c553
movl 0x1c(%r15), %esi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x1d916
cmpl $0x4, %eax
jne 0x1c553
movl 0x20(%r15), %esi
movq %rbx, %rdi
movl $0x4, %edx
callq 0x1d916
cmpl $0x4, %eax
je 0x1c551
jmp 0x1c553
movq 0x18(%r15), %r15
testq %r15, %r15
je 0x1c551
movq (%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c057
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1c553
movq 0x8(%r15), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c057
testl %eax, %eax
jne 0x1c553
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq