// File: /workspace/github_c_makefile_star2_O3/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 0xb136
movzwl 0x10(%r14), %eax
cmpl $0x1, %eax
je 0xb13b
cmpl $0x1c, %eax
jne 0xb136
movl $0x518, %eax            # imm = 0x518
jmp 0xb140
xorl %r15d, %r15d
jmp 0xb14f
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 0x19496
movq %r13, %rdi
callq 0x19496
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 0x194ee
movq %rax, 0x10(%r13)
movq 0x5c0(%rbx), %rax
testq %rax, %rax
je 0xb1db
movq 0x5b8(%rbx), %rdi
movl 0x474(%rbx), %edx
leaq 0x5b1(%rip), %r8        # 0xb762
leaq 0x38(%rsp), %rsi
movq %r15, %rcx
movq %r14, %r9
callq *%rax
movl %eax, %ebp
leaq 0x38(%rsp), %rdi
callq 0x19ae0
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 0xb264
leaq 0x38(%rsp), %rdi
movl $0x29, %esi
callq 0x1ad6f
testq %rax, %rax
jne 0xb20d
leaq 0x38(%rsp), %rdi
callq 0x1ae8f
testq %rax, %rax
je 0xb44a
movw $0x400, 0xa(%rax)       # imm = 0x400
movl 0x90(%r15), %edx
addq $0x10, %r15
movq %rax, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x1b504
testl %eax, %eax
je 0xb264
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb1c0
leaq 0x17769(%rip), %rsi     # 0x229b0
leaq 0x17bd2(%rip), %rdx     # 0x22e20
leaq 0x17c02(%rip), %r8      # 0x22e57
movl $0x3, %edi
movl $0x38f, %ecx            # imm = 0x38F
jmp 0xb47e
cmpl $0x0, 0x44c(%rbx)
je 0xb316
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1b58c
testl %eax, %eax
jle 0xb416
movq 0x460(%rbx), %rdx
movq 0x468(%rbx), %rsi
movl 0x470(%rbx), %ecx
leaq 0x16b0f(%rip), %rdi     # 0x21dc2
callq 0x13e60
testq %rax, %rax
je 0xb48a
movq %rax, %r15
leaq 0x17c24(%rip), %rsi     # 0x22eef
leaq 0x17c2a(%rip), %rdx     # 0x22efc
movq %rax, %rdi
callq 0x13fd7
testl %eax, %eax
je 0xb4f2
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb542
leaq 0x176b7(%rip), %rsi     # 0x229b0
leaq 0x17bbb(%rip), %rdx     # 0x22ebb
leaq 0x17c0d(%rip), %r8      # 0x22f14
movl $0x3, %edi
movl $0x320, %ecx            # imm = 0x320
jmp 0xb53b
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1b58c
testl %eax, %eax
jle 0xb4be
movq 0x10(%rsp), %rdi
movl 0x18(%rsp), %esi
leaq 0x34(%rsp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x7eac
testq %rax, %rax
je 0xb559
movq %rax, %r15
leaq 0x10(%rsp), %rdi
movq $0x0, 0x8(%rdi)
movq 0x468(%rbx), %rdx
leaq 0x17bee(%rip), %rsi     # 0x22f6d
movq %rax, %rcx
xorl %eax, %eax
callq 0x1d504
cmpl $-0x1, %eax
je 0xb58a
movq %r15, %rdi
callq 0x3450
movq 0x10(%rsp), %rsi
movq 0x460(%rbx), %rdx
movl 0x470(%rbx), %ecx
leaq 0x16a06(%rip), %rdi     # 0x21db9
callq 0x13e60
testq %rax, %rax
je 0xb5b7
movq %rax, %r15
leaq 0x17b24(%rip), %rsi     # 0x22eef
leaq 0x17b2a(%rip), %rdx     # 0x22efc
movq %rax, %rdi
callq 0x13fd7
testl %eax, %eax
je 0xb6e7
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb542
leaq 0x175b7(%rip), %rsi     # 0x229b0
leaq 0x17b40(%rip), %rdx     # 0x22f40
leaq 0x17b0d(%rip), %r8      # 0x22f14
movl $0x3, %edi
movl $0x363, %ecx            # imm = 0x363
jmp 0xb53b
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x17583(%rip), %rsi     # 0x229b0
leaq 0x17a87(%rip), %rdx     # 0x22ebb
leaq 0x17331(%rip), %r8      # 0x2276c
movl $0x3, %edi
movl $0x312, %ecx            # imm = 0x312
jmp 0xb5e2
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb1c0
leaq 0x1754a(%rip), %rsi     # 0x229b0
leaq 0x179b3(%rip), %rdx     # 0x22e20
leaq 0x179be(%rip), %r8      # 0x22e32
movl $0x3, %edi
movl $0x387, %ecx            # imm = 0x387
xorl %eax, %eax
callq 0x1771e
jmp 0xb1c0
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x1750f(%rip), %rsi     # 0x229b0
leaq 0x17a13(%rip), %rdx     # 0x22ebb
leaq 0x17a23(%rip), %r8      # 0x22ed2
movl $0x3, %edi
movl $0x319, %ecx            # imm = 0x319
jmp 0xb5e2
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x174db(%rip), %rsi     # 0x229b0
leaq 0x17a64(%rip), %rdx     # 0x22f40
leaq 0x17289(%rip), %r8      # 0x2276c
movl $0x3, %edi
movl $0x341, %ecx            # imm = 0x341
jmp 0xb5e2
leaq 0x17a3c(%rip), %rsi     # 0x22f35
leaq 0x17a3c(%rip), %rdx     # 0x22f3c
movq %r15, %rdi
callq 0x13fd7
testl %eax, %eax
je 0xb735
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb542
leaq 0x1748d(%rip), %rsi     # 0x229b0
leaq 0x17991(%rip), %rdx     # 0x22ebb
leaq 0x179e3(%rip), %r8      # 0x22f14
movl $0x3, %edi
movl $0x328, %ecx            # imm = 0x328
xorl %eax, %eax
callq 0x1771e
leaq 0x10(%rsp), %rdi
callq 0x1cdc9
movq %r15, %rdi
callq 0x13ee7
jmp 0xb5f3
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x17440(%rip), %rsi     # 0x229b0
leaq 0x179c9(%rip), %rdx     # 0x22f40
leaq 0x179d8(%rip), %r8      # 0x22f56
movl $0x3, %edi
movl $0x348, %ecx            # imm = 0x348
jmp 0xb5e2
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x17413(%rip), %rsi     # 0x229b0
leaq 0x1799c(%rip), %rdx     # 0x22f40
leaq 0x179cc(%rip), %r8      # 0x22f77
movl $0x3, %edi
movl $0x353, %ecx            # imm = 0x353
jmp 0xb5e2
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb5e9
leaq 0x173e6(%rip), %rsi     # 0x229b0
leaq 0x1796f(%rip), %rdx     # 0x22f40
leaq 0x178fa(%rip), %r8      # 0x22ed2
movl $0x3, %edi
movl $0x35c, %ecx            # imm = 0x35C
xorl %eax, %eax
callq 0x1771e
leaq 0x10(%rsp), %rdi
callq 0x1cdc9
xorl %r15d, %r15d
testq %r15, %r15
je 0xb687
movq 0x5b8(%rbx), %rdi
movl 0x47c(%rbx), %r8d
addq $0x8, %rbx
movq %r14, (%rsp)
leaq 0x989(%rip), %r9        # 0xbfa5
movq %rbx, %rsi
movl %ebp, %edx
movq %r15, %rcx
callq 0x15081
testl %eax, %eax
je 0xb6e0
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb663
leaq 0x1736c(%rip), %rsi     # 0x229b0
leaq 0x177d5(%rip), %rdx     # 0x22e20
leaq 0x17856(%rip), %r8      # 0x22ea8
movl $0x3, %edi
movl $0x3a2, %ecx            # imm = 0x3A2
xorl %eax, %eax
callq 0x1771e
movq %r15, %rdi
xorl %esi, %esi
callq 0x1417e
movq %rax, %rdi
callq 0x3450
movq %r15, %rdi
callq 0x13ee7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xb1c0
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xb1c0
cmpl $0x0, 0x44c(%rbx)
leaq 0x177e6(%rip), %rax     # 0x22e90
leaq 0x177c6(%rip), %r9      # 0x22e77
cmoveq %rax, %r9
leaq 0x172f4(%rip), %rsi     # 0x229b0
leaq 0x1775d(%rip), %rdx     # 0x22e20
leaq 0x177a3(%rip), %r8      # 0x22e6d
movl $0x3, %edi
movl $0x39c, %ecx            # imm = 0x39C
xorl %eax, %eax
callq 0x1771e
jmp 0xb1c0
xorl %ebp, %ebp
jmp 0xb1c0
leaq 0x17847(%rip), %rsi     # 0x22f35
leaq 0x17847(%rip), %rdx     # 0x22f3c
movq %r15, %rdi
callq 0x13fd7
testl %eax, %eax
je 0xb735
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xb542
leaq 0x17298(%rip), %rsi     # 0x229b0
leaq 0x17821(%rip), %rdx     # 0x22f40
leaq 0x177ee(%rip), %r8      # 0x22f14
movl $0x3, %edi
movl $0x36b, %ecx            # imm = 0x36B
jmp 0xb53b
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
movq %r15, %rdi
callq 0x1418d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x140f4
movq (%r12), %rsi
movq %r15, %rdi
callq 0x140fe
jmp 0xb5f6