LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_doh.c
// Function: destroy
static void destroy(channel_t* ctx)
{
	channel_doh_t* c = (channel_doh_t*)ctx;
	dlitem_t* cur, * nxt;
	channel_req_t* req;

	/* Destroy http first */
	http_destroy(c->http);

	dllist_foreach(&c->reqs, cur, nxt,
		channel_req_t, req, entry) {
		dllist_remove(&req->entry);
		if (req->callback)
			req->callback(ctx, -1, NULL, FALSE, FALSE, req->cb_state);
		myreq_destroy(req);
	}
	
	free(c->host);
	free(c->path);
	free(c->china_net.name);
	free(c->foreign_net.name);
	free(c->china_net6.name);
	free(c->foreign_net6.name);
	free(c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0x1412a
leaq 0x58(%rbx), %r15
movq 0x58(%rbx), %r14
pushq $-0x1
popq %rbp
cmpq %r15, %r14
je 0xc745
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 0xc734
movq -0x8(%r14), %r9
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
addq $-0x28, %r14
movq %r14, %rdi
callq 0xccb6
movq %r12, %r14
jmp 0xc703
movq 0x120(%rbx), %rdi
callq 0x3460
movq 0x128(%rbx), %rdi
callq 0x3460
movq 0x148(%rbx), %rdi
callq 0x3460
movq 0x1e0(%rbx), %rdi
callq 0x3460
movq 0x278(%rbx), %rdi
callq 0x3460
movq 0x310(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_doh.c
// Function: myreq_new
static channel_req_t* myreq_new(
	channel_doh_t *ctx,
	const ns_msg_t* msg,
	channel_query_cb callback, void* cb_state)
{
	channel_req_t* req;

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

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

	req->req_id = new_req_id(ctx);
	req->id = msg->id;
	req->flags = msg->flags;
	req->qr = msg->qrs[0];
	req->qr.qname = strdup(msg->qrs[0].qname);
	req->callback = callback;
	req->cb_state = cb_state;
	req->rbn.key = &req->req_id;
	req->ctx = ctx;

	return req;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
pushq $0x1
popq %rdi
movl $0x80, %esi
callq 0x3250
movq %rax, %rbx
testq %rax, %rax
je 0xc8c8
movq %r12, 0x8(%rsp)
movq %r14, 0x10(%rsp)
leaq 0x68(%r15), %rbp
movl $0x7fff, %r12d          # imm = 0x7FFF
leaq 0x6(%rsp), %r14
callq 0x30f0
cltd
idivl %r12d
movw %dx, 0x6(%rsp)
testw %dx, %dx
je 0xc863
movq %rbp, %rdi
movq %r14, %rsi
callq 0x38ef
testq %rax, %rax
jne 0xc863
movzwl 0x6(%rsp), %eax
movw %ax, (%rbx)
movl (%r13), %eax
movl %eax, 0x2(%rbx)
movq 0x10(%r13), %rax
movups (%rax), %xmm0
movups %xmm0, 0x8(%rbx)
movq (%rax), %rdi
callq 0x3620
movq %rax, 0x8(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rbx)
movq %rbx, 0x38(%rbx)
movq %r15, 0x60(%rbx)
jmp 0xc8f6
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xc8f6
leaq 0x1472e(%rip), %rsi     # 0x21009
leaq 0x143c3(%rip), %rdx     # 0x20ca5
leaq 0x14fca(%rip), %r8      # 0x218b3
pushq $0x3
popq %rdi
pushq $0x54
popq %rcx
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_doh.c
// Function: build_request_nsmsg
static int build_request_nsmsg(ns_msg_t* msg, channel_req_t* req)
{
	init_ns_msg(msg);

	msg->id = req->req_id;
	msg->flags = req->flags;
	msg->qdcount = 1;
	msg->qrs = ns_qr_clone(&req->qr, 1);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x18296
movzwl (%rbx), %eax
movw %ax, (%r14)
movzwl 0x4(%rbx), %eax
movw %ax, 0x2(%r14)
movw $0x1, 0x4(%r14)
addq $0x8, %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x182e8
movq %rax, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_doh.c
// Function: get_nsmsg_flags
static int get_nsmsg_flags(channel_doh_t* ctx, ns_msg_t* msg)
{
	int i, rrcount, flags = 0;
	ns_rr_t* rr;

	rrcount = msg->ancount + msg->nscount;
	for (i = 0; i < rrcount; i++) {
		rr = msg->rrs + i;
		flags |= get_rr_flags(ctx, rr, i);
	}

	rrcount = ns_rrcount(msg);
	for (; i < rrcount; i++) {
		rr = msg->rrs + i;
		flags |= get_rr_flags(ctx, rr, i);
	}

	return flags;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x6(%rsi), %eax
movzwl 0x8(%rsi), %r15d
addq %rax, %r15
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
cmpq %r12, %r15
je 0xdad7
movq 0x18(%rbx), %rsi
addq %r13, %rsi
movq %r14, %rdi
movl %r12d, %edx
callq 0xdb24
orl %eax, %ebp
incq %r12
addq $0x20, %r13
jmp 0xdab5
movzwl 0x6(%rbx), %eax
movzwl 0x8(%rbx), %ecx
addq %rax, %rcx
movzwl 0xa(%rbx), %r12d
addq %rcx, %r12
movl %r15d, %r13d
shll $0x5, %r13d
cmpq %r12, %r15
jae 0xdb13
movq 0x18(%rbx), %rsi
addq %r13, %rsi
movq %r14, %rdi
movl %r15d, %edx
callq 0xdb24
orl %eax, %ebp
incq %r15
addq $0x20, %r13
jmp 0xdaf1
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_O2/GangZhuo[P]dohclient/src/channel_os.c
// Function: channel_os_create
int channel_os_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)
{
	channel_os_t* ctx;

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

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

	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;

	*pctx = (channel_t*)ctx;

	return CHANNEL_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebp
movq %r8, %r14
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %rbx
pushq $0x1
popq %rdi
pushq $0x58
popq %rsi
callq 0x3250
testq %rax, %rax
je 0xdcff
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rsi
movq %r12, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %ebp, 0x18(%rax)
movq %rsi, 0x20(%rax)
movq %rdx, 0x28(%rax)
movq %rcx, 0x50(%rax)
leaq 0x6c(%rip), %rcx        # 0xdd3f
movq %rcx, 0x30(%rax)
leaq 0x64(%rip), %rcx        # 0xdd42
movq %rcx, 0x38(%rax)
leaq 0x5c(%rip), %rcx        # 0xdd45
movq %rcx, 0x40(%rax)
leaq 0x245(%rip), %rcx       # 0xdf39
movq %rcx, 0x48(%rax)
movq %rax, (%rbx)
xorl %ebx, %ebx
jmp 0xdd34
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0xdd31
leaq 0x1349e(%rip), %rsi     # 0x211b0
leaq 0x134a8(%rip), %rdx     # 0x211c1
leaq 0x13b93(%rip), %r8      # 0x218b3
pushq $0x3
popq %rbx
pushq $0x6b
popq %rcx
movl %ebx, %edi
xorl %eax, %eax
callq 0x1662e
jmp 0xdd34
pushq $0x3
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: req_destroy
static void req_destroy(tcpreq_t* req)
{
	dlitem_t *cur, *nxt;
	reqconn_t *conn;
	dllist_foreach(&req->conns, cur, nxt,
		reqconn_t, conn, conn.entry) {
		dllist_init_remove(&conn->conn.entry);
		reqconn_destroy(conn);
	}
	free(req->qr.qname);
	free(req);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
movq 0x48(%rdi), %rax
cmpq %r14, %rax
je 0xe5d7
leaq -0x40(%rax), %rdi
movq (%rax), %r15
movq 0x8(%rax), %rcx
movq %r15, (%rcx)
movq %rcx, 0x8(%r15)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
callq 0xf1b9
movq %r15, %rax
jmp 0xe5b0
movq 0x8(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: fdset
static sock_t fdset(channel_t* ctx,
	fd_set* readset, fd_set* writeset, fd_set* errorset)
{
	channel_tcp_t *c = (channel_tcp_t*)ctx;
	dlitem_t *cur, *nxt;
	tcpreq_t *req;
	sock_t maxfd = 0, fd;
	dllist_foreach(&c->reqs, cur, nxt, tcpreq_t, req, entry) {
		if (!req->is_closing) {
			fd = req_fdset(ctx, req, readset, writeset, errorset);
			maxfd = MAX(maxfd, fd);
		}
	}
	return maxfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r8
movq %rdx, %r9
movq 0x58(%rdi), %r14
addq $0x58, %rdi
xorl %eax, %eax
movl $0x40, %r10d
movabsq $0x1, %r15
movl $0x1940, %ebp           # imm = 0x1940
cmpq %rdi, %r14
je 0xea62
movq %r14, %r12
movq (%r14), %r14
cmpl $0x0, 0x28(%r12)
jne 0xe959
movl %eax, -0x4(%rsp)
movq 0x18(%r12), %rbx
addq $0x18, %r12
xorl %r13d, %r13d
cmpq %r12, %rbx
je 0xea52
movq %rbx, %r11
movq (%rbx), %rbx
movl -0x8(%r11), %eax
movl %eax, %ecx
andl $-0x5, %ecx
cmpl $0x9, %ecx
je 0xea0c
cmpl $0x2, %eax
jne 0xe9a9
cmpl $0x0, 0x28(%r11)
je 0xea0c
cmpl $0xc, %eax
ja 0xe980
btl %eax, %ebp
jb 0xe9e7
movl $0x4a0, %ecx            # imm = 0x4A0
btl %eax, %ecx
jb 0xe9c2
cmpl $0x1, %eax
jne 0xe980
movl -0x40(%r11), %ecx
cmpl %ecx, %r13d
cmovlel %ecx, %r13d
movl %ecx, %eax
cltd
idivl %r10d
movslq %eax, %rdx
shll $0x6, %eax
subl %eax, %ecx
movq %r15, %rax
shlq %cl, %rax
orq %rax, (%r9,%rdx,8)
jmp 0xea49
movl -0x40(%r11), %ecx
cmpl %ecx, %r13d
cmovlel %ecx, %r13d
movl %ecx, %eax
cltd
idivl %r10d
movslq %eax, %rdx
shll $0x6, %eax
subl %eax, %ecx
movq %r15, %rax
shlq %cl, %rax
orq %rax, (%rsi,%rdx,8)
jmp 0xea49
movl -0x40(%r11), %ecx
movq %r9, %rbp
movl -0x18(%r11), %r9d
cmpl %ecx, %r13d
cmovlel %ecx, %r13d
movl %ecx, %eax
cltd
idivl %r10d
movslq %eax, %rdx
shll $0x6, %eax
subl %eax, %ecx
movq %r15, %rax
shlq %cl, %rax
cmpl -0x14(%r11), %r9d
movq %rbp, %r9
movl $0x1940, %ebp           # imm = 0x1940
movq %rsi, %rcx
cmovgq %r9, %rcx
orq %rax, (%rcx,%rdx,8)
orq %rax, (%r8,%rdx,8)
jmp 0xe980
movl -0x4(%rsp), %eax
cmpl %r13d, %eax
cmovlel %r13d, %eax
jmp 0xe959
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x58(%rdi), %r15
movq 0x58(%rdi), %r14
pushq $-0x1
popq %rbp
cmpq %r15, %r14
je 0xf1a9
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 0xf198
movq -0x8(%r14), %r9
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
addq $-0x30, %r14
movq %r14, %rdi
callq 0xe5a0
movq %r12, %r14
jmp 0xf167
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %r8
movl 0x500(%rdi), %eax
xorl %r11d, %r11d
testl %eax, %eax
cmovlel %r11d, %eax
imulq $0x90, %rax, %rbx
movl $0x40, %ebp
movabsq $0x1, %r14
xorl %r9d, %r9d
cmpq %r11, %rbx
je 0x105a3
movl 0x108(%rdi,%r11), %r10d
movl %r10d, %eax
cltd
idivl %ebp
movslq %eax, %rdx
shll $0x6, %eax
movl %r10d, %ecx
subl %eax, %ecx
movq %r14, %rax
shlq %cl, %rax
orq %rax, (%rsi,%rdx,8)
orq %rax, (%r8,%rdx,8)
cmpl %r10d, %r9d
cmovlel %r10d, %r9d
addq $0x90, %r11
jmp 0x10567
movl %r9d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x58(%rdi), %r15
movq 0x58(%rdi), %r14
pushq $-0x1
popq %rbp
cmpq %r15, %r14
je 0x10a65
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 0x10a54
movq -0x8(%r14), %r9
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%rax
andq $0x0, -0x10(%r14)
addq $-0x30, %r14
movq %r14, %rdi
callq 0x100db
movq %r12, %r14
jmp 0x10a1e
movl 0x500(%rbx), %eax
testl %eax, %eax
jle 0x10a9a
leaq 0x108(%rbx), %r14
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x10a9a
movl (%r14), %edi
callq 0x3680
incq %r15
movl 0x500(%rbx), %eax
addq $0x90, %r14
jmp 0x10a79
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x3250
testq %rax, %rax
je 0x10d37
movq %rax, %rbx
movl %ebp, (%rax)
cmpl $0xa, %ebp
je 0x10d6b
cmpl $0x2, %ebp
jne 0x10d75
movl (%r14), %eax
movl %eax, 0x4(%rbx)
jmp 0x10db0
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x10db0
leaq 0x109ca(%rip), %rsi     # 0x21716
leaq 0x10a3f(%rip), %rdx     # 0x21792
leaq 0x10b59(%rip), %r8      # 0x218b3
xorl %ebx, %ebx
pushq $0x3
popq %rdi
pushq $0x2d
popq %rcx
xorl %eax, %eax
callq 0x1662e
jmp 0x10db0
movups (%r14), %xmm0
movups %xmm0, 0x4(%rbx)
jmp 0x10db0
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x10da6
leaq 0x1098e(%rip), %rsi     # 0x21716
leaq 0x10a03(%rip), %rdx     # 0x21792
leaq 0x10a07(%rip), %r8      # 0x2179d
pushq $0x3
popq %rdi
pushq $0x3c
popq %rcx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rdi
callq 0x3460
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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)
pushq $0x1
popq %rdi
pushq $0x68
popq %rsi
callq 0x3250
testq %rax, %rax
je 0x10eac
movq %rax, %r15
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
leaq 0xf1(%rip), %rsi        # 0x10ef4
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 0xd0(%rip), %rax        # 0x10ef9
movq %rax, 0x30(%r15)
leaq 0xc8(%rip), %rax        # 0x10efc
movq %rax, 0x38(%r15)
leaq 0xc0(%rip), %rax        # 0x10eff
movq %rax, 0x40(%r15)
leaq 0x2f1(%rip), %rax       # 0x1113b
movq %rax, 0x48(%r15)
testq %rbx, %rbx
je 0x10ea1
leaq 0x300(%rip), %rsi       # 0x1115a
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1c9ca
testl %eax, %eax
je 0x10ea1
xorl %eax, %eax
callq 0x165f5
pushq $0x2
popq %rbp
cmpl $0x3, (%rax)
jl 0x10ee3
leaq 0x10897(%rip), %rsi     # 0x21716
leaq 0x108f0(%rip), %rdx     # 0x21776
leaq 0xfa30(%rip), %r8       # 0x208bd
pushq $0x3
popq %rdi
movl $0x1cc, %ecx            # imm = 0x1CC
movq %rbx, %r9
xorl %eax, %eax
callq 0x1662e
jmp 0x10ee3
movq (%rsp), %rax
movq %r15, (%rax)
xorl %ebp, %ebp
jmp 0x10ee3
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x10ee0
leaq 0x10857(%rip), %rsi     # 0x21716
leaq 0x108b0(%rip), %rdx     # 0x21776
leaq 0x109e6(%rip), %r8      # 0x218b3
pushq $0x3
popq %rbp
movl %ebp, %edi
movl $0x1b5, %ecx            # imm = 0x1B5
xorl %eax, %eax
callq 0x1662e
jmp 0x10ee3
pushq $0x3
popq %rbp
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_O2/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 0x1157a
movl (%rdi), %r8d
testl %r8d, %r8d
je 0x1157a
decl %r8d
movl (%rsi), %ecx
bswapl %ecx
movq 0x8(%rdi), %rsi
xorl %edi, %edi
pushq $0x2
popq %r9
movl %edi, %eax
cmpl %r8d, %eax
je 0x11568
movl %eax, %edi
leal (%rdi,%r8), %eax
cltd
idivl %r9d
movslq %eax, %rdx
cmpl (%rsi,%rdx,8), %ecx
jb 0x1155e
cmpl %eax, %edi
jne 0x11541
jmp 0x1156b
cmpl %eax, %r8d
movl %eax, %r8d
jne 0x1153f
jmp 0x1156b
movl %r8d, %edi
movslq %edi, %rdx
andl 0x4(%rsi,%rdx,8), %ecx
xorl %eax, %eax
cmpl (%rsi,%rdx,8), %ecx
sete %al
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1165d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x10(%rdi), %ebx
testl %ebx, %ebx
je 0x1164f
movups (%rsi), %xmm0
movaps %xmm0, (%rsp)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x115d6
movl (%rsp,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rsp,%rax,4)
incq %rax
jmp 0x115c3
decl %ebx
movq 0x18(%rdi), %r15
xorl %r12d, %r12d
pushq $0x2
popq %rbp
movq %rsp, %r14
movl %ebx, %r13d
movl %r12d, %ebx
cmpl %r13d, %ebx
je 0x11620
movl %ebx, %r12d
leal (%r12,%r13), %eax
cltd
idivl %ebp
movl %eax, %ebx
movslq %eax, %rsi
shlq $0x5, %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x1165e
testl %eax, %eax
js 0x11619
cmpl %ebx, %r12d
jne 0x115eb
jmp 0x11623
cmpl %ebx, %r13d
jne 0x115e5
jmp 0x11623
movl %r13d, %r12d
movslq %r12d, %rax
shlq $0x5, %rax
addq %rax, %r15
xorl %ecx, %ecx
pushq $0x1
popq %rax
cmpq $0x4, %rcx
je 0x1164f
movl 0x10(%r15,%rcx,4), %edx
andl (%rsp,%rcx,4), %edx
leaq 0x1(%rcx), %rsi
cmpl (%r15,%rcx,4), %edx
movq %rsi, %rcx
je 0x11632
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/chnroute.c
// Function: cmp_net_mask6
static int cmp_net_mask6(const void* a, const void* b)
{
	const net_mask6_t* x = a;
	const net_mask6_t* y = b;
	int i;
	for (i = 0; i < 4; i++) {
		if (x->net[i] < y->net[i]) return -1;
		else if (x->net[i] > y->net[i]) return 1;
	}
	return 0;
}

// Assembly:
xorl %eax, %eax
pushq $-0x1
popq %rcx
pushq $0x1
popq %rdx
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x11686
movl (%rdi,%r8,4), %r9d
movl (%rsi,%r8,4), %r10d
cmpl %r10d, %r9d
jb 0x11687
incq %r8
cmpl %r10d, %r9d
jbe 0x11669
movl %edx, %eax
retq
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x116b0
movzwl (%rsi), %eax
cmpl $0xa, %eax
je 0x116b3
cmpl $0x2, %eax
jne 0x116b0
addq $0x4, %rsi
jmp 0x11514
xorl %eax, %eax
retq
addq $0x8, %rsi
jmp 0x1158b
// File: /workspace/github_c_makefile_star2_O2/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 0x11d11
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x3460
movq 0x18(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
popq %rbx
jmp 0x3460
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 %r12d, %r12d
movq %rdi, %rax
addq %r12, %rax
je 0x12006
cmpq $0x0, (%rax)
je 0x12006
addq $0x8, %r12
jmp 0x11ff2
leaq 0x10(%r12), %rsi
callq 0x35c0
testq %rax, %rax
je 0x12032
movq %rax, %r15
movq %rax, 0x70(%r14)
movq %rbx, %rdi
callq 0x3620
movq %rax, (%r15,%r12)
andq $0x0, 0x8(%r15,%r12)
xorl %ebx, %ebx
jmp 0x12063
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x12063
leaq 0xfa35(%rip), %rsi      # 0x21a7d
leaq 0xfbd5(%rip), %rdx      # 0x21c24
leaq 0xf85d(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
pushq $0x1e
popq %rcx
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12d, %r12d
movq %rdi, %rax
addq %r12, %rax
je 0x1209a
cmpq $0x0, (%rax)
je 0x1209a
addq $0x8, %r12
jmp 0x12086
leaq 0x10(%r12), %rsi
callq 0x35c0
testq %rax, %rax
je 0x120c6
movq %rax, %r15
movq %rax, 0x78(%r14)
movq %rbx, %rdi
callq 0x3620
movq %rax, (%r15,%r12)
andq $0x0, 0x8(%r15,%r12)
xorl %ebx, %ebx
jmp 0x120f7
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x120f7
leaq 0xf9a1(%rip), %rsi      # 0x21a7d
leaq 0xfb52(%rip), %rdx      # 0x21c35
leaq 0xf7c9(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
pushq $0x38
popq %rcx
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
cmpq $0x0, (%rdi)
jne 0x12121
leaq 0xf905(%rip), %rdi      # 0x21a1e
callq 0x3620
movq %rax, (%r14)
cmpq $0x0, 0x8(%r14)
jne 0x12138
leaq 0xe928(%rip), %rdi      # 0x20a57
callq 0x3620
movq %rax, 0x8(%r14)
cmpl $0x0, 0x88(%r14)
jg 0x1214d
movl $0x5, 0x88(%r14)
cmpl $0x0, 0x8c(%r14)
jns 0x12162
movl $0x1, 0x8c(%r14)
cmpl $0x0, 0x80(%r14)
jns 0x12177
movl $0x1, 0x80(%r14)
cmpq $0x0, 0x70(%r14)
pushq $-0x1
popq %rbx
je 0x1220d
cmpq $0x0, 0x78(%r14)
je 0x12225
cmpq $0x0, 0x50(%r14)
jne 0x121a7
leaq 0xf8c7(%rip), %rdi      # 0x21a65
callq 0x3620
movq %rax, 0x50(%r14)
movq 0x70(%r14), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x121c0
cmpq $0x0, (%rcx)
je 0x121c0
incl %eax
addq $0x8, %rcx
jmp 0x121ad
movq 0x78(%r14), %rcx
testq %rcx, %rcx
je 0x121d7
cmpq $0x0, (%rcx)
je 0x121d7
addq $0x8, %rcx
decl %eax
jmp 0x121c4
testl %eax, %eax
je 0x1223d
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x1223f
leaq 0xf88f(%rip), %rsi      # 0x21a7d
leaq 0xf895(%rip), %rdx      # 0x21a8a
leaq 0xf899(%rip), %r8       # 0x21a95
pushq $0x3
popq %rdi
movl $0xe4, %ecx
xorl %eax, %eax
callq 0x1662e
jmp 0x1223f
leaq 0xe3db(%rip), %rsi      # 0x205ef
movq %r14, %rdi
callq 0x11fdd
testl %eax, %eax
jne 0x1223f
jmp 0x12185
leaq 0xf7fa(%rip), %rsi      # 0x21a26
movq %r14, %rdi
callq 0x12071
testl %eax, %eax
jne 0x1223f
jmp 0x12190
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3460
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
callq 0x3460
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x3460
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0x3460
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x3460
andq $0x0, 0x20(%rbx)
movq 0x28(%rbx), %rdi
callq 0x3460
andq $0x0, 0x28(%rbx)
movq 0x38(%rbx), %rdi
callq 0x3460
andq $0x0, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x3460
andq $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
callq 0x3460
andq $0x0, 0x48(%rbx)
movq 0x30(%rbx), %rdi
callq 0x3460
andq $0x0, 0x30(%rbx)
movq 0x50(%rbx), %rdi
callq 0x3460
andq $0x0, 0x50(%rbx)
movq 0x58(%rbx), %rdi
callq 0x3460
andq $0x0, 0x58(%rbx)
movq 0x68(%rbx), %rdi
callq 0x3460
andq $0x0, 0x68(%rbx)
movq 0x60(%rbx), %rdi
callq 0x3460
andq $0x0, 0x60(%rbx)
movq 0x78(%rbx), %r14
testq %r14, %r14
je 0x12fb4
movq (%r14), %rdi
testq %rdi, %rdi
je 0x12fb4
callq 0x3460
addq $0x8, %r14
jmp 0x12f9c
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x12fd0
movq (%r14), %rdi
testq %rdi, %rdi
je 0x12fd0
callq 0x3460
addq $0x8, %r14
jmp 0x12fb8
movq 0x78(%rbx), %rdi
callq 0x3460
andq $0x0, 0x78(%rbx)
movq 0x70(%rbx), %rdi
callq 0x3460
andq $0x0, 0x70(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13228
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x20(%rdi)
jle 0x13208
movq 0x18(%rbx), %rdi
callq 0x3460
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1321f
callq 0x188ce
movq 0x8(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
popq %rbx
jmp 0x3460
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
pushq $0x68
popq %rsi
callq 0x3250
movq %rax, %rbx
testq %rax, %rax
je 0x13279
movq %rbx, %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 0x132a9
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x132a9
leaq 0xeaa8(%rip), %rsi      # 0x21d34
leaq 0xeaac(%rip), %rdx      # 0x21d3f
leaq 0xe619(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
movl $0x106, %ecx            # imm = 0x106
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13312
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x132d3
andq $0x0, 0xa0(%rax)
leaq 0x18(%rbx), %r14
movq 0x18(%rbx), %rax
cmpq %r14, %rax
je 0x132fc
leaq -0x10(%rax), %rdi
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %r15, (%rax)
movq %rax, 0x8(%r15)
callq 0x3460
movq %r15, %rax
jmp 0x132db
movq 0x50(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3460
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x13313
testq %rax, %rax
je 0x1338f
movq %r14, 0x8(%rax)
jmp 0x133c4
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x3250
testq %rax, %rax
je 0x13416
movq %r15, (%rax)
movq %r14, 0x8(%rax)
leaq 0x18(%rbx), %rcx
movq %rax, %rdx
addq $0x10, %rdx
movq %rcx, 0x10(%rax)
movq 0x20(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rdx, (%rcx)
movq %rdx, 0x20(%rbx)
leaq 0xe9a0(%rip), %rsi      # 0x21d6b
movq %r15, %rdi
callq 0x34f0
testl %eax, %eax
jne 0x133db
movq %r14, 0x10(%rbx)
leaq 0xe98e(%rip), %rsi      # 0x21d70
movq %r15, %rdi
callq 0x34f0
xorl %ebp, %ebp
testl %eax, %eax
jne 0x13409
leaq 0xd6da(%rip), %rsi      # 0x20ad1
movq %r14, %rdi
callq 0x34f0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x34(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0x13409
leaq 0xe908(%rip), %rsi      # 0x21d34
leaq 0xe920(%rip), %rdx      # 0x21d53
leaq 0xe479(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
movl $0x14c, %ecx            # imm = 0x14C
xorl %eax, %eax
callq 0x1662e
jmp 0x13409
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq %rsi, %rbx
movq %rsi, 0x10(%rdi)
leaq 0xe8b3(%rip), %rsi      # 0x21d6b
callq 0x13313
testq %rax, %rax
je 0x134c6
movq %rbx, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
addq $0x18, %rdi
callq 0x13523
testl %eax, %eax
je 0x1351d
movq %r14, %rcx
orq %rbx, %rcx
je 0x1351d
movq (%r15), %rcx
testq %r14, %r14
je 0x13511
movq -0x10(%rcx), %rdx
movq %rdx, (%r14)
testq %rbx, %rbx
je 0x1351d
movq -0x8(%rcx), %rcx
movq %rcx, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/dllist.h
// Function: dliterator_next
static inline int dliterator_next(struct dllist_t* list, struct dliterator_t* iterator)
{
    if (!iterator->cur) {
        iterator->cur = dllist_start(list);
        iterator->nxt = iterator->cur->next;
    }
    else {
        iterator->cur = iterator->nxt;
        iterator->nxt = iterator->cur->next;
    }
    return !dllist_is_end(list, iterator->cur);
}

// Assembly:
cmpq $0x0, (%rsi)
je 0x1352f
movq 0x8(%rsi), %rcx
jmp 0x13532
movq (%rdi), %rcx
movq %rcx, (%rsi)
movq (%rcx), %rax
movq %rax, 0x8(%rsi)
xorl %eax, %eax
cmpq %rdi, %rcx
setne %al
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x13545
cmpl $-0x1, %eax
je 0x1381b
movq (%rbx), %rdi
leaq 0xc5ba(%rip), %rsi      # 0x1fdc2
callq 0x34f0
testl %eax, %eax
je 0x13858
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x1384e
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x1384e
leaq 0xe503(%rip), %rsi      # 0x21d34
leaq 0xe5c7(%rip), %rdx      # 0x21dff
leaq 0xe5d7(%rip), %r8       # 0x21e16
pushq $0x3
popq %rdi
movl $0x206, %ecx            # imm = 0x206
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x30(%rbx), %edx
testl %edx, %edx
jle 0x13811
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x1be74
cmpl $-0x1, %eax
jne 0x13811
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x1384e
leaq 0xe4ae(%rip), %rsi      # 0x21d34
leaq 0xe572(%rip), %rdx      # 0x21dff
leaq 0xd6e3(%rip), %r8       # 0x20f77
pushq $0x3
popq %rdi
movl $0x20d, %ecx            # imm = 0x20D
jmp 0x13847
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
pushq $0x40
popq %rsi
callq 0x3250
movq %rax, %rbx
testq %rax, %rax
je 0x138cc
leaq 0x10(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
addq $0x20, %rdi
callq 0x1b898
jmp 0x138fc
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x138fc
leaq 0xe455(%rip), %rsi      # 0x21d34
leaq 0xe552(%rip), %rdx      # 0x21e38
leaq 0xdfc6(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
movl $0x21c, %ecx            # imm = 0x21C
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1398d
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x13927
andq $0x0, 0xa8(%rax)
leaq 0x10(%rbx), %r15
movq 0x10(%rbx), %r12
cmpq %r15, %r12
je 0x1396a
leaq -0x10(%r12), %r14
movq (%r12), %r13
movq 0x8(%r12), %rax
movq %r13, (%rax)
movq %rax, 0x8(%r13)
movq -0x10(%r12), %rdi
callq 0x3460
movq -0x8(%r12), %rdi
callq 0x3460
movq %r14, %rdi
callq 0x3460
movq %r13, %r12
jmp 0x1392f
movq 0x8(%rbx), %rdi
callq 0x3460
leaq 0x20(%rbx), %rdi
callq 0x1b8a6
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3460
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x3250
testq %rax, %rax
je 0x13a47
movq %rax, %r15
movq %r12, %rdi
callq 0x3620
movq %rax, (%r15)
movq %r14, %rdi
callq 0x3620
movq %rax, 0x8(%r15)
leaq 0x10(%rbx), %rax
movq %r15, %rcx
addq $0x10, %rcx
movq %rax, 0x10(%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r15)
movq %rcx, (%rax)
movq %rcx, 0x18(%rbx)
xorl %ebx, %ebx
jmp 0x13a7a
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x13a7a
leaq 0xe2d7(%rip), %rsi      # 0x21d34
leaq 0xe3e9(%rip), %rdx      # 0x21e4d
leaq 0xde48(%rip), %r8       # 0x218b3
pushq $0x3
popq %rdi
movl $0x25e, %ecx            # imm = 0x25E
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
callq 0x1398e
testq %rax, %rax
je 0x13ac9
movq %rax, %r14
movq 0x8(%rax), %rdi
callq 0x3460
movq %rbx, %rdi
callq 0x3620
movq %rax, 0x8(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x139ea
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
addq $0x10, %rdi
callq 0x13523
testl %eax, %eax
je 0x13b30
movq %r14, %rcx
orq %rbx, %rcx
je 0x13b30
movq (%r15), %rcx
testq %r14, %r14
je 0x13b24
movq -0x10(%rcx), %rdx
movq %rdx, (%r14)
testq %rbx, %rbx
je 0x13b30
movq -0x8(%rcx), %rcx
movq %rcx, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1be74
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x13b89
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x13b89
leaq 0xe1c8(%rip), %rsi      # 0x21d34
leaq 0xe2f3(%rip), %rdx      # 0x21e66
leaq 0xe306(%rip), %r8       # 0x21e80
pushq $0x3
popq %rdi
movl $0x298, %ecx            # imm = 0x298
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movzwl (%rsi), %edx
movzwl 0x2(%rsi), %ecx
movl 0x4(%rsi), %r8d
movq 0x8(%rsi), %r9
leaq 0xe2db(%rip), %rsi      # 0x21e92
xorl %eax, %eax
callq 0x1bf2d
cmpl $-0x1, %eax
je 0x13c40
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
leaq 0x8(%rsp), %r12
movq %rsp, %r13
leaq 0xe1e5(%rip), %rbp      # 0x21dc3
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x13af2
testl %eax, %eax
je 0x13c6e
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
movq %r14, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x1bf2d
cmpl $-0x1, %eax
jne 0x13bde
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x13cc2
leaq 0xe10c(%rip), %rsi      # 0x21d34
leaq 0xe276(%rip), %rdx      # 0x21ea5
leaq 0xd341(%rip), %r8       # 0x20f77
pushq $0x3
popq %rdi
movl $0x2b4, %ecx            # imm = 0x2B4
jmp 0x13cbb
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x13cc2
leaq 0xe0de(%rip), %rsi      # 0x21d34
leaq 0xe248(%rip), %rdx      # 0x21ea5
leaq 0xd313(%rip), %r8       # 0x20f77
pushq $0x3
popq %rdi
movl $0x2ac, %ecx            # imm = 0x2AC
jmp 0x13cbb
leaq 0xe187(%rip), %rsi      # 0x21dfc
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x1be74
cmpl $-0x1, %eax
je 0x13c8f
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x13cc2
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x13cc2
leaq 0xe08f(%rip), %rsi      # 0x21d34
leaq 0xe1f9(%rip), %rdx      # 0x21ea5
leaq 0xd2c4(%rip), %r8       # 0x20f77
pushq $0x3
popq %rdi
movl $0x2ba, %ecx            # imm = 0x2BA
xorl %eax, %eax
callq 0x1662e
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq