LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: destroy
static void destroy(channel_t* ctx)
{
	channel_tcp_t* c = (channel_tcp_t*)ctx;
	dlitem_t* cur, * nxt;
	tcpreq_t* req;
	dllist_foreach(&c->reqs, cur, nxt,
		tcpreq_t, req, entry) {
		dllist_remove(&req->entry);
		if (req->callback)
			req->callback(ctx, -1, NULL, FALSE, FALSE, req->cb_state);
		req_destroy(req);
	}
	free(ctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x58(%rdi), %r15
movq 0x58(%rdi), %r14
cmpq %r15, %r14
je 0xfee3
movq (%r14), %r12
movq 0x8(%r14), %rax
movq %r12, (%rax)
movq (%r14), %rcx
movq %rax, 0x8(%rcx)
movq -0x10(%r14), %rax
testq %rax, %rax
je 0xfecf
movq -0x8(%r14), %r9
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
addq $-0x30, %r14
movq %r14, %rdi
callq 0xf1f6
movq %r12, %r14
cmpq %r15, %r12
jne 0xfea0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3450
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_udp.c
// Function: fdset
static sock_t fdset(channel_t* ctx,
	fd_set* readset, fd_set* writeset, fd_set* errorset)
{
	channel_udp_t* c = (channel_udp_t*)ctx;
	sock_t maxfd = 0;
	int i;
	for (i = 0; i < c->upstream_num; i++) {
		FD_SET(c->upstreams[i].sock, readset);
		FD_SET(c->upstreams[i].sock, errorset);
		maxfd = MAX(maxfd, c->upstreams[i].sock);
	}
	return maxfd;
}

// Assembly:
movslq 0x500(%rdi), %rax
testq %rax, %rax
jle 0x11403
pushq %rbx
movq %rcx, %rdx
shlq $0x4, %rax
leaq (%rax,%rax,8), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
movl 0x108(%rdi,%r9), %eax
leal 0x3f(%rax), %r11d
testl %eax, %eax
cmovnsl %eax, %r11d
movl %r11d, %ebx
andl $-0x40, %ebx
movl %eax, %ecx
subl %ebx, %ecx
movl $0x1, %ebx
shlq %cl, %rbx
sarl $0x6, %r11d
movslq %r11d, %rcx
orq %rbx, (%rsi,%rcx,8)
orq %rbx, (%rdx,%rcx,8)
cmpl %eax, %r10d
cmovgl %r10d, %eax
addq $0x90, %r9
movl %eax, %r10d
cmpq %r9, %r8
jne 0x113b8
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_udp.c
// Function: destroy
static void destroy(channel_t* ctx)
{
	channel_udp_t* c = (channel_udp_t*)ctx;
	dlitem_t* cur, * nxt;
	udpreq_t* req;
	dllist_foreach(&c->reqs, cur, nxt,
		udpreq_t, req, entry) {
		dllist_remove(&req->entry);
		if (req->callback) {
			req->callback(ctx, -1, NULL, FALSE, FALSE, req->cb_state);
			req->callback = NULL;
		}
		req_destroy(req);
	}
	if (c->upstream_num > 0) {
		int i;
		for (i = 0; i < c->upstream_num; i++) {
			close(c->upstreams[i].sock);
		}
	}
	free(ctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x58(%rdi), %r15
movq 0x58(%rdi), %r14
cmpq %r15, %r14
je 0x1199f
movq (%r14), %r12
movq 0x8(%r14), %rax
movq %r12, (%rax)
movq (%r14), %rcx
movq %rax, 0x8(%rcx)
movq -0x10(%r14), %rax
testq %rax, %rax
je 0x11982
movq -0x8(%r14), %r9
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
movq $0x0, -0x10(%r14)
movq -0x28(%r14), %rdi
addq $-0x30, %r14
callq 0x3450
movq %r14, %rdi
callq 0x3450
movq %r12, %r14
cmpq %r15, %r12
jne 0x1194b
cmpl $0x0, 0x500(%rbx)
jle 0x119d9
cmpl $0x0, 0x500(%rbx)
jle 0x119d9
leaq 0x108(%rbx), %r14
xorl %r15d, %r15d
movl (%r14), %edi
callq 0x3670
incq %r15
movslq 0x500(%rbx), %rax
addq $0x90, %r14
cmpq %rax, %r15
jl 0x119bb
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3450
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_hosts.c
// Function: ipnode_new
static ipnode_t *ipnode_new(const void *ip, int family)
{
	ipnode_t *ipnode;

	ipnode = (ipnode_t*)malloc(sizeof(ipnode_t));
	if (!ipnode) {
		loge("alloc\n");
		return NULL;
	}

	memset(ipnode, 0, sizeof(ipnode_t));

	ipnode->family = family;

	if (family == AF_INET) {
		memcpy(&ipnode->ip4, ip, sizeof(struct in_addr));
	}
	else if (family == AF_INET6) {
		memcpy(&ipnode->ip6, ip, sizeof(struct in6_addr));
	}
	else if (family != 0) {
		loge("unknown \"family\" %d\n", family);
		free(ipnode);
		return NULL;
	}

	return ipnode;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x20, %edi
callq 0x34b0
testq %rax, %rax
je 0x11c9f
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movl %ebp, (%rax)
cmpl $0xa, %ebp
je 0x11cd7
cmpl $0x2, %ebp
jne 0x11ce1
movl (%r14), %eax
movl %eax, 0x4(%rbx)
jmp 0x11d20
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x11d20
leaq 0x11a52(%rip), %rsi     # 0x23706
leaq 0x11ac7(%rip), %rdx     # 0x23782
leaq 0x11be1(%rip), %r8      # 0x238a3
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x2d, %ecx
xorl %eax, %eax
callq 0x17d92
jmp 0x11d20
movups (%r14), %xmm0
movups %xmm0, 0x4(%rbx)
jmp 0x11d20
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x11d16
leaq 0x11a12(%rip), %rsi     # 0x23706
leaq 0x11a87(%rip), %rdx     # 0x23782
leaq 0x11a8b(%rip), %r8      # 0x2378d
movl $0x3, %edi
movl $0x3c, %ecx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rdi
callq 0x3450
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/channel_hosts.c
// Function: hosts_create
int hosts_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)
{
	hosts_t *ctx;

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

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

	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) {
		if (parse_querystring(args, parse_args_callback, ctx)) {
			loge("invalid args: %s\n", args);
			return CHANNEL_WRONG_ARG;
		}
	}

	*pctx = (channel_t*)ctx;

	return CHANNEL_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, (%rsp)
movl $0x68, %edi
callq 0x34b0
testq %rax, %rax
je 0x11e3f
movq %rax, %r15
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x50(%r15)
movups %xmm0, 0x30(%r15)
movups %xmm0, 0x40(%r15)
leaq 0xf5(%rip), %rsi        # 0x11e87
movq %rsi, 0x60(%r15)
movq %r14, (%r15)
movq %r13, 0x8(%r15)
movq %r12, 0x10(%r15)
movl %ebp, 0x18(%r15)
movq %rdx, 0x20(%r15)
movq %rcx, 0x28(%r15)
movq %rax, 0x50(%r15)
leaq 0xd4(%rip), %rax        # 0x11e8c
movq %rax, 0x30(%r15)
leaq 0xcc(%rip), %rax        # 0x11e8f
movq %rax, 0x38(%r15)
leaq 0xc4(%rip), %rax        # 0x11e92
movq %rax, 0x40(%r15)
leaq 0x315(%rip), %rax       # 0x120ee
movq %rax, 0x48(%r15)
testq %rbx, %rbx
je 0x11e34
leaq 0x337(%rip), %rsi       # 0x12120
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1e826
testl %eax, %eax
je 0x11e34
xorl %eax, %eax
callq 0x17d59
movl $0x2, %ebp
cmpl $0x3, (%rax)
jl 0x11e76
leaq 0x118f6(%rip), %rsi     # 0x23706
leaq 0x1194f(%rip), %rdx     # 0x23766
leaq 0x10abf(%rip), %r8      # 0x228dd
movl $0x3, %edi
movl $0x1cc, %ecx            # imm = 0x1CC
movq %rbx, %r9
xorl %eax, %eax
callq 0x17d92
jmp 0x11e76
movq (%rsp), %rax
movq %r15, (%rax)
xorl %ebp, %ebp
jmp 0x11e76
xorl %eax, %eax
callq 0x17d59
movl $0x3, %ebp
cmpl $0x3, (%rax)
jl 0x11e76
leaq 0x118af(%rip), %rsi     # 0x23706
leaq 0x11908(%rip), %rdx     # 0x23766
leaq 0x11a3e(%rip), %r8      # 0x238a3
movl $0x3, %edi
movl $0x1b5, %ecx            # imm = 0x1B5
xorl %eax, %eax
callq 0x17d92
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/chnroute.c
// Function: chnroute_test4
int chnroute_test4(chnroute_ctx ctx, struct in_addr* ip)
{
	net_list_t* netlist = ctx;
	int l = 0, r;
	int m, cmp;
	net_mask_t ip_net;
	net_mask_t* find;

	if (netlist == NULL || ip == NULL || netlist->entries == 0)
		return FALSE;

	r = netlist->entries - 1;

	ip_net.net = ntohl(ip->s_addr);
	while (l != r) {
		m = (l + r) / 2;
		cmp = cmp_net_mask(&ip_net, &netlist->nets[m]);
		if (cmp < 0) {
			if (r != m)
				r = m;
			else
				break;
		}
		else {
			if (l != m)
				l = m;
			else
				break;
		}
	}
	find = &netlist->nets[l];
	if ((ip_net.net & find->mask) != find->net) {
		return FALSE;
	}
	return TRUE;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x125ab
movl (%rdi), %r8d
testl %r8d, %r8d
je 0x125ab
xorl %edx, %edx
movl (%rsi), %ecx
bswapl %ecx
decl %r8d
je 0x1259b
movq 0x8(%rdi), %rax
leal (%rdx,%r8), %r9d
movl %r9d, %esi
shrl $0x1f, %esi
addl %r9d, %esi
sarl %esi
movslq %esi, %r9
cmpl (%rax,%r9,8), %ecx
jae 0x1258d
cmpl %esi, %r8d
movl %esi, %r8d
movl %edx, %esi
jne 0x12591
jmp 0x12598
cmpl %esi, %edx
je 0x12598
movl %esi, %edx
cmpl %r8d, %esi
jne 0x12569
movslq %edx, %rdx
movq 0x8(%rdi), %rsi
andl 0x4(%rsi,%rdx,8), %ecx
xorl %eax, %eax
cmpl (%rsi,%rdx,8), %ecx
sete %al
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/chnroute.c
// Function: chnroute_test6
int chnroute_test6(chnroute_ctx ctx, struct in6_addr* ip)
{
	net_list_t* netlist = ctx;
	int l = 0, r;
	int m, cmp;
	int i;
	net_mask6_t ip_net;
	net_mask6_t* find;

	if (netlist == NULL || ip == NULL || netlist->entries6 == 0)
		return FALSE;

	r = netlist->entries6 - 1;

	memcpy(ip_net.net, ip->s6_addr, 16);
	for (i = 0; i < 4; i++) {
		ip_net.net[i] = ntohl(ip_net.net[i]);
	}
	while (l != r) {
		m = (l + r) / 2;
		cmp = cmp_net_mask6(&ip_net, &netlist->nets6[m]);
		if (cmp < 0) {
			if (r != m)
				r = m;
			else
				break;
		}
		else {
			if (l != m)
				l = m;
			else
				break;
		}
	}
	find = &netlist->nets6[l];
	for (i = 0; i < 4; i++) {
		if ((ip_net.net[i] & find->mask[i]) != find->net[i]) {
			return FALSE;
		}
	}
	return TRUE;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x12684
movl 0x10(%rdi), %edx
testl %edx, %edx
je 0x12684
pushq %rbx
movups (%rsi), %xmm0
movaps %xmm0, -0x20(%rsp)
xorl %eax, %eax
movl -0x20(%rsp,%rax,4), %ecx
bswapl %ecx
movl %ecx, -0x20(%rsp,%rax,4)
incq %rax
cmpq $0x4, %rax
jne 0x125ea
xorl %ecx, %ecx
decl %edx
je 0x1265c
movq 0x18(%rdi), %rax
leal (%rcx,%rdx), %r8d
movl %r8d, %esi
shrl $0x1f, %esi
addl %r8d, %esi
sarl %esi
movslq %esi, %r8
shlq $0x5, %r8
addq %rax, %r8
xorl %r9d, %r9d
movl -0x20(%rsp,%r9,4), %r10d
movl (%r8,%r9,4), %r11d
cmpl %r11d, %r10d
jb 0x12645
ja 0x12640
leaq 0x1(%r9), %rbx
cmpq $0x3, %r9
movq %rbx, %r9
jne 0x12623
cmpl %r11d, %r10d
jae 0x1264f
cmpl %esi, %edx
movl %esi, %edx
movl %ecx, %esi
jne 0x12653
jmp 0x12659
cmpl %esi, %ecx
je 0x12659
movl %esi, %ecx
cmpl %edx, %esi
jne 0x12607
movslq %ecx, %rcx
shlq $0x5, %rcx
addq 0x18(%rdi), %rcx
xorl %eax, %eax
xorl %edx, %edx
movl 0x10(%rcx,%rdx,4), %esi
andl -0x20(%rsp,%rdx,4), %esi
cmpl (%rcx,%rdx,4), %esi
jne 0x12683
incq %rdx
cmpq $0x4, %rdx
jne 0x12668
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/chnroute.c
// Function: chnroute_test
int chnroute_test(chnroute_ctx ctx, struct sockaddr* addr)
{
	if (ctx == NULL || addr == NULL) {
		return FALSE;
	}
	if (addr->sa_family == AF_INET) {
		return chnroute_test4(ctx, &((struct sockaddr_in*)addr)->sin_addr);
	}
	else if (addr->sa_family == AF_INET6) {
		return chnroute_test6(ctx, &((struct sockaddr_in6*)addr)->sin6_addr);
	}
	else {
		return FALSE;
	}
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x126cf
movzwl (%rsi), %eax
cmpl $0xa, %eax
je 0x126d2
cmpl $0x2, %eax
jne 0x126cf
addq $0x4, %rsi
jmp 0x12540
xorl %eax, %eax
retq
addq $0x8, %rsi
jmp 0x125be
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/chnroute.c
// Function: chnroute_free
void chnroute_free(chnroute_ctx ctx)
{
	if (ctx) {
		net_list_t* netlist = ctx;
		free(netlist->nets);
		free(netlist->nets6);
		free(netlist);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x12dca
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x3450
movq 0x18(%rbx), %rdi
callq 0x3450
movq %rbx, %rdi
popq %rbx
jmp 0x3450
retq
nop
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/config.c
// Function: conf_add_channel
static int conf_add_channel(config_t* conf, const char *channel)
{
	char** channels;
	int num = 0;
	char** p;

	p = conf->channels;
	while (p && *p) {
		num++;
		p++;
	}
	
	channels = (char**)realloc(conf->channels, sizeof(char*) * (num + 2));

	if (!channels) {
		loge("alloc\n");
		return -1;
	}

	conf->channels = channels;
	channels[num++] = strdup(channel);
	channels[num] = NULL;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x70(%rdi), %rdi
xorl %eax, %eax
testq %rdi, %rdi
je 0x130d4
cmpq $0x0, (%rdi)
je 0x130d4
xorl %eax, %eax
cmpq $0x0, 0x8(%rdi,%rax,8)
leaq 0x1(%rax), %rax
jne 0x130c8
movl %eax, %r12d
leaq 0x10(,%r12,8), %rsi
callq 0x35b0
testq %rax, %rax
je 0x13109
movq %rax, %r15
movq %rax, 0x70(%r14)
movq %rbx, %rdi
callq 0x3610
movq %rax, (%r15,%r12,8)
movq $0x0, 0x8(%r15,%r12,8)
xorl %ebx, %ebx
jmp 0x13140
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x13140
leaq 0x1094c(%rip), %rsi     # 0x23a6d
leaq 0x10af0(%rip), %rdx     # 0x23c18
leaq 0x10774(%rip), %r8      # 0x238a3
movl $0x3, %edi
movl $0x1e, %ecx
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/config.c
// Function: conf_add_channel_args
static int conf_add_channel_args(config_t* conf, const char* args)
{
	char** channel_args;
	int num = 0;
	char** p;

	p = conf->channel_args;
	while (p && *p) {
		num++;
		p++;
	}

	channel_args = (char**)realloc(conf->channel_args, sizeof(char*) * (num + 2));

	if (!channel_args) {
		loge("alloc\n");
		return -1;
	}

	conf->channel_args = channel_args;
	channel_args[num++] = strdup(args);
	channel_args[num] = NULL;

	return 0;

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x78(%rdi), %rdi
xorl %eax, %eax
testq %rdi, %rdi
je 0x1317b
cmpq $0x0, (%rdi)
je 0x1317b
xorl %eax, %eax
cmpq $0x0, 0x8(%rdi,%rax,8)
leaq 0x1(%rax), %rax
jne 0x1316f
movl %eax, %r12d
leaq 0x10(,%r12,8), %rsi
callq 0x35b0
testq %rax, %rax
je 0x131b0
movq %rax, %r15
movq %rax, 0x78(%r14)
movq %rbx, %rdi
callq 0x3610
movq %rax, (%r15,%r12,8)
movq $0x0, 0x8(%r15,%r12,8)
xorl %ebx, %ebx
jmp 0x131e7
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x131e7
leaq 0x108a5(%rip), %rsi     # 0x23a6d
leaq 0x10a5a(%rip), %rdx     # 0x23c29
leaq 0x106cd(%rip), %r8      # 0x238a3
movl $0x3, %edi
movl $0x38, %ecx
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/config.c
// Function: conf_check
int conf_check(config_t* conf)
{
	int channel_num = 0;
	int channel_args_num = 0;
	char** p;

	if (conf->listen_addr == NULL) {
		conf->listen_addr = strdup(DEFAULT_LISTEN_ADDR);
	}
	if (conf->listen_port == NULL) {
		conf->listen_port = strdup(DEFAULT_LISTEN_PORT);
	}
	if (conf->timeout <= 0) {
		conf->timeout = DEFAULT_TIMEOUT;
	}
	if (conf->cache_timeout < 0) {
		conf->cache_timeout = CACHE_TIMEOUT_FOLLOWING_TTL;
	}
	if (conf->channel_choose_mode < 0) {
		conf->channel_choose_mode = CHOOSE_MODE_CONCUR;
	}
	if (conf->channels == NULL) {
		if (conf_add_channel(conf, DEFAULT_CHANNEL)) {
			return -1;
		}
	}
	if (conf->channel_args == NULL) {
		if (conf_add_channel_args(conf, DEFAULT_CHANNEL_ARGS)) {
			return -1;
		}
	}
	if (conf->wwwroot == NULL) {
		conf->wwwroot = strdup(DEFAULT_WWWROOT);
	}

	p = conf->channels;
	while (p && *p) {
		channel_num++;
		p++;
	}

	p = conf->channel_args;
	while (p && *p) {
		channel_args_num++;
		p++;
	}

	if (channel_num != channel_args_num) {
		loge("channel and channel_args are not match\n");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x13210
leaq 0x10806(%rip), %rdi     # 0x23a0e
callq 0x3610
movq %rax, (%rbx)
cmpq $0x0, 0x8(%rbx)
jne 0x13227
leaq 0xf831(%rip), %rdi      # 0x22a4f
callq 0x3610
movq %rax, 0x8(%rbx)
cmpl $0x0, 0x88(%rbx)
jg 0x1323a
movl $0x5, 0x88(%rbx)
cmpl $0x0, 0x8c(%rbx)
jns 0x1324d
movl $0x1, 0x8c(%rbx)
cmpl $0x0, 0x80(%rbx)
jns 0x13260
movl $0x1, 0x80(%rbx)
cmpq $0x0, 0x70(%rbx)
je 0x13312
cmpq $0x0, 0x78(%rbx)
je 0x1332f
cmpq $0x0, 0x50(%rbx)
jne 0x1328d
leaq 0x107d1(%rip), %rdi     # 0x23a55
callq 0x3610
movq %rax, 0x50(%rbx)
movq 0x70(%rbx), %rdx
xorl %eax, %eax
movl $0x0, %ecx
testq %rdx, %rdx
je 0x132b6
cmpq $0x0, (%rdx)
movl $0x0, %ecx
je 0x132b6
xorl %ecx, %ecx
cmpq $0x0, 0x8(%rdx,%rcx,8)
leaq 0x1(%rcx), %rcx
jne 0x132aa
movq 0x78(%rbx), %rdx
testq %rdx, %rdx
je 0x132d3
cmpq $0x0, (%rdx)
je 0x132d3
xorl %eax, %eax
cmpq $0x0, 0x8(%rdx,%rax,8)
leaq 0x1(%rax), %rax
jne 0x132c7
xorl %ebp, %ebp
cmpl %eax, %ecx
je 0x1334b
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1334b
leaq 0x1077c(%rip), %rsi     # 0x23a6d
leaq 0x10782(%rip), %rdx     # 0x23a7a
leaq 0x10786(%rip), %r8      # 0x23a85
movl $0x3, %edi
movl $0xe4, %ecx
xorl %eax, %eax
callq 0x17d92
jmp 0x1334b
leaq 0xf2f6(%rip), %rsi      # 0x2260f
movq %rbx, %rdi
callq 0x130a7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1334b
jmp 0x1326b
leaq 0x106e0(%rip), %rsi     # 0x23a16
movq %rbx, %rdi
callq 0x1314e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0x13276
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/config.c
// Function: conf_free
void conf_free(config_t* conf)
{
	char** p;

	free(conf->listen_addr);
	conf->listen_addr = NULL;

	free(conf->listen_port);
	conf->listen_port = NULL;

	free(conf->pid_file);
	conf->pid_file = NULL;

	free(conf->log_file);
	conf->log_file = NULL;

	free(conf->launch_log);
	conf->launch_log = NULL;

	free(conf->config_file);
	conf->config_file = NULL;

	free(conf->chnroute);
	conf->chnroute = NULL;

	free(conf->blacklist);
	conf->blacklist = NULL;

	free(conf->hosts);
	conf->hosts = NULL;

	free(conf->proxy);
	conf->proxy = NULL;

	free(conf->wwwroot);
	conf->wwwroot = NULL;

	free(conf->cachedb);
	conf->cachedb = NULL;

	free(conf->cache_api);
	conf->cache_api = NULL;

	free(conf->cachedb_autosave);
	conf->cachedb_autosave = NULL;

	p = conf->channel_args;
	while (p && *p) {
		free(*p);
		p++;
	}

	p = conf->channels;
	while (p && *p) {
		free(*p);
		p++;
	}

	free(conf->channel_args);
	conf->channel_args = NULL;

	free(conf->channels);
	conf->channels = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x3450
xorl %r14d, %r14d
movq %r14, (%rbx)
movq 0x8(%rbx), %rdi
callq 0x3450
movq %r14, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x3450
movq %r14, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0x3450
movq %r14, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x3450
movq %r14, 0x20(%rbx)
movq 0x28(%rbx), %rdi
callq 0x3450
movq %r14, 0x28(%rbx)
movq 0x38(%rbx), %rdi
callq 0x3450
movq %r14, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x3450
movq %r14, 0x40(%rbx)
movq 0x48(%rbx), %rdi
callq 0x3450
movq %r14, 0x48(%rbx)
movq 0x30(%rbx), %rdi
callq 0x3450
movq %r14, 0x30(%rbx)
movq 0x50(%rbx), %rdi
callq 0x3450
movq %r14, 0x50(%rbx)
movq 0x58(%rbx), %rdi
callq 0x3450
movq %r14, 0x58(%rbx)
movq 0x68(%rbx), %rdi
callq 0x3450
movq %r14, 0x68(%rbx)
movq 0x60(%rbx), %rdi
callq 0x3450
movq %r14, 0x60(%rbx)
movq 0x78(%rbx), %r14
testq %r14, %r14
je 0x14094
movq (%r14), %rdi
testq %rdi, %rdi
je 0x14094
addq $0x8, %r14
callq 0x3450
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x14083
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x140ba
movq (%r14), %rdi
testq %rdi, %rdi
je 0x140ba
addq $0x8, %r14
callq 0x3450
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x140a9
movq 0x78(%rbx), %rdi
callq 0x3450
xorl %r14d, %r14d
movq %r14, 0x78(%rbx)
movq 0x70(%rbx), %rdi
callq 0x3450
movq %r14, 0x70(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/dns_request.c
// Function: req_destroy
void req_destroy(req_t* req)
{
	if (req) {
		if (req->fromlen > 0)
			free(req->from);
		if (req->msg) {
			ns_msg_free(req->msg);
			free(req->msg);
		}
		free(req);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x14337
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x20(%rdi)
jle 0x14317
movq 0x18(%rbx), %rdi
callq 0x3450
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1432e
callq 0x1a1dd
movq 0x8(%rbx), %rdi
callq 0x3450
movq %rbx, %rdi
popq %rbx
jmp 0x3450
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_create
http_request_t* http_request_create(
	const char *method, const char *path,
	const char *host, int keep_alive)
{
	http_request_t* req = (http_request_t*)malloc(sizeof(http_request_t));
	if (!req) {
		loge("alloc\n");
		return NULL;
	}

	memset(req, 0, sizeof(http_request_t));

	dllist_init(&req->headers);

	req->method = method;
	req->path = path;
	req->host = host;
	req->keep_alive = keep_alive;

	return req;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x68, %edi
callq 0x34b0
testq %rax, %rax
je 0x143a7
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movq $0x0, 0x60(%rax)
addq $0x18, %rax
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq %r12, (%rbx)
movq %r15, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movl %ebp, 0x34(%rbx)
jmp 0x143dd
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x143dd
leaq 0xf96c(%rip), %rsi      # 0x23d28
leaq 0xf970(%rip), %rdx      # 0x23d33
leaq 0xf4d9(%rip), %r8       # 0x238a3
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x106, %ecx            # imm = 0x106
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_destroy
void http_request_destroy(http_request_t *request)
{
	if (request) {
		dlitem_t* cur, * nxt;
		http_header_t* header;
		if (request->conn) {
			request->conn->request = NULL;
		}
		dllist_foreach(&request->headers, cur, nxt,
			http_header_t, header, entry) {
			dllist_remove(&header->entry);
			free(header);
		}
		free(request->tag);
		free(request);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x1444f
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x1440a
movq $0x0, 0xa0(%rax)
leaq 0x18(%rbx), %r14
movq 0x18(%rbx), %rax
cmpq %r14, %rax
je 0x14439
leaq -0x10(%rax), %rdi
movq (%rax), %r15
movq 0x8(%rax), %rcx
movq %r15, (%rcx)
movq (%rax), %rax
movq %rcx, 0x8(%rax)
callq 0x3450
movq %r15, %rax
cmpq %r14, %r15
jne 0x14417
movq 0x50(%rbx), %rdi
callq 0x3450
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3450
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_get_header
const char* http_request_get_header(http_request_t* request,
	const char* name)
{
	http_header_t* header = 
		http_request_find_header(request, name);
	if (header) {
		return header->value;
	}
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %r14
xorl %r15d, %r15d
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x144d0
movq -0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x144af
addq $-0x10, %r12
movq %r12, %r15
testq %r15, %r15
je 0x144db
movq 0x8(%r15), %rax
jmp 0x144dd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_set_header
int http_request_set_header(http_request_t* request,
	const char *name, const char *value)
{
	http_header_t* header =
		http_request_find_header(request, name);
	if (header) {
		header->value = (char*)value;
	}
	else {
		header = (http_header_t*)malloc(sizeof(http_header_t));
		if (!header) {
			loge("alloc\n");
			return -1;
		}

		memset(header, 0, sizeof(http_header_t));

		header->name = (char*)name;
		header->value = (char*)value;

		dllist_add(&request->headers, &header->entry);
	}

	if (strcmp(name, "Host") == 0) {
		request->host = value;
	}

	if (strcmp(name, "Connection") == 0) {
		request->keep_alive = strcmp(value, "keep-alive") == 0;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rdi), %r12
xorl %r13d, %r13d
movq %r12, %rbp
movq (%rbp), %rbp
cmpq %r12, %rbp
je 0x14527
movq -0x10(%rbp), %rdi
movq %r15, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x14507
addq $-0x10, %rbp
movq %rbp, %r13
testq %r13, %r13
je 0x14532
movq %r14, 0x8(%r13)
jmp 0x14570
movl $0x20, %edi
callq 0x34b0
testq %rax, %rax
je 0x145c6
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movq %r12, 0x10(%rax)
movq 0x20(%rbx), %rdx
movq %rdx, 0x18(%rax)
movq %rcx, (%rdx)
movq %rcx, 0x20(%rbx)
leaq 0xf7e8(%rip), %rsi      # 0x23d5f
movq %r15, %rdi
callq 0x34e0
testl %eax, %eax
jne 0x14587
movq %r14, 0x10(%rbx)
leaq 0xf7d6(%rip), %rsi      # 0x23d64
movq %r15, %rdi
callq 0x34e0
xorl %ebp, %ebp
testl %eax, %eax
jne 0x145b5
leaq 0xe526(%rip), %rsi      # 0x22ac9
movq %r14, %rdi
callq 0x34e0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x34(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x145b5
leaq 0xf74a(%rip), %rsi      # 0x23d28
leaq 0xf762(%rip), %rdx      # 0x23d47
leaq 0xf2b7(%rip), %r8       # 0x238a3
movl $0x3, %edi
movl $0x14c, %ecx            # imm = 0x14C
xorl %eax, %eax
callq 0x17d92
jmp 0x145b5
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_set_host
void http_request_set_host(http_request_t* request,
	const char* value)
{
	request->host = value;
	http_header_t* header =
		http_request_find_header(request, "Host");
	if (header) {
		header->value = (char*)value;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x10(%rdi)
addq $0x18, %r14
xorl %r12d, %r12d
leaq 0xf6e1(%rip), %r15      # 0x23d5f
movq %r14, %r13
movq (%r13), %r13
cmpq %r14, %r13
je 0x146a1
movq -0x10(%r13), %rdi
movq %r15, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x14681
addq $-0x10, %r13
movq %r13, %r12
testq %r12, %r12
je 0x146ab
movq %rbx, 0x8(%r12)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_header_next
int http_request_header_next(http_request_t* request, struct dliterator_t* iterator,
	const char** name, const char** value)
{
	int r = dliterator_next(&request->headers, iterator);
	if (r && (name || value)) {
		http_header_t* header =
			dllist_container_of(iterator->cur, http_header_t, entry);
		if (name) *name = header->name;
		if (value) *value = header->value;
	}
	return r;
}

// Assembly:
addq $0x18, %rdi
cmpq $0x0, (%rsi)
je 0x146dc
movq 0x8(%rsi), %rax
jmp 0x146df
movq (%rdi), %rax
movq %rax, (%rsi)
movq (%rax), %rax
movq %rax, 0x8(%rsi)
movq (%rsi), %rsi
cmpq %rdi, %rsi
je 0x14711
movq %rdx, %rax
orq %rcx, %rax
je 0x14711
testq %rdx, %rdx
je 0x14705
movq -0x10(%rsi), %rax
movq %rax, (%rdx)
testq %rcx, %rcx
je 0x14711
movq -0x8(%rsi), %rax
movq %rax, (%rcx)
xorl %eax, %eax
cmpq %rdi, %rsi
setne %al
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_request_serialize
int http_request_serialize(/*write stream*/stream_t* s, http_request_t* req)
{
	if (http_request_headers_serialize(s, req) == -1) {
		loge("http_request_headers_serialize()\n");
		return -1;
	}

	if (strcmp(req->method, "POST") == 0) {
		if (req->data_len > 0) {
			if (stream_appends(s, req->data, req->data_len) == -1) {
				loge("stream_appendf()\n");
				return -1;
			}
		}
	}

	return s->size - s->pos;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1471a
cmpl $-0x1, %eax
je 0x14a14
movq (%rbx), %rdi
leaq 0xd3e1(%rip), %rsi      # 0x21de2
callq 0x34e0
testl %eax, %eax
je 0x14a55
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x14a4b
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14a4b
leaq 0xf2fc(%rip), %rsi      # 0x23d28
leaq 0xf3c0(%rip), %rdx      # 0x23df3
leaq 0xf3d0(%rip), %r8       # 0x23e0a
movl $0x3, %edi
movl $0x206, %ecx            # imm = 0x206
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x30(%rbx), %edx
testl %edx, %edx
jle 0x14a0a
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x1dbf0
cmpl $-0x1, %eax
jne 0x14a0a
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14a4b
leaq 0xf2a3(%rip), %rsi      # 0x23d28
leaq 0xf367(%rip), %rdx      # 0x23df3
leaq 0xe4dc(%rip), %r8       # 0x22f6f
movl $0x3, %edi
movl $0x20d, %ecx            # imm = 0x20D
jmp 0x14a44
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_create
http_response_t* http_response_create()
{
	http_response_t* res = (http_response_t*)malloc(sizeof(http_response_t));
	if (!res) {
		loge("alloc\n");
		return NULL;
	}

	memset(res, 0, sizeof(http_response_t));

	dllist_init(&res->headers);

	stream_init(&res->data);

	return res;
}

// Assembly:
pushq %rbx
movl $0x40, %edi
callq 0x34b0
testq %rax, %rax
je 0x14adb
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
leaq 0x20(%rax), %rdi
addq $0x10, %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x18(%rbx)
callq 0x1d5e8
jmp 0x14b11
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x14b11
leaq 0xf238(%rip), %rsi      # 0x23d28
leaq 0xf335(%rip), %rdx      # 0x23e2c
leaq 0xeda5(%rip), %r8       # 0x238a3
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x21c, %ecx            # imm = 0x21C
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_destroy
void http_response_destroy(http_response_t* response)
{
	if (response) {
		dlitem_t* cur, * nxt;
		http_header_t* header;
		if (response->conn) {
			response->conn->response = NULL;
		}
		dllist_foreach(&response->headers, cur, nxt,
			http_header_t, header, entry) {
			dllist_remove(&header->entry);
			free(header->name);
			free(header->value);
			free(header);
		}
		free(response->status_text);
		stream_free(&response->data);
		free(response);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x14bac
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x14b3f
movq $0x0, 0xa8(%rax)
leaq 0x10(%rbx), %r15
movq 0x10(%rbx), %r12
cmpq %r15, %r12
je 0x14b89
leaq -0x10(%r12), %r14
movq (%r12), %r13
movq 0x8(%r12), %rax
movq %r13, (%rax)
movq (%r12), %rcx
movq %rax, 0x8(%rcx)
movq -0x10(%r12), %rdi
callq 0x3450
movq -0x8(%r12), %rdi
callq 0x3450
movq %r14, %rdi
callq 0x3450
movq %r13, %r12
cmpq %r15, %r13
jne 0x14b4c
movq 0x8(%rbx), %rdi
callq 0x3450
leaq 0x20(%rbx), %rdi
callq 0x1d5f9
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3450
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_get_header
const char* http_response_get_header(http_response_t* response,
	const char* name)
{
	http_header_t* header =
		http_response_find_header(response, name);
	if (header) {
		return header->value;
	}
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x10, %r14
xorl %r15d, %r15d
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x14c2d
movq -0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x14c0c
addq $-0x10, %r12
movq %r12, %r15
testq %r15, %r15
je 0x14c38
movq 0x8(%r15), %rax
jmp 0x14c3a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_add_header
int http_response_add_header(http_response_t* response,
	const char* name, const char* value)
{
	http_header_t* header;

	header = (http_header_t*)malloc(sizeof(http_header_t));
	if (!header) {
		loge("alloc\n");
		return -1;
	}

	memset(header, 0, sizeof(http_header_t));

	header->name = strdup(name);
	header->value = strdup(value);

	dllist_add(&response->headers, &header->entry);

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x20, %edi
callq 0x34b0
testq %rax, %rax
je 0x14cad
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, %r13
addq $0x10, %r13
movq %r12, %rdi
callq 0x3610
movq %rax, (%r14)
movq %r15, %rdi
callq 0x3610
movq %rax, 0x8(%r14)
leaq 0x10(%rbx), %rax
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movq %r13, (%rax)
movq %r13, 0x18(%rbx)
xorl %ebx, %ebx
jmp 0x14ce4
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14ce4
leaq 0xf063(%rip), %rsi      # 0x23d28
leaq 0xf175(%rip), %rdx      # 0x23e41
leaq 0xebd0(%rip), %r8       # 0x238a3
movl $0x3, %edi
movl $0x25e, %ecx            # imm = 0x25E
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_set_header
int http_response_set_header(http_response_t* response,
	const char* name, const char* value)
{
	http_header_t* header =
		http_response_find_header(response, name);
	if (header) {
		free(header->value);
		header->value = strdup(value);
		return 0;
	}
	else {
		return http_response_add_header(response, name, value);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x10(%rdi), %rbp
xorl %r12d, %r12d
movq %rbp, %r13
movq (%r13), %r13
cmpq %rbp, %r13
je 0x14d2e
movq -0x10(%r13), %rdi
movq %r14, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x14d0e
addq $-0x10, %r13
movq %r13, %r12
testq %r12, %r12
je 0x14d5b
movq 0x8(%r12), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3610
movq %rax, 0x8(%r12)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x14c46
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_header_next
int http_response_header_next(http_response_t* response, struct dliterator_t* iterator,
	const char** name, const char** value)
{
	int r = dliterator_next(&response->headers, iterator);
	if (r && (name || value)) {
		http_header_t* header =
			dllist_container_of(iterator->cur, http_header_t, entry);
		if (name) *name = header->name;
		if (value) *value = header->value;
	}
	return r;
}

// Assembly:
addq $0x10, %rdi
cmpq $0x0, (%rsi)
je 0x14d97
movq 0x8(%rsi), %rax
jmp 0x14d9a
movq (%rdi), %rax
movq %rax, (%rsi)
movq (%rax), %rax
movq %rax, 0x8(%rsi)
movq (%rsi), %rsi
cmpq %rdi, %rsi
je 0x14dcc
movq %rdx, %rax
orq %rcx, %rax
je 0x14dcc
testq %rdx, %rdx
je 0x14dc0
movq -0x10(%rsi), %rax
movq %rax, (%rdx)
testq %rcx, %rcx
je 0x14dcc
movq -0x8(%rsi), %rax
movq %rax, (%rcx)
xorl %eax, %eax
cmpq %rdi, %rsi
setne %al
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_append_data
int http_response_append_data(http_response_t* response,
	const char* data, int data_len)
{
	if (stream_appends(&response->data, data, data_len) == -1) {
		loge("stream_appends()\n");
		return -1;
	}
	return 0;
}

// Assembly:
pushq %rbx
addq $0x20, %rdi
callq 0x1dbf0
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x14e2c
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14e2c
leaq 0xef1b(%rip), %rsi      # 0x23d28
leaq 0xf046(%rip), %rdx      # 0x23e5a
leaq 0xf059(%rip), %r8       # 0x23e74
movl $0x3, %edi
movl $0x298, %ecx            # imm = 0x298
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_headers_serialize
int http_response_headers_serialize(/*write stream*/stream_t* s, http_response_t* response)
{
	struct dliterator_t it;
	const char* name;
	const char* value;
	int have_connection = FALSE;
	int have_host = FALSE;

	if (stream_appendf(s,
		"HTTP/%d.%d %d %s\r\n",
		response->http_major,
		response->http_minor,
		response->status_code,
		response->status_text) == -1) {
		loge("stream_appendf()\n");
		return -1;
	}

	dliterator_reset(&it);

	while (http_response_header_next(response, &it, &name, &value)) {
		if (stream_appendf(s, "%s: %s\r\n", name, value) == -1) {
			loge("stream_appendf()\n");
			return -1;
		}
	}

	if (stream_appends(s, "\r\n", 2) == -1) {
		loge("stream_appendf()\n");
		return -1;
	}

	return s->size - s->pos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movzwl (%rsi), %edx
movzwl 0x2(%rsi), %ecx
movl 0x4(%rsi), %r8d
movq 0x8(%rsi), %r9
leaq 0xf02f(%rip), %rsi      # 0x23e86
xorl %eax, %eax
callq 0x1dcf7
cmpl $-0x1, %eax
je 0x14eeb
addq $0x10, %r14
movb $0x1, %r15b
xorl %ebp, %ebp
testb $0x1, %r15b
je 0x14e79
movq (%r14), %rbp
cmpq %r14, %rbp
je 0x14e86
movq -0x10(%rbp), %r12
movq -0x8(%rbp), %r13
cmpq %r14, %rbp
je 0x14f1d
movq (%rbp), %rbp
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0xef17(%rip), %rsi      # 0x23db7
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x1dcf7
cmpl $-0x1, %eax
jne 0x14e70
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14f75
leaq 0xee5a(%rip), %rsi      # 0x23d28
leaq 0xefc4(%rip), %rdx      # 0x23e99
leaq 0xe093(%rip), %r8       # 0x22f6f
movl $0x3, %edi
movl $0x2b4, %ecx            # imm = 0x2B4
jmp 0x14f6e
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14f75
leaq 0xee25(%rip), %rsi      # 0x23d28
leaq 0xef8f(%rip), %rdx      # 0x23e99
leaq 0xe05e(%rip), %r8       # 0x22f6f
movl $0x3, %edi
movl $0x2ac, %ecx            # imm = 0x2AC
jmp 0x14f6e
leaq 0xeecc(%rip), %rsi      # 0x23df0
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1dbf0
cmpl $-0x1, %eax
je 0x14f3e
movl 0x8(%rbx), %ebp
subl 0xc(%rbx), %ebp
jmp 0x14f75
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14f75
leaq 0xedd2(%rip), %rsi      # 0x23d28
leaq 0xef3c(%rip), %rdx      # 0x23e99
leaq 0xe00b(%rip), %r8       # 0x22f6f
movl $0x3, %edi
movl $0x2ba, %ecx            # imm = 0x2BA
xorl %eax, %eax
callq 0x17d92
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_response_serialize
int http_response_serialize(/*write stream*/stream_t* s, http_response_t* response)
{
	if (http_response_headers_serialize(s, response) == -1) {
		loge("http_response_headers_serialize()\n");
		return -1;
	}

	if (response->data.size > 0) {
		if (stream_appends(s, response->data.array, response->data.size) == -1) {
			loge("stream_appendf()\n");
			return -1;
		}
	}

	return s->size - s->pos;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x14e30
cmpl $-0x1, %eax
je 0x14fbc
movl 0x28(%rbx), %edx
testl %edx, %edx
jle 0x14fb2
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x1dbf0
cmpl $-0x1, %eax
je 0x14fee
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x15025
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x15025
leaq 0xed54(%rip), %rsi      # 0x23d28
leaq 0xeede(%rip), %rdx      # 0x23eb9
leaq 0xeeef(%rip), %r8       # 0x23ed1
movl $0x3, %edi
movl $0x2c4, %ecx            # imm = 0x2C4
jmp 0x1501e
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x15025
leaq 0xed22(%rip), %rsi      # 0x23d28
leaq 0xeeac(%rip), %rdx      # 0x23eb9
leaq 0xdf5b(%rip), %r8       # 0x22f6f
movl $0x3, %edi
movl $0x2ca, %ecx            # imm = 0x2CA
xorl %eax, %eax
callq 0x17d92
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_create
http_ctx_t* http_create(
	const proxy_t* proxies,
	const int proxy_num,
	int timeout)
{
	http_ctx_t* ctx = (http_ctx_t*)malloc(sizeof(http_ctx_t));
	if (!ctx) {
		loge("alloc\n");
		return NULL;
	}

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

	rbtree_init(&ctx->pool, rbcmp);

	ctx->proxies = proxies;
	ctx->proxy_num = proxy_num;
	ctx->timeout = timeout;

	return ctx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl $0x20, %edi
callq 0x34b0
testq %rax, %rax
je 0x1538e
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
leaq 0x55(%rip), %rax        # 0x153d2
movq %rax, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movl %r14d, 0x18(%rbx)
movl %ebp, 0x1c(%rbx)
jmp 0x153c4
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x153c4
leaq 0xe985(%rip), %rsi      # 0x23d28
leaq 0xec87(%rip), %rdx      # 0x24031
leaq 0xe4f2(%rip), %r8       # 0x238a3
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x741, %ecx            # imm = 0x741
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: rbcmp
static int rbcmp(const void* a, const void* b)
{
	pool_key_t* x = (pool_key_t*)a;
	pool_key_t* y = (pool_key_t*)b;
	int r;
	if (x->addr.addr.ss_family != y->addr.addr.ss_family)
		r = ((int)x->addr.addr.ss_family) - ((int)y->addr.addr.ss_family);
	else if (x->addr.addr.ss_family != AF_INET) {
		r = memcmp(
			&((struct sockaddr_in*)(&x->addr.addr))->sin_addr,
			&((struct sockaddr_in*)&y->addr.addr)->sin_addr,
			4);
	}
	else {
		r = memcmp(
			&((struct sockaddr_in6*)(&x->addr.addr))->sin6_addr,
			&((struct sockaddr_in6*)&y->addr.addr)->sin6_addr,
			16);
	}

	if (r == 0) {
		r = x->use_proxy - y->use_proxy;
	}

	return r;
}

// Assembly:
movzwl (%rdi), %eax
movzwl (%rsi), %ecx
cmpw %cx, %ax
jne 0x15416
cmpl $0x2, %eax
jne 0x1541a
movq 0x8(%rdi), %rcx
bswapq %rcx
movq 0x8(%rsi), %rdx
bswapq %rdx
cmpq %rdx, %rcx
jne 0x1540a
movq 0x10(%rdi), %rcx
movq 0x10(%rsi), %rdx
bswapq %rcx
bswapq %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x1542e
xorl %eax, %eax
cmpq %rdx, %rcx
sbbl %eax, %eax
orl $0x1, %eax
jmp 0x1542e
subl %ecx, %eax
jmp 0x1542e
movl 0x4(%rdi), %ecx
movl 0x4(%rsi), %edx
bswapl %ecx
bswapl %edx
xorl %eax, %eax
cmpl %edx, %ecx
seta %al
sbbl $0x0, %eax
testl %eax, %eax
je 0x15433
retq
movl 0x88(%rdi), %eax
subl 0x88(%rsi), %eax
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: rb_fdset_func
static int rb_fdset_func(rbtree_t* tree, rbnode_t* n, void* state)
{
	http_fdset_state* st = (http_fdset_state*)state;
	http_pool_item_t* pi = rbtree_container_of(n, http_pool_item_t, rbn);
	/* "fly" should be first, then "idle", then "busy". */
	/* otherwise, some connection maybe processed twice. */
	dl_fdset_func(&pi->fly_conns, st);
	dl_fdset_func(&pi->idle_conns, st);
	dl_fdset_func(&pi->busy_conns, st);
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq -0x20(%rsi), %rdi
movq %rdx, %rsi
callq 0x16ff4
leaq -0x40(%r14), %rdi
movq %rbx, %rsi
callq 0x16ff4
addq $-0x30, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16ff4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: rb_step_func
static int rb_step_func(rbtree_t* tree, rbnode_t* n, void* state)
{
	http_step_state* st = (http_step_state*)state;
	http_pool_item_t* pi = rbtree_container_of(n, http_pool_item_t, rbn);
	dl_step_func(&pi->idle_conns, st);
	dl_step_func(&pi->busy_conns, st);
	dl_step_func(&pi->fly_conns, st);
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq -0x40(%rsi), %rdi
movq %rdx, %rsi
callq 0x17156
leaq -0x30(%r14), %rdi
movq %rbx, %rsi
callq 0x17156
addq $-0x20, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17156
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/http.c
// Function: http_ssl_handshake
static int http_ssl_handshake(http_ctx_t* ctx, http_conn_t* conn)
{
	int r;
	int err;
	conn->conn.status = cs_ssl_handshaking;
	r = SSL_connect(conn->ssl);
	if (r == 1) {
		/* connected */
		conn->conn.status = cs_ssl_handshaked;
		http_move_to_busy(conn);
		logd("ssl handshaked\n");
		return 0;
	}

	if (r == -1) {
		err = SSL_get_error(conn->ssl, r);
		if (err == SSL_ERROR_WANT_READ) {
			conn->conn.status = cs_ssl_handshaking_want_read;
			return 0;
		}
		else if (err == SSL_ERROR_WANT_WRITE) {
			conn->conn.status = cs_ssl_handshaking_want_write;
			return 0;
		}
		else {
			loge("errno=%d, %s\n",
				err, http_ssl_errstr(err));
			if (err == SSL_ERROR_SYSCALL) {
				while ((err = ERR_get_error()) != 0) {
					loge("errno=%d, %s\n",
						err, ERR_error_string(err, NULL));
				}
			}
		}
	}

	if (r != 0) {
		SSL_shutdown(conn->ssl);
	}

	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0xe, 0x48(%rdi)
movq 0x78(%rdi), %rdi
callq 0x34f0
movl %eax, %ebp
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x16af7
testl %ebp, %ebp
je 0x16be2
cmpl $0x1, %ebp
jne 0x16bd9
movl $0x11, 0x48(%r14)
movq %r14, %rdi
callq 0x17be8
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17d59
cmpl $0x7, (%rax)
jl 0x16be2
leaq 0xd257(%rip), %rsi      # 0x23d28
leaq 0xd5d5(%rip), %rdx      # 0x240ad
leaq 0xda04(%rip), %r8       # 0x244e3
xorl %ebx, %ebx
movl $0x7, %edi
movl $0x399, %ecx            # imm = 0x399
xorl %eax, %eax
callq 0x17d92
jmp 0x16be2
movq 0x78(%r14), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3030
cmpl $0x3, %eax
je 0x16b1c
movl %eax, %r15d
cmpl $0x2, %eax
jne 0x16b2b
movl $0xf, 0x48(%r14)
jmp 0x16b24
movl $0x10, 0x48(%r14)
xorl %ebx, %ebx
jmp 0x16be2
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x16b6c
movl %r15d, %edi
callq 0x1776e
movq %rax, (%rsp)
leaq 0xd1de(%rip), %rsi      # 0x23d28
leaq 0xd55c(%rip), %rdx      # 0x240ad
leaq 0xcdba(%rip), %r8       # 0x23912
movl $0x3, %edi
movl $0x3a9, %ecx            # imm = 0x3A9
movl %r15d, %r9d
xorl %eax, %eax
callq 0x17d92
cmpl $0x5, %r15d
jne 0x16bd5
callq 0x34a0
movq %rax, %r15
testl %r15d, %r15d
je 0x16bd5
leaq 0xd527(%rip), %r13      # 0x240ad
leaq 0xcd85(%rip), %r12      # 0x23912
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0x16bc8
movslq %r15d, %rdi
xorl %esi, %esi
callq 0x3120
movq %rax, (%rsp)
movl $0x3, %edi
leaq 0xd175(%rip), %rsi      # 0x23d28
movq %r13, %rdx
movl $0x3ad, %ecx            # imm = 0x3AD
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x17d92
callq 0x34a0
movq %rax, %r15
testl %r15d, %r15d
jne 0x16b8d
testl %ebp, %ebp
je 0x16bf3
movq 0x78(%r14), %rdi
callq 0x3410
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x16be2