// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: step
static int step(channel_t* ctx,
	fd_set* readset, fd_set* writeset, fd_set* errorset)
{
	channel_tcp_t *c = (channel_tcp_t*)ctx;
	dlitem_t *cur, *nxt;
	tcpreq_t *req;
	time_t now;
	now = time(NULL);
	dllist_foreach(&c->reqs, cur, nxt, tcpreq_t, req, entry) {
		if (req->is_closing) {
			if (req->callback) {
				req->callback((channel_t*)c, -1, NULL, FALSE, FALSE, req->cb_state);
				req->callback = NULL;
			}
			dllist_init_remove(&req->entry);
			c->req_count--;
			req_destroy(req);
		}
		else {
			int r = req_step(ctx, req, now, readset, writeset, errorset);
			if (r != 0 || is_expired(req, now)) {
				if (r == 0)
					loge("request timeout - %s\n", req->qr.qname);
				if (req->callback) {
					req->callback((channel_t*)c, -1, NULL, FALSE, FALSE, req->cb_state);
					req->callback = NULL;
				}
				dllist_init_remove(&req->entry);
				c->req_count--;
				req_destroy(req);
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r15
movq %rdx, 0x28(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdi, %rbx
xorl %edi, %edi
callq 0x3320
movq %rax, 0x68(%rsp)
leaq 0x58(%rbx), %r14
movq 0x58(%rbx), %r12
leaq 0x70(%rbx), %rax
movq %rax, 0x80(%rsp)
movq %r15, 0x60(%rsp)
movq %rbx, 0x20(%rsp)
movq %r14, 0x70(%rsp)
cmpq %r14, %r12
je 0xf12a
movq %r12, %r13
movq (%r12), %r12
cmpl $0x0, 0x28(%r13)
je 0xeb0c
movq -0x10(%r13), %rax
movq %r12, %rcx
testq %rax, %rax
je 0xeafc
movq -0x8(%r13), %r9
movq %rbx, %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
andq $0x0, -0x10(%r13)
movq (%r13), %rcx
movq 0x8(%r13), %rax
movq %rcx, (%rax)
movq (%r13), %rcx
jmp 0xf0c2
movq %r12, 0x78(%rsp)
leaq 0x18(%r13), %rax
movq %rax, 0x30(%rsp)
movq %r13, 0x18(%rsp)
movq 0x18(%r13), %r12
pushq $-0x1
popq %rcx
movl %ecx, %ebp
cmpq 0x30(%rsp), %r12
je 0xf07e
movq %r12, %r13
movq (%r12), %r12
leaq -0x40(%r13), %r14
movl -0x8(%r13), %esi
leal -0x3(%rsi), %eax
cmpl $0x2, %eax
jb 0xf058
movl (%r14), %edi
movl %edi, %eax
cltd
pushq $0x40
popq %rcx
idivl %ecx
movl %edx, %ecx
cltq
movq (%r15,%rax,8), %r8
pushq $0x1
popq %rdx
shlq %cl, %rdx
btq %rcx, %r8
jae 0xebe0
callq 0x16d2f
movl %eax, %ebx
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xf058
movl %ebx, %edi
callq 0x3140
movq %rax, %r15
movslq 0x50(%r13), %rax
imulq $0x88, %rax, %rdi
addq 0x80(%rsp), %rdi
callq 0x16d82
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq 0x60(%rsp), %r15
pushq $0x3
popq %rdi
leaq 0x1268e(%rip), %rsi     # 0x2124c
leaq 0x1298e(%rip), %rdx     # 0x21553
movl $0x327, %ecx            # imm = 0x327
leaq 0x1298b(%rip), %r8      # 0x2155c
movl %ebx, %r9d
xorl %eax, %eax
callq 0x1662e
jmp 0xf058
movl %esi, %ecx
andl $-0x5, %ecx
cmpl $0x9, %ecx
je 0xebfc
movl 0x28(%r13), %r8d
movl %esi, %ecx
xorl $0x2, %ecx
orl %r8d, %ecx
jne 0xee7d
movl -0x18(%r13), %ecx
cmpl -0x14(%r13), %ecx
jle 0xec2c
xorl %ecx, %ecx
movq 0x28(%rsp), %rsi
testq %rdx, (%rsi,%rax,8)
je 0xeb26
leaq -0x20(%r13), %rsi
callq 0x17be2
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0xf04e
xorl %ecx, %ecx
movq 0x58(%rsp), %rsi
testq %rdx, (%rsi,%rax,8)
je 0xeb26
leaq -0x38(%r13), %r15
movq %r15, %rdi
movl $0x402, %esi            # imm = 0x402
callq 0x1b9d4
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0xf042
movq %r15, 0x48(%rsp)
movslq -0x30(%r13), %rsi
movl -0x28(%r13), %edx
subl %esi, %edx
addq -0x38(%r13), %rsi
movl -0x40(%r13), %edi
callq 0x17d02
movl %eax, %ebx
incl %eax
cmpl $0x2, %eax
jb 0xf042
addl %ebx, -0x30(%r13)
xorl %eax, %eax
callq 0x165f5
cmpl $0x8, (%rax)
jl 0xecde
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x50(%r13), %rcx
imulq $0x88, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x70, %rdi
callq 0x16d82
movq %rax, (%rsp)
pushq $0x8
popq %rdi
leaq 0x1258b(%rip), %rsi     # 0x2124c
leaq 0x128b3(%rip), %rdx     # 0x2157b
movl $0x11b, %ecx            # imm = 0x11B
leaq 0x128b0(%rip), %r8      # 0x21584
movl %ebx, %r9d
xorl %eax, %eax
callq 0x1662e
movl %ebx, 0x3c(%rsp)
movl -0x2c(%r13), %esi
movl -0x30(%r13), %ebx
subl %esi, %ebx
cmpl $0x2, %ebx
movq 0x48(%rsp), %rdi
jl 0xef48
pushq $0x2
popq %rdx
callq 0x1bd16
movl %eax, %r15d
cmpl $0x401, %eax            # imm = 0x401
jge 0xef00
movl %r15d, %eax
addl $0x2, %eax
cmpl %eax, %ebx
jl 0xef3f
movl %eax, 0x44(%rsp)
movq -0x38(%r13), %rbx
movslq -0x2c(%r13), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x50(%rsp)
pushq $0x20
popq %rdi
callq 0x34c0
testq %rax, %rax
je 0xef93
movl %r15d, 0x40(%rsp)
movq %rax, %rdi
movq %rax, %r15
callq 0x18296
testl %eax, %eax
jne 0xefcc
movq 0x10(%rsp), %rax
leaq (%rbx,%rax), %rsi
addq $0x2, %rsi
movq %r15, 0x10(%rsp)
movq %r15, %rdi
movl 0x40(%rsp), %edx
callq 0x18e8f
movl %eax, %ebx
xorl %eax, %eax
callq 0x165f5
movl (%rax), %eax
testl %ebx, %ebx
jne 0xf001
cmpl $0x7, %eax
jl 0xee05
movq 0x10(%rsp), %rax
cmpw $0x0, 0x4(%rax)
je 0xedbb
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0xedbb
callq 0x1897e
movq %rax, %rbx
jmp 0xedbd
xorl %ebx, %ebx
movslq 0x50(%r13), %rax
imulq $0x88, %rax, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x70, %rdi
callq 0x16d82
movq %rax, (%rsp)
pushq $0x7
popq %rdi
leaq 0x12464(%rip), %rsi     # 0x2124c
leaq 0x127f2(%rip), %rdx     # 0x215e1
movl $0xd5, %ecx
leaq 0x127f3(%rip), %r8      # 0x215ee
movq %rbx, %r9
xorl %eax, %eax
callq 0x1662e
movq 0x18(%rsp), %rbx
movq -0x10(%rbx), %rax
testq %rax, %rax
je 0xee30
movq -0x8(%rbx), %r9
movq 0x50(%rsp), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq *%rax
andq $0x0, -0x10(%rbx)
movq 0x30(%rsp), %rax
movq (%rax), %rax
cmpq 0x30(%rsp), %rax
je 0xee60
movq (%rax), %rbx
movl $0x3, -0x8(%rax)
movl -0x40(%rax), %edi
movq %rbx, %rax
testl %edi, %edi
je 0xee38
pushq $0x2
popq %rsi
callq 0x34d0
movq %rbx, %rax
jmp 0xee38
movq 0x18(%rsp), %rax
movl $0x1, 0x28(%rax)
movl 0x44(%rsp), %esi
addl -0x2c(%r13), %esi
movl %esi, -0x2c(%r13)
jmp 0xece6
xorl %ecx, %ecx
cmpl $0xc, %esi
ja 0xeb26
movl $0x1940, %r9d           # imm = 0x1940
btl %esi, %r9d
jb 0xeea7
movl $0x4a0, %r9d            # imm = 0x4A0
btl %esi, %r9d
jae 0xeec8
movq 0x28(%rsp), %rsi
jmp 0xeeac
movq 0x58(%rsp), %rsi
testq %rdx, (%rsi,%rax,8)
je 0xeb26
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0xf1d4
jmp 0xf04e
cmpl $0x1, %esi
jne 0xeb26
movq 0x28(%rsp), %rsi
testq %rdx, (%rsi,%rax,8)
je 0xeb26
movl $0x2, -0x8(%r13)
testl %r8d, %r8d
jne 0xeeb6
movl -0x18(%r13), %eax
cmpl -0x14(%r13), %eax
jle 0xeb26
jmp 0xec17
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
pushq $-0x1
popq %rbx
jl 0xf042
pushq $0x3
popq %rdi
leaq 0x1232f(%rip), %rsi     # 0x2124c
leaq 0x12674(%rip), %rdx     # 0x21598
movl $0xe9, %ecx
leaq 0x12673(%rip), %r8      # 0x215a3
movl %r15d, %r9d
xorl %eax, %eax
callq 0x1662e
jmp 0xf03f
movl -0x2c(%r13), %esi
movq 0x48(%rsp), %rdi
testl %esi, %esi
movl 0x3c(%rsp), %ebx
jle 0xf042
callq 0x1b99d
testl %eax, %eax
je 0xf042
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
pushq $-0x1
popq %rbx
jl 0xf042
pushq $0x3
popq %rdi
leaq 0x122ce(%rip), %rsi     # 0x2124c
leaq 0x12613(%rip), %rdx     # 0x21598
movl $0xfb, %ecx
leaq 0x12639(%rip), %r8      # 0x215ca
jmp 0xefc3
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
pushq $-0x1
popq %rbx
jl 0xf042
pushq $0x3
popq %rdi
leaq 0x1229c(%rip), %rsi     # 0x2124c
leaq 0x1262a(%rip), %rdx     # 0x215e1
movl $0xc3, %ecx
leaq 0x128f0(%rip), %r8      # 0x218b3
xorl %eax, %eax
callq 0x1662e
jmp 0xf03f
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xeffc
pushq $0x3
popq %rdi
leaq 0x1226a(%rip), %rsi     # 0x2124c
leaq 0x125f8(%rip), %rdx     # 0x215e1
movl $0xc8, %ecx
leaq 0x115b7(%rip), %r8      # 0x205ac
xorl %eax, %eax
callq 0x1662e
movq %r15, %rdi
jmp 0xf03a
cmpl $0x3, %eax
jl 0xf02a
pushq $0x3
popq %rdi
leaq 0x1223c(%rip), %rsi     # 0x2124c
leaq 0x125ca(%rip), %rdx     # 0x215e1
movl $0xce, %ecx
leaq 0x11f6e(%rip), %r8      # 0x20f91
xorl %eax, %eax
callq 0x1662e
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x188ce
movq %rbx, %rdi
callq 0x3460
pushq $-0x1
popq %rbx
movl %ebx, %eax
sarl $0x1f, %eax
andl %ebx, %eax
movq 0x60(%rsp), %r15
xorl %ecx, %ecx
testl %eax, %eax
je 0xeb26
movq (%r13), %rax
movq 0x8(%r13), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movq %r14, %rdi
callq 0xf1b9
movl %ebp, %ecx
jmp 0xeb26
testl %ebp, %ebp
movq 0x20(%rsp), %rbx
movq 0x70(%rsp), %r14
movq 0x78(%rsp), %r12
movq 0x18(%rsp), %r13
je 0xf0e2
movq -0x10(%r13), %rax
testq %rax, %rax
je 0xf0b7
movq -0x8(%r13), %r9
movq %rbx, %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
andq $0x0, -0x10(%r13)
movq (%r13), %rcx
movq 0x8(%r13), %rax
movq %rcx, (%rax)
movq %rax, 0x8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
addq $-0x30, %r13
decl 0x68(%rbx)
movq %r13, %rdi
callq 0xe5a0
jmp 0xeabd
movq 0x68(%rsp), %rax
cmpq %rax, -0x18(%r13)
jg 0xeabd
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xf096
movq -0x28(%r13), %r9
pushq $0x3
popq %rdi
leaq 0x12141(%rip), %rsi     # 0x2124c
leaq 0x125d8(%rip), %rdx     # 0x216ea
movl $0x37b, %ecx            # imm = 0x37B
leaq 0x13041(%rip), %r8      # 0x2215f
xorl %eax, %eax
callq 0x1662e
jmp 0xf096
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq