// File: /workspace/github_c_makefile_star2_O1/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, 0xdce0(%rip)      # 0x2ea20
jle 0x20d79
leaq 0xd8e3(%rip), %rbx      # 0x2e62c
xorl %r14d, %r14d
movl -0x4(%rbx), %edi
testl %edi, %edi
je 0x20d58
callq 0x3670
movl (%rbx), %edi
testl %edi, %edi
je 0x20d63
callq 0x3670
incq %r14
movslq 0xdcb3(%rip), %rax      # 0x2ea20
addq $0x90, %rbx
cmpq %rax, %r14
jl 0x20d4c
movl $0x0, 0xdc9d(%rip)      # 0x2ea20
movq 0xc946(%rip), %rdi      # 0x2d6d0
leaq 0xc93f(%rip), %rbx      # 0x2d6d0
cmpq %rbx, %rdi
je 0x20daa
movq (%rdi), %r14
addq $-0x40, %rdi
callq 0x20229
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x20d96
movq 0xc92f(%rip), %rdi      # 0x2d6e0
leaq 0xc928(%rip), %rbx      # 0x2d6e0
cmpq %rbx, %rdi
je 0x20dd1
movq (%rdi), %r14
addq $-0x58, %rdi
callq 0x20c08
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x20dbd
movq $0x0, 0xc914(%rip) # 0x2d6f0
leaq -0x565(%rip), %rax      # 0x2087e
movq %rax, 0xc90e(%rip)      # 0x2d6f8
cmpq $0x0, 0xd79e(%rip)      # 0x2e590
je 0x20e3d
cmpl $0x0, 0xd78d(%rip)      # 0x2e588
jle 0x20e1c
xorl %ebx, %ebx
movq 0xd78a(%rip), %rax      # 0x2e590
movq (%rax,%rbx,8), %rdi
callq *0x48(%rdi)
incq %rbx
movslq 0xd771(%rip), %rax      # 0x2e588
cmpq %rax, %rbx
jl 0x20dff
movq 0xd76d(%rip), %rdi      # 0x2e590
callq 0x3450
movq $0x0, 0xd75d(%rip) # 0x2e590
movl $0x0, 0xd74b(%rip)      # 0x2e588
movq 0xd73c(%rip), %rdi      # 0x2e580
testq %rdi, %rdi
je 0x20e73
cmpb $0x1, 0xdbd4(%rip)      # 0x2ea24
jne 0x20e5e
movq 0xc837(%rip), %rsi      # 0x2d690
callq 0x8ede
movq 0xd71b(%rip), %rdi      # 0x2e580
callq *0x48(%rdi)
movq $0x0, 0xd70d(%rip) # 0x2e580
movq 0xd6fe(%rip), %rdi      # 0x2e578
testq %rdi, %rdi
je 0x20e8d
callq *0x48(%rdi)
movq $0x0, 0xd6eb(%rip) # 0x2e578
movq 0xd6d4(%rip), %rdi      # 0x2e568
callq 0x12da6
xorl %ebx, %ebx
movq %rbx, 0xd6c6(%rip)      # 0x2e568
movq 0xd6c7(%rip), %rdi      # 0x2e570
callq 0x12da6
movq %rbx, 0xd6bb(%rip)      # 0x2e570
movl $0x0, 0xd6a1(%rip)      # 0x2e560
xorl %eax, %eax
callq 0x15329
xorl %eax, %eax
callq 0x180c2
testl %eax, %eax
je 0x20ed8
xorl %eax, %eax
callq 0x18021
xorl %eax, %eax
callq 0x180ba
testl %eax, %eax
je 0x20ef1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x18088
addq $0x8, %rsp
popq %rbx
popq %r14
retq