// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: dl_fdset_func
static void dl_fdset_func(dllist_t* conns, http_fdset_state* st)
{
	dlitem_t* cur, * nxt;
	http_conn_t* conn;
	conn_status cs;
	int is_sending;
	dllist_foreach(conns, cur, nxt,
		http_conn_t, conn, entry) {
		cs = conn->conn.status;
		if (cs == cs_ssl_handshaked) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			if (conn->ssl_status == SSL_ERROR_WANT_READ) {
				FD_SET(conn->conn.sock, st->readset);
			}
			else if (conn->ssl_status == SSL_ERROR_WANT_WRITE) {
				FD_SET(conn->conn.sock, st->writeset);
			}
			else {
				is_sending = stream_rsize(&conn->conn.ws) > 0;
				if (is_sending)
					FD_SET(conn->conn.sock, st->writeset);
				else
					FD_SET(conn->conn.sock, st->readset);
			}
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_ssl_handshaking_want_read ||
			cs == cs_socks5_waiting_method ||
			cs == cs_socks5_waiting_connect ||
			cs == cs_hp_waiting_connect ||
			cs == cs_hp_waiting_data) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->readset);
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_ssl_handshaking_want_write ||
			cs == cs_socks5_sending_method ||
			cs == cs_socks5_sending_connect ||
			cs == cs_hp_sending_connect) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->writeset);
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_connecting) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->writeset);
			FD_SET(conn->conn.sock, st->errorset);
		}
	}
}

// Assembly:
movq (%rdi), %rax
cmpq %rdi, %rax
je 0x17155
leaq 0xcc69(%rip), %rdx      # 0x23c70
movq %rax, %r8
movq (%rax), %rax
movl -0x48(%r8), %ecx
decl %ecx
cmpl $0x10, %ecx
ja 0x170a5
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl 0x20(%rsi), %r9d
movl -0x80(%r8), %ecx
cmpl %ecx, %r9d
cmovlel %ecx, %r9d
leal 0x3f(%rcx), %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
movl %r10d, %r8d
andl $-0x40, %r8d
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
movl %r9d, 0x20(%rsi)
movq 0x10(%rsi), %r9
jmp 0x1708f
movl 0x20(%rsi), %r9d
movl -0x80(%r8), %ecx
cmpl %ecx, %r9d
cmovlel %ecx, %r9d
leal 0x3f(%rcx), %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
movl %r10d, %r8d
andl $-0x40, %r8d
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
movl %r9d, 0x20(%rsi)
movq 0x8(%rsi), %r9
sarl $0x6, %r10d
movslq %r10d, %rcx
orq %r8, (%r9,%rcx,8)
shlq $0x3, %rcx
addq 0x18(%rsi), %rcx
orq %r8, (%rcx)
cmpq %rdi, %rax
jne 0x17007
jmp 0x17155
movl 0x20(%rsi), %r9d
movl -0x80(%r8), %ecx
cmpl %ecx, %r9d
cmovlel %ecx, %r9d
movl %r9d, 0x20(%rsi)
movl -0x10(%r8), %r9d
cmpl $0x3, %r9d
je 0x170e9
cmpl $0x2, %r9d
jne 0x170fc
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r9
jmp 0x17121
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r9
jmp 0x17117
movl -0x58(%r8), %r10d
leal 0x3f(%rcx), %r9d
testl %ecx, %ecx
cmovnsl %ecx, %r9d
sarl $0x6, %r9d
movslq %r9d, %r9
cmpl -0x54(%r8), %r10d
jle 0x17121
shlq $0x3, %r9
addq 0x10(%rsi), %r9
jmp 0x17129
shlq $0x3, %r9
addq 0x8(%rsi), %r9
leal 0x3f(%rcx), %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
movl %r10d, %r8d
andl $-0x40, %r8d
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
orq %r8, (%r9)
sarl $0x6, %r10d
movslq %r10d, %rcx
jmp 0x1709a
retq