// File: /workspace/github_c_makefile_star2_O2/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 0xac14
movzwl 0x10(%r14), %eax
cmpl $0x1, %eax
je 0xac19
cmpl $0x1c, %eax
jne 0xac14
movl $0x518, %eax            # imm = 0x518
jmp 0xac1e
xorl %r15d, %r15d
jmp 0xac2d
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 0x18296
movq %r13, %rdi
callq 0x18296
andw $0x0, (%r13)
movzwl 0x4(%r14), %eax
movw %ax, 0x2(%r13)
movw $0x1, 0x4(%r13)
leaq 0x8(%r14), %r12
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0x182e8
movq %rax, 0x10(%r13)
movq 0x5c0(%rbx), %rax
testq %rax, %rax
je 0xacb6
movq 0x5b8(%rbx), %rdi
movl 0x474(%rbx), %edx
leaq 0x57c(%rip), %r8        # 0xb208
leaq 0x38(%rsp), %rsi
movq %r15, %rcx
movq %r14, %r9
callq *%rax
movl %eax, %ebp
leaq 0x38(%rsp), %rdi
callq 0x188ce
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 0xad39
leaq 0x38(%rsp), %rdi
pushq $0x29
popq %rsi
callq 0x19ad8
testq %rax, %rax
jne 0xace6
leaq 0x38(%rsp), %rdi
callq 0x19bdc
testq %rax, %rax
je 0xaf0e
movw $0x400, 0xa(%rax)       # imm = 0x400
movl 0x90(%r15), %edx
addq $0x10, %r15
movq %rax, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x1a257
testl %eax, %eax
je 0xad39
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0xac9b
leaq 0x15c92(%rip), %rsi     # 0x209b0
leaq 0x160fb(%rip), %rdx     # 0x20e20
leaq 0x1612b(%rip), %r8      # 0x20e57
pushq $0x3
popq %rdi
movl $0x38f, %ecx            # imm = 0x38F
jmp 0xaf3e
cmpl $0x0, 0x44c(%rbx)
je 0xade6
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1a2cd
testl %eax, %eax
jle 0xaedc
movq 0x460(%rbx), %rdx
movq 0x468(%rbx), %rsi
movl 0x470(%rbx), %ecx
leaq 0x1503d(%rip), %rdi     # 0x1fdc2
callq 0x13234
testq %rax, %rax
je 0xaf4a
movq %rax, %r15
leaq 0x16152(%rip), %rsi     # 0x20eef
leaq 0x16158(%rip), %rdx     # 0x20efc
movq %rax, %rdi
callq 0x1336f
testl %eax, %eax
je 0xafae
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xaffc
leaq 0x15be5(%rip), %rsi     # 0x209b0
leaq 0x160e9(%rip), %rdx     # 0x20ebb
leaq 0x1613b(%rip), %r8      # 0x20f14
pushq $0x3
popq %rdi
movl $0x320, %ecx            # imm = 0x320
jmp 0xaff5
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x1a2cd
testl %eax, %eax
jle 0xaf7c
movq 0x10(%rsp), %rdi
movl 0x18(%rsp), %esi
leaq 0x34(%rsp), %rdx
pushq $0x1
popq %r8
xorl %ecx, %ecx
callq 0x7b8c
testq %rax, %rax
je 0xb013
movq %rax, %r15
leaq 0x10(%rsp), %rdi
andq $0x0, 0x8(%rdi)
movq 0x468(%rbx), %rdx
leaq 0x16126(%rip), %rsi     # 0x20f6d
movq %rax, %rcx
xorl %eax, %eax
callq 0x1bf2d
cmpl $-0x1, %eax
je 0xb03e
movq %r15, %rdi
callq 0x3460
movq 0x10(%rsp), %rsi
movq 0x460(%rbx), %rdx
movl 0x470(%rbx), %ecx
leaq 0x14f3e(%rip), %rdi     # 0x1fdb9
callq 0x13234
testq %rax, %rax
je 0xb069
movq %rax, %r15
leaq 0x1605c(%rip), %rsi     # 0x20eef
leaq 0x16062(%rip), %rdx     # 0x20efc
movq %rax, %rdi
callq 0x1336f
testl %eax, %eax
je 0xb18f
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xaffc
leaq 0x15aef(%rip), %rsi     # 0x209b0
leaq 0x16078(%rip), %rdx     # 0x20f40
leaq 0x16045(%rip), %r8      # 0x20f14
pushq $0x3
popq %rdi
movl $0x363, %ecx            # imm = 0x363
jmp 0xaff5
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x15abd(%rip), %rsi     # 0x209b0
leaq 0x15fc1(%rip), %rdx     # 0x20ebb
leaq 0x1586b(%rip), %r8      # 0x2076c
pushq $0x3
popq %rdi
movl $0x312, %ecx            # imm = 0x312
jmp 0xb092
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0xac9b
leaq 0x15a88(%rip), %rsi     # 0x209b0
leaq 0x15ef1(%rip), %rdx     # 0x20e20
leaq 0x15efc(%rip), %r8      # 0x20e32
pushq $0x3
popq %rdi
movl $0x387, %ecx            # imm = 0x387
xorl %eax, %eax
callq 0x1662e
jmp 0xac9b
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x15a4f(%rip), %rsi     # 0x209b0
leaq 0x15f53(%rip), %rdx     # 0x20ebb
leaq 0x15f63(%rip), %r8      # 0x20ed2
pushq $0x3
popq %rdi
movl $0x319, %ecx            # imm = 0x319
jmp 0xb092
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x15a1d(%rip), %rsi     # 0x209b0
leaq 0x15fa6(%rip), %rdx     # 0x20f40
leaq 0x157cb(%rip), %r8      # 0x2076c
pushq $0x3
popq %rdi
movl $0x341, %ecx            # imm = 0x341
jmp 0xb092
leaq 0x15f80(%rip), %rsi     # 0x20f35
leaq 0x15f80(%rip), %rdx     # 0x20f3c
movq %r15, %rdi
callq 0x1336f
testl %eax, %eax
je 0xb1db
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xaffc
leaq 0x159d1(%rip), %rsi     # 0x209b0
leaq 0x15ed5(%rip), %rdx     # 0x20ebb
leaq 0x15f27(%rip), %r8      # 0x20f14
pushq $0x3
popq %rdi
movl $0x328, %ecx            # imm = 0x328
xorl %eax, %eax
callq 0x1662e
leaq 0x10(%rsp), %rdi
callq 0x1b8a6
movq %r15, %rdi
callq 0x132b5
jmp 0xb0a3
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x1598a(%rip), %rsi     # 0x209b0
leaq 0x15f13(%rip), %rdx     # 0x20f40
leaq 0x15f22(%rip), %r8      # 0x20f56
pushq $0x3
popq %rdi
movl $0x348, %ecx            # imm = 0x348
jmp 0xb092
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x1595f(%rip), %rsi     # 0x209b0
leaq 0x15ee8(%rip), %rdx     # 0x20f40
leaq 0x15f18(%rip), %r8      # 0x20f77
pushq $0x3
popq %rdi
movl $0x353, %ecx            # imm = 0x353
jmp 0xb092
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb099
leaq 0x15934(%rip), %rsi     # 0x209b0
leaq 0x15ebd(%rip), %rdx     # 0x20f40
leaq 0x15e48(%rip), %r8      # 0x20ed2
pushq $0x3
popq %rdi
movl $0x35c, %ecx            # imm = 0x35C
xorl %eax, %eax
callq 0x1662e
leaq 0x10(%rsp), %rdi
callq 0x1b8a6
xorl %r15d, %r15d
testq %r15, %r15
je 0xb133
movq 0x5b8(%rbx), %rdi
movl 0x47c(%rbx), %r8d
addq $0x8, %rbx
movq %r14, (%rsp)
leaq 0x91c(%rip), %r9        # 0xb9e8
movq %rbx, %rsi
movl %ebp, %edx
movq %r15, %rcx
callq 0x14297
testl %eax, %eax
je 0xb188
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xb111
leaq 0x158bc(%rip), %rsi     # 0x209b0
leaq 0x15d25(%rip), %rdx     # 0x20e20
leaq 0x15da6(%rip), %r8      # 0x20ea8
pushq $0x3
popq %rdi
movl $0x3a2, %ecx            # imm = 0x3A2
xorl %eax, %eax
callq 0x1662e
movq %r15, %rdi
xorl %esi, %esi
callq 0x134c8
movq %rax, %rdi
callq 0x3460
movq %r15, %rdi
callq 0x132b5
pushq $-0x1
popq %rbp
jmp 0xac9b
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0xac9b
cmpl $0x0, 0x44c(%rbx)
leaq 0x15d3c(%rip), %rax     # 0x20e90
leaq 0x15d1c(%rip), %r9      # 0x20e77
cmoveq %rax, %r9
leaq 0x1584a(%rip), %rsi     # 0x209b0
leaq 0x15cb3(%rip), %rdx     # 0x20e20
leaq 0x15cf9(%rip), %r8      # 0x20e6d
pushq $0x3
popq %rdi
movl $0x39c, %ecx            # imm = 0x39C
xorl %eax, %eax
callq 0x1662e
jmp 0xac9b
xorl %ebp, %ebp
jmp 0xac9b
leaq 0x15d9f(%rip), %rsi     # 0x20f35
leaq 0x15d9f(%rip), %rdx     # 0x20f3c
movq %r15, %rdi
callq 0x1336f
testl %eax, %eax
je 0xb1db
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xaffc
leaq 0x157f0(%rip), %rsi     # 0x209b0
leaq 0x15d79(%rip), %rdx     # 0x20f40
leaq 0x15d46(%rip), %r8      # 0x20f14
pushq $0x3
popq %rdi
movl $0x36b, %ecx            # imm = 0x36B
jmp 0xaff5
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
movq %r15, %rdi
callq 0x134d7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1346a
movq (%r12), %rsi
movq %r15, %rdi
callq 0x13474
jmp 0xb0a6