// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: channel_tcp_query
int channel_tcp_query(channel_t* ctx,
	const ns_msg_t* msg,
	int use_proxy, subnet_t* subnet,
	channel_query_cb callback, void* state)
{
	channel_tcp_t* c = (channel_tcp_t*)ctx;
	tcpreq_t* req;
	int i, n = 0;

	if (use_proxy == -1) use_proxy = c->use_proxy;

	req = req_new(c, msg, callback, state);
	if (!req)
		return -1;

	dllist_add(&c->reqs, &req->entry);
	c->req_count++;

	for (i = 0; i < c->upstream_num; i++) {
		if (tcp_query(req, i, use_proxy ? 0 : -1, subnet)) {
			logw("tcp_query() error\n");
		}
		else {
			n++;
		}
	}

	if (n == 0) {
		loge("no invalid upstream\n");
		dllist_init_remove(&req->entry);
		c->req_count--;
		req_destroy(req);
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, %r15
movq %r8, %r12
movq %rcx, 0x20(%rsp)
movq %rsi, %r13
movq %rdi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
cmpl $-0x1, %edx
jne 0xe695
movq 0x18(%rsp), %rax
movl 0x4b4(%rax), %eax
movl %eax, 0x14(%rsp)
movl $0x1, %edi
movl $0x60, %esi
callq 0x3240
testq %rax, %rax
je 0xecdb
movq %rax, %r14
movl (%r13), %eax
movl %eax, (%r14)
movq 0x10(%r13), %rax
movups (%rax), %xmm0
movups %xmm0, 0x8(%r14)
movq (%rax), %rdi
callq 0x3610
movq %rax, 0x8(%r14)
movq %r12, 0x20(%r14)
movq %r15, 0x28(%r14)
movq 0x18(%rsp), %rbx
movq %rbx, 0x40(%r14)
leaq 0x48(%r14), %rax
movq %rax, 0x48(%r14)
movq %rax, 0x50(%rsp)
movq %rax, 0x50(%r14)
xorl %edi, %edi
callq 0x3310
movslq 0x4b8(%rbx), %rcx
addq %rax, %rcx
movq %rcx, 0x18(%r14)
leaq 0x58(%rbx), %rax
leaq 0x30(%r14), %r15
movq %rax, 0x30(%r14)
movq 0x60(%rbx), %rax
movq %rax, 0x38(%r14)
movq %r15, (%rax)
movq %r15, 0x60(%rbx)
incl 0x68(%rbx)
cmpl $0x0, 0x4b0(%rbx)
jle 0xec7c
movq %r15, 0x48(%rsp)
movq %r14, %rax
addq $0x8, %rax
movq %rax, 0x60(%rsp)
movq 0x20(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x58(%rsp)
movl $0x70, %ebx
leaq 0x14af0(%rip), %rbp     # 0x2324c
xorl %r13d, %r13d
movl $0x0, 0x10(%rsp)
movq 0x40(%r14), %r15
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
movl $0x1, %edi
movl $0x98, %esi
callq 0x3240
testq %rax, %rax
je 0xe813
movq %rax, %r12
movq %r14, 0x88(%rax)
movl %r13d, 0x90(%rax)
cmpl $0x0, 0x14(%rsp)
je 0xe7bd
cmpl $0x0, 0x18(%r15)
jle 0xe7bd
movl $0x1, 0x68(%r12)
movq 0x10(%r15), %rdi
addq $0x8, %rdi
jmp 0xe7c1
leaq (%r15,%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0x18b33
movl %eax, %ebp
leal -0x3(%rbp), %eax
cmpl $-0x3, %eax
ja 0xe843
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
leaq 0x14a66(%rip), %rbp     # 0x2324c
jl 0xe895
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14b16(%rip), %rdx     # 0x23311
movl $0x53, %ecx
leaq 0x14b16(%rip), %r8      # 0x2331d
xorl %eax, %eax
callq 0x1771e
jmp 0xe895
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xe89d
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14ae3(%rip), %rdx     # 0x23311
movl $0x41, %ecx
leaq 0x15079(%rip), %r8      # 0x238b3
xorl %eax, %eax
callq 0x1771e
jmp 0xe89d
movl 0x28(%rsp), %esi
movq %r12, %rdi
callq 0x1914f
testl %eax, %eax
je 0xe91d
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
leaq 0x149e4(%rip), %rbp     # 0x2324c
jl 0xe88c
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14a98(%rip), %rdx     # 0x23311
movl $0x59, %ecx
leaq 0x14aad(%rip), %r8      # 0x23332
xorl %eax, %eax
callq 0x1771e
movl 0x28(%rsp), %edi
callq 0x3670
movq %r12, %rdi
callq 0x3450
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xe8cb
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x149ae(%rip), %rdx     # 0x23266
movl $0x16e, %ecx            # imm = 0x16E
leaq 0x149e7(%rip), %r8      # 0x232ab
xorl %eax, %eax
callq 0x1771e
xorl %eax, %eax
callq 0x176e5
cmpl $0x4, (%rax)
jl 0xe8f9
movl $0x4, %edi
movq %rbp, %rsi
leaq 0x14978(%rip), %rdx     # 0x2325e
movl $0x3a6, %ecx            # imm = 0x3A6
leaq 0x1497e(%rip), %r8      # 0x23270
xorl %eax, %eax
callq 0x1771e
incq %r13
movq 0x18(%rsp), %rax
movslq 0x4b0(%rax), %rax
addq $0x88, %rbx
cmpq %rax, %r13
jl 0xe767
jmp 0xec6a
movl %ebp, 0x38(%r12)
leaq 0x28(%rsp), %rdi
callq 0x19496
movl (%r14), %eax
movl %eax, 0x28(%rsp)
movw $0x1, 0x2c(%rsp)
movq 0x60(%rsp), %rdi
movl $0x1, %esi
callq 0x194ee
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x20(%rsp)
leaq 0x148f1(%rip), %rbp     # 0x2324c
je 0xe9d8
leaq 0x28(%rsp), %rdi
movl $0x29, %esi
callq 0x1ad6f
testq %rax, %rax
jne 0xe984
leaq 0x28(%rsp), %rdi
callq 0x1ae8f
testq %rax, %rax
je 0xeb73
movw $0x400, 0xa(%rax)       # imm = 0x400
movq 0x20(%rsp), %rcx
movl 0x90(%rcx), %edx
movq %rax, %rdi
movq 0x58(%rsp), %rsi
xorl %ecx, %ecx
callq 0x1b504
testl %eax, %eax
je 0xe9d8
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xeba1
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x1497e(%rip), %rdx     # 0x23345
movl $0x140, %ecx            # imm = 0x140
leaq 0x14484(%rip), %r8      # 0x22e57
jmp 0xeb9a
leaq 0x20(%r12), %rcx
movq $0x0, 0x28(%r12)
cmpl $0x3ff, 0x30(%r12)      # imm = 0x3FF
movq %rcx, 0x8(%rsp)
jg 0xea3e
movq 0x8(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x1cf07
movq 0x8(%rsp), %rcx
testl %eax, %eax
je 0xea3e
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xeba1
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14918(%rip), %rdx     # 0x23345
movl $0x14a, %ecx            # imm = 0x14A
leaq 0x13cec(%rip), %r8      # 0x22725
jmp 0xeb9a
movq %rcx, %rbp
movq %rcx, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1d115
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x1b58c
testl %eax, %eax
jle 0xeafa
movl %eax, %ebp
leaq 0x28(%rsp), %rdi
callq 0x19ae0
movl $0x0, 0x2c(%r12)
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movl %ebp, %edx
movl $0x2, %ecx
callq 0x1d224
movq %r12, %rax
addq $0x40, %rax
movq 0x50(%rsp), %rcx
movq %rcx, 0x40(%r12)
movq 0x50(%r14), %rcx
movq %rcx, 0x48(%r12)
movq %rax, (%rcx)
movq %rax, 0x50(%r14)
movl 0x38(%r12), %ecx
movl 0x68(%r12), %eax
movl %ecx, %edx
xorl $0x2, %edx
orl %eax, %edx
jne 0xeb3e
movl (%r12), %edi
movq 0x8(%rsp), %rsi
movq %rsi, %r15
callq 0x18d8e
cmpl $-0x1, %eax
leaq 0x1476e(%rip), %rbp     # 0x2324c
je 0xebfa
movl 0x28(%r12), %eax
cmpl 0x2c(%r12), %eax
jne 0xeb6a
movq %r15, %rdi
callq 0x1cdc9
jmp 0xeb6a
movq 0x8(%rsp), %r15
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
leaq 0x1473c(%rip), %rbp     # 0x2324c
jl 0xeb34
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14824(%rip), %rdx     # 0x23345
movl $0x154, %ecx            # imm = 0x154
leaq 0x13c3f(%rip), %r8      # 0x2276c
xorl %eax, %eax
callq 0x1771e
movq %r15, %rdi
callq 0x1cdc9
jmp 0xeba1
cmpl $0x2, %ecx
sete %cl
testl %eax, %eax
setne %al
andb %cl, %al
cmpb $0x1, %al
leaq 0x146f8(%rip), %rbp     # 0x2324c
jne 0xeb6a
movq %r15, %rdi
movq %r12, %rsi
callq 0xfa1c
cmpl $-0x1, %eax
je 0xec2d
incl 0x10(%rsp)
jmp 0xe8f9
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xeba1
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x147b7(%rip), %rdx     # 0x23345
movl $0x137, %ecx            # imm = 0x137
leaq 0x14298(%rip), %r8      # 0x22e32
xorl %eax, %eax
callq 0x1771e
leaq 0x28(%rsp), %rdi
callq 0x19ae0
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xebd9
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x146a0(%rip), %rdx     # 0x23266
movl $0x176, %ecx            # imm = 0x176
leaq 0x146f1(%rip), %r8      # 0x232c3
xorl %eax, %eax
callq 0x1771e
movq %r12, %rdi
callq 0x19218
movq %r12, %rdi
addq $0x70, %rdi
callq 0x1cdc9
movq %r12, %rdi
callq 0x3450
jmp 0xe8cb
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xec28
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x14651(%rip), %rdx     # 0x23266
movl $0x181, %ecx            # imm = 0x181
leaq 0x146c5(%rip), %r8      # 0x232e6
xorl %eax, %eax
callq 0x1771e
movq %r15, %rdi
jmp 0xec60
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xec5b
movl $0x3, %edi
movq %rbp, %rsi
leaq 0x1461e(%rip), %rdx     # 0x23266
movl $0x18c, %ecx            # imm = 0x18C
leaq 0x146a4(%rip), %r8      # 0x232f8
xorl %eax, %eax
callq 0x1771e
movq 0x8(%rsp), %rdi
callq 0x1cdc9
jmp 0xe8cb
xorl %ebp, %ebp
cmpl $0x0, 0x10(%rsp)
movq 0x48(%rsp), %r15
jne 0xed12
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0xecae
leaq 0x145bd(%rip), %rsi     # 0x2324c
leaq 0x145c8(%rip), %rdx     # 0x2325e
leaq 0x145e6(%rip), %r8      # 0x23283
movl $0x3, %edi
movl $0x3ae, %ecx            # imm = 0x3AE
xorl %eax, %eax
callq 0x1771e
movq 0x30(%r14), %rax
movq 0x38(%r14), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq 0x18(%rsp), %rax
decl 0x68(%rax)
movq %r14, %rdi
callq 0xed23
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xed12
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0xed12
leaq 0x14559(%rip), %rsi     # 0x2324c
leaq 0x13fad(%rip), %rdx     # 0x22ca7
leaq 0x14bb2(%rip), %r8      # 0x238b3
movl $0x3, %edi
movl $0x8b, %ecx
xorl %eax, %eax
callq 0x1771e
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq