LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 $0x1, %edi
movl $0x68, %esi
callq 0x3240
movq %rax, %rbx
testq %rax, %rax
je 0x13ea9
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 0x13edb
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x13edb
leaq 0xfe78(%rip), %rsi      # 0x23d34
leaq 0xfe7c(%rip), %rdx      # 0x23d3f
leaq 0xf9e9(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0x106, %ecx            # imm = 0x106
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x13f4a
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x13f08
movq $0x0, 0xa0(%rax)
leaq 0x18(%rbx), %r14
movq 0x18(%rbx), %rax
cmpq %r14, %rax
je 0x13f34
leaq -0x10(%rax), %rdi
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %r15, (%rax)
movq %rax, 0x8(%r15)
callq 0x3450
movq %r15, %rax
cmpq %r14, %r15
jne 0x13f15
movq 0x50(%rbx), %rdi
callq 0x3450
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3450
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r15
addq $0x18, %r15
xorl %ebx, %ebx
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x13fc8
movq -0x10(%r12), %rdi
movq %r14, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x13fa9
movq -0x8(%r12), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %r12, %r13
movq (%r13), %r13
cmpq %r12, %r13
je 0x14011
movq -0x10(%r13), %rdi
movq %r15, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x13ff2
movq %r14, -0x8(%r13)
jmp 0x14046
movl $0x1, %edi
movl $0x20, %esi
callq 0x3240
testq %rax, %rax
je 0x1408d
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, 0x10(%rax)
movq 0x20(%rbx), %rdx
movq %rdx, 0x18(%rax)
movq %rcx, (%rdx)
movq %rcx, 0x20(%rbx)
leaq 0xfd1e(%rip), %rsi      # 0x23d6b
movq %r15, %rdi
callq 0x34e0
testl %eax, %eax
jne 0x1405d
movq %r14, 0x10(%rbx)
leaq 0xfd0c(%rip), %rsi      # 0x23d70
movq %r15, %rdi
callq 0x34e0
xorl %ebp, %ebp
testl %eax, %eax
jne 0x140c4
leaq 0xea58(%rip), %rsi      # 0x22ad1
movq %r14, %rdi
callq 0x34e0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x34(%rbx)
jmp 0x140c4
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x140c4
leaq 0xfc8f(%rip), %rsi      # 0x23d34
leaq 0xfca7(%rip), %rdx      # 0x23d53
leaq 0xf800(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0x14c, %ecx            # imm = 0x14C
xorl %eax, %eax
callq 0x1771e
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_O3/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x10(%rdi)
addq $0x18, %r14
leaq 0xfc1b(%rip), %r15      # 0x23d6b
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x14172
movq -0x10(%r12), %rdi
movq %r15, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x14153
movq %rbx, -0x8(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x141a5
movq 0x8(%rsi), %r8
jmp 0x141a8
movq (%rdi), %r8
movq %r8, (%rsi)
movq (%r8), %rax
movq %rax, 0x8(%rsi)
cmpq %rdi, %r8
je 0x141d7
movq %rdx, %rax
orq %rcx, %rax
je 0x141d7
testq %rdx, %rdx
je 0x141cb
movq -0x10(%r8), %rax
movq %rax, (%rdx)
testq %rcx, %rcx
je 0x141d7
movq -0x8(%r8), %rax
movq %rax, (%rcx)
xorl %eax, %eax
cmpq %rdi, %r8
setne %al
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x141e0
cmpl $-0x1, %eax
je 0x144d4
movq (%rbx), %rdi
leaq 0xd901(%rip), %rsi      # 0x21dc2
callq 0x34e0
testl %eax, %eax
je 0x14515
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x1450b
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1450b
leaq 0xf848(%rip), %rsi      # 0x23d34
leaq 0xf90c(%rip), %rdx      # 0x23dff
leaq 0xf91c(%rip), %r8       # 0x23e16
movl $0x3, %edi
movl $0x206, %ecx            # imm = 0x206
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x30(%rbx), %edx
testl %edx, %edx
jle 0x144ca
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x1d3fd
cmpl $-0x1, %eax
jne 0x144ca
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1450b
leaq 0xf7ef(%rip), %rsi      # 0x23d34
leaq 0xf8b3(%rip), %rdx      # 0x23dff
leaq 0xea24(%rip), %r8       # 0x22f77
movl $0x3, %edi
movl $0x20d, %ecx            # imm = 0x20D
jmp 0x14504
// File: /workspace/github_c_makefile_star2_O3/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 $0x1, %edi
movl $0x40, %esi
callq 0x3240
movq %rax, %rbx
testq %rax, %rax
je 0x14591
leaq 0x10(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
addq $0x20, %rdi
callq 0x1cdb8
jmp 0x145c3
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x145c3
leaq 0xf790(%rip), %rsi      # 0x23d34
leaq 0xf88d(%rip), %rdx      # 0x23e38
leaq 0xf301(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0x21c, %ecx            # imm = 0x21C
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1465a
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x145f1
movq $0x0, 0xa8(%rax)
leaq 0x10(%rbx), %r15
movq 0x10(%rbx), %r12
cmpq %r15, %r12
je 0x14637
leaq -0x10(%r12), %r14
movq (%r12), %r13
movq 0x8(%r12), %rax
movq %r13, (%rax)
movq %rax, 0x8(%r13)
movq -0x10(%r12), %rdi
callq 0x3450
movq -0x8(%r12), %rdi
callq 0x3450
movq %r14, %rdi
callq 0x3450
movq %r13, %r12
cmpq %r15, %r13
jne 0x145fe
movq 0x8(%rbx), %rdi
callq 0x3450
leaq 0x20(%rbx), %rdi
callq 0x1cdc9
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3450
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r15
addq $0x10, %r15
xorl %ebx, %ebx
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x146d8
movq -0x10(%r12), %rdi
movq %r14, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x146b9
movq -0x8(%r12), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x1, %edi
movl $0x20, %esi
callq 0x3240
testq %rax, %rax
je 0x14748
movq %rax, %r14
movq %r12, %rdi
callq 0x3610
movq %rax, (%r14)
movq %r15, %rdi
callq 0x3610
movq %rax, 0x8(%r14)
leaq 0x10(%rbx), %rax
movq %r14, %rcx
addq $0x10, %rcx
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movq %rcx, (%rax)
movq %rcx, 0x18(%rbx)
xorl %ebx, %ebx
jmp 0x1477f
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1477f
leaq 0xf5d4(%rip), %rsi      # 0x23d34
leaq 0xf6e6(%rip), %rdx      # 0x23e4d
leaq 0xf145(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0x25e, %ecx            # imm = 0x25E
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x10(%rdi), %r13
movq %r13, %r12
movq (%r12), %r12
cmpq %r13, %r12
je 0x147e3
movq -0x10(%r12), %rdi
movq %r14, %rsi
callq 0x34e0
testl %eax, %eax
jne 0x147a6
movq -0x8(%r12), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3610
movq %rax, -0x8(%r12)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x146e7
// File: /workspace/github_c_makefile_star2_O3/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 0x1481a
movq 0x8(%rsi), %r8
jmp 0x1481d
movq (%rdi), %r8
movq %r8, (%rsi)
movq (%r8), %rax
movq %rax, 0x8(%rsi)
cmpq %rdi, %r8
je 0x1484c
movq %rdx, %rax
orq %rcx, %rax
je 0x1484c
testq %rdx, %rdx
je 0x14840
movq -0x10(%r8), %rax
movq %rax, (%rdx)
testq %rcx, %rcx
je 0x1484c
movq -0x8(%r8), %rax
movq %rax, (%rcx)
xorl %eax, %eax
cmpq %rdi, %r8
setne %al
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1d3fd
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x148ac
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x148ac
leaq 0xf4a7(%rip), %rsi      # 0x23d34
leaq 0xf5d2(%rip), %rdx      # 0x23e66
leaq 0xf5e5(%rip), %r8       # 0x23e80
movl $0x3, %edi
movl $0x298, %ecx            # imm = 0x298
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzwl (%rsi), %edx
movzwl 0x2(%rsi), %ecx
movl 0x4(%rsi), %r8d
movq 0x8(%rsi), %r9
leaq 0xf5be(%rip), %rsi      # 0x23e92
xorl %eax, %eax
callq 0x1d504
cmpl $-0x1, %eax
je 0x1495d
addq $0x10, %r14
movb $0x1, %bpl
xorl %ecx, %ecx
leaq 0xf4d3(%rip), %r15      # 0x23dc3
testb $0x1, %bpl
je 0x148f9
movq (%r14), %rcx
cmpq %r14, %rcx
je 0x1498f
movq (%rcx), %r12
movq -0x10(%rcx), %rdx
movq -0x8(%rcx), %rcx
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1d504
movq %r12, %rcx
cmpl $-0x1, %eax
jne 0x148f0
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x149e7
leaq 0xf3f4(%rip), %rsi      # 0x23d34
leaq 0xf55e(%rip), %rdx      # 0x23ea5
leaq 0xe629(%rip), %r8       # 0x22f77
movl $0x3, %edi
movl $0x2b4, %ecx            # imm = 0x2B4
jmp 0x149e0
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x149e7
leaq 0xf3bf(%rip), %rsi      # 0x23d34
leaq 0xf529(%rip), %rdx      # 0x23ea5
leaq 0xe5f4(%rip), %r8       # 0x22f77
movl $0x3, %edi
movl $0x2ac, %ecx            # imm = 0x2AC
jmp 0x149e0
leaq 0xf466(%rip), %rsi      # 0x23dfc
movq %rbx, %rdi
movl $0x2, %edx
callq 0x1d3fd
cmpl $-0x1, %eax
je 0x149b0
movl 0x8(%rbx), %ebp
subl 0xc(%rbx), %ebp
jmp 0x149e7
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x149e7
leaq 0xf36c(%rip), %rsi      # 0x23d34
leaq 0xf4d6(%rip), %rdx      # 0x23ea5
leaq 0xe5a1(%rip), %r8       # 0x22f77
movl $0x3, %edi
movl $0x2ba, %ecx            # imm = 0x2BA
xorl %eax, %eax
callq 0x1771e
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x148b0
cmpl $-0x1, %eax
je 0x14a28
movl 0x28(%rbx), %edx
testl %edx, %edx
jle 0x14a1e
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x1d3fd
cmpl $-0x1, %eax
je 0x14a5a
movl 0x8(%r14), %ebx
subl 0xc(%r14), %ebx
jmp 0x14a91
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14a91
leaq 0xf2f4(%rip), %rsi      # 0x23d34
leaq 0xf47e(%rip), %rdx      # 0x23ec5
leaq 0xf48f(%rip), %r8       # 0x23edd
movl $0x3, %edi
movl $0x2c4, %ecx            # imm = 0x2C4
jmp 0x14a8a
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x14a91
leaq 0xf2c2(%rip), %rsi      # 0x23d34
leaq 0xf44c(%rip), %rdx      # 0x23ec5
leaq 0xe4f7(%rip), %r8       # 0x22f77
movl $0x3, %edi
movl $0x2ca, %ecx            # imm = 0x2CA
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 $0x1, %edi
movl $0x20, %esi
callq 0x3240
movq %rax, %rbx
testq %rax, %rax
je 0x14df5
leaq 0x51(%rip), %rax        # 0x14e35
movq %rax, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movl %r14d, 0x18(%rbx)
movl %ebp, 0x1c(%rbx)
jmp 0x14e27
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x14e27
leaq 0xef2c(%rip), %rsi      # 0x23d34
leaq 0xf22e(%rip), %rdx      # 0x2403d
leaq 0xea9d(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0x741, %ecx            # imm = 0x741
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x14e79
cmpl $0x2, %eax
jne 0x14e7d
movq 0x8(%rdi), %rcx
bswapq %rcx
movq 0x8(%rsi), %rdx
bswapq %rdx
cmpq %rdx, %rcx
jne 0x14e6d
movq 0x10(%rdi), %rcx
movq 0x10(%rsi), %rdx
bswapq %rcx
bswapq %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x14e91
xorl %eax, %eax
cmpq %rdx, %rcx
sbbl %eax, %eax
orl $0x1, %eax
jmp 0x14e91
subl %ecx, %eax
jmp 0x14e91
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 0x14e96
retq
movl 0x88(%rdi), %eax
subl 0x88(%rsi), %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x16a06
leaq -0x40(%r14), %rdi
movq %rbx, %rsi
callq 0x16a06
addq $-0x30, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16a06
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x16b18
leaq -0x30(%r14), %rdi
movq %rbx, %rsi
callq 0x16b18
addq $-0x20, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16b18
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x16550
testl %eax, %eax
je 0x16637
cmpl $0x1, %eax
jne 0x1662e
movl $0x11, 0x48(%r14)
movq %r14, %rdi
callq 0x17573
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x176e5
cmpl $0x7, (%rax)
jl 0x16637
leaq 0xd80a(%rip), %rsi      # 0x23d34
leaq 0xdb88(%rip), %rdx      # 0x240b9
leaq 0xdfb7(%rip), %r8       # 0x244ef
xorl %ebx, %ebx
movl $0x7, %edi
movl $0x399, %ecx            # imm = 0x399
xorl %eax, %eax
callq 0x1771e
jmp 0x16637
movq 0x78(%r14), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3030
cmpl $0x3, %eax
je 0x16574
movl %eax, %ebp
cmpl $0x2, %eax
jne 0x16583
movl $0xf, 0x48(%r14)
jmp 0x1657c
movl $0x10, 0x48(%r14)
xorl %ebx, %ebx
jmp 0x16637
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x165c3
movl %ebp, %edi
callq 0x17106
movq %rax, (%rsp)
leaq 0xd793(%rip), %rsi      # 0x23d34
leaq 0xdb11(%rip), %rdx      # 0x240b9
leaq 0xd373(%rip), %r8       # 0x23922
movl $0x3, %edi
movl $0x3a9, %ecx            # imm = 0x3A9
movl %ebp, %r9d
xorl %eax, %eax
callq 0x1771e
cmpl $0x5, %ebp
jne 0x1662e
callq 0x34a0
movq %rax, %r15
testl %r15d, %r15d
je 0x1662e
leaq 0xd758(%rip), %r12      # 0x23d34
leaq 0xdad6(%rip), %r13      # 0x240b9
leaq 0xd338(%rip), %rbp      # 0x23922
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x16621
movslq %r15d, %rdi
xorl %esi, %esi
callq 0x3120
movq %rax, (%rsp)
movl $0x3, %edi
movq %r12, %rsi
movq %r13, %rdx
movl $0x3ad, %ecx            # imm = 0x3AD
movq %rbp, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x1771e
callq 0x34a0
movq %rax, %r15
testl %r15d, %r15d
jne 0x165ea
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
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: http_conn_close
static void http_conn_close(http_conn_t* conn)
{
	conn->conn.status = cs_closing;
	http_move_to_fly(conn);
	if (conn->conn.sock) {
		shutdown(conn->conn.sock, SHUT_RDWR);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x3, 0x48(%rdi)
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x16685
leaq 0xd6ce(%rip), %rsi      # 0x23d34
leaq 0xde92(%rip), %rdx      # 0x244ff
leaq 0xde9c(%rip), %r8       # 0x24510
movl $0x8, %edi
movl $0x361, %ecx            # imm = 0x361
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rdi
callq 0x170a6
movq 0x88(%rbx), %rax
leaq 0xb0(%rax), %rcx
leaq 0x90(%rbx), %rdx
movq %rcx, 0x90(%rbx)
movq 0xb8(%rax), %rcx
movq %rcx, 0x98(%rbx)
movq %rdx, (%rcx)
movq %rdx, 0xb8(%rax)
incl 0xc8(%rax)
movl $0x1, 0x84(%rbx)
movl 0x10(%rbx), %edi
testl %edi, %edi
je 0x166e3
movl $0x2, %esi
popq %rbx
jmp 0x34c0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: http_conn_free
static void http_conn_free(http_conn_t *conn)
{
	if (conn->request) {
		http_call_callback(conn->request, HTTP_ABORT, conn->response);
	}
	if (conn->response) {
		conn->response->conn = NULL;
		conn->response = NULL;
	}
	if (conn->ssl) {
		SSL_free(conn->ssl);
	}
	conn_free(&conn->conn);
	stream_free(&conn->field.name);
	stream_free(&conn->field.value);
	stream_free(&conn->proxy_stream);
	free(conn->tag);
	free(conn);

	logv("free http connection\n");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa0(%rdi), %rsi
testq %rsi, %rsi
je 0x1695d
movq 0xa8(%rbx), %rdx
movq 0x38(%rsi), %rax
testq %rax, %rax
je 0x1693e
xorl %ecx, %ecx
movq %rcx, 0xa0(%rax)
movq %rcx, 0x38(%rsi)
movq 0x40(%rsi), %rax
testq %rax, %rax
je 0x1695d
leaq 0x40(%rsi), %r14
movq 0x48(%rsi), %rcx
movl $0x1, %edi
callq *%rax
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0xa8(%rbx), %rax
testq %rax, %rax
je 0x16976
xorl %ecx, %ecx
movq %rcx, 0x38(%rax)
movq %rcx, 0xa8(%rbx)
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x16984
callq 0x31f0
leaq 0x10(%rbx), %rdi
callq 0x19218
leaq 0xd0(%rbx), %rdi
callq 0x1cdc9
leaq 0xe8(%rbx), %rdi
callq 0x1cdc9
leaq 0x110(%rbx), %rdi
callq 0x1cdc9
movq 0x128(%rbx), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3450
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x169fe
leaq 0xd35c(%rip), %rsi      # 0x23d34
leaq 0xd749(%rip), %rdx      # 0x24128
leaq 0xd751(%rip), %r8       # 0x24137
movl $0x8, %edi
movl $0xba, %ecx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1771e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: dl_fdset_func
static void dl_fdset_func(dllist_t* conns, http_fdset_state* st)
{
	dlitem_t* cur, * nxt;
	http_conn_t* conn;
	conn_status cs;
	int is_sending;
	dllist_foreach(conns, cur, nxt,
		http_conn_t, conn, entry) {
		cs = conn->conn.status;
		if (cs == cs_ssl_handshaked) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			if (conn->ssl_status == SSL_ERROR_WANT_READ) {
				FD_SET(conn->conn.sock, st->readset);
			}
			else if (conn->ssl_status == SSL_ERROR_WANT_WRITE) {
				FD_SET(conn->conn.sock, st->writeset);
			}
			else {
				is_sending = stream_rsize(&conn->conn.ws) > 0;
				if (is_sending)
					FD_SET(conn->conn.sock, st->writeset);
				else
					FD_SET(conn->conn.sock, st->readset);
			}
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_ssl_handshaking_want_read ||
			cs == cs_socks5_waiting_method ||
			cs == cs_socks5_waiting_connect ||
			cs == cs_hp_waiting_connect ||
			cs == cs_hp_waiting_data) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->readset);
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_ssl_handshaking_want_write ||
			cs == cs_socks5_sending_method ||
			cs == cs_socks5_sending_connect ||
			cs == cs_hp_sending_connect) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->writeset);
			FD_SET(conn->conn.sock, st->errorset);
		}
		else if (cs == cs_connecting) {
			st->maxfd = MAX(st->maxfd, conn->conn.sock);
			FD_SET(conn->conn.sock, st->writeset);
			FD_SET(conn->conn.sock, st->errorset);
		}
	}
}

// Assembly:
movq (%rdi), %rax
cmpq %rdi, %rax
je 0x16b17
leaq 0xd263(%rip), %rdx      # 0x23c7c
movq %rax, %r9
movq (%rax), %rax
movl -0x48(%r9), %ecx
decl %ecx
cmpl $0x10, %ecx
ja 0x16ac1
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl 0x20(%rsi), %r8d
movl -0x80(%r9), %ecx
cmpl %ecx, %r8d
cmovlel %ecx, %r8d
movl %r8d, 0x20(%rsi)
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r8
leaq (,%r8,8), %r9
addq 0x10(%rsi), %r9
jmp 0x16a99
movl 0x20(%rsi), %r8d
movl -0x80(%r9), %ecx
cmpl %ecx, %r8d
cmovlel %ecx, %r8d
movl %r8d, 0x20(%rsi)
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r8
leaq (,%r8,8), %r9
addq 0x8(%rsi), %r9
leal 0x3f(%rcx), %r10d
testl %ecx, %ecx
cmovnsl %ecx, %r10d
andl $0xc0, %r10d
subl %r10d, %ecx
movl $0x1, %r10d
shlq %cl, %r10
orq %r10, (%r9)
movq 0x18(%rsi), %rcx
orq %r10, (%rcx,%r8,8)
cmpq %rdi, %rax
jne 0x16a19
jmp 0x16b17
movl 0x20(%rsi), %r8d
movl -0x80(%r9), %ecx
cmpl %ecx, %r8d
cmovlel %ecx, %r8d
movl %r8d, 0x20(%rsi)
movl -0x10(%r9), %r8d
cmpl $0x3, %r8d
je 0x16a4a
cmpl $0x2, %r8d
je 0x16a7c
movl -0x58(%r9), %r10d
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r8
cmpl -0x54(%r9), %r10d
jg 0x16a5b
jmp 0x16a8d
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: http_remove_conn
static void http_remove_conn(http_conn_t* conn)
{
	dllist_remove(&conn->entry);
	if (conn->status == HTTP_CONN_ST_FLY)
		conn->pool->fly_count--;
	else if (conn->status == HTTP_CONN_ST_IDLE)
		conn->pool->idle_count--;
	else if (conn->status == HTTP_CONN_ST_BUSY)
		conn->pool->busy_count--;
	conn->status = HTTP_CONN_ST_NONE;
}

// Assembly:
movq 0x90(%rdi), %rax
movq 0x98(%rdi), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movl 0x84(%rdi), %eax
cmpl $0x3, %eax
je 0x170ee
cmpl $0x2, %eax
je 0x170df
cmpl $0x1, %eax
jne 0x170fb
movq 0x88(%rdi), %rax
decl 0xc8(%rax)
jmp 0x170fb
movq 0x88(%rdi), %rax
decl 0xc0(%rax)
jmp 0x170fb
movq 0x88(%rdi), %rax
decl 0xc4(%rax)
movl $0x0, 0x84(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_status
static int on_status(http_parser* parser, const char* at, size_t length)
{
	http_conn_t* conn = (http_conn_t*)parser->data;
	http_response_t* response = conn->response;
	response->status_code = parser->status_code;
	response->status_text = http_strdup(at, length);
	response->http_major = parser->http_major;
	response->http_minor = parser->http_minor;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0xa8(%rax), %r13
movzwl 0x14(%rdi), %eax
movl %eax, 0x4(%r13)
shlq $0x20, %r15
movabsq $0x100000000, %rdi      # imm = 0x100000000
addq %r15, %rdi
sarq $0x20, %rdi
callq 0x34b0
movq %rax, %r14
testq %rax, %rax
je 0x17187
sarq $0x20, %r15
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x32b0
movb $0x0, (%r14,%r15)
jmp 0x171b9
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x171b9
leaq 0xcb9a(%rip), %rsi      # 0x23d34
leaq 0xd0ea(%rip), %rdx      # 0x2428b
leaq 0xc70b(%rip), %r8       # 0x238b3
movl $0x3, %edi
movl $0xf7, %ecx
xorl %eax, %eax
callq 0x1771e
movq %r14, 0x8(%r13)
movl 0x10(%rbx), %eax
movl %eax, (%r13)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_header_field
static int on_header_field(http_parser* parser, const char* at, size_t length)
{
	http_conn_t* conn = (http_conn_t*)parser->data;

	if (conn->field.status == fs_value) {
		if (on_header_field_complete(parser))
			return -1;
	}

	conn->field.status = fs_name;

	if (stream_writes(&conn->field.name, at, (int)length) == -1) {
		loge("stream_writes()\n");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq 0x18(%rdi), %r12
leaq 0xd0(%r12), %r15
cmpl $0x2, 0x100(%r12)
jne 0x17224
movq 0xa8(%r12), %rdi
movq 0xd0(%r12), %rsi
movq 0xe8(%r12), %rdx
callq 0x146e7
xorl %eax, %eax
movq %rax, 0xd8(%r12)
movq %rax, 0xf0(%r12)
movl $0x1, 0x100(%r12)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x1cfe9
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x1727b
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1727b
leaq 0xcad8(%rip), %rsi      # 0x23d34
leaq 0xd034(%rip), %rdx      # 0x24297
leaq 0xd03d(%rip), %r8       # 0x242a7
movl $0x3, %edi
movl $0x604, %ecx            # imm = 0x604
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_header_value
static int on_header_value(http_parser* parser, const char* at, size_t length)
{
	http_conn_t* conn = (http_conn_t*)parser->data;

	conn->field.status = fs_value;

	if (stream_writes(&conn->field.value, at, (int)length) == -1) {
		loge("stream_writes()\n");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbx
movq 0x18(%rdi), %rdi
movl $0x2, 0x100(%rdi)
addq $0xe8, %rdi
callq 0x1cfe9
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x172e2
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x172e2
leaq 0xca71(%rip), %rsi      # 0x23d34
leaq 0xcfee(%rip), %rdx      # 0x242b8
leaq 0xcfd6(%rip), %r8       # 0x242a7
movl $0x3, %edi
movl $0x612, %ecx            # imm = 0x612
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_headers_complete
static int on_headers_complete(http_parser* parser)
{
	http_conn_t* conn = (http_conn_t*)parser->data;

	if (conn->field.status != fs_none) {
		if (on_header_field_complete(parser))
			return -1;
	}

	conn->keep_alive = http_should_keep_alive(parser);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %r14
cmpl $0x0, 0x100(%r14)
je 0x17330
movq 0xa8(%r14), %rdi
movq 0xd0(%r14), %rsi
movq 0xe8(%r14), %rdx
callq 0x146e7
xorl %eax, %eax
movq %rax, 0xd8(%r14)
movq %rax, 0xf0(%r14)
movl $0x0, 0x100(%r14)
movq %rbx, %rdi
callq 0x75a7
movl %eax, 0x108(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_body
static int on_body(http_parser* parser, const char* at, size_t length)
{
	http_conn_t* conn = (http_conn_t*)parser->data;
	http_response_t* response = conn->response;

	if (http_response_append_data(response, at, (int)length) == -1) {
		loge("http_response_append_data()\n");
		return -1;
	}
	return 0;
}

// Assembly:
pushq %rbx
movq 0x18(%rdi), %rax
movq 0xa8(%rax), %rdi
callq 0x14864
xorl %ebx, %ebx
cmpl $-0x1, %eax
jne 0x17398
xorl %eax, %eax
callq 0x176e5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x17398
leaq 0xc9bb(%rip), %rsi      # 0x23d34
leaq 0xcf48(%rip), %rdx      # 0x242c8
leaq 0xcf49(%rip), %r8       # 0x242d0
movl $0x3, %edi
movl $0x62d, %ecx            # imm = 0x62D
xorl %eax, %eax
callq 0x1771e
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/http.c
// Function: on_message_complete
static int on_message_complete(http_parser* parser)
{
	http_conn_t* conn = (http_conn_t*)parser->data;
	http_request_t* request = conn->request;
	http_response_t* response = conn->response;

	if (loglevel > LOG_DEBUG) {
		stream_t s = STREAM_INIT();
		http_request_headers_serialize(&s, request);
		logv("Request Headers:\r\n%s\r\n", s.array);
		stream_reset(&s);
		http_response_headers_serialize(&s, response);
		logv("Response:\r\n%s\r\n%s%s",
			s.array,
			response->status_code != 200 ? (const char*)response->data.array : "",
			response->status_code != 200 ? "\r\n" : "");
		stream_free(&s);
	}

	http_call_callback(request, HTTP_OK, response);

	if (conn->keep_alive) {
		http_move_to_idle(conn);
	}
	else {
		http_conn_close(conn);
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdi), %rbx
movq 0xa0(%rbx), %r14
movq 0xa8(%rbx), %r15
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x17492
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %r14, %rsi
callq 0x141e0
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x17418
movq (%rsp), %r9
leaq 0xc93b(%rip), %rsi      # 0x23d34
leaq 0xceed(%rip), %rdx      # 0x242ed
leaq 0xcefa(%rip), %r8       # 0x24301
movl $0x8, %edi
movl $0x63c, %ecx            # imm = 0x63C
xorl %eax, %eax
callq 0x1771e
movq %rsp, %rdi
movq $0x0, 0x8(%rdi)
movq %r15, %rsi
callq 0x148b0
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x1748a
movq (%rsp), %r9
cmpl $0xc8, 0x4(%r15)
jne 0x17451
leaq 0xc9b2(%rip), %r11      # 0x23dfe
movq %r11, %r10
jmp 0x1745c
movq 0x20(%r15), %r10
leaq 0xc9a0(%rip), %r11      # 0x23dfc
leaq 0xc8d1(%rip), %rsi      # 0x23d34
leaq 0xce83(%rip), %rdx      # 0x242ed
leaq 0xcea7(%rip), %r8       # 0x24318
movl $0x8, %edi
movl $0x642, %ecx            # imm = 0x642
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x1771e
addq $0x10, %rsp
movq %rsp, %rdi
callq 0x1cdc9
testq %r14, %r14
je 0x174d0
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x174ad
xorl %ecx, %ecx
movq %rcx, 0xa0(%rax)
movq %rcx, 0x38(%r14)
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x174d0
leaq 0x40(%r14), %r12
movq 0x48(%r14), %rcx
xorl %edi, %edi
movq %r14, %rsi
movq %r15, %rdx
callq *%rax
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
cmpl $0x0, 0x108(%rbx)
je 0x17557
xorl %eax, %eax
callq 0x176e5
cmpl $0x8, (%rax)
jl 0x1750b
leaq 0xc848(%rip), %rsi      # 0x23d34
leaq 0xce39(%rip), %rdx      # 0x2432c
leaq 0xce44(%rip), %r8       # 0x2433e
movl $0x8, %edi
movl $0x35a, %ecx            # imm = 0x35A
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rdi
callq 0x170a6
movq 0x88(%rbx), %rax
movl $0x90, %ecx
leaq (%rax,%rcx), %rdx
addq %rbx, %rcx
movq %rdx, 0x90(%rbx)
movq 0x98(%rax), %rdx
movq %rdx, 0x98(%rbx)
movq %rcx, (%rdx)
movq %rcx, 0x98(%rax)
incl 0xc0(%rax)
movl $0x2, 0x84(%rbx)
jmp 0x1755f
movq %rbx, %rdi
callq 0x16648
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_get_ttl
uint32_t ns_get_ttl(const ns_msg_t* msg)
{
	int i, rrcount;
	uint32_t ttl = 0;
	ns_rr_t* rr;

	rrcount = ns_rrcount(msg);
	for (i = 0; i < rrcount; i++) {
		rr = msg->rrs + i;
		if (rr->ttl > 0 && rr->type != NS_TYPE_OPT) {
			if (ttl == 0 || ttl > rr->ttl) ttl = rr->ttl;
		}
	}

	return ttl;
}

// Assembly:
movzwl 0x6(%rdi), %ecx
movzwl 0x8(%rdi), %eax
leal (%rax,%rcx), %edx
movzwl 0xa(%rdi), %esi
addl %esi, %edx
je 0x194eb
movq 0x18(%rdi), %rdx
addl %esi, %eax
addl %eax, %ecx
shll $0x5, %ecx
xorl %esi, %esi
xorl %eax, %eax
movl 0xc(%rdx,%rsi), %edi
testl %edi, %edi
je 0x194e1
cmpw $0x29, 0x8(%rdx,%rsi)
je 0x194e1
leal -0x1(%rax), %r8d
cmpl %edi, %r8d
cmovbl %eax, %edi
movl %edi, %eax
addq $0x20, %rsi
cmpq %rsi, %rcx
jne 0x194c5
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_qr_clone
ns_qr_t* ns_qr_clone(const ns_qr_t* array, int num)
{
	ns_qr_t* copy, * dst;
	const ns_qr_t* src;
	int i;
	if (!array)
		return NULL;
	copy = (ns_qr_t*)malloc(sizeof(ns_qr_t) * num);
	if (!copy) {
		loge("alloc \n");
		return NULL;
	}
	memset(copy, 0, sizeof(ns_qr_t) * num);
	for (i = 0; i < num; i++) {
		src = array + i;
		dst = copy + i;
		dst->qname = src->qname ? strdup(src->qname) : NULL;
		dst->qtype = src->qtype;
		dst->qclass = src->qclass;
	}
	return copy;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x19552
movl %esi, %ebp
movq %rdi, %r14
movslq %esi, %rsi
shlq $0x4, %rsi
movl $0x1, %edi
callq 0x3240
testq %rax, %rax
je 0x19556
movq %rax, %rbx
testl %ebp, %ebp
jle 0x1958c
movl %ebp, %r15d
shlq $0x4, %r15
xorl %r12d, %r12d
movq (%r14,%r12), %rdi
testq %rdi, %rdi
je 0x19537
callq 0x3610
jmp 0x19539
xorl %eax, %eax
movq %rax, (%rbx,%r12)
movl 0x8(%r14,%r12), %eax
movl %eax, 0x8(%rbx,%r12)
addq $0x10, %r12
cmpq %r12, %r15
jne 0x19527
jmp 0x1958c
xorl %ebx, %ebx
jmp 0x1958c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x1958c
leaq 0xb679(%rip), %rsi      # 0x24be4
leaq 0xb67f(%rip), %rdx      # 0x24bf1
leaq 0x905d(%rip), %r8       # 0x225d6
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x6c, %ecx
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_msg_clone
ns_msg_t* ns_msg_clone(const ns_msg_t *msg)
{
	ns_msg_t* copy;
	copy = (ns_msg_t*)malloc(sizeof(ns_msg_t));
	if (!copy) {
		loge("alloc \n");
		return NULL;
	}

	memset(copy, 0, sizeof(ns_msg_t));
	
	copy->id = msg->id;
	copy->flags = msg->flags;
	if (msg->qrs) {
		copy->qrs = ns_qr_clone(msg->qrs, msg->qdcount);
		if (!copy->qrs) {
			loge("ns_qr_clone() error\n");
			free(copy);
			return NULL;
		}
	}
	copy->qdcount = msg->qdcount;

	if (msg->rrs) {
		copy->rrs = ns_rr_clone(msg->rrs, ns_rrcount(msg));
		if (!copy->rrs) {
			loge("ns_rr_clone() error\n");
			ns_msg_free(copy);
			return NULL;
		}
	}

	copy->ancount = msg->ancount;
	copy->nscount = msg->nscount;
	copy->arcount = msg->arcount;

	return copy;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x20, %esi
callq 0x3240
testq %rax, %rax
je 0x19a21
movq %rax, %rbx
movl (%r14), %eax
movl %eax, (%rbx)
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x199d5
movzwl 0x4(%r14), %esi
callq 0x194ee
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x19a5d
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%rbx)
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x19a0c
movzwl 0x6(%r14), %eax
movzwl 0x8(%r14), %ecx
addl %eax, %ecx
movzwl 0xa(%r14), %esi
addl %ecx, %esi
callq 0x19598
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x19a99
movl 0x6(%r14), %eax
movl %eax, 0x6(%rbx)
movzwl 0xa(%r14), %eax
movw %ax, 0xa(%rbx)
jmp 0x19ad5
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x19ad5
leaq 0xb1aa(%rip), %rsi      # 0x24be4
leaq 0xb1c8(%rip), %rdx      # 0x24c09
leaq 0x8b8e(%rip), %r8       # 0x225d6
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x11f, %ecx            # imm = 0x11F
xorl %eax, %eax
callq 0x1771e
jmp 0x19ad5
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x19a8f
leaq 0xb174(%rip), %rsi      # 0x24be4
leaq 0xb192(%rip), %rdx      # 0x24c09
leaq 0x8b43(%rip), %r8       # 0x225c1
movl $0x3, %edi
movl $0x12a, %ecx            # imm = 0x12A
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rdi
callq 0x3450
jmp 0x19ad3
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x19acb
leaq 0xb138(%rip), %rsi      # 0x24be4
leaq 0xb156(%rip), %rdx      # 0x24c09
leaq 0xb15c(%rip), %r8       # 0x24c16
movl $0x3, %edi
movl $0x134, %ecx            # imm = 0x134
xorl %eax, %eax
callq 0x1771e
movq %rbx, %rdi
callq 0x19ae0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_msg_free
void ns_msg_free(ns_msg_t *msg)
{
	int i, rrcount;
	if (msg) {
        if (msg->qrs) {
            for (i = 0; i < msg->qdcount; i++) {
                ns_msg_free_qr(msg->qrs + i);
            }
            free(msg->qrs);
        }

        if (msg->rrs) {
            for (i = 0, rrcount = ns_rrcount(msg);
                    i < rrcount; i++) {
                ns_msg_free_rr(msg->rrs + i);
            }
            free(msg->rrs);
        }
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x19b9a
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x19b31
cmpw $0x0, 0x4(%rbx)
je 0x19b2c
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x3450
incq %r15
movzwl 0x4(%rbx), %eax
addq $0x10, %r14
cmpq %rax, %r15
jb 0x19b0b
movq 0x10(%rbx), %rdi
callq 0x3450
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x19b9a
movzwl 0x6(%rbx), %r15d
movzwl 0x8(%rbx), %eax
leal (%rax,%r15), %edx
movzwl 0xa(%rbx), %ecx
addl %ecx, %edx
je 0x19b8c
addl %ecx, %eax
addl %eax, %r15d
shll $0x5, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx), %r13
leaq (%r12,%r13), %r14
movq (%r13,%r12), %rdi
callq 0x3450
movq %r14, %rdi
callq 0x1993a
movq 0x18(%r13,%r12), %rdi
callq 0x3450
addq $0x20, %r12
cmpq %r12, %r15
jne 0x19b5b
movq 0x18(%rbx), %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3450
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]dohclient/src/ns_msg.c
// Function: qr_key
const char* qr_key(const ns_qr_t* qr)
{
	static char key[REQ_KEY_SIZE];
	int n;

	if (!qr)
		return NULL;

	n = snprintf(key, sizeof(key), "%s %s %s",
		ns_typename(qr->qtype),
		ns_classname(qr->qclass),
		qr->qname ? qr->qname : "");

	if (n <= 0 || n >= sizeof(key)) {
		loge("snprintf() error\n");
		return NULL;
	}

	return key;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x19c40
movq %rdi, %rbx
movzwl 0x8(%rdi), %edi
callq 0x19c4d
movq %rax, %r14
movzwl 0xa(%rbx), %edi
callq 0x19d84
movq (%rbx), %rcx
testq %rcx, %rcx
leaq 0xa228(%rip), %r9       # 0x23dfe
cmovneq %rcx, %r9
leaq 0x13bff(%rip), %rbx     # 0x2d7e0
leaq 0xb31a(%rip), %rdx      # 0x24f02
movl $0x10f, %esi            # imm = 0x10F
movq %rbx, %rdi
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x3590
movl $0xfffffef1, %ecx       # imm = 0xFFFFFEF1
addl %ecx, %eax
cmpl %ecx, %eax
ja 0x19c42
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x176e5
cmpl $0x3, (%rax)
jl 0x19c42
leaq 0xafc7(%rip), %rsi      # 0x24be4
leaq 0xb007(%rip), %rdx      # 0x24c2b
leaq 0xb007(%rip), %r8       # 0x24c32
xorl %ebx, %ebx
movl $0x3, %edi
movl $0x14f, %ecx            # imm = 0x14F
xorl %eax, %eax
callq 0x1771e
jmp 0x19c42
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq