// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
callq 0x2380
movq %rax, %rbx
leaq 0x43dd(%rip), %rsi      # 0x7478
movq %rax, %rdi
callq 0x2080
testq %rax, %rax
je 0x3110
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x43c7(%rip), %rsi      # 0x747c
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3121
leaq 0x43bb(%rip), %rsi      # 0x7483
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3125
xorl %eax, %eax
callq 0x24d9
cmpl $0x3, (%rax)
jl 0x3107
leaq 0x4061(%rip), %rsi      # 0x7148
leaq 0x439a(%rip), %rdx      # 0x7488
leaq 0x43a2(%rip), %r8       # 0x7497
pushq $0x3
popq %rdi
movl $0x132, %ecx            # imm = 0x132
movq %rbx, %r9
xorl %eax, %eax
callq 0x2512
movb $0x3a, (%r15)
jmp 0x31f4
andl $0x0, (%r14)
movq %rbx, %r15
testq %rbx, %rbx
jne 0x3133
jmp 0x31f4
xorl %eax, %eax
jmp 0x3128
pushq $0x1
popq %rax
movl %eax, (%r14)
movb $0x3a, (%r15)
addq $0x3, %r15
leaq 0x94(%r14), %r13
leaq 0xc6(%r14), %r12
pushq $0x40
popq %rsi
movq %r15, %rdi
callq 0x20d0
testq %rax, %rax
je 0x3199
movq %rax, %rbp
movq %rbx, 0x10(%rsp)
movb $0x0, (%rax)
pushq $0x3a
popq %rsi
movq %r15, %rdi
callq 0x20d0
testq %rax, %rax
je 0x31a5
movq %rax, %rbx
movb $0x0, (%rax)
pushq $0x31
popq %rdx
movq %r13, %rdi
movq %r15, %rsi
movq %rdx, %r15
callq 0x2100
movq %rbx, %rsi
incq %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x2100
movb $0x3a, (%rbx)
jmp 0x31b8
xorl %eax, %eax
movb %al, (%r13)
movb %al, (%r12)
jmp 0x31d9
pushq $0x31
popq %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movb $0x0, (%r12)
movb $0x40, (%rbp)
cmpb $0x0, (%r13)
movq 0x10(%rsp), %rbx
je 0x3210
cmpb $0x0, (%r12)
je 0x3291
incq %rbp
movq %rbp, %r15
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r15, %rdi
callq 0x2dc4
testl %eax, %eax
je 0x3241
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x2290
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0x31f7
leaq 0x3f22(%rip), %rsi      # 0x7148
leaq 0x42a3(%rip), %rdx      # 0x74d0
leaq 0x42bc(%rip), %r8       # 0x74f0
pushq $0x3
popq %rdi
movl $0x15b, %ecx            # imm = 0x15B
jmp 0x32c1
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x3250
cmpb $0x0, (%rdx)
jne 0x3275
movl (%r14), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
leaq 0x42ad(%rip), %rdx      # 0x750c
cmoveq %rdx, %rcx
testl %eax, %eax
leaq 0x429e(%rip), %rdx      # 0x750a
cmovneq %rcx, %rdx
testq %rdx, %rdx
je 0x32cd
addq $0x8, %r14
movq 0x20(%rsp), %rsi
movl 0xc(%rsp), %ecx
movq %r14, %rdi
callq 0x2e4b
movl %eax, %ebp
jmp 0x31f7
xorl %eax, %eax
callq 0x24d9
pushq $-0x1
popq %rbp
cmpl $0x3, (%rax)
jl 0x31f7
leaq 0x3e9d(%rip), %rsi      # 0x7148
leaq 0x421e(%rip), %rdx      # 0x74d0
leaq 0x4244(%rip), %r8       # 0x74fd
pushq $0x3
popq %rdi
movl $0x15f, %ecx            # imm = 0x15F
xorl %eax, %eax
callq 0x2512
jmp 0x31f7
leaq 0x3f33(%rip), %rdi      # 0x7207
leaq 0x3e6d(%rip), %rsi      # 0x7148
leaq 0x3f2a(%rip), %rcx      # 0x720c
movl $0x18b, %edx            # imm = 0x18B
callq 0x2140