// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/main.c
// Function: uninit_dohclient
static void uninit_dohclient()
{
	dlitem_t* cur, * nxt;
	peer_t* peer;
	req_t* req;
	int i;

	for (i = 0; i < listen_num; i++) {
		listen_t* listen = listens + i;
		if (listen->sock)
			close(listen->sock);
		if (listen->usock)
			close(listen->usock);
	}

	listen_num = 0;

	dllist_foreach(&peers, cur, nxt,
		peer_t, peer, conn.entry) {
		peer_close(peer);
	}

	dllist_foreach(&reqs, cur, nxt,
		req_t, req, entry) {
		req_remove(req);
	}

	rbtree_init(&reqdic, req_rbkeycmp);

	if (channels) {
		for (i = 0; i < channel_num; i++) {
			channels[i]->destroy(channels[i]);
		}
		free(channels);
		channels = NULL;
		channel_num = 0;
	}

	if (cache) {
		if (save_cache_when_close) {
			cache_save_cachedb(cache, conf.cachedb_autosave);
		}
		cache->destroy(cache);
		cache = NULL;
	}

	if (hosts) {
		hosts->destroy(hosts);
		hosts = NULL;
	}

	chnroute_free(chnr);
	chnr = NULL;

	chnroute_free(blacklist);
	blacklist = NULL;

	proxy_num = 0;

	http_uninit();

	if (is_use_logfile()) {
		close_logfile();
	}

	if (is_use_syslog()) {
		close_syslog();
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x10958(%rip), %rbx     # 0x2f63c
xorl %r14d, %r14d
movslq 0x10d42(%rip), %rax     # 0x2fa30
cmpq %rax, %r14
jge 0x1ed16
movl -0x4(%rbx), %edi
testl %edi, %edi
je 0x1ecff
callq 0x3680
movl (%rbx), %edi
testl %edi, %edi
je 0x1ed0a
callq 0x3680
incq %r14
addq $0x90, %rbx
jmp 0x1ece7
andl $0x0, 0x10d13(%rip)     # 0x2fa30
movq 0xf9bc(%rip), %rdi      # 0x2e6e0
leaq 0xf9b5(%rip), %rbx      # 0x2e6e0
cmpq %rbx, %rdi
je 0x1ed41
movq (%rdi), %r14
addq $-0x40, %rdi
callq 0x1e2c6
movq %r14, %rdi
jmp 0x1ed2b
movq 0xf9a8(%rip), %rdi      # 0x2e6f0
leaq 0xf9a1(%rip), %rbx      # 0x2e6f0
cmpq %rbx, %rdi
je 0x1ed65
movq (%rdi), %r14
addq $-0x58, %rdi
callq 0x1ebde
movq %r14, %rdi
jmp 0x1ed4f
andq $0x0, 0xf993(%rip)      # 0x2e700
leaq -0x54a(%rip), %rax      # 0x1e82a
movq %rax, 0xf98d(%rip)      # 0x2e708
cmpq $0x0, 0x1081d(%rip)     # 0x2f5a0
je 0x1edba
xorl %ebx, %ebx
movslq 0x1080a(%rip), %rax     # 0x2f598
movq 0x1080b(%rip), %rdi     # 0x2f5a0
cmpq %rax, %rbx
jge 0x1eda6
movq (%rdi,%rbx,8), %rdi
callq *0x48(%rdi)
incq %rbx
jmp 0x1ed87
callq 0x3460
andq $0x0, 0x107ed(%rip)     # 0x2f5a0
andl $0x0, 0x107de(%rip)     # 0x2f598
movq 0x107cf(%rip), %rdi     # 0x2f590
testq %rdi, %rdi
je 0x1eded
cmpb $0x1, 0x10c67(%rip)     # 0x2fa34
jne 0x1ede2
movq 0xf8ca(%rip), %rsi      # 0x2e6a0
callq 0x886a
movq 0x107ae(%rip), %rdi     # 0x2f590
callq *0x48(%rdi)
andq $0x0, 0x107a3(%rip)     # 0x2f590
movq 0x10794(%rip), %rdi     # 0x2f588
testq %rdi, %rdi
je 0x1ee04
callq *0x48(%rdi)
andq $0x0, 0x10784(%rip)     # 0x2f588
movq 0x1076d(%rip), %rdi     # 0x2f578
callq 0x11ced
andq $0x0, 0x10760(%rip)     # 0x2f578
movq 0x10761(%rip), %rdi     # 0x2f580
callq 0x11ced
andq $0x0, 0x10754(%rip)     # 0x2f580
andl $0x0, 0x1073d(%rip)     # 0x2f570
xorl %eax, %eax
callq 0x14040
xorl %eax, %eax
callq 0x169be
testl %eax, %eax
je 0x1ee4c
xorl %eax, %eax
callq 0x16921
xorl %eax, %eax
callq 0x169b6
testl %eax, %eax
je 0x1ee65
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x16984
addq $0x8, %rsp
popq %rbx
popq %r14
retq