LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: udp_send
int udp_send(sock_t sock, stream_t* s,
	const struct sockaddr* to, int tolen)
{
	int nsend;
	int rsize = stream_rsize(s);

	nsend = sendto(sock, s->array + s->pos, rsize, 0, to, tolen);
	if (nsend == -1) {
		loge("to=%s, errno=%d, %s\n",
			get_addrname(to), errno, strerror(errno));
		return -1;
	}
	return nsend;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r9d
movq %rdx, %r14
movslq 0x8(%rsi), %rdx
movslq 0xc(%rsi), %rax
subq %rax, %rdx
addq (%rsi), %rax
movq %rax, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x2050
movq %rax, %rbx
cmpl $-0x1, %ebx
jne 0x3d54
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3d54
movq %r14, %rdi
callq 0x2c66
callq 0x2030
movl (%rax), %r14d
movl %r14d, %edi
callq 0x20c0
movq %rax, %r10
leaq 0x341e(%rip), %rsi      # 0x7148
leaq 0x36cd(%rip), %rdx      # 0x73fe
leaq 0x4317(%rip), %r8       # 0x804f
leaq 0x7531(%rip), %r9       # 0xb270
pushq $0x3
popq %rdi
movl $0x2bd, %ecx            # imm = 0x2BD
xorl %eax, %eax
pushq %r10
pushq %r14
callq 0x2512
popq %rax
popq %rcx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: udp_recv
int udp_recv(sock_t sock, char* buf, int buflen,
	struct sockaddr* from, int* fromlen)
{
	int nread;

	nread = recvfrom(sock, buf, buflen, 0, from, fromlen);
	if (nread > 0) {
		return nread;
	}
	else {
		loge("errno=%d, %s\n", errno, strerror(errno));
		return -1;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %r8, %r9
movq %rcx, %r8
movslq %edx, %rdx
xorl %ecx, %ecx
callq 0x2180
movq %rax, %rbx
testl %ebx, %ebx
jg 0x3dc0
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x3dc0
callq 0x2030
movl (%rax), %ebp
movl %ebp, %edi
callq 0x20c0
movq %rax, (%rsp)
leaq 0x33a8(%rip), %rsi      # 0x7148
leaq 0x3660(%rip), %rdx      # 0x7407
leaq 0x42a8(%rip), %r8       # 0x8056
pushq $0x3
popq %rdi
movl $0x2cd, %ecx            # imm = 0x2CD
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2512
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: conn_new
conn_t* conn_new(sock_t sock)
{
	conn_t* conn = (conn_t*)malloc(sizeof(conn_t));
	if (!conn) {
		loge("alloc\n");
		return NULL;
	}

	if (conn_init(conn, sock)) {
		free(conn);
		loge("conn_init() error\n");
		return NULL;
	}

	return conn;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $0x68
popq %rdi
callq 0x22e0
testq %rax, %rax
je 0x3e23
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
callq 0x3e61
testl %eax, %eax
je 0x3e57
movq %rbx, %rdi
callq 0x2290
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3e57
leaq 0x333f(%rip), %rsi      # 0x7148
leaq 0x3600(%rip), %rdx      # 0x7410
leaq 0x3609(%rip), %r8       # 0x7420
xorl %ebx, %ebx
pushq $0x3
popq %rdi
movl $0x2dc, %ecx            # imm = 0x2DC
jmp 0x3e50
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3e57
leaq 0x3310(%rip), %rsi      # 0x7148
leaq 0x35d1(%rip), %rdx      # 0x7410
leaq 0x35d3(%rip), %r8       # 0x7419
xorl %ebx, %ebx
pushq $0x3
popq %rdi
movl $0x2d6, %ecx            # imm = 0x2D6
xorl %eax, %eax
callq 0x2512
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: conn_init
int conn_init(conn_t* conn, sock_t sock)
{
	memset(conn, 0, sizeof(conn_t));

	if (stream_init(&conn->rs)) {
		loge("stream_init() error\n");
		return -1;
	}

	if (stream_init(&conn->ws)) {
		stream_free(&conn->rs);
		loge("stream_init() error\n");
		return -1;
	}

	conn->sock = sock;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
andq $0x0, 0x60(%rdi)
leaq 0x8(%rdi), %r15
movq %r15, %rdi
callq 0x40d0
testl %eax, %eax
je 0x3ec8
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x3f17
leaq 0x3298(%rip), %rsi      # 0x7148
leaq 0x357c(%rip), %rdx      # 0x7433
leaq 0x357f(%rip), %r8       # 0x743d
pushq $0x3
popq %rdi
movl $0x2e8, %ecx            # imm = 0x2E8
jmp 0x3f09
leaq 0x20(%r14), %rdi
callq 0x40d0
testl %eax, %eax
je 0x3f12
movq %r15, %rdi
callq 0x40de
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x3f17
leaq 0x3255(%rip), %rsi      # 0x7148
leaq 0x3539(%rip), %rdx      # 0x7433
leaq 0x353c(%rip), %r8       # 0x743d
pushq $0x3
popq %rdi
movl $0x2ee, %ecx            # imm = 0x2EE
xorl %eax, %eax
callq 0x2512
jmp 0x3f17
movl %ebx, (%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: conn_free
void conn_free(conn_t* conn)
{
	if (conn == NULL)
		return;
	if (conn->sock) {
		close(conn->sock);
		conn->sock = 0;
	}
	stream_free(&conn->rs);
	stream_free(&conn->ws);
}

// Assembly:
testq %rdi, %rdi
je 0x3f4c
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
je 0x3f36
callq 0x23b0
andl $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
callq 0x40de
addq $0x20, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x40de
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: peer_new
peer_t* peer_new(sock_t sock, int listen)
{
	peer_t* peer = (peer_t*)malloc(sizeof(peer_t));
	if (!peer) {
		loge("alloc\n");
		return NULL;
	}

	if (peer_init(peer, sock, listen)) {
		free(peer);
		loge("peer_init() error\n");
		return NULL;
	}

	return peer;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
movl $0x80, %edi
callq 0x22e0
testq %rax, %rax
je 0x3fc2
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x3ffe
testl %eax, %eax
je 0x3ff6
movq %rbx, %rdi
callq 0x2290
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3ff6
leaq 0x31a0(%rip), %rsi      # 0x7148
leaq 0x34a3(%rip), %rdx      # 0x7452
leaq 0x34a5(%rip), %r8       # 0x745b
xorl %ebx, %ebx
pushq $0x3
popq %rdi
movl $0x313, %ecx            # imm = 0x313
jmp 0x3fef
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3ff6
leaq 0x3171(%rip), %rsi      # 0x7148
leaq 0x3474(%rip), %rdx      # 0x7452
leaq 0x3434(%rip), %r8       # 0x7419
xorl %ebx, %ebx
pushq $0x3
popq %rdi
movl $0x30d, %ecx            # imm = 0x30D
xorl %eax, %eax
callq 0x2512
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/netutils.c
// Function: peer_init
int peer_init(peer_t* peer, sock_t sock, int listen)
{
	memset(peer, 0, sizeof(peer_t));

	if (conn_init(&peer->conn, sock)) {
		loge("conn_init() error\n");
		return -1;
	}

	dllist_init(&peer->reqs);

	peer->listen = listen;

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rdi)
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
callq 0x3e61
testl %eax, %eax
je 0x4067
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbx
cmpl $0x3, (%rax)
jl 0x4079
leaq 0x3100(%rip), %rsi      # 0x7148
leaq 0x341f(%rip), %rdx      # 0x746e
leaq 0x33ca(%rip), %r8       # 0x7420
pushq $0x3
popq %rdi
movl $0x31f, %ecx            # imm = 0x31F
xorl %eax, %eax
callq 0x2512
jmp 0x4079
leaq 0x70(%r14), %rax
movq %rax, 0x70(%r14)
movq %rax, 0x78(%r14)
movl %ebx, 0x68(%r14)
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/stream.c
// Function: stream_seek
int stream_seek(stream_t *stream, int offset, int whence)
{
	switch (whence) {
	case SEEK_CUR:
		offset += stream->pos;
		break;
	case SEEK_END:
		offset = stream->size - offset;
		break;
	case SEEK_SET:
	default:
		break;
	}
	if (offset < 0 || offset > stream->size)
		return -1;
	stream->pos = offset;
	return 0;
}

// Assembly:
cmpl $0x2, %edx
je 0x410a
cmpl $0x1, %edx
jne 0x4111
addl 0xc(%rdi), %esi
jmp 0x4111
movl 0x8(%rdi), %eax
subl %esi, %eax
movl %eax, %esi
pushq $-0x1
popq %rax
testl %esi, %esi
js 0x4122
cmpl 0x8(%rdi), %esi
jg 0x4122
movl %esi, 0xc(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_shrink
int stream_shrink(stream_t *stream)
{
	char *newarray;
	int rsize = stream_rsize(stream);
	if (rsize == 0)
	{
		free(stream->array);
		memset(stream, 0, sizeof(stream_t));
		return 0;
	}
	
	if (rsize == stream->cap)
		return 0;

	if (stream->pos == 0) {
		newarray = realloc(stream->array, rsize);
		if (newarray == NULL)
			return -1;
		stream->array = newarray;
		stream->cap = rsize;
		return 0;
	}

	newarray = (char*)malloc(rsize);
	if (newarray == NULL)
		return -1;
	memcpy(newarray, stream->array + stream->pos, rsize);
	free(stream->array);
	stream->array = newarray;
	stream->cap = rsize;
	stream->size = rsize;
	stream->pos = 0;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl 0x8(%rdi), %ebp
movslq 0xc(%rdi), %r15
subl %r15d, %ebp
jne 0x4155
movq (%r14), %rdi
callq 0x2290
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
xorl %ebx, %ebx
jmp 0x41c4
xorl %ebx, %ebx
cmpl 0x10(%r14), %ebp
je 0x41c4
testl %r15d, %r15d
je 0x41a8
movslq %ebp, %r13
movq %r13, %rdi
callq 0x22e0
testq %rax, %rax
je 0x41c1
movq %rax, %r12
movq (%r14), %rax
movq %rax, (%rsp)
addq %rax, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x21a0
movq (%rsp), %rdi
callq 0x2290
movq %r12, (%r14)
movl %ebp, 0x10(%r14)
movl %ebp, 0x8(%r14)
andl $0x0, 0xc(%r14)
jmp 0x41c4
movq (%r14), %rdi
movslq %ebp, %rsi
callq 0x2350
testq %rax, %rax
je 0x41c1
movq %rax, (%r14)
movl %ebp, 0x10(%r14)
jmp 0x41c4
pushq $-0x1
popq %rbx
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_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_quake
int stream_quake(stream_t* stream)
{
	if (stream->pos > 0) {
		int size = stream_rsize(stream);
		if (size > 0) {
			memmove(stream->array, stream->array + stream->pos, size);
			stream->size = size;
			stream->pos = 0;
		}
		else {
			stream->size = 0;
			stream->pos = 0;
		}
	}

	return 0;
}

// Assembly:
movslq 0xc(%rdi), %rsi
testq %rsi, %rsi
jle 0x4209
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %ebp
subl %esi, %ebp
jle 0x41fa
movq (%rbx), %rdi
addq %rdi, %rsi
movl %ebp, %edx
callq 0x2340
jmp 0x41fc
xorl %ebp, %ebp
movl %ebp, 0x8(%rbx)
andl $0x0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_set_cap
int stream_set_cap(stream_t *stream, int cap)
{
	char *newarray;

	if (stream->cap == cap)
		return 0;

	if (stream->cap > cap && stream->cap <= (cap + cap * 4 / 10))
		return 0;

	newarray = realloc(stream->array, cap);
	if (newarray == NULL)
		return -1;
	stream->array = newarray;
	stream->cap = cap;
	if (stream->size > cap)
		stream->size = cap;
	if (stream->pos > cap)
		stream->pos = cap;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0x10(%rdi), %ecx
xorl %ebx, %ebx
cmpl %esi, %ecx
je 0x4267
movl %esi, %r14d
movq %rdi, %r15
jle 0x4237
leal (,%r14,4), %eax
pushq $0xa
popq %rsi
cltd
idivl %esi
addl %r14d, %eax
cmpl %eax, %ecx
jle 0x4267
movq (%r15), %rdi
movslq %r14d, %rsi
callq 0x2350
testq %rax, %rax
je 0x4264
movq %rax, (%r15)
movl %r14d, 0x10(%r15)
cmpl %r14d, 0x8(%r15)
jle 0x4258
movl %r14d, 0x8(%r15)
cmpl %r14d, 0xc(%r15)
jle 0x4267
movl %r14d, 0xc(%r15)
jmp 0x4267
pushq $-0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_write
int stream_write(stream_t *stream, const char *s, int n)
{
	if (stream_rcap(stream) < n) {
		if (stream_set_cap(stream, stream->pos + align(n)))
			return -1;
	}
	memcpy(stream->array + stream->pos, s, n);
	stream->pos += n;
	stream->size += n;
	return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %ecx
subl %eax, %ecx
cmpl %edx, %ecx
jge 0x42a7
movl %ebx, %ecx
orl $0x3, %ecx
leal (%rcx,%rax), %esi
incl %esi
movq %r14, %rdi
callq 0x420c
testl %eax, %eax
je 0x42a3
pushq $-0x1
popq %rbx
jmp 0x42d1
movl 0xc(%r14), %eax
movslq %eax, %rdi
addq (%r14), %rdi
movslq %ebx, %rdx
movq %r15, %rsi
callq 0x21a0
movq 0x8(%r14), %xmm0
movd %ebx, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
paddd %xmm0, %xmm1
movq %xmm1, 0x8(%r14)
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_writes
int stream_writes(stream_t* stream, const char* s, int n)
{
	if (stream_rcap(stream) < (n+1)) {
		if (stream_set_cap(stream, stream->pos + align(n+1)))
			return -1;
	}
	memcpy(stream->array + stream->pos, s, n);
	stream->pos += n;
	stream->size += n;
	stream->array[stream->pos] = '\0';
	return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %ecx
subl %eax, %ecx
cmpl %edx, %ecx
jg 0x4315
leal 0x1(%rbx), %ecx
orl $0x3, %ecx
leal (%rcx,%rax), %esi
incl %esi
movq %r14, %rdi
callq 0x420c
testl %eax, %eax
je 0x4311
pushq $-0x1
popq %rbx
jmp 0x433f
movl 0xc(%r14), %eax
movslq %eax, %rdi
addq (%r14), %rdi
movslq %ebx, %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x21a0
movslq 0xc(%r14), %rax
addq %r12, %rax
movl %eax, 0xc(%r14)
addl %ebx, 0x8(%r14)
movq (%r14), %rcx
movb $0x0, (%rcx,%rax)
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/stream.c
// Function: stream_writess
int stream_writess(stream_t *dst, stream_t *src, int n)
{
	if (stream_rsize(src) < n)
		n = src->size - src->pos;

	if (stream_rcap(dst) < n) {
		if (stream_set_cap(dst, dst->pos + align(n)))
			return -1;
	}

	memcpy(dst->array + dst->pos, src->array + src->pos, n);
	dst->pos += n;
	dst->size += n;
	src->pos += n;
	return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x8(%rsi), %ebx
movl 0xc(%rsi), %eax
subl %eax, %ebx
cmpl %edx, %ebx
cmovgel %edx, %ebx
movl 0xc(%rdi), %ecx
movl 0x10(%rdi), %edx
subl %ecx, %edx
cmpl %ebx, %edx
jge 0x4394
movl %ebx, %eax
orl $0x3, %eax
leal (%rcx,%rax), %esi
incl %esi
movq %r15, %rdi
callq 0x420c
testl %eax, %eax
je 0x438c
pushq $-0x1
popq %rbx
jmp 0x43c5
movl 0xc(%r15), %ecx
movl 0xc(%r14), %eax
movslq %ecx, %rdi
addq (%r15), %rdi
movslq %eax, %rsi
addq (%r14), %rsi
movslq %ebx, %rdx
callq 0x21a0
movq 0x8(%r15), %xmm0
movd %ebx, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
paddd %xmm0, %xmm1
movq %xmm1, 0x8(%r15)
addl %ebx, 0xc(%r14)
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_writei
int stream_writei(stream_t *stream, int v, int nb)
{
	int i;
	if (stream_rcap(stream) < nb) {
		if (stream_set_cap(stream, stream->pos + align(nb)))
			return -1;
	}
	for (i = 0;
		i < nb && stream->size < stream->cap;
		i++, stream->size++) {
		stream->array[stream->pos++] = ((v >> ((nb - i - 1) * 8)) & 0xFF);
	}
	return i;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %ecx
subl %eax, %ecx
cmpl %edx, %ecx
jge 0x443a
movl %r15d, %ecx
orl $0x3, %ecx
leal (%rcx,%rax), %esi
incl %esi
movq %r14, %rdi
callq 0x420c
testl %eax, %eax
je 0x443a
pushq $-0x1
popq %rax
jmp 0x4482
xorl %edx, %edx
testl %r15d, %r15d
movl $0x0, %eax
cmovgl %r15d, %eax
leal -0x8(,%r15,8), %ecx
cmpl %edx, %eax
je 0x4482
movl 0x8(%r14), %esi
cmpl 0x10(%r14), %esi
jge 0x4480
movl %ebx, %esi
sarl %cl, %esi
movq (%r14), %rdi
movslq 0xc(%r14), %r8
leal 0x1(%r8), %r9d
movl %r9d, 0xc(%r14)
movb %sil, (%rdi,%r8)
incl %edx
incl 0x8(%r14)
addl $-0x8, %ecx
jmp 0x4450
movl %edx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_writell
int stream_writell(stream_t *stream, long long v, int nb)
{
	int i;
	if (stream_rcap(stream) < nb) {
		if (stream_set_cap(stream, stream->pos + align(nb)))
			return -1;
	}
	for (i = 0;
		i < nb && stream->size < stream->cap;
		i++, stream->size++) {
		stream->array[stream->pos++] = (char)((v >> ((nb - i - 1) * 8)) & 0xFF);
	}
	return i;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %ecx
subl %eax, %ecx
cmpl %edx, %ecx
jge 0x44be
movl %r15d, %ecx
orl $0x3, %ecx
leal (%rcx,%rax), %esi
incl %esi
movq %r14, %rdi
callq 0x420c
testl %eax, %eax
je 0x44be
pushq $-0x1
popq %rax
jmp 0x450a
xorl %edx, %edx
testl %r15d, %r15d
movl $0x0, %eax
cmovgl %r15d, %eax
leal -0x8(,%r15,8), %ecx
cmpq %rdx, %rax
je 0x450a
movl 0x8(%r14), %esi
cmpl 0x10(%r14), %esi
jge 0x4508
movq %rbx, %rsi
sarq %cl, %rsi
movq (%r14), %rdi
movslq 0xc(%r14), %r8
leal 0x1(%r8), %r9d
movl %r9d, 0xc(%r14)
movb %sil, (%rdi,%r8)
incq %rdx
incl 0x8(%r14)
addl $-0x8, %ecx
jmp 0x44d4
movl %edx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_seti
int stream_seti(stream_t *stream, int position, int v, int nb)
{
	int i;
	for (i = 0;
		i < nb && position < stream->cap;
		i++, position++) {
		stream->array[position] = ((v >> ((nb - i - 1) * 8)) & 0xFF);
	}
	return i;
}

// Assembly:
movslq %esi, %r8
xorl %esi, %esi
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
leal -0x8(,%rcx,8), %ecx
cmpl %esi, %eax
je 0x454d
movslq 0x10(%rdi), %r9
cmpq %r9, %r8
jge 0x454b
movl %edx, %r9d
sarl %cl, %r9d
movq (%rdi), %r10
movb %r9b, (%r10,%r8)
incq %r8
incq %rsi
addl $-0x8, %ecx
jmp 0x4526
movl %esi, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_geti
int stream_geti(stream_t* stream, int position, int nb)
{
	int i, v = 0;
	for (i = 0; i < nb; i++, position++) {
		v <<= 8;
		v |= (stream->array[position] & 0xFF);
	}
	return v;
}

// Assembly:
movslq %esi, %rcx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
subl $0x1, %edx
jb 0x456e
shll $0x8, %eax
movq (%rdi), %rsi
movzbl (%rsi,%rcx), %esi
orl %esi, %eax
incq %rcx
jmp 0x4558
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_vwritef
int stream_vwritef(stream_t *stream, const char *fmt, va_list args)
{
	int cnt, sz;
	char *buf;
	va_list ap_try;

	sz = 128;
	buf = (char*)alloca(sz);
	if (!buf) return -1;
try_print:
	va_copy(ap_try, args);
	cnt = vsnprintf(buf, sz, fmt, ap_try);
	va_end(ap_try);
	if (cnt >= sz) {
		sz *= 2;
		buf = (char*)alloca(sz);
		if (!buf) return -1;
		goto try_print;
	}
	if (cnt < 0)
		return -1;

	if (stream_writes(stream, buf, cnt) != cnt) {
		return -1;
	}

	return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
leaq -0xd0(%rbp), %r13
movl $0x80, %r12d
movq 0x10(%r14), %rax
movq %rax, -0x40(%rbp)
movups (%r14), %xmm0
movaps %xmm0, -0x50(%rbp)
movl %r12d, %esi
movq %r13, %rdi
movq %r15, %rdx
leaq -0x50(%rbp), %rcx
callq 0x2130
cmpl %r12d, %eax
jl 0x45da
addl %r12d, %r12d
movslq %r12d, %rax
movq %rsp, %r13
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
jmp 0x459a
movl %eax, %ebx
testl %eax, %eax
js 0x45f8
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x42d9
cmpl %ebx, %eax
pushq $-0x1
popq %rax
cmovel %ebx, %eax
jmp 0x45fb
pushq $-0x1
popq %rax
leaq -0x28(%rbp), %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/stream.c
// Function: stream_appends
int stream_appends(stream_t* stream, const char* s, int n)
{
	int pos = stream->pos;
	int nwrite;

	stream->pos = stream->size;
	nwrite = stream_writes(stream, s, n);
	stream->pos = pos;

	return nwrite;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %ebp
movl %eax, 0xc(%rdi)
callq 0x42d9
movl %ebp, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/stream.c
// Function: stream_readi
int stream_readi(stream_t *stream, int nb)
{
	int v = 0;
	int i;
	for (i = 0;
		i < nb && stream->pos < stream->size;
		i++, stream->pos++) {
		v <<= 8;
		v |= (stream->array[stream->pos] & 0xff);
	}
	return v;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %esi
subl $0x1, %esi
jb 0x4811
movslq 0xc(%rdi), %rcx
cmpl 0x8(%rdi), %ecx
jge 0x4811
shll $0x8, %eax
movq (%rdi), %rdx
movzbl (%rdx,%rcx), %edx
orl %edx, %eax
incl %ecx
movl %ecx, 0xc(%rdi)
jmp 0x47f0
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/utils.c
// Function: ltrim
char* ltrim(char* s)
{
	char* p = s;
	while (p && (*p) && isspace((int)(*((unsigned char*)p))))
		p++;
	return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x5014
movzbl (%r14), %r15d
testq %r15, %r15
je 0x5011
callq 0x2230
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r15,2)
je 0x5011
incq %r14
jmp 0x4fee
movq %r14, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/utils.c
// Function: trim_quote
char* trim_quote(char* s)
{
	char* start, * end;
	size_t len;

	len = strlen(s);
	start = s;
	end = s + len - 1;

	while ((*start) && ((*start) == '\'' || (*start) == '"'))
		start++;

	while (end >= start && ((*end) == '\'' || (*end) == '"')) (*(end--)) = '\0';

	return start;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x20e0
movq %rax, %rcx
movq %rbx, %rax
movzbl (%rax), %edx
cmpl $0x22, %edx
je 0x5078
cmpl $0x27, %edx
jne 0x507d
incq %rax
jmp 0x506b
addq %rbx, %rcx
decq %rcx
cmpq %rax, %rcx
jb 0x509d
movzbl (%rcx), %edx
cmpl $0x27, %edx
je 0x5095
cmpl $0x22, %edx
jne 0x509d
movb $0x0, (%rcx)
decq %rcx
jmp 0x5083
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/utils.c
// Function: urldecode
char *urldecode(char *s)
{
	unsigned char *src  = (unsigned char *)s,
				  *dest = (unsigned char *)s;
	while (*src) {
		if (*src == '%') {
			int a = (int)src[1] & 0xFF;
			int b = a ? ((int)src[2] & 0xFF) : 0;
			int ch = b ? hex2dec(src + 1) : -1;
			if (ch == -1) {
				*dest++ = *src++;
			}
			else {
				*dest++ = (char)ch;
				src += 3;
			}
		}
		else if (*src == '+') {
			*dest++ = ' ';
			src++;
		}
		else {
			*dest++ = *src++;
		}
	}
	*dest = '\0';
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq %rdi, %r15
movq %rdi, %r12
movzbl (%r12), %eax
cmpl $0x25, %eax
je 0x50d4
cmpl $0x2b, %eax
je 0x50cb
testl %eax, %eax
je 0x5121
incq %r12
movb %al, (%r15)
jmp 0x511c
movb $0x20, (%r15)
incq %r12
jmp 0x511c
movzbl 0x1(%r12), %edi
testl %edi, %edi
je 0x5115
movzbl 0x2(%r12), %r14d
testl %r14d, %r14d
je 0x5115
callq 0x52b9
movl %eax, %ebp
movl %r14d, %edi
callq 0x52b9
cmpl $-0x1, %ebp
je 0x5115
cmpl $-0x1, %eax
je 0x5115
shll $0x4, %ebp
orl %ebp, %eax
cmpl $-0x1, %eax
je 0x5115
movb %al, (%r15)
addq $0x3, %r12
jmp 0x511c
incq %r12
movb $0x25, (%r15)
incq %r15
jmp 0x50b0
movb $0x0, (%r15)
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/utils.c
// Function: urlencode
int urlencode(char *buf, int buflen, const char *s)
{
	unsigned char *src  = (unsigned char *)s,
				  *dest = (unsigned char *)buf,
				  *end  = dest + buflen;
	int n = 0;
	while ((*src) && dest < end) {
		int ch = *src++;
		if (ch <= ' ' || ch > '~' ||
				ch == ':' || ch ==  '/' || ch == '?' || ch == '#' ||
				ch == '[' || ch ==  ']' || ch == '@' || ch == '!' ||
				ch == '$' || ch ==  '&' || ch == '\''|| ch == '(' ||
				ch == ')' || ch ==  '*' || ch == '+' || ch == ',' ||
				ch == ';' || ch ==  '=' || ch ==  '%') {
			if (ch == ' ') {
				*dest++ = '+';
			}
			else {
				int h = dec2ch((ch >> 4) & 0xf);
				int l = dec2ch(ch & 0xf);
				*dest++ = '%';
				if (dest < end) {
					*dest++ = h;
					if (dest < end) {
						*dest++ = l;
					}
				}
			}
		}
		else {
			*dest++ = ch;
		}
	}
	if (dest < end) {
		*dest = '\0';
	}
	return (int)(dest - (unsigned char*)buf);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movslq %esi, %rcx
addq %rdi, %rcx
movl $0x30, %esi
movl $0x37, %r8d
movabsq $0x14000000d6004ffd, %r9 # imm = 0x14000000D6004FFD
movq %rdi, %r14
movq %r14, %rax
movb (%rdx), %r10b
testb %r10b, %r10b
je 0x51f3
cmpq %rcx, %rax
jae 0x51f3
incq %rdx
leal -0x7f(%r10), %r11d
cmpb $-0x5e, %r11b
jae 0x5189
cmpb $0x20, %r10b
jne 0x519d
movb $0x2b, (%rax)
incq %rax
movq %rax, %r14
jmp 0x5153
movzbl %r10b, %r11d
addl $-0x21, %r11d
cmpl $0x3c, %r11d
ja 0x51ee
btq %r11, %r9
jae 0x51ee
movl %r10d, %r11d
andb $0xf, %r11b
cmpb $0xa, %r11b
movl %r8d, %ebx
cmovbl %esi, %ebx
leaq 0x1(%rax), %r14
movb $0x25, (%rax)
cmpq %rcx, %r14
jae 0x5153
cmpb $-0x60, %r10b
movl %r8d, %ebp
cmovbl %esi, %ebp
shrb $0x4, %r10b
addb %bpl, %r10b
leaq 0x2(%rax), %r14
movb %r10b, 0x1(%rax)
cmpq %rcx, %r14
jae 0x5153
addb %r11b, %bl
movb %bl, 0x2(%rax)
addq $0x3, %rax
movq %rax, %r14
jmp 0x5153
movb %r10b, (%rax)
jmp 0x5181
cmpq %rcx, %rax
jae 0x51fb
movb $0x0, (%rax)
subl %edi, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/utils.c
// Function: parse_querystring
int parse_querystring(const char *query,
	int (*callback)(char *name, char *value, void *state),
	void *state)
{
	char *cpy, *saveptr = NULL;
	char *p;
	char *v;
	int r;

	if (!query || !*query) return 0;

	cpy = strdup(query);

	for (p = strtok_r(cpy, "&", &saveptr);
		p && *p;
		p = strtok_r(NULL, "&", &saveptr)) {

		v = strchr(p, '=');
		if (!v) continue;

		*v = '\0';
		v++;

		urldecode(v);

		if ((r = callback(p, v, state)) != 0) {
			return r;
		}
	}

	free(cpy);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
andq $0x0, 0x10(%rsp)
xorl %eax, %eax
testq %rdi, %rdi
je 0x52aa
cmpb $0x0, (%rdi)
je 0x52aa
movq %rdx, %rbx
movq %rsi, %r14
callq 0x2380
leaq 0x249d(%rip), %r12      # 0x76d9
leaq 0x10(%rsp), %r13
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2370
testq %rax, %rax
je 0x529e
movq %rax, %r15
cmpb $0x0, (%rax)
je 0x529e
movq %r15, %rdi
pushq $0x3d
popq %rsi
callq 0x20d0
movl $0x0, %edi
testq %rax, %rax
je 0x5249
movq %rax, %rbp
movb $0x0, (%rax)
incq %rbp
movq %rbp, %rdi
callq 0x509f
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq *%r14
movl $0x0, %edi
testl %eax, %eax
je 0x5249
jmp 0x52aa
movq 0x8(%rsp), %rdi
callq 0x2290
xorl %eax, %eax
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/utils.c
// Function: ch2dec
static inline int ch2dec(int ch)
{
	if (ch >= '0' && ch <= '9')
		ch -= '0';
	else if (ch >= 'a' && ch <= 'f')
		ch -= 'a' - 10;
	else if (ch >= 'A' && ch <= 'F')
		ch -= 'A' - 10;
	else {
		ch = -1;
	}
	return ch;
}

// Assembly:
leal -0x30(%rdi), %eax
cmpl $0xa, %eax
jb 0x52de
leal -0x61(%rdi), %eax
cmpl $0x5, %eax
ja 0x52cf
addl $-0x57, %edi
movl %edi, %eax
retq
leal -0x41(%rdi), %eax
addl $-0x37, %edi
cmpl $0x6, %eax
pushq $-0x1
popq %rax
cmovbl %edi, %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/mleak.c
// Function: mleak_malloc
void *mleak_malloc(size_t size, const char *filename, int line)
{
	struct mleak_mem_t *ent;
	time_t now;
	ent = (struct mleak_mem_t *) malloc(sizeof(struct mleak_mem_t) + size);
	ent->ptr = (void *)(((char *)ent) + sizeof(struct mleak_mem_t));
	ent->size = size;
	ent->filename = filename;
	ent->line = line;
	now = time(NULL);
	strftime(ent->time, sizeof(ent->time), "%Y-%m-%d %H:%M:%S", localtime(&now));
	append_mem_ent(ent);
	return ent->ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
addq $0x50, %rdi
callq 0x22e0
movq %rax, %rbx
addq $0x50, %rax
movq %rax, 0x10(%rbx)
movq %r15, 0x18(%rbx)
movq %r14, 0x20(%rbx)
movl %ebp, 0x28(%rbx)
xorl %edi, %edi
callq 0x21e0
movq %rsp, %rdi
movq %rax, (%rdi)
movq %rbx, %r14
addq $0x2c, %r14
callq 0x2160
leaq 0x1d4b(%rip), %rdx      # 0x7079
pushq $0x20
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
callq 0x2190
movq 0x5fad(%rip), %rax      # 0xb2f0
testq %rax, %rax
je 0x5354
movq %rax, 0x8(%rbx)
movq (%rax), %rcx
movq %rcx, (%rbx)
jmp 0x5361
movq %rbx, 0x5f95(%rip)      # 0xb2f0
movq %rbx, %rcx
movq %rbx, %rax
movq %rbx, 0x8(%rcx)
movq %rbx, (%rax)
movq 0x10(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/mleak.c
// Function: mleak_free
void mleak_free(void *ptr)
{
    if (!ptr) return;
	struct mleak_mem_t *ent;
	ent = (struct mleak_mem_t *)(((char *)ptr) - sizeof(struct mleak_mem_t));
	remove_mem_ent(ent);
	free(ent);
}

// Assembly:
testq %rdi, %rdi
je 0x53c5
movq %rdi, %rax
addq $-0x50, %rdi
movq -0x48(%rax), %rcx
cmpq %rdi, %rcx
je 0x53c6
movq 0x5f4f(%rip), %rdx      # 0xb2f0
cmpq %rdi, %rdx
jne 0x53b1
movq 0x8(%rdx), %rdx
movq %rdx, 0x5f3f(%rip)      # 0xb2f0
movq -0x50(%rax), %rdx
movq %rcx, 0x8(%rdx)
movq -0x48(%rax), %rax
movq %rdx, (%rax)
jmp 0x2290
retq
andq $0x0, 0x5f22(%rip)      # 0xb2f0
jmp 0x2290
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/mleak.c
// Function: mleak_realloc
void* mleak_realloc(void* ptr, size_t size, const char* filename, int line)
{
	void* newptr = mleak_malloc(size, filename, line);
	if (!newptr) return NULL;
	if (ptr) {
		struct mleak_mem_t* ent;
		ent = (struct mleak_mem_t*)(((char*)ptr) - sizeof(struct mleak_mem_t));
		memcpy(newptr, ptr, MIN(size, ent->size));
		mleak_free(ptr);
	}
	return newptr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
movl %ecx, %edx
callq 0x52e0
movq %rax, %r14
testq %rax, %rax
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x541f
movq -0x38(%rbx), %rax
cmpq %r15, %rax
cmovbq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x21a0
movq %rbx, %rdi
callq 0x5385
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/mleak.c
// Function: mleak_strdup
void* mleak_strdup(const char *s, const char* filename, int line)
{
	int len = strlen(s);
	void* newptr = mleak_malloc(len + 1, filename, line);
	if (!newptr) return NULL;
	memcpy(newptr, s, len + 1);
	return newptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x20e0
incl %eax
movslq %eax, %r14
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x52e0
testq %rax, %rax
je 0x546b
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21a0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/mleak.c
// Function: mleak_print_leak
void mleak_print_leak()
{
	struct mleak_mem_t *ent, *p;
	if (!_mem) return;
	ent = _mem;
	do {
		_print(ent->ptr, ent->filename, ent->line, ent->time);
		ent = ent->next;
	} while(ent != _mem);
	ent = _mem;
	do {
		p = ent;
		ent = ent->next;
		free(p);
	} while(ent != _mem);
	_mem = 0;
}

// Assembly:
pushq %rbx
movq 0x5e64(%rip), %rbx      # 0xb2f0
testq %rbx, %rbx
je 0x54d3
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rsi
movl 0x28(%rbx), %edx
leaq 0x2c(%rbx), %rcx
callq *0x5d62(%rip)           # 0xb208
movq 0x8(%rbx), %rbx
movq 0x5e3f(%rip), %rdi      # 0xb2f0
cmpq %rdi, %rbx
jne 0x5491
movq 0x8(%rdi), %rbx
callq 0x2290
movq %rbx, %rdi
cmpq 0x5e27(%rip), %rbx      # 0xb2f0
jne 0x54b6
andq $0x0, 0x5e1d(%rip)      # 0xb2f0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/dohclient-cache.c
// Function: is_digitstr
static int is_digitstr(const char *s)
{
	const char *p = s;
	while (*p) {
		if (!isdigit(*p))
			return FALSE;
		p++;
	}
	return TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x1
popq %rbx
movsbq (%r14), %r15
testq %r15, %r15
je 0x6478
callq 0x2230
movq (%rax), %rax
incq %r14
testb $0x8, 0x1(%rax,%r15,2)
jne 0x645a
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/chbarts[P]aa-tree/aa-test1.c
// Function: main
int main(int argc, char *argv[])
{
    aa *tree;
    FILE *fin;
    int i;

    if ((tree = aa_new(comparator)) == NULL) {
        fprintf(stderr, "aa_new error\n");
        exit(EXIT_FAILURE);
    }

    if (argc == 1) {
        dofile("stdin", stdin, tree);
    } else {
        for (i = 1; i < argc; i++) {
            if ((fin = fopen(argv[i], "rb")) == NULL) {
                handle_ferr(argv[i], "aa-test1");
                continue;
            }

            dofile(argv[i], fin, tree);

            if (fclose(fin) == EOF) {
                handle_ferr(argv[i], "aa-test1");
            }
        }
    }

    aa_print(tree, stdout, print);

    cleanup(tree);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
leaq 0xdd(%rip), %rdi        # 0x1c14
callq 0x1344
testq %rax, %rax
je 0x1bf0
movq %rax, %rbx
cmpl $0x1, %ebp
jne 0x1b98
movq 0x2484(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
leaq 0x55f(%rip), %rdi       # 0x20bd
movq %rbx, %rdx
callq 0x1c29
movq 0x2463(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq 0x183(%rip), %rdx       # 0x1cfa
movq %rbx, %rdi
callq 0x197b
movq %rbx, %rdi
callq 0x1d08
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %ebp, %rbp
pushq $0x1
popq %r12
leaq 0x51d(%rip), %r15       # 0x20c3
cmpq %rbp, %r12
jge 0x1b66
movq (%r14,%r12,8), %rdi
movq %r15, %rsi
callq 0x10e0
movq (%r14,%r12,8), %rdi
testq %rax, %rax
je 0x1bdf
movq %rax, %r13
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1c29
movq %r13, %rdi
callq 0x1050
cmpl $-0x1, %eax
jne 0x1beb
movq (%r14,%r12,8), %rdi
leaq 0x4e0(%rip), %rsi       # 0x20c6
callq 0x130c
incq %r12
jmp 0x1ba6
movq 0x2401(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x4ae(%rip), %rdi       # 0x20af
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x1110
pushq $0x1
popq %rdi
callq 0x1100
// File: /workspace/github_c_makefile_star2_O2/chbarts[P]aa-tree/aa-test1.c
// Function: dofile
static void dofile(char *fname, FILE * fin, aa * tree)
{
    char *ln;

    while (fggets(&ln, fin) == 0) {
        switch (aa_add(tree, ln, duplicate)) {
        case 0:                /* no error */
            break;
        case 2:                /* memory error */
            free(ln);
            error(tree);
            break;
        default:               /* can't happen */
            fprintf(stderr, "can't happen\n");
            free(ln);
            cleanup(tree);
            exit(EXIT_FAILURE);
            break;
        }
    }

    if (ferror(fin) != 0)
        handle_ferr(fname, "aa-test1");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8(%rsp), %r12
leaq 0xcf(%rip), %r13        # 0x1d1a
movq %r12, %rdi
movq %r15, %rsi
callq 0x122c
testl %eax, %eax
jne 0x1c9b
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x136c
testl %eax, %eax
je 0x1c4b
cmpl $0x2, %eax
jne 0x1cc4
movq 0x8(%rsp), %rdi
callq 0x1030
movq 0x2374(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x44f(%rip), %rdi       # 0x20dd
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x1110
jmp 0x1cea
movq %r15, %rdi
callq 0x1040
testl %eax, %eax
je 0x1cb6
leaq 0x418(%rip), %rsi       # 0x20c6
movq %r14, %rdi
callq 0x130c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x232d(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x3fa(%rip), %rdi       # 0x20cf
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x1110
movq 0x8(%rsp), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1d08
pushq $0x1
popq %rdi
callq 0x1100
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/perftests/dynamodb_queue/main.c
// Function: donereq
static int
donereq(void * cookie, struct http_response * R, const char * err)
{

	(void)cookie; /* UNUSED */
	(void)err; /* UNUSED */

	/* This request is over. */
	if (--inprogress == 0)
		done = 1;

	/* Print status. */
	printf("HTTP status = %d; ", R->status);

	/* Print the body received. */
	fwrite(R->body, 1, R->bodylen, stdout);
	fprintf(stdout, "\n");

	/* Free the body. */
	free(R->body);

	/* Success! */
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
decl 0x14ac8(%rip)           # 0x18708
jne 0x3c4c
movl $0x1, 0x14ab8(%rip)     # 0x18704
movl (%rbx), %esi
leaq 0xc52d(%rip), %rdi      # 0x10182
xorl %eax, %eax
callq 0x3050
movq 0x18(%rbx), %rdx
movq 0x20(%rbx), %rdi
movq 0x1435d(%rip), %r14     # 0x17fc8
movq (%r14), %rcx
pushq $0x1
popq %rsi
callq 0x3640
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x3490
movq 0x20(%rbx), %rdi
callq 0x3460
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_kv.c
// Function: dynamodb_kv_put
char *
dynamodb_kv_put(const char * table, const char * key,
    const uint8_t * buf, size_t len)
{
	/**
	 * The body of a PutItem request (with spaces added) is:
	 * { "TableName": "TABLE",
	 *   "Item": {
	 *     "K": { "S": "KEY" },
	 *     "V": { "B": "BASE64VALUE" }
	 *   },
	 *   "ReturnConsumedCapacity": "TOTAL"
	 * }
	 */
	const char * s1 = "{\"TableName\":\"";
	const char * s2 = "\",\"Item\":{\"K\":{\"S\":\"";
	const char * s3 = "\"},\"V\":{\"B\":\"";
	const char * s4 = "\"}},\"ReturnConsumedCapacity\":\"TOTAL\"}";
	size_t slen = strlen(s1) + strlen(table) + strlen(s2) + strlen(key) +
	    strlen(s3) + b64len(len) + strlen(s4);
	size_t spos = 0;
	char * s;

	/* Allocate request string. */
	if ((s = malloc(slen + 1)) == NULL)
		goto done;

	/* Construct the request, piece by piece. */
	COPYANDINCR(s, spos, s1);
	COPYANDINCR(s, spos, table);
	COPYANDINCR(s, spos, s2);
	COPYANDINCR(s, spos, key);
	COPYANDINCR(s, spos, s3);
	b64encode(buf, &s[spos], len);
	spos += b64len(len);
	COPYANDINCR(s, spos, s4);
	s[spos] = '\0';

	/* Check that we got the buffer size right. */
	assert(slen == spos);

done:
	/* Return string (or NULL if allocation failed). */
	return (s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, 0x20(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
callq 0x3190
movq %rax, %r12
movq %r15, 0x18(%rsp)
movq %r15, %rdi
callq 0x3190
movq %rax, 0x10(%rsp)
leaq (%r12,%rax), %rbp
addq $0x22, %rbp
leaq 0x2(%r14), %rax
pushq $0x3
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %r15
leaq 0x33(,%rax,4), %rdi
addq %rbp, %rdi
callq 0x34d0
movq %rax, %r13
testq %rax, %rax
je 0x57fc
movq %r14, 0x8(%rsp)
movq %r12, %r14
addq $0x22, %r14
shlq $0x2, %r15
movabsq $0x223a22656d614e65, %rax # imm = 0x223A22656D614E65
movq %rax, 0x6(%r13)
movabsq $0x4e656c626154227b, %rax # imm = 0x4E656C626154227B
movq %rax, (%r13)
leaq 0xe(%r13), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3290
movups 0xae29(%rip), %xmm0     # 0x10594
movups %xmm0, 0xe(%r13,%r12)
movl $0x223a2253, 0x1e(%r13,%r12) # imm = 0x223A2253
addq %r13, %r14
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x3290
movq %r13, %rbx
addq %rbp, %rbx
movabsq $0x7b3a2256222c7d22, %rax # imm = 0x7B3A2256222C7D22
movq %rax, (%r13,%rbp)
movabsq $0x223a2242227b3a22, %rax # imm = 0x223A2242227B3A22
movq %rax, 0x5(%r13,%rbp)
leaq 0xd(,%rbp), %rsi
addq %r13, %rsi
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0xa614
movabsq $0x7d224c41544f5422, %rax # imm = 0x7D224C41544F5422
movq %rax, 0x2a(%r15,%rbx)
movups 0xade4(%rip), %xmm0     # 0x105c7
movups %xmm0, 0x1d(%r15,%rbx)
movups 0xadc7(%rip), %xmm0     # 0x105b7
movups %xmm0, 0xd(%r15,%rbx)
movb $0x0, 0x32(%r15,%rbx)
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_kv.c
// Function: dynamodb_kv_get
char *
dynamodb_kv_get(const char * table, const char * key)
{
	/**
	 * The body of a GetItem request (with spaces added) is:
	 * { "TableName": "TABLE",
	 *   "Key": {
	 *     "K": { "S": "KEY" }
	 *   },
	 *   "ReturnConsumedCapacity": "TOTAL"
	 * }
	 */
	const char * s1 = "{\"TableName\":\"";
	const char * s2 = "\",\"Key\":{\"K\":{\"S\":\"";
	const char * s3 = "\"}},\"ReturnConsumedCapacity\":\"TOTAL\"}";
	size_t slen = strlen(s1) + strlen(table) + strlen(s2) + strlen(key) +
	    strlen(s3);
	size_t spos = 0;
	char * s;

	/* Allocate request string. */
	if ((s = malloc(slen + 1)) == NULL)
		goto done;

	/* Construct the request, piece by piece. */
	COPYANDINCR(s, spos, s1);
	COPYANDINCR(s, spos, table);
	COPYANDINCR(s, spos, s2);
	COPYANDINCR(s, spos, key);
	COPYANDINCR(s, spos, s3);
	s[spos] = '\0';

	/* Check that we got the buffer size right. */
	assert(slen == spos);

done:
	/* Return string (or NULL if allocation failed). */
	return (s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r13
callq 0x3190
movq %rax, %r12
movq %rbx, %rdi
callq 0x3190
movq %rax, %r15
leaq (%r12,%rax), %rdi
addq $0x47, %rdi
callq 0x34d0
movq %rax, %r14
testq %rax, %rax
je 0x5ca5
movq %rbx, (%rsp)
leaq (%r12,%r15), %rbx
addq $0x21, %rbx
movq %r12, %rbp
addq $0x21, %rbp
movabsq $0x223a22656d614e65, %rax # imm = 0x223A22656D614E65
movq %rax, 0x6(%r14)
movabsq $0x4e656c626154227b, %rax # imm = 0x4E656C626154227B
movq %rax, (%r14)
leaq 0xe(%r14), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x3290
movups 0xaa5f(%rip), %xmm0     # 0x106b5
movups %xmm0, 0xe(%r14,%r12)
movl $0x223a2253, 0x1d(%r14,%r12) # imm = 0x223A2253
addq %r14, %rbp
movq %rbp, %rdi
movq (%rsp), %rsi
movq %r15, %rdx
callq 0x3290
movabsq $0x7d224c41544f5422, %rax # imm = 0x7D224C41544F5422
movq %rax, 0x1d(%r14,%rbx)
movups 0xa92a(%rip), %xmm0     # 0x105b7
movups %xmm0, (%r14,%rbx)
movups 0xa92e(%rip), %xmm0     # 0x105c7
movups %xmm0, 0x10(%r14,%rbx)
movb $0x0, 0x25(%r14,%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_kv.c
// Function: dynamodb_kv_getc
char *
dynamodb_kv_getc(const char * table, const char * key)
{
	/**
	 * The body of a strongly consistent GetItem request (with spaces
	 * added) is:
	 * { "ConsistentRead": true,
	 *   "TableName": "TABLE",
	 *   "Key": {
	 *     "K": { "S": "KEY" }
	 *   },
	 *   "ReturnConsumedCapacity": "TOTAL"
	 * }
	 */
	const char * s1 = "{\"ConsistentRead\":true,\"TableName\":\"";
	const char * s2 = "\",\"Key\":{\"K\":{\"S\":\"";
	const char * s3 = "\"}},\"ReturnConsumedCapacity\":\"TOTAL\"}";
	size_t slen = strlen(s1) + strlen(table) + strlen(s2) + strlen(key) +
	    strlen(s3);
	size_t spos = 0;
	char * s;

	/* Allocate request string. */
	if ((s = malloc(slen + 1)) == NULL)
		goto done;

	/* Construct the request, piece by piece. */
	COPYANDINCR(s, spos, s1);
	COPYANDINCR(s, spos, table);
	COPYANDINCR(s, spos, s2);
	COPYANDINCR(s, spos, key);
	COPYANDINCR(s, spos, s3);
	s[spos] = '\0';

	/* Check that we got the buffer size right. */
	assert(slen == spos);

done:
	/* Return string (or NULL if allocation failed). */
	return (s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r13
callq 0x3190
movq %rax, %r12
movq %rbx, %rdi
callq 0x3190
movq %rax, %r15
leaq (%r12,%rax), %rdi
addq $0x5d, %rdi
callq 0x34d0
movq %rax, %r14
testq %rax, %rax
je 0x5d8b
movq %rbx, (%rsp)
leaq (%r12,%r15), %rbx
addq $0x37, %rbx
movq %r12, %rbp
addq $0x37, %rbp
movups 0xa9cb(%rip), %xmm0     # 0x106d9
movups %xmm0, 0x10(%r14)
movups 0xa9af(%rip), %xmm0     # 0x106c9
movups %xmm0, (%r14)
movl $0x223a2265, 0x20(%r14) # imm = 0x223A2265
leaq 0x24(%r14), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x3290
movups 0xa979(%rip), %xmm0     # 0x106b5
movups %xmm0, 0x24(%r14,%r12)
movl $0x223a2253, 0x33(%r14,%r12) # imm = 0x223A2253
addq %r14, %rbp
movq %rbp, %rdi
movq (%rsp), %rsi
movq %r15, %rdx
callq 0x3290
movabsq $0x7d224c41544f5422, %rax # imm = 0x7D224C41544F5422
movq %rax, 0x1d(%r14,%rbx)
movups 0xa844(%rip), %xmm0     # 0x105b7
movups %xmm0, (%r14,%rbx)
movups 0xa848(%rip), %xmm0     # 0x105c7
movups %xmm0, 0x10(%r14,%rbx)
movb $0x0, 0x25(%r14,%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_kv.c
// Function: dynamodb_kv_extractv
int
dynamodb_kv_extractv(const uint8_t * inbuf, size_t inlen,
    uint8_t ** outbuf, uint32_t * outlen)
{
	const uint8_t * p = inbuf;
	const uint8_t * end = &inbuf[inlen];
	size_t slen;
	size_t vlen;

	/* If we have no response body, there is no value. */
	if (inbuf == NULL)
		goto novalue;

	/**
	 * We need to locate B64VALUE in the string
	 * {"Item":{"V":{"B":"dmFsdWUK"},"K":{"S":"key"}}}
	 * so we look for the json object associated with "Item"; then look
	 * for the json object associated with "V" inside that; then look
	 * for the json object associated with "B" inside that.
	 */
	p = json_find(p, end, "Item");
	p = json_find(p, end, "V");
	p = json_find(p, end, "B");

	/* We should be pointing at the opening '"' of a string. */
	if (p == end)
		goto novalue;
	if (*p++ != '"')
		goto novalue;

	/* How long is it? */
	for (slen = 0; &p[slen] != end; slen++) {
		if (p[slen] == '"')
			break;
	}

	/* We should have found a terminating '"'. */
	if (&p[slen] == end)
		goto novalue;

	/* Bail if the value of "B" is less than 4 characters. */
	if (slen < 4)
		goto novalue;

	/* Allocate a buffer. */
	if ((*outbuf = malloc((slen / 4) * 3)) == NULL)
		goto err0;

	/* Attempt to parse the base64-encoded data. */
	if (b64decode((const char *)p, slen, *outbuf, &vlen))
		goto novalue1;

	/* Record the size of the returned value. */
	if (vlen >= (uint32_t)(-1))
		goto novalue1;
	*outlen = (uint32_t)vlen;

	/* Success! */
	return (0);

novalue1:
	free(*outbuf);
novalue:
	/* We have no value. */
	*outbuf = NULL;

	/* Success!  (Or at least, no internal error.) */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
testq %rdi, %rdi
je 0x5f4d
movq %rcx, %r14
movq %rsi, %r15
addq %rdi, %r15
leaq 0xa2d5(%rip), %rdx      # 0x1017d
movq %r15, %rsi
callq 0xa790
leaq 0xa837(%rip), %rdx      # 0x106ee
movq %rax, %rdi
movq %r15, %rsi
callq 0xa790
leaq 0xa827(%rip), %rdx      # 0x106f0
movq %rax, %rdi
movq %r15, %rsi
callq 0xa790
cmpq %r15, %rax
je 0x5f4d
movq %rax, %r12
cmpb $0x22, (%rax)
jne 0x5f4d
incq %r12
xorl %r13d, %r13d
leaq (%r12,%r13), %rax
cmpq %r15, %rax
je 0x5f4d
cmpb $0x22, (%rax)
je 0x5efa
incq %r13
jmp 0x5ee7
cmpq $0x4, %r13
jb 0x5f4d
movq %r13, %rax
shrq $0x2, %rax
leaq (%rax,%rax,2), %rdi
callq 0x34d0
movq %rax, (%rbx)
testq %rax, %rax
je 0x5f61
leaq 0x8(%rsp), %r15
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %r15, %rcx
callq 0xa684
testl %eax, %eax
setne %cl
movq (%r15), %rax
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
cmpq %rdx, %rax
seta %dl
orb %cl, %dl
je 0x5f66
movq (%rbx), %rdi
callq 0x3460
andq $0x0, (%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
pushq $-0x1
popq %rax
jmp 0x5f53
movl %eax, (%r14)
jmp 0x5f51
nop