// File: /workspace/github_c_makefile_star2_O3/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
cmpl $0x0, 0xe4b0(%rip)      # 0x2ea20
jle 0x205a9
leaq 0xe0b3(%rip), %rbx      # 0x2e62c
xorl %r14d, %r14d
movl -0x4(%rbx), %edi
testl %edi, %edi
je 0x20588
callq 0x3670
movl (%rbx), %edi
testl %edi, %edi
je 0x20593
callq 0x3670
incq %r14
movslq 0xe483(%rip), %rax      # 0x2ea20
addq $0x90, %rbx
cmpq %rax, %r14
jl 0x2057c
movl $0x0, 0xe46d(%rip)      # 0x2ea20
movq 0xd116(%rip), %rdi      # 0x2d6d0
leaq 0xd10f(%rip), %rbx      # 0x2d6d0
cmpq %rbx, %rdi
je 0x205da
movq (%rdi), %r14
addq $-0x40, %rdi
callq 0x1fa87
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x205c6
movq 0xd0ff(%rip), %rdi      # 0x2d6e0
leaq 0xd0f8(%rip), %rbx      # 0x2d6e0
cmpq %rbx, %rdi
je 0x20601
movq (%rdi), %r14
addq $-0x58, %rdi
callq 0x2044b
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x205ed
movq $0x0, 0xd0e4(%rip) # 0x2d6f0
leaq -0x56f(%rip), %rax      # 0x200a4
movq %rax, 0xd0de(%rip)      # 0x2d6f8
movq 0xdf6f(%rip), %rdi      # 0x2e590
testq %rdi, %rdi
je 0x2066f
cmpl $0x0, 0xdf5b(%rip)      # 0x2e588
jle 0x20655
xorl %ebx, %ebx
movq 0xdf58(%rip), %rax      # 0x2e590
movq (%rax,%rbx,8), %rdi
callq *0x48(%rdi)
incq %rbx
movslq 0xdf3f(%rip), %rax      # 0x2e588
cmpq %rax, %rbx
jl 0x20631
movq 0xdf3b(%rip), %rdi      # 0x2e590
callq 0x3450
movq $0x0, 0xdf2b(%rip) # 0x2e590
movl $0x0, 0xdf19(%rip)      # 0x2e588
movq 0xdf0a(%rip), %rdi      # 0x2e580
testq %rdi, %rdi
je 0x206a5
cmpb $0x1, 0xe3a2(%rip)      # 0x2ea24
jne 0x20697
movq 0xd005(%rip), %rsi      # 0x2d690
callq 0x8ba6
movq 0xdee9(%rip), %rdi      # 0x2e580
callq *0x48(%rdi)
movq $0x0, 0xdedb(%rip) # 0x2e580
movq 0xdecc(%rip), %rdi      # 0x2e578
testq %rdi, %rdi
je 0x206bf
callq *0x48(%rdi)
movq $0x0, 0xdeb9(%rip) # 0x2e578
movq 0xdea2(%rip), %rdi      # 0x2e568
callq 0x1283b
xorl %ebx, %ebx
movq %rbx, 0xde94(%rip)      # 0x2e568
movq 0xde95(%rip), %rdi      # 0x2e570
callq 0x1283b
movq %rbx, 0xde89(%rip)      # 0x2e570
movl $0x0, 0xde6f(%rip)      # 0x2e560
xorl %eax, %eax
callq 0x14d95
xorl %eax, %eax
callq 0x17a79
testl %eax, %eax
je 0x2070a
xorl %eax, %eax
callq 0x179d8
xorl %eax, %eax
callq 0x17a71
testl %eax, %eax
je 0x20723
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x17a3f
addq $0x8, %rsp
popq %rbx
popq %r14
retq