// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_cache.c
// Function: cache_create
int cache_create(
	channel_t** pctx,
	const char* name,
	const char* args,
	const config_t* conf,
	const proxy_t* proxies,
	const int proxy_num,
	const chnroute_ctx chnr,
	const chnroute_ctx blacklist,
	void* data)
{
	cache_t* ctx;

	ctx = (cache_t*)malloc(sizeof(cache_t));
	if (!ctx) {
		loge("alloc\n");
		return CHANNEL_ALLOC;
	}

	memset(ctx, 0, sizeof(cache_t));

	dllist_init(&ctx->items);
	rbtree_init(&ctx->dic, rbkeycmp);

	ctx->name = name;
	ctx->conf = conf;
	ctx->proxies = proxies;
	ctx->proxy_num = proxy_num;
	ctx->chnr = chnr;
	ctx->blacklist = blacklist;
	ctx->data = data;

	ctx->fdset = fdset;
	ctx->step = step;
	ctx->query = query;
	ctx->destroy = destroy;

	if (args) {
		struct cb_querystring_state_t st[1] = {{
			.ctx = ctx, .override = FALSE,
		}};
		if (parse_querystring(args, cb_querystring, st)) {
			loge("invalid args: %s\n", args);
			return CHANNEL_WRONG_ARG;
		}
	}

	*pctx = (channel_t*)ctx;

	return CHANNEL_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl $0x78, %edi
callq 0x34d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xd9d3
jmp 0xd993
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0xd9c5
movl $0x3, %edi
leaq 0x28247(%rip), %rsi     # 0x35bf2
leaq 0x284f4(%rip), %rdx     # 0x35ea6
movl $0x298, %ecx            # imm = 0x298
leaq 0x294d9(%rip), %r8      # 0x36e97
movb $0x0, %al
callq 0x243b0
jmp 0xd9c7
movl $0x3, -0x4(%rbp)
jmp 0xdb33
movq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x3200
movq -0x40(%rbp), %rcx
addq $0x58, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x40(%rbp), %rcx
addq $0x58, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x60(%rax)
jmp 0xda05
movq -0x40(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x40(%rbp), %rax
leaq 0x124(%rip), %rcx       # 0xdb40
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x18(%rax)
movq 0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq 0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x40(%rbp), %rax
leaq 0x104(%rip), %rcx       # 0xdb80
movq %rcx, 0x30(%rax)
movq -0x40(%rbp), %rax
leaq 0x115(%rip), %rcx       # 0xdba0
movq %rcx, 0x38(%rax)
movq -0x40(%rbp), %rax
leaq 0x156(%rip), %rcx       # 0xdbf0
movq %rcx, 0x40(%rax)
movq -0x40(%rbp), %rax
leaq 0x257(%rip), %rcx       # 0xdd00
movq %rcx, 0x48(%rax)
cmpq $0x0, -0x20(%rbp)
je 0xdb21
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rdx
leaq 0x2fe(%rip), %rsi       # 0xddd0
callq 0x2f540
cmpl $0x0, %eax
je 0xdb1f
jmp 0xdade
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0xdb14
movq -0x20(%rbp), %r9
movl $0x3, %edi
leaq 0x280f8(%rip), %rsi     # 0x35bf2
leaq 0x283a5(%rip), %rdx     # 0x35ea6
movl $0x2b3, %ecx            # imm = 0x2B3
leaq 0x283a6(%rip), %r8      # 0x35eb3
movb $0x0, %al
callq 0x243b0
jmp 0xdb16
movl $0x2, -0x4(%rbp)
jmp 0xdb33
jmp 0xdb21
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)