// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_chndoh.c
// Function: doh_emit_query
static int doh_emit_query(channel_req_t* rq, doh_server_t *doh)
{
	channel_chndoh_t* c = rq->ctx;
	subnet_t* subnet = NULL;
	int r;
	ns_msg_t msg;

	if (doh->ecs) {
		if (rq->qr.qtype == NS_QTYPE_A) {
			if (doh->net.is_set) {
				subnet = &doh->net;
			}
		}
		else if (rq->qr.qtype == NS_QTYPE_AAAA) {
			if (doh->net6.is_set) {
				subnet = &doh->net6;
			}
		}
	}

	init_ns_msg(&msg);

	r = build_request_nsmsg(&msg, rq);
	if (r) {
		loge("build_request_nsmsg() error\n");
		return -1;
	}

	if (doh->query) {
		r = doh->query(doh->chctx, &msg, doh->use_proxy, subnet, query_cb, rq);
	}
	else {
		r = doh_channel_query(rq, doh, &msg, doh->use_proxy, subnet);
	}

	ns_msg_free(&msg);

	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x478(%rsi)
je 0xb50d
movzwl 0x10(%r14), %eax
cmpl $0x1, %eax
je 0xb512
cmpl $0x1c, %eax
jne 0xb50d
movl $0x518, %eax            # imm = 0x518
jmp 0xb517
xorl %r15d, %r15d
jmp 0xb526
movl $0x480, %eax            # imm = 0x480
leaq (%rbx,%rax), %rcx
xorl %r15d, %r15d
cmpl $0x0, (%rbx,%rax)
cmovneq %rcx, %r15
leaq 0x38(%rsp), %r13
movq %r13, %rdi
callq 0x19b12
movq %r13, %rdi
callq 0x19b12
movw $0x0, (%r13)
movzwl 0x4(%r14), %eax
movw %ax, 0x2(%r13)
movw $0x1, 0x4(%r13)
leaq 0x8(%r14), %r12
movq %r12, %rdi
movl $0x1, %esi
callq 0x19b6a
movq %rax, 0x10(%r13)
movq 0x5c0(%rbx), %rax
testq %rax, %rax
je 0xb5b2
movq 0x5b8(%rbx), %rdi
movl 0x474(%rbx), %edx
leaq 0x5b1(%rip), %r8        # 0xbb39
leaq 0x38(%rsp), %rsi
movq %r15, %rcx
movq %r14, %r9
callq *%rax
movl %eax, %ebp
leaq 0x38(%rsp), %rdi
callq 0x1a1dd
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x474(%rbx), %ebp
testq %r15, %r15
je 0xb63b
leaq 0x38(%rsp), %rdi
movl $0x29, %esi
callq 0x1b531
testq %rax, %rax
jne 0xb5e4
leaq 0x38(%rsp), %rdi
callq 0x1b653
testq %rax, %rax
je 0xb821
movw $0x400, 0xa(%rax)       # imm = 0x400
movl 0x90(%r15), %edx
addq $0x10, %r15
movq %rax, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x1bd22
testl %eax, %eax
je 0xb63b
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb597
leaq 0x1738a(%rip), %rsi     # 0x229a8
leaq 0x177f3(%rip), %rdx     # 0x22e18
leaq 0x17823(%rip), %r8      # 0x22e4f
movl $0x3, %edi
movl $0x38f, %ecx            # imm = 0x38F
jmp 0xb855
cmpl $0x0, 0x44c(%rbx)
je 0xb6ed
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1bdbb
testl %eax, %eax
jle 0xb7ed
movq 0x460(%rbx), %rdx
movq 0x468(%rbx), %rsi
movl 0x470(%rbx), %ecx
leaq 0x16758(%rip), %rdi     # 0x21de2
callq 0x14344
testq %rax, %rax
je 0xb861
movq %rax, %r15
leaq 0x17845(%rip), %rsi     # 0x22ee7
leaq 0x1784b(%rip), %rdx     # 0x22ef4
movq %rax, %rdi
callq 0x144e9
testl %eax, %eax
je 0xb8c9
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb919
leaq 0x172d8(%rip), %rsi     # 0x229a8
leaq 0x177dc(%rip), %rdx     # 0x22eb3
leaq 0x1782e(%rip), %r8      # 0x22f0c
movl $0x3, %edi
movl $0x320, %ecx            # imm = 0x320
jmp 0xb912
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1bdbb
testl %eax, %eax
jle 0xb895
movq 0x10(%rsp), %rdi
movl 0x18(%rsp), %esi
leaq 0x34(%rsp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x81a4
testq %rax, %rax
je 0xb930
movq %rax, %r15
leaq 0x10(%rsp), %rdi
movq $0x0, 0x8(%rdi)
movq 0x468(%rbx), %rdx
leaq 0x1780f(%rip), %rsi     # 0x22f65
movq %rax, %rcx
xorl %eax, %eax
callq 0x1dcf7
cmpl $-0x1, %eax
je 0xb961
movq %r15, %rdi
callq 0x3450
movq 0x10(%rsp), %rsi
movq 0x460(%rbx), %rdx
movl 0x470(%rbx), %ecx
leaq 0x1664f(%rip), %rdi     # 0x21dd9
callq 0x14344
testq %rax, %rax
je 0xb98e
movq %rax, %r15
leaq 0x17745(%rip), %rsi     # 0x22ee7
leaq 0x1774b(%rip), %rdx     # 0x22ef4
movq %rax, %rdi
callq 0x144e9
testl %eax, %eax
je 0xbabe
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb919
leaq 0x171d8(%rip), %rsi     # 0x229a8
leaq 0x17761(%rip), %rdx     # 0x22f38
leaq 0x1772e(%rip), %r8      # 0x22f0c
movl $0x3, %edi
movl $0x363, %ecx            # imm = 0x363
jmp 0xb912
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x171a4(%rip), %rsi     # 0x229a8
leaq 0x176a8(%rip), %rdx     # 0x22eb3
leaq 0x16f7a(%rip), %r8      # 0x2278c
movl $0x3, %edi
movl $0x312, %ecx            # imm = 0x312
jmp 0xb9b9
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb597
leaq 0x1716b(%rip), %rsi     # 0x229a8
leaq 0x175d4(%rip), %rdx     # 0x22e18
leaq 0x175df(%rip), %r8      # 0x22e2a
movl $0x3, %edi
movl $0x387, %ecx            # imm = 0x387
xorl %eax, %eax
callq 0x17d92
jmp 0xb597
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x17130(%rip), %rsi     # 0x229a8
leaq 0x17634(%rip), %rdx     # 0x22eb3
leaq 0x17644(%rip), %r8      # 0x22eca
movl $0x3, %edi
movl $0x319, %ecx            # imm = 0x319
jmp 0xb9b9
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x170fc(%rip), %rsi     # 0x229a8
leaq 0x17685(%rip), %rdx     # 0x22f38
leaq 0x16ed2(%rip), %r8      # 0x2278c
movl $0x3, %edi
movl $0x341, %ecx            # imm = 0x341
jmp 0xb9b9
leaq 0x1765d(%rip), %rsi     # 0x22f2d
leaq 0x1765d(%rip), %rdx     # 0x22f34
movq %r15, %rdi
callq 0x144e9
testl %eax, %eax
je 0xbb0c
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb919
leaq 0x170ae(%rip), %rsi     # 0x229a8
leaq 0x175b2(%rip), %rdx     # 0x22eb3
leaq 0x17604(%rip), %r8      # 0x22f0c
movl $0x3, %edi
movl $0x328, %ecx            # imm = 0x328
xorl %eax, %eax
callq 0x17d92
leaq 0x10(%rsp), %rdi
callq 0x1d5f9
movq %r15, %rdi
callq 0x143e9
jmp 0xb9ca
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x17061(%rip), %rsi     # 0x229a8
leaq 0x175ea(%rip), %rdx     # 0x22f38
leaq 0x175f9(%rip), %r8      # 0x22f4e
movl $0x3, %edi
movl $0x348, %ecx            # imm = 0x348
jmp 0xb9b9
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x17034(%rip), %rsi     # 0x229a8
leaq 0x175bd(%rip), %rdx     # 0x22f38
leaq 0x175ed(%rip), %r8      # 0x22f6f
movl $0x3, %edi
movl $0x353, %ecx            # imm = 0x353
jmp 0xb9b9
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb9c0
leaq 0x17007(%rip), %rsi     # 0x229a8
leaq 0x17590(%rip), %rdx     # 0x22f38
leaq 0x1751b(%rip), %r8      # 0x22eca
movl $0x3, %edi
movl $0x35c, %ecx            # imm = 0x35C
xorl %eax, %eax
callq 0x17d92
leaq 0x10(%rsp), %rdi
callq 0x1d5f9
xorl %r15d, %r15d
testq %r15, %r15
je 0xba5e
movq 0x5b8(%rbx), %rdi
movl 0x47c(%rbx), %r8d
addq $0x8, %rbx
movq %r14, (%rsp)
leaq 0x999(%rip), %r9        # 0xc38c
movq %rbx, %rsi
movl %ebp, %edx
movq %r15, %rcx
callq 0x155b2
testl %eax, %eax
je 0xbab7
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xba3a
leaq 0x16f8d(%rip), %rsi     # 0x229a8
leaq 0x173f6(%rip), %rdx     # 0x22e18
leaq 0x17477(%rip), %r8      # 0x22ea0
movl $0x3, %edi
movl $0x3a2, %ecx            # imm = 0x3A2
xorl %eax, %eax
callq 0x17d92
movq %r15, %rdi
xorl %esi, %esi
callq 0x146b5
movq %rax, %rdi
callq 0x3450
movq %r15, %rdi
callq 0x143e9
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xb597
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb597
cmpl $0x0, 0x44c(%rbx)
leaq 0x17407(%rip), %rax     # 0x22e88
leaq 0x173e7(%rip), %r9      # 0x22e6f
cmoveq %rax, %r9
leaq 0x16f15(%rip), %rsi     # 0x229a8
leaq 0x1737e(%rip), %rdx     # 0x22e18
leaq 0x173c4(%rip), %r8      # 0x22e65
movl $0x3, %edi
movl $0x39c, %ecx            # imm = 0x39C
xorl %eax, %eax
callq 0x17d92
jmp 0xb597
xorl %ebp, %ebp
jmp 0xb597
leaq 0x17468(%rip), %rsi     # 0x22f2d
leaq 0x17468(%rip), %rdx     # 0x22f34
movq %r15, %rdi
callq 0x144e9
testl %eax, %eax
je 0xbb0c
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xb919
leaq 0x16eb9(%rip), %rsi     # 0x229a8
leaq 0x17442(%rip), %rdx     # 0x22f38
leaq 0x1740f(%rip), %r8      # 0x22f0c
movl $0x3, %edi
movl $0x36b, %ecx            # imm = 0x36B
jmp 0xb912
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
movq %r15, %rdi
callq 0x146c4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1461e
movq (%r12), %rsi
movq %r15, %rdi
callq 0x14628
jmp 0xb9cd