LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/log.c
// Function: open_syslog
void open_syslog(const char *ident)
{
#ifdef WINDOWS
	logw("use_syslog(): not implemented in Windows port");
#else
	if (!s_is_use_syslog) {
		openlog(ident, LOG_CONS | LOG_PID, LOG_DAEMON);
		s_is_use_syslog = 1;
		log_vprintf = log_vprintf_syslog;
		log_vprintf_with_timestamp = log_vprintf_syslog;
	}
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpl $0x0, 0xb781(%rip)      # 0xe2d4
jne 0x2b8e
movq -0x8(%rbp), %rdi
movl $0x3, %esi
movl $0x18, %edx
callq 0x21d0
movl $0x1, 0xb762(%rip)      # 0xe2d4
leaq -0x159(%rip), %rax      # 0x2a20
movq %rax, 0xb670(%rip)      # 0xe1f0
leaq -0x167(%rip), %rax      # 0x2a20
movq %rax, 0xb66a(%rip)      # 0xe1f8
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/log.c
// Function: close_syslog
void close_syslog()
{
#ifdef WINDOWS
	logw("close_syslog(): not implemented in Windows port");
#else
	if (s_is_use_syslog) {
		s_is_use_syslog = 0;
		log_vprintf = log_vprintf_default;
		log_vprintf_with_timestamp = log_vprintf_with_timestamp_default;
		closelog();
	}
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0xb729(%rip)      # 0xe2d4
je 0x2bd8
movl $0x0, 0xb71d(%rip)      # 0xe2d4
leaq -0x70e(%rip), %rax      # 0x24b0
movq %rax, 0xb62b(%rip)      # 0xe1f0
leaq -0x6cc(%rip), %rax      # 0x2500
movq %rax, 0xb625(%rip)      # 0xe1f8
callq 0x2210
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/log.c
// Function: get_filename
static const char *get_filename(const char *file)
{
	size_t len;
	const char *p;
	if (!file) return NULL;
	len = strlen(file);
	for (p = file + len; p > file && *p != '/' && *p != '\\'; --p);
	if (*p == '/' || *p == '\\') ++p;
	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x2c30
movq $0x0, -0x8(%rbp)
jmp 0x2cbe
movq -0x10(%rbp), %rdi
callq 0x20f0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpq -0x10(%rbp), %rcx
movb %al, -0x21(%rbp)
jbe 0x2c79
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x21(%rbp)
je 0x2c79
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x2c82
jmp 0x2c92
jmp 0x2c84
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2c49
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x2caa
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x2cb6
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/log.c
// Function: log_vmprintf
static char *log_vmprintf(const char *fmt, va_list args)
{
	int cnt, sz;
	char *buf;
	va_list ap_try;

	sz = 1024;
	buf = (char*)malloc(sz);
	if (!buf)
		return NULL;
try_print:
	va_copy(ap_try, args);
	cnt = vsnprintf(buf, sz, fmt, ap_try);
	va_end(ap_try);
	if (cnt >= sz) {
		char *newbuf;
		sz *= 2;
		newbuf = (char*)realloc(buf, sz);
		if (!newbuf) {
			free(buf);
			return NULL;
		}
		buf = newbuf;
		goto try_print;
	}
	if (cnt < 0) {
		free(buf);
		return NULL;
	}
	return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x400, -0x20(%rbp)     # imm = 0x400
movslq -0x20(%rbp), %rdi
callq 0x22d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x2d08
movq $0x0, -0x8(%rbp)
jmp 0x2da2
jmp 0x2d0a
leaq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq -0x28(%rbp), %rdi
movslq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x2140
movl %eax, -0x1c(%rbp)
leaq -0x40(%rbp), %rax
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x2d81
movl -0x20(%rbp), %eax
shll %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x2340
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x2d77
movq -0x28(%rbp), %rdi
callq 0x2290
movq $0x0, -0x8(%rbp)
jmp 0x2da2
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x2d0a
cmpl $0x0, -0x1c(%rbp)
jge 0x2d9a
movq -0x28(%rbp), %rdi
callq 0x2290
movq $0x0, -0x8(%rbp)
jmp 0x2da2
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: try_parse_as_ip4
int try_parse_as_ip4(sockaddr_t* addr, const char* host, const char* port)
{
	struct sockaddr_in* in = (struct sockaddr_in*)(&addr->addr);

	if (inet_pton(AF_INET, host, &in->sin_addr) == 1) {
		in->sin_family = AF_INET;
		in->sin_port = htons(atoi(port));
		addr->addrlen = sizeof(struct sockaddr_in);
		return TRUE;
	}

	return FALSE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x4, %rdx
movl $0x2, %edi
callq 0x2380
cmpl $0x1, %eax
jne 0x2ec3
movq -0x28(%rbp), %rax
movw $0x2, (%rax)
movq -0x20(%rbp), %rdi
callq 0x2310
movzwl %ax, %edi
callq 0x2050
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x10(%rbp), %rax
movl $0x10, 0x80(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2eca
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: try_parse_as_ip6
int try_parse_as_ip6(sockaddr_t* addr, const char* host, const char* port)
{
	struct sockaddr_in6* in = (struct sockaddr_in6*)(&addr->addr);

	if (inet_pton(AF_INET6, host, &in->sin6_addr) == 1) {
		in->sin6_family = AF_INET6;
		in->sin6_port = htons(atoi(port));
		addr->addrlen = sizeof(struct sockaddr_in);
		return TRUE;
	}

	return FALSE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x8, %rdx
movl $0xa, %edi
callq 0x2380
cmpl $0x1, %eax
jne 0x2f53
movq -0x28(%rbp), %rax
movw $0xa, (%rax)
movq -0x20(%rbp), %rdi
callq 0x2310
movzwl %ax, %edi
callq 0x2050
movw %ax, %cx
movq -0x28(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x10(%rbp), %rax
movl $0x10, 0x80(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2f5a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: setnonblock
int setnonblock(sock_t sock)
{
#ifdef WINDOWS
	int iResult;
	/* If iMode!=0, non-blocking mode is enabled.*/
	u_long iMode = 1;
	iResult = ioctlsocket(sock, FIONBIO, &iMode);
	if (iResult != NO_ERROR) {
		loge("ioctlsocket() error: result=%ld, errno=%d, %s\n",
			iResult, errno, strerror(errno));
		return -1;
	}
#else
	int flags;
	flags = fcntl(sock, F_GETFL, 0);
	if (flags == -1) {
		loge("fcntl() error: errno=%d, %s\n", errno, strerror(errno));
		return -1;
	}
	if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) {
		loge("fcntl() error: errno=%d, %s\n", errno, strerror(errno));
		return -1;
	}
#endif

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x2130
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x3045
jmp 0x2fe7
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3037
callq 0x2030
movl (%rax), %eax
movl %eax, -0x10(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movl -0x10(%rbp), %r9d
movl $0x3, %edi
leaq 0x710f(%rip), %rsi      # 0xa128
leaq 0x7117(%rip), %rdx      # 0xa137
movl $0x3c, %ecx
leaq 0x7117(%rip), %r8       # 0xa143
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x3039
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30c6
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x2130
cmpl $-0x1, %eax
jne 0x30bf
jmp 0x3064
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x30b4
callq 0x2030
movl (%rax), %eax
movl %eax, -0x14(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movl -0x14(%rbp), %r9d
movl $0x3, %edi
leaq 0x7092(%rip), %rsi      # 0xa128
leaq 0x709a(%rip), %rdx      # 0xa137
movl $0x40, %ecx
leaq 0x709a(%rip), %r8       # 0xa143
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x30b6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x30c6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: setreuseaddr
int setreuseaddr(sock_t sock)
{
	int opt = 1;

	if (setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (const char*)&opt, sizeof(opt)) != 0) {
		loge("setsockopt() error: errno=%d, %s\n", errno, strerror(errno));
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl $0x1, -0xc(%rbp)
movl -0x8(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0xc(%rbp), %rcx
movl $0x4, %r8d
callq 0x2350
cmpl $0x0, %eax
je 0x3160
jmp 0x3105
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3155
callq 0x2030
movl (%rax), %eax
movl %eax, -0x10(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movl -0x10(%rbp), %r9d
movl $0x3, %edi
leaq 0x6ff1(%rip), %rsi      # 0xa128
leaq 0x7022(%rip), %rdx      # 0xa160
movl $0x4d, %ecx
leaq 0x7023(%rip), %r8       # 0xa16d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x3157
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3167
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: setnodelay
int setnodelay(sock_t sock)
{
	int opt = 1;

	if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&opt, sizeof(opt)) != 0) {
		loge("setsockopt() error: errno=%d, %s\n", errno, strerror(errno));
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl $0x1, -0xc(%rbp)
movl -0x8(%rbp), %edi
movl $0x6, %esi
movl $0x1, %edx
leaq -0xc(%rbp), %rcx
movl $0x4, %r8d
callq 0x2350
cmpl $0x0, %eax
je 0x3200
jmp 0x31a5
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x31f5
callq 0x2030
movl (%rax), %eax
movl %eax, -0x10(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movl -0x10(%rbp), %r9d
movl $0x3, %edi
leaq 0x6f51(%rip), %rsi      # 0xa128
leaq 0x6fb1(%rip), %rdx      # 0xa18f
movl $0x59, %ecx
leaq 0x6f83(%rip), %r8       # 0xa16d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x31f7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3207
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: getsockerr
int getsockerr(sock_t sock)
{
	int err = 0;
	int len = sizeof(int);
	if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (char*)& err, &len) < 0)
		return errno;
	return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x4, -0x10(%rbp)
movl -0x8(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
leaq -0xc(%rbp), %rcx
leaq -0x10(%rbp), %r8
callq 0x2180
cmpl $0x0, %eax
jge 0x3254
callq 0x2030
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x325a
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: get_addrname
char* get_addrname(const struct sockaddr* addr)
{
	static char addrname[INET6_ADDRSTRLEN + 16];
	char sip[INET6_ADDRSTRLEN];
	if (addr->sa_family == AF_INET) {
		const struct sockaddr_in* addr_in = (const struct sockaddr_in*)addr;
		inet_ntop(AF_INET, &addr_in->sin_addr, sip, sizeof(sip));
		snprintf(addrname, sizeof(addrname), "%s:%d", sip,
			(int)(htons(addr_in->sin_port) & 0xFFFF));
	}
	else if (addr->sa_family == AF_INET6) {
		const struct sockaddr_in6* addr_in6 = (const struct sockaddr_in6*)addr;
		inet_ntop(AF_INET6, &addr_in6->sin6_addr, sip, sizeof(sip));
		snprintf(addrname, sizeof(addrname), "[%s]:%d", sip,
			(int)(htons(addr_in6->sin6_port) & 0xFFFF));
	}
	else {
		addrname[0] = '\0';
	}
	return addrname;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x332b
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
addq $0x4, %rsi
leaq -0x40(%rbp), %rdx
movl $0x2, %edi
movl $0x2e, %ecx
callq 0x2230
leaq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x2050
movq -0x58(%rbp), %rcx
movzwl %ax, %r8d
andl $0xffff, %r8d           # imm = 0xFFFF
leaq 0xaffa(%rip), %rdi      # 0xe310
movl $0x3e, %esi
leaq 0x6e78(%rip), %rdx      # 0xa19a
movb $0x0, %al
callq 0x2320
jmp 0x33a3
movq -0x8(%rbp), %rax
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0x339a
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
addq $0x8, %rsi
leaq -0x40(%rbp), %rdx
movl $0xa, %edi
movl $0x2e, %ecx
callq 0x2230
leaq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x2050
movq -0x60(%rbp), %rcx
movzwl %ax, %r8d
andl $0xffff, %r8d           # imm = 0xFFFF
leaq 0xaf8b(%rip), %rdi      # 0xe310
movl $0x3e, %esi
leaq 0x6e0f(%rip), %rdx      # 0xa1a0
movb $0x0, %al
callq 0x2320
jmp 0x33a1
movb $0x0, 0xaf6f(%rip)      # 0xe310
jmp 0x33a3
leaq 0xaf66(%rip), %rax      # 0xe310
addq $0x60, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: get_sockname
char* get_sockname(sock_t sock)
{
	static char buffer[INET6_ADDRSTRLEN + 16] = { 0 };
	char sip[INET6_ADDRSTRLEN];
	struct sockaddr_storage addr;
	socklen_t len = sizeof(addr);
	memset(&addr, 0, len);
	int err = getpeername(sock, (struct sockaddr*) & addr, &len);
	if (err != 0)
		return NULL;
	if (addr.ss_family == AF_INET) {
		struct sockaddr_in* s = (struct sockaddr_in*) & addr;
		inet_ntop(AF_INET, &s->sin_addr, sip, sizeof(sip));
		snprintf(buffer, sizeof(buffer), "%s:%d", sip,
			(int)(htons(s->sin_port) & 0xFFFF));
		return buffer;
	}
	else if (addr.ss_family == AF_INET6) {
		struct sockaddr_in6* s = (struct sockaddr_in6*) & addr;
		inet_ntop(AF_INET6, &s->sin6_addr, sip, sizeof(sip));
		snprintf(buffer, sizeof(buffer), "[%s]:%d", sip,
			(int)(htons(s->sin6_port) & 0xFFFF));
		return buffer;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl %edi, -0xc(%rbp)
movl $0x80, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, %edx
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
callq 0x2120
movl -0xc(%rbp), %edi
leaq -0xc0(%rbp), %rsi
leaq -0xc4(%rbp), %rdx
callq 0x2160
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
je 0x3410
movq $0x0, -0x8(%rbp)
jmp 0x353d
movzwl -0xc0(%rbp), %eax
cmpl $0x2, %eax
jne 0x34a3
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rsi
addq $0x4, %rsi
leaq -0x40(%rbp), %rdx
movl $0x2, %edi
movl $0x2e, %ecx
callq 0x2230
leaq -0x40(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xd0(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x2050
movq -0xe0(%rbp), %rcx
movzwl %ax, %r8d
andl $0xffff, %r8d           # imm = 0xFFFF
leaq 0xaed0(%rip), %rdi      # 0xe350
movl $0x3e, %esi
leaq 0x6d0e(%rip), %rdx      # 0xa19a
movb $0x0, %al
callq 0x2320
leaq 0xaeb6(%rip), %rax      # 0xe350
movq %rax, -0x8(%rbp)
jmp 0x353d
movzwl -0xc0(%rbp), %eax
cmpl $0xa, %eax
jne 0x3533
leaq -0xc0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rsi
addq $0x8, %rsi
leaq -0x40(%rbp), %rdx
movl $0xa, %edi
movl $0x2e, %ecx
callq 0x2230
leaq -0x40(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xd8(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x2050
movq -0xe8(%rbp), %rcx
movzwl %ax, %r8d
andl $0xffff, %r8d           # imm = 0xFFFF
leaq 0xae3d(%rip), %rdi      # 0xe350
movl $0x3e, %esi
leaq 0x6c81(%rip), %rdx      # 0xa1a0
movb $0x0, %al
callq 0x2320
leaq 0xae23(%rip), %rax      # 0xe350
movq %rax, -0x8(%rbp)
jmp 0x353d
jmp 0x3535
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: parse_host_port
int parse_host_port(char* s, char** host, char** port, int* ai_family)
{
	char* p;
	int cnt = 0;

	/* ipv6 */
	if (*s == '[') {
		p = strrchr(s, ']');
		if (p) {
			*host = s + 1;
			*p = '\0';
			p++;
			if (*p == ':')
				* port = p + 1;
			else
				*port = NULL;
			*ai_family = AF_INET6;
			return 0;
		}
		else {
			return -1;
		}
	}

	p = strrchr(s, ':');
	if (p) {
		*port = p + 1;
		*p = '\0';
	}
	else {
		*port = NULL;
	}

	*host = s;
	*ai_family = AF_INET;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
jne 0x35fa
movq -0x10(%rbp), %rdi
movl $0x5d, %esi
callq 0x2260
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x35f1
movq -0x10(%rbp), %rcx
addq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x35d3
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x35de
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movl $0xa, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3652
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3652
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x2260
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x362b
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
jmp 0x3636
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movl $0x2, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: host2addr
int host2addr(sockaddr_t* addr, const char* host, const char* port, int ai_family)
{
	struct addrinfo hints;
	struct addrinfo* addrinfo;
	int r;

	memset(&hints, 0, sizeof(hints));

	hints.ai_family = ai_family;
	hints.ai_socktype = SOCK_STREAM;

	r = getaddrinfo(host, port, &hints, &addrinfo);

	if (r != 0)
	{
		loge("retval=%d %s %s:%s\n",
			r, gai_strerror(r), host, port);
		return -1;
	}

	memcpy(&addr->addr, addrinfo->ai_addr, addrinfo->ai_addrlen);
	addr->addrlen = (int)addrinfo->ai_addrlen;

	freeaddrinfo(addrinfo);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2120
movl -0x24(%rbp), %eax
movl %eax, -0x54(%rbp)
movl $0x1, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x22b0
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
je 0x371f
jmp 0x36b7
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3714
movl -0x64(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %edi
callq 0x22e0
movl -0x68(%rbp), %r9d
movq %rax, %r11
movq -0x18(%rbp), %r10
movq -0x20(%rbp), %rax
movl $0x3, %edi
leaq 0x6a3c(%rip), %rsi      # 0xa128
leaq 0x6ab5(%rip), %rdx      # 0xa1a8
movl $0xd8, %ecx
leaq 0x6ab3(%rip), %r8       # 0xa1b2
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x3716
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x375a
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x60(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0x21b0
movq -0x60(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x80(%rax)
movq -0x60(%rbp), %rdi
callq 0x22c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: str2addr
int str2addr(
	const char* s, sockaddr_t* addr,
	const char* default_port)
{
	char* copy = strdup(s);
	char* host, * port;
	int ai_family;
	int r;

	if (parse_host_port(copy, &host, &port, &ai_family)) {
		free(copy);
		return -1;
	}

	if (!port || strlen(port) == 0)
		port = (char*)default_port;

	r = host2addr(addr, host, port, ai_family);

	free(copy);

	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2370
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x3550
cmpl $0x0, %eax
je 0x37bd
movq -0x28(%rbp), %rdi
callq 0x2290
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3801
cmpq $0x0, -0x38(%rbp)
je 0x37d3
movq -0x38(%rbp), %rdi
callq 0x20f0
cmpq $0x0, %rax
jne 0x37db
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0x3660
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2290
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: str2addrs
int str2addrs(
	const char* str,
	sockaddr_t* addrs,
	int max_num,
	int element_size,
	const char* default_port)
{
	char* s, * p, *saveptr = NULL;
	int i;
	sockaddr_t* addr;

	s = strdup(str);

	for (i = 0, p = strtok_r(s, ",", &saveptr);
		p && *p && i < max_num;
		p = strtok_r(NULL, ",", &saveptr)) {

		addr = (sockaddr_t*)(((char*)addrs) + (size_t)element_size * i);

		if (str2addr(p, addr, default_port)) {
			free(s);
			loge("resolve \"%s\" failed\n", str);
			return -1;
		}

		i++;
	}

	free(s);

	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2370
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x6975(%rip), %rsi      # 0xa1c6
leaq -0x40(%rbp), %rdx
callq 0x2360
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x51(%rbp)
je 0x3887
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x51(%rbp)
je 0x3887
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setl %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x3893
jmp 0x3930
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movslq -0x44(%rbp), %rdx
imulq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x3770
cmpl $0x0, %eax
je 0x390a
movq -0x30(%rbp), %rdi
callq 0x2290
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x38ff
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0x6843(%rip), %rsi      # 0xa128
leaq 0x68dc(%rip), %rdx      # 0xa1c8
movl $0x111, %ecx            # imm = 0x111
leaq 0x68da(%rip), %r8       # 0xa1d2
movb $0x0, %al
callq 0x2640
jmp 0x3901
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x393f
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x68a8(%rip), %rsi      # 0xa1c6
leaq -0x40(%rbp), %rdx
callq 0x2360
movq %rax, -0x38(%rbp)
jmp 0x385e
movq -0x30(%rbp), %rdi
callq 0x2290
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: str2proxy
int str2proxy(const char *s, proxy_t *proxy)
{
	char *copy = strdup(s), *p;
	char *host, *port;
	int ai_family;
	int r;

	p = get_proxy_type(copy, &proxy->proxy_type);
	if (!p) {
		free(copy);
		return -1;
	}

	p = get_proxy_username_and_password(p, proxy->username, proxy->password);
	if (!p) {
		free(copy);
		return -1;
	}

	if (parse_host_port(p, &host, &port, &ai_family)) {
		free(copy);
		return -1;
	}

	if (!port || strlen(port) == 0) {
		port = (char*)get_proxy_default_port(proxy->proxy_type);
		assert(port);
	}

	r = host2addr(&proxy->addr, host, port, ai_family);

	free(copy);

	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2370
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3a90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x399a
movq -0x20(%rbp), %rdi
callq 0x2290
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3a7e
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x94, %rsi
movq -0x18(%rbp), %rdx
addq $0xc6, %rdx
callq 0x3b90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x39d9
movq -0x20(%rbp), %rdi
callq 0x2290
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3a7e
movq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x3550
cmpl $0x0, %eax
je 0x3a05
movq -0x20(%rbp), %rdi
callq 0x2290
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3a7e
cmpq $0x0, -0x38(%rbp)
je 0x3a1b
movq -0x38(%rbp), %rdi
callq 0x20f0
cmpq $0x0, %rax
jne 0x3a54
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x3d10
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3a33
jmp 0x3a52
leaq 0x67ad(%rip), %rdi      # 0xa1e7
leaq 0x66e7(%rip), %rsi      # 0xa128
movl $0x18b, %edx            # imm = 0x18B
leaq 0x679f(%rip), %rcx      # 0xa1ec
callq 0x2150
jmp 0x3a54
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0x3660
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2290
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: get_proxy_type
static char *get_proxy_type(char *s, int *proxy_type)
{
	char *p;

	p = strstr(s, "://");

	if (!p) {
		/* socks5 default */
		*proxy_type = SOCKS5_PROXY;
		return s;
	}

	*p = '\0';
	if (strcmp(s, "socks5") == 0) {
		*proxy_type = SOCKS5_PROXY;
	}
	else if (strcmp(s, "http") == 0) {
		*proxy_type = HTTP_PROXY;
	}
	else {
		loge("unsupport proxy(%s), "
			"only \"socks5\" and \"http\" supported\n", s);
		*p = ':'; /* restore */
		return NULL;
	}

	*p = ':'; /* restore */
	p += strlen("://");

	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x69ad(%rip), %rsi      # 0xa458
callq 0x2090
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3ad2
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3b83
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
leaq 0x6978(%rip), %rsi      # 0xa45c
callq 0x22f0
cmpl $0x0, %eax
jne 0x3afa
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x3b68
movq -0x10(%rbp), %rdi
leaq 0x695e(%rip), %rsi      # 0xa463
callq 0x22f0
cmpl $0x0, %eax
jne 0x3b1b
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x3b66
jmp 0x3b1d
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3b53
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0x65ef(%rip), %rsi      # 0xa128
leaq 0x6928(%rip), %rdx      # 0xa468
movl $0x132, %ecx            # imm = 0x132
leaq 0x692b(%rip), %r8       # 0xa477
movb $0x0, %al
callq 0x2640
jmp 0x3b55
movq -0x20(%rbp), %rax
movb $0x3a, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x3b83
jmp 0x3b68
movq -0x20(%rbp), %rax
movb $0x3a, (%rax)
movq -0x20(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: get_proxy_username_and_password
static char *get_proxy_username_and_password(char *s, char *username, char *password)
{
	char *p, *colon;

	p = strchr(s, '@');

	if (!p) {
		*username = '\0';
		*password = '\0';
		return s;
	}

	*p = '\0';
	colon = strchr(s, ':');

	if (colon) {
		*colon = '\0';
		strncpy(username, s, PROXY_USERNAME_LEN - 1);
		strncpy(password, colon + 1, PROXY_PASSWORD_LEN - 1);
		*colon = ':';
	}
	else {
		strncpy(username, s, PROXY_USERNAME_LEN - 1);
		*password = '\0';
	}

	/* restore */
	*p = '@';

	if (strlen(username) == 0) {
		loge("no username\n");
		return NULL;
	}
	if (strlen(password) == 0) {
		loge("no password\n");
		return NULL;
	}

	++p;

	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x40, %esi
callq 0x20e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3bd8
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3d02
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3c30
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x31, %edx
callq 0x2110
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
movl $0x31, %edx
callq 0x2110
movq -0x30(%rbp), %rax
movb $0x3a, (%rax)
jmp 0x3c49
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x31, %edx
callq 0x2110
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movb $0x40, (%rax)
movq -0x18(%rbp), %rdi
callq 0x20f0
cmpq $0x0, %rax
jne 0x3c9f
jmp 0x3c61
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3c93
movl $0x3, %edi
leaq 0x64af(%rip), %rsi      # 0xa128
leaq 0x6830(%rip), %rdx      # 0xa4b0
movl $0x15b, %ecx            # imm = 0x15B
leaq 0x6844(%rip), %r8       # 0xa4d0
movb $0x0, %al
callq 0x2640
jmp 0x3c95
movq $0x0, -0x8(%rbp)
jmp 0x3d02
movq -0x20(%rbp), %rdi
callq 0x20f0
cmpq $0x0, %rax
jne 0x3cee
jmp 0x3cb0
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3ce2
movl $0x3, %edi
leaq 0x6460(%rip), %rsi      # 0xa128
leaq 0x67e1(%rip), %rdx      # 0xa4b0
movl $0x15f, %ecx            # imm = 0x15F
leaq 0x6802(%rip), %r8       # 0xa4dd
movb $0x0, %al
callq 0x2640
jmp 0x3ce4
movq $0x0, -0x8(%rbp)
jmp 0x3d02
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: get_proxy_default_port
static const char *get_proxy_default_port(int proxy_type)
{
	switch (proxy_type) {
		case SOCKS5_PROXY: return "1080";
		case HTTP_PROXY: return "80";
		default: return NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x10(%rbp)
testl %eax, %eax
je 0x3d2d
jmp 0x3d23
movl -0x10(%rbp), %eax
subl $0x1, %eax
je 0x3d3a
jmp 0x3d47
leaq 0x67b6(%rip), %rax      # 0xa4ea
movq %rax, -0x8(%rbp)
jmp 0x3d4f
leaq 0x67ab(%rip), %rax      # 0xa4ec
movq %rax, -0x8(%rbp)
jmp 0x3d4f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: str2proxies
int str2proxies(
	const char* str,
	proxy_t* proxies,
	int max_num)
{
	char* s, * p, *saveptr = NULL;
	int i;
	proxy_t* proxy;

	s = strdup(str);

	for (i = 0, p = strtok_r(s, ",", &saveptr);
		p && *p && i < max_num;
		p = strtok_r(NULL, ",", &saveptr)) {

		proxy = proxies + i;

		if (str2proxy(p, proxy)) {
			free(s);
			loge("resolve \"%s\" failed\n", str);
			return -1;
		}

		i++;
	}

	free(s);

	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2370
movq %rax, -0x28(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x642c(%rip), %rsi      # 0xa1c6
leaq -0x38(%rbp), %rdx
callq 0x2360
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0x49(%rbp)
je 0x3dd0
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
je 0x3dd0
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
setl %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x3ddc
jmp 0x3e74
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0xf8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3950
cmpl $0x0, %eax
je 0x3e4e
movq -0x28(%rbp), %rdi
callq 0x2290
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3e43
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0x62ff(%rip), %rsi      # 0xa128
leaq 0x63e3(%rip), %rdx      # 0xa213
movl $0x1a8, %ecx            # imm = 0x1A8
leaq 0x6396(%rip), %r8       # 0xa1d2
movb $0x0, %al
callq 0x2640
jmp 0x3e45
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3e83
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x6364(%rip), %rsi      # 0xa1c6
leaq -0x38(%rbp), %rdx
callq 0x2360
movq %rax, -0x30(%rbp)
jmp 0x3da7
movq -0x28(%rbp), %rdi
callq 0x2290
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: str2listens
int str2listens(
	const char* str,
	listen_t * listens,
	int max_num,
	int element_size,
	const char* default_port)
{
	int listen_num;

	memset(listens, 0, (size_t)element_size * max_num);

	listen_num = str2addrs(
		str,
		&listens[0].addr,
		max_num,
		element_size,
		default_port);

	if (listen_num == -1) {
		loge("parse \"%s\" failed\n",
			str);
		return -1;
	}

	return listen_num;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rdx
movslq -0x1c(%rbp), %rax
imulq %rax, %rdx
xorl %esi, %esi
callq 0x2120
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movq -0x28(%rbp), %r8
callq 0x3810
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x3f24
jmp 0x3ee3
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x3f19
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0x6229(%rip), %rsi      # 0xa128
leaq 0x6319(%rip), %rdx      # 0xa21f
movl $0x1c8, %ecx            # imm = 0x1C8
leaq 0x6319(%rip), %r8       # 0xa22b
movb $0x0, %al
callq 0x2640
jmp 0x3f1b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3f2a
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: init_listens
int init_listens(listen_t* listens, int listen_num)
{
	int i, num = listen_num, n = 0;
	listen_t* listen;

	for (i = 0; i < num; i++) {
		listen = listens + i;
		if (tcp_listen(listen) == 0) {
			n++;
		}
		if (udp_listen(listen) == 0) {
			n++;
		}
	}

	if (n == 0)
		return -1;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x446c
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x90, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3f40
cmpl $0x0, %eax
jne 0x4448
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41f0
cmpl $0x0, %eax
jne 0x445f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4461
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4413
cmpl $0x0, -0x20(%rbp)
jne 0x447b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4482
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: tcp_send
int tcp_send(sock_t sock, stream_t* s)
{
	int rsize = stream_rsize(s);
	int nsend;

	if (rsize == 0)
		return 0;

	nsend = send(sock, s->array + s->pos, rsize, 0);
	if (nsend == -1) {
		int err = errno;
		if (!is_eagain(err)) {
			loge("errno=%d, %s \n",
				err, strerror(err));
			return -1;
		}
		return 0;
	}
	else {
		s->pos += nsend;
		logv("send %d bytes\n", nsend);
		if (stream_quake(s)) {
			loge("stream_quake()\n");
			return -1;
		}
		return nsend;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x4862
movl $0x0, -0x4(%rbp)
jmp 0x49ad
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rsi
movslq -0x14(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2100
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x4915
callq 0x2030
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0xb, -0x1c(%rbp)
je 0x4909
cmpl $0x73, -0x1c(%rbp)
je 0x4909
cmpl $0xb, -0x1c(%rbp)
je 0x4909
cmpl $0x73, -0x1c(%rbp)
je 0x4909
jmp 0x48b3
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x48fb
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edi
callq 0x20d0
movl -0x20(%rbp), %r9d
movl $0x3, %edi
leaq 0x584b(%rip), %rsi      # 0xa128
leaq 0x5a9f(%rip), %rdx      # 0xa383
movl $0x28b, %ecx            # imm = 0x28B
leaq 0x6785(%rip), %r8       # 0xb075
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x48fd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49ad
movl $0x0, -0x4(%rbp)
jmp 0x49ad
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movb $0x0, %al
callq 0x2560
cmpl $0x8, (%rax)
jl 0x4958
movl -0x18(%rbp), %r9d
movl $0x8, %edi
leaq 0x57ea(%rip), %rsi      # 0xa128
leaq 0x5a3e(%rip), %rdx      # 0xa383
movl $0x292, %ecx            # imm = 0x292
leaq 0x5a3b(%rip), %r8       # 0xa38c
movb $0x0, %al
callq 0x2640
jmp 0x495a
movq -0x10(%rbp), %rdi
callq 0x5370
cmpl $0x0, %eax
je 0x49a7
jmp 0x496a
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x499c
movl $0x3, %edi
leaq 0x57a6(%rip), %rsi      # 0xa128
leaq 0x59fa(%rip), %rdx      # 0xa383
movl $0x294, %ecx            # imm = 0x294
leaq 0x5a06(%rip), %r8       # 0xa39b
movb $0x0, %al
callq 0x2640
jmp 0x499e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49ad
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/netutils.c
// Function: tcp_recv
int tcp_recv(sock_t sock, char* buf, int buflen)
{
	int nread;

	nread = recv(sock, buf, buflen, 0);
	if (nread == -1) {
		int err = errno;
		if (!is_eagain(err)) {
			loge("errno=%d, %s\n",
				err, strerror(err));
			return -1;
		}
		return 0;
	}
	else if (nread == 0) {
		logd("connection closed by peer\n");
		return -1;
	}
	else {
		logv("recv %d bytes\n", nread);

		return nread;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x4a77
callq 0x2030
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0xb, -0x1c(%rbp)
je 0x4a6b
cmpl $0x73, -0x1c(%rbp)
je 0x4a6b
cmpl $0xb, -0x1c(%rbp)
je 0x4a6b
cmpl $0x73, -0x1c(%rbp)
je 0x4a6b
jmp 0x4a15
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4a5d
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edi
callq 0x20d0
movl -0x20(%rbp), %r9d
movl $0x3, %edi
leaq 0x56e9(%rip), %rsi      # 0xa128
leaq 0x5965(%rip), %rdx      # 0xa3ab
movl $0x2a4, %ecx            # imm = 0x2A4
leaq 0x66c4(%rip), %r8       # 0xb116
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x4a5f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4afc
movl $0x0, -0x4(%rbp)
jmp 0x4afc
cmpl $0x0, -0x18(%rbp)
jne 0x4abc
jmp 0x4a7f
movb $0x0, %al
callq 0x2560
cmpl $0x7, (%rax)
jl 0x4ab1
movl $0x7, %edi
leaq 0x5691(%rip), %rsi      # 0xa128
leaq 0x590d(%rip), %rdx      # 0xa3ab
movl $0x2aa, %ecx            # imm = 0x2AA
leaq 0x590a(%rip), %r8       # 0xa3b4
movb $0x0, %al
callq 0x2640
jmp 0x4ab3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4afc
jmp 0x4abe
movb $0x0, %al
callq 0x2560
cmpl $0x8, (%rax)
jl 0x4af4
movl -0x18(%rbp), %r9d
movl $0x8, %edi
leaq 0x564e(%rip), %rsi      # 0xa128
leaq 0x58ca(%rip), %rdx      # 0xa3ab
movl $0x2ae, %ecx            # imm = 0x2AE
leaq 0x58e2(%rip), %r8       # 0xa3cf
movb $0x0, %al
callq 0x2640
jmp 0x4af6
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x24(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rdx
movq -0x18(%rbp), %r8
movl -0x1c(%rbp), %r9d
xorl %ecx, %ecx
callq 0x2060
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jne 0x4bdb
jmp 0x4b6a
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4bd0
movq -0x18(%rbp), %rdi
callq 0x32b0
movq %rax, -0x30(%rbp)
callq 0x2030
movl (%rax), %eax
movl %eax, -0x28(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movq -0x30(%rbp), %r9
movl -0x28(%rbp), %r10d
movl $0x3, %edi
leaq 0x557b(%rip), %rsi      # 0xa128
leaq 0x582a(%rip), %rdx      # 0xa3de
movl $0x2bd, %ecx            # imm = 0x2BD
leaq 0x654f(%rip), %r8       # 0xb10f
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x4bd2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4be1
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
xorl %ecx, %ecx
callq 0x2190
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x4c35
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4c90
jmp 0x4c37
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4c87
callq 0x2030
movl (%rax), %eax
movl %eax, -0x30(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x20d0
movl -0x30(%rbp), %r9d
movl $0x3, %edi
leaq 0x54bf(%rip), %rsi      # 0xa128
leaq 0x5777(%rip), %rdx      # 0xa3e7
movl $0x2cd, %ecx            # imm = 0x2CD
leaq 0x649a(%rip), %r8       # 0xb116
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2640
jmp 0x4c89
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movl $0x68, %edi
callq 0x22d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x4d00
jmp 0x4cc2
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4cf4
movl $0x3, %edi
leaq 0x544e(%rip), %rsi      # 0xa128
leaq 0x570f(%rip), %rdx      # 0xa3f0
movl $0x2d6, %ecx            # imm = 0x2D6
leaq 0x570c(%rip), %r8       # 0xa3f9
movb $0x0, %al
callq 0x2640
jmp 0x4cf6
movq $0x0, -0x8(%rbp)
jmp 0x4d60
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x4d70
cmpl $0x0, %eax
je 0x4d58
movq -0x18(%rbp), %rdi
callq 0x2290
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4d4c
movl $0x3, %edi
leaq 0x53f6(%rip), %rsi      # 0xa128
leaq 0x56b7(%rip), %rdx      # 0xa3f0
movl $0x2dc, %ecx            # imm = 0x2DC
leaq 0x56bb(%rip), %r8       # 0xa400
movb $0x0, %al
callq 0x2640
jmp 0x4d4e
movq $0x0, -0x8(%rbp)
jmp 0x4d60
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2120
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x5110
cmpl $0x0, %eax
je 0x4de0
jmp 0x4da3
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4dd5
movl $0x3, %edi
leaq 0x536d(%rip), %rsi      # 0xa128
leaq 0x5651(%rip), %rdx      # 0xa413
movl $0x2e8, %ecx            # imm = 0x2E8
leaq 0x564f(%rip), %r8       # 0xa41d
movb $0x0, %al
callq 0x2640
jmp 0x4dd7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4e4c
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
callq 0x5110
cmpl $0x0, %eax
je 0x4e3c
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x5140
movb $0x0, %al
callq 0x2560
cmpl $0x3, (%rax)
jl 0x4e31
movl $0x3, %edi
leaq 0x5311(%rip), %rsi      # 0xa128
leaq 0x55f5(%rip), %rdx      # 0xa413
movl $0x2ee, %ecx            # imm = 0x2EE
leaq 0x55f3(%rip), %r8       # 0xa41d
movb $0x0, %al
callq 0x2640
jmp 0x4e33
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4e4c
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x4e75
jmp 0x4ead
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4e93
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x23a0
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x5140
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0x5140
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)