// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/http.c
// Function: dl_step_func
static void dl_step_func(dllist_t* conns, http_step_state* st)
{
	dlitem_t* cur, * nxt;
	http_conn_t* conn;
	conn_status cs;
	http_request_t* req;
	http_response_t* res;
	time_t now;
	int r = 0;
	int is_sending;
	int is_req_expired;
	now = time(NULL);
	dllist_foreach(conns, cur, nxt,
		http_conn_t, conn, entry) {
		cs = conn->conn.status;
		r = 0;
		if (cs == cs_closing || cs == cs_rsp_closing) {
			r = -1;
		}
		else if (FD_ISSET(conn->conn.sock, st->errorset)) {
			int err = getsockerr(conn->conn.sock);
			loge("sock error: errno=%d, %s \n",
				err, strerror(err));
			r = -1;
		}
		else {
			if (cs == cs_ssl_handshaked) {
				if (conn->ssl_status == SSL_ERROR_WANT_READ) {
					if (FD_ISSET(conn->conn.sock, st->readset)) {
						is_sending = stream_rsize(&conn->conn.ws) > 0;
						if (is_sending) {
							r = http_conn_send(conn);
							if (r >= 0)
								r = 0;
						}
						else {
							r = http_conn_recv(conn);
							if (r >= 0)
								r = 0;
						}
					}
				}
				else if (conn->ssl_status == SSL_ERROR_WANT_WRITE) {
					if (FD_ISSET(conn->conn.sock, st->writeset)) {
						is_sending = stream_rsize(&conn->conn.ws) > 0;
						if (is_sending) {
							r = http_conn_send(conn);
							if (r >= 0)
								r = 0;
						}
						else {
							r = http_conn_recv(conn);
							if (r >= 0)
								r = 0;
						}
					}
				}
				else {
					is_sending = stream_rsize(&conn->conn.ws) > 0;
					if (is_sending) {
						if (FD_ISSET(conn->conn.sock, st->writeset)) {
							r = http_conn_send(conn);
							if (r >= 0)
								r = 0;
						}
					}
					else if (FD_ISSET(conn->conn.sock, st->readset)) {
						r = http_conn_recv(conn);
						if (r >= 0)
							r = 0;
					}
				}
			}
			else if (cs == cs_ssl_handshaking_want_read) {
				if (FD_ISSET(conn->conn.sock, st->readset)) {
					r = http_ssl_handshake(st->ctx, conn);
				}
			}
			else if (cs == cs_ssl_handshaking_want_write) {
				if (FD_ISSET(conn->conn.sock, st->writeset)) {
					r = http_ssl_handshake(st->ctx, conn);
				}
			}
			else if (cs == cs_socks5_waiting_method || cs == cs_socks5_waiting_connect ||
					cs == cs_hp_waiting_connect || cs == cs_hp_waiting_data) {
				if (FD_ISSET(conn->conn.sock, st->readset)) {
					r = http_proxy_handshake(st->ctx, conn);
				}
			}
			else if (cs == cs_socks5_sending_method || cs == cs_socks5_sending_connect ||
					cs == cs_hp_sending_connect) {
				if (FD_ISSET(conn->conn.sock, st->writeset)) {
					r = http_proxy_handshake(st->ctx, conn);
				}
			}
			else if (cs == cs_connecting) {
				if (FD_ISSET(conn->conn.sock, st->writeset)) {
					conn->conn.status = cs_connected;
					if (conn->use_proxy && st->ctx->proxy_num > 0) {
						r = http_proxy_handshake(st->ctx, conn);
					}
					else {
						r = http_ssl_handshake(st->ctx, conn);
					}
				}
			}
		}

		if (r == 0 && ((is_req_expired = http_is_request_expired(conn, now)) || http_is_expired(conn, now))) {
			if (is_req_expired)
				loge("http request timeout - %s\n", get_sockname(conn->conn.sock));
			else
				logd("http connection timeout - %s\n", get_sockname(conn->conn.sock));
			r = -1;
			req = conn->request;
			res = conn->response;
			if (req) {
				http_call_callback(req, HTTP_TIMEOUT, res);
			}
			http_conn_close(conn);
		}
		else if (r != 0) {
			req = conn->request;
			res = conn->response;
			if (req) {
				http_call_callback(req, HTTP_ERROR, res);
			}
			http_remove_conn(conn);
			http_conn_free(conn);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x4c(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x3330
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x90, %rcx
subq %rcx, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2157d
jmp 0x21d9c
movq -0x28(%rbp), %rax
movl 0x48(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x4c(%rbp)
cmpl $0x3, -0x2c(%rbp)
je 0x2159a
cmpl $0x4, -0x2c(%rbp)
jne 0x215a6
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
jmp 0x21c08
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x68(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x60(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x21660
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x24f80
movl %eax, -0x58(%rbp)
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x21652
movl -0x58(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x58(%rbp), %edi
callq 0x3150
movl -0x6c(%rbp), %r9d
movl $0x3, %edi
leaq 0x15de8(%rip), %rsi     # 0x3741c
leaq 0x161fc(%rip), %rdx     # 0x37837
movl $0x6b5, %ecx            # imm = 0x6B5
leaq 0x18307(%rip), %r8      # 0x3994e
movq %rax, (%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x21654
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
jmp 0x21c06
cmpl $0x11, -0x2c(%rbp)
jne 0x21927
movq -0x28(%rbp), %rax
cmpl $0x2, 0x80(%rax)
jne 0x2172f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x80(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x78(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x2172a
movq -0x28(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0x3c(%rcx), %eax
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0x2170d
movq -0x28(%rbp), %rdi
callq 0x20940
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x2170b
movl $0x0, -0x4c(%rbp)
jmp 0x21728
movq -0x28(%rbp), %rdi
callq 0x21db0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x21726
movl $0x0, -0x4c(%rbp)
jmp 0x21728
jmp 0x2172a
jmp 0x21922
movq -0x28(%rbp), %rax
cmpl $0x3, 0x80(%rax)
jne 0x21800
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x90(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x88(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x217fb
movq -0x28(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0x3c(%rcx), %eax
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0x217de
movq -0x28(%rbp), %rdi
callq 0x20940
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x217dc
movl $0x0, -0x4c(%rbp)
jmp 0x217f9
movq -0x28(%rbp), %rdi
callq 0x21db0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x217f7
movl $0x0, -0x4c(%rbp)
jmp 0x217f9
jmp 0x217fb
jmp 0x21920
movq -0x28(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x28(%rbp), %rcx
subl 0x3c(%rcx), %eax
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0x218a0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x98(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x2189e
movq -0x28(%rbp), %rdi
callq 0x20940
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x2189c
movl $0x0, -0x4c(%rbp)
jmp 0x2189e
jmp 0x2191e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xa8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x2191c
movq -0x28(%rbp), %rdi
callq 0x21db0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x2191a
movl $0x0, -0x4c(%rbp)
jmp 0x2191c
jmp 0x2191e
jmp 0x21920
jmp 0x21922
jmp 0x21c04
cmpl $0xf, -0x2c(%rbp)
jne 0x219a6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xc0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xb8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x219a1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20730
movl %eax, -0x4c(%rbp)
jmp 0x21c02
cmpl $0x10, -0x2c(%rbp)
jne 0x21a25
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xd0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xc8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x21a20
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20730
movl %eax, -0x4c(%rbp)
jmp 0x21c00
cmpl $0x6, -0x2c(%rbp)
je 0x21a3d
cmpl $0x8, -0x2c(%rbp)
je 0x21a3d
cmpl $0xb, -0x2c(%rbp)
je 0x21a3d
cmpl $0xc, -0x2c(%rbp)
jne 0x21ab6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xe0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xd8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x21ab1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20670
movl %eax, -0x4c(%rbp)
jmp 0x21bfe
cmpl $0x5, -0x2c(%rbp)
je 0x21ac8
cmpl $0x7, -0x2c(%rbp)
je 0x21ac8
cmpl $0xa, -0x2c(%rbp)
jne 0x21b41
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xe8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x21b3c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20670
movl %eax, -0x4c(%rbp)
jmp 0x21bfc
cmpl $0x1, -0x2c(%rbp)
jne 0x21bfa
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x100(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf8(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0xf8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x21bf8
movq -0x28(%rbp), %rax
movl $0x2, 0x48(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x21be3
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x18(%rax)
jle 0x21be3
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20670
movl %eax, -0x4c(%rbp)
jmp 0x21bf6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x20730
movl %eax, -0x4c(%rbp)
jmp 0x21bf8
jmp 0x21bfa
jmp 0x21bfc
jmp 0x21bfe
jmp 0x21c00
jmp 0x21c02
jmp 0x21c04
jmp 0x21c06
jmp 0x21c08
cmpl $0x0, -0x4c(%rbp)
jne 0x21d1a
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x22110
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
jne 0x21c3d
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x22170
cmpl $0x0, %eax
je 0x21d1a
cmpl $0x0, -0x54(%rbp)
je 0x21c8a
jmp 0x21c45
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x21c86
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x25120
movq %rax, %r9
movl $0x3, %edi
leaq 0x157b0(%rip), %rsi     # 0x3741c
leaq 0x15bc4(%rip), %rdx     # 0x37837
movl $0x70d, %ecx            # imm = 0x70D
leaq 0x15bc5(%rip), %r8      # 0x37844
movb $0x0, %al
callq 0x243b0
jmp 0x21c88
jmp 0x21cd1
jmp 0x21c8c
movb $0x0, %al
callq 0x242d0
cmpl $0x7, (%rax)
jl 0x21ccd
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x25120
movq %rax, %r9
movl $0x7, %edi
leaq 0x15769(%rip), %rsi     # 0x3741c
leaq 0x15b7d(%rip), %rdx     # 0x37837
movl $0x70f, %ecx            # imm = 0x70F
leaq 0x15b99(%rip), %r8      # 0x3785f
movb $0x0, %al
callq 0x243b0
jmp 0x21ccf
jmp 0x21cd1
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movq 0xa0(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x21d0f
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rdx
movl $0x2, %esi
callq 0x20ea0
movq -0x28(%rbp), %rdi
callq 0x208f0
jmp 0x21d6b
cmpl $0x0, -0x4c(%rbp)
je 0x21d69
movq -0x28(%rbp), %rax
movq 0xa0(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x21d57
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rdx
movl $0x3, %esi
callq 0x20ea0
movq -0x28(%rbp), %rdi
callq 0x221a0
movq -0x28(%rbp), %rdi
callq 0x20d80
jmp 0x21d6b
jmp 0x21d6d
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x90, %rcx
subq %rcx, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x21564
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)