// File: /workspace/github_c_makefile_star2_O1/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, 0x30(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %r14
xorl %edi, %edi
callq 0x3310
movq %rax, 0x68(%rsp)
leaq 0x58(%r14), %r12
movq 0x58(%r14), %rbx
cmpq %r12, %rbx
je 0xfe61
leaq 0x68(%r14), %r13
leaq 0x70(%r14), %rax
movq %rax, 0x78(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, 0x28(%rsp)
movq %r12, 0x70(%rsp)
movq %r13, 0x58(%rsp)
movq (%rbx), %rax
movq %rax, 0x80(%rsp)
cmpl $0x0, 0x28(%rbx)
je 0xf80c
movq -0x10(%rbx), %rax
testq %rax, %rax
je 0xf7d3
movq -0x8(%rbx), %r9
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
movq $0x0, -0x10(%rbx)
leaq -0x30(%rbx), %rdi
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movq (%rbx), %rax
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
decl (%r13)
callq 0xf1f6
movq 0x80(%rsp), %rax
movq %rax, %rbx
cmpq %r12, %rax
jne 0xf79c
jmp 0xfe61
leaq 0x18(%rbx), %rax
movq 0x18(%rbx), %r13
movq %rax, 0x38(%rsp)
cmpq %rax, %r13
je 0xfdfe
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movq (%r13), %r12
leaq -0x40(%r13), %rbp
movl -0x8(%r13), %edx
leal -0x3(%rdx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x2, %ecx
jb 0xf9de
movl (%rbp), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rsi
movq (%r15,%rsi,8), %r9
andl $-0x40, %eax
movl %edi, %ecx
subl %eax, %ecx
movl $0x1, %r8d
shlq %cl, %r8
btq %rcx, %r9
jae 0xf8fa
callq 0x1847d
movl %eax, %r14d
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jl 0xf9de
movl %r14d, %edi
callq 0x3140
movq %rax, %r15
movslq 0x50(%r13), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rdi
addq 0x78(%rsp), %rdi
callq 0x184d9
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq 0x10(%rsp), %r15
movl $0x3, %edi
leaq 0x13969(%rip), %rsi     # 0x2323c
leaq 0x13c69(%rip), %rdx     # 0x23543
movl $0x327, %ecx            # imm = 0x327
leaq 0x13c66(%rip), %r8      # 0x2354c
movl %r14d, %r9d
xorl %eax, %eax
callq 0x17d92
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xf9de
movl %edx, %eax
andl $-0x5, %eax
cmpl $0x9, %eax
je 0xf911
movl 0x28(%r13), %ecx
movl %edx, %eax
xorl $0x2, %eax
orl %ecx, %eax
jne 0xf967
movl -0x18(%r13), %eax
cmpl -0x14(%r13), %eax
jle 0xf93b
movq 0x30(%rsp), %rax
testq %r8, (%rax,%rsi,8)
je 0xf963
leaq -0x20(%r13), %rsi
callq 0x19402
movl %eax, %ecx
sarl $0x1f, %eax
andl %ecx, %eax
jmp 0xf9de
movq 0x60(%rsp), %rax
testq %r8, (%rax,%rsi,8)
je 0xf963
leaq -0x38(%r13), %r14
movq %r14, %rdi
movl $0x402, %esi            # imm = 0x402
callq 0x1d737
testl %eax, %eax
je 0xf9ab
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0xf9d5
xorl %eax, %eax
jmp 0xf9de
xorl %eax, %eax
cmpl $0xc, %edx
ja 0xf9de
movl $0x1940, %r9d           # imm = 0x1940
btl %edx, %r9d
jb 0xf991
movl $0x4a0, %r9d            # imm = 0x4A0
btl %edx, %r9d
jae 0xfa36
movq 0x30(%rsp), %rcx
jmp 0xf996
movq 0x60(%rsp), %rcx
testq %r8, (%rcx,%rsi,8)
je 0xf9de
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xfef6
jmp 0xf9de
movq %r14, 0x50(%rsp)
movslq -0x30(%r13), %rsi
movl -0x28(%r13), %edx
subl %esi, %edx
addq -0x38(%r13), %rsi
movl -0x40(%r13), %edi
callq 0x19530
movl %eax, %r14d
incl %eax
cmpl $0x2, %eax
jae 0xfa69
movl %r14d, %eax
sarl $0x1f, %eax
andl %r14d, %eax
testl %eax, %eax
je 0xfa1b
movq (%r13), %rax
movq 0x8(%r13), %rcx
movq %rax, (%rcx)
movq (%r13), %rax
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movq %rbp, %rdi
callq 0x19891
addq $0x30, %r13
movq %r13, %rdi
callq 0x1d5f9
movq %rbp, %rdi
callq 0x3450
jmp 0xfa23
movl $0x0, 0x24(%rsp)
movq %r12, %r13
cmpq 0x38(%rsp), %r12
jne 0xf82a
jmp 0xfded
cmpl $0x1, %edx
jne 0xf9de
movq 0x30(%rsp), %rdx
testq %r8, (%rdx,%rsi,8)
je 0xf9de
movl $0x2, -0x8(%r13)
testl %ecx, %ecx
jne 0xf99c
movl -0x18(%r13), %ecx
cmpl -0x14(%r13), %ecx
jg 0xf926
jmp 0xf9de
addl %r14d, -0x30(%r13)
xorl %eax, %eax
callq 0x17d59
cmpl $0x8, (%rax)
jl 0xfac6
movq 0x10(%rbx), %rax
movslq 0x50(%r13), %rcx
movq %rcx, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rcx,8), %rcx
leaq (%rax,%rcx), %rdi
addq $0x70, %rdi
callq 0x184d9
movq %rax, (%rsp)
movl $0x8, %edi
leaq 0x13793(%rip), %rsi     # 0x2323c
leaq 0x13abb(%rip), %rdx     # 0x2356b
movl $0x11b, %ecx            # imm = 0x11B
leaq 0x13ab8(%rip), %r8      # 0x23574
movl %r14d, %r9d
xorl %eax, %eax
callq 0x17d92
movl %r14d, 0x20(%rsp)
movl -0x30(%r13), %r15d
movl -0x2c(%r13), %r14d
subl %r14d, %r15d
cmpl $0x2, %r15d
jl 0xfc7d
movq 0x50(%rsp), %rdi
movl %r14d, %esi
movl $0x2, %edx
callq 0x1da55
movl %eax, %r14d
cmpl $0x401, %eax            # imm = 0x401
jge 0xfcea
movl %r14d, 0x44(%rsp)
addl $0x2, %r14d
cmpl %r14d, %r15d
jl 0xfc7d
movq -0x38(%r13), %rax
movq %rax, 0x18(%rsp)
movslq -0x2c(%r13), %r15
movq 0x10(%rbx), %rax
movq %rax, 0x48(%rsp)
movl $0x20, %edi
callq 0x34b0
testq %rax, %rax
je 0xfd25
movl %r14d, 0x40(%rsp)
movq %rax, %rdi
movq %rax, %r14
callq 0x19b12
testl %eax, %eax
jne 0xfd59
movq 0x18(%rsp), %rax
leaq (%rax,%r15), %rsi
addq $0x2, %rsi
movq %r14, 0x18(%rsp)
movq %r14, %rdi
movl 0x44(%rsp), %edx
callq 0x1a7e0
movl %eax, %r15d
xorl %eax, %eax
callq 0x17d59
movl (%rax), %eax
testl %r15d, %r15d
jne 0xfda3
cmpl $0x7, %eax
movl 0x40(%rsp), %r14d
jl 0xfc00
movq 0x18(%rsp), %rax
cmpw $0x0, 0x4(%rax)
je 0xfbaf
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0xfbaf
callq 0x1a29d
movq %rax, %r15
jmp 0xfbb2
xorl %r15d, %r15d
movslq 0x50(%r13), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x70, %rdi
callq 0x184d9
movq %rax, (%rsp)
movl $0x7, %edi
leaq 0x13659(%rip), %rsi     # 0x2323c
leaq 0x139e7(%rip), %rdx     # 0x235d1
movl $0xd5, %ecx
leaq 0x139e8(%rip), %r8      # 0x235de
movq %r15, %r9
xorl %eax, %eax
callq 0x17d92
movq -0x10(%rbx), %rax
testq %rax, %rax
je 0xfc2b
movq -0x8(%rbx), %r9
movq 0x48(%rsp), %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq *%rax
movq $0x0, -0x10(%rbx)
movq 0x38(%rsp), %rax
movq (%rax), %r15
cmpq %rax, %r15
je 0xfc5d
movq %r15, %rax
movq (%r15), %r15
movl $0x3, -0x8(%rax)
movl -0x40(%rax), %edi
testl %edi, %edi
je 0xfc56
movl $0x2, %esi
callq 0x34c0
cmpq 0x38(%rsp), %r15
jne 0xfc38
movl $0x1, 0x28(%rbx)
addl -0x2c(%r13), %r14d
movl %r14d, -0x2c(%r13)
movl -0x30(%r13), %r15d
subl %r14d, %r15d
cmpl $0x1, %r15d
jg 0xfae0
cmpl $0x0, -0x2c(%r13)
jle 0xfcdb
movq 0x50(%rsp), %rdi
callq 0x1d6fd
testl %eax, %eax
movq 0x10(%rsp), %r15
movl 0x20(%rsp), %r14d
je 0xf9d5
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xf95b
movl $0x3, %edi
leaq 0x13580(%rip), %rsi     # 0x2323c
leaq 0x138c5(%rip), %rdx     # 0x23588
movl $0xfb, %ecx
leaq 0x138eb(%rip), %r8      # 0x235ba
xorl %eax, %eax
callq 0x17d92
jmp 0xf95b
movq 0x10(%rsp), %r15
movl 0x20(%rsp), %r14d
jmp 0xf9d5
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xfd93
movl $0x3, %edi
leaq 0x13536(%rip), %rsi     # 0x2323c
leaq 0x1387b(%rip), %rdx     # 0x23588
movl $0xe9, %ecx
leaq 0x1387a(%rip), %r8      # 0x23593
movl %r14d, %r9d
xorl %eax, %eax
callq 0x17d92
jmp 0xfd93
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xfd93
movl $0x3, %edi
leaq 0x134ff(%rip), %rsi     # 0x2323c
leaq 0x1388d(%rip), %rdx     # 0x235d1
movl $0xc3, %ecx
leaq 0x13b53(%rip), %r8      # 0x238a3
xorl %eax, %eax
callq 0x17d92
jmp 0xfd93
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xfd8b
movl $0x3, %edi
leaq 0x134cb(%rip), %rsi     # 0x2323c
leaq 0x13859(%rip), %rdx     # 0x235d1
movl $0xc8, %ecx
leaq 0x12848(%rip), %r8      # 0x225cc
xorl %eax, %eax
callq 0x17d92
movq %r14, %rdi
callq 0x3450
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r15
jmp 0xf9d5
cmpl $0x3, %eax
movq 0x10(%rsp), %r15
jl 0xfdd3
movl $0x3, %edi
leaq 0x13483(%rip), %rsi     # 0x2323c
leaq 0x13811(%rip), %rdx     # 0x235d1
movl $0xce, %ecx
leaq 0x131bd(%rip), %r8      # 0x22f89
xorl %eax, %eax
callq 0x17d92
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x1a1dd
movq %r14, %rdi
callq 0x3450
jmp 0xf95b
cmpl $0x0, 0x24(%rsp)
movq 0x28(%rsp), %r14
movq 0x70(%rsp), %r12
je 0xfe15
movq -0x10(%rbx), %rax
testq %rax, %rax
movq 0x58(%rsp), %r13
jne 0xf7b6
jmp 0xf7d3
movq 0x68(%rsp), %rax
cmpq %rax, -0x18(%rbx)
movq 0x58(%rsp), %r13
jg 0xf7f7
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xfdfe
movq -0x28(%rbx), %r9
movl $0x3, %edi
leaq 0x133f7(%rip), %rsi     # 0x2323c
leaq 0x1388e(%rip), %rdx     # 0x236da
movl $0x37b, %ecx            # imm = 0x37B
leaq 0x142fb(%rip), %r8      # 0x24153
xorl %eax, %eax
callq 0x17d92
jmp 0xfdfe
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq