// File: /workspace/github_c_makefile_star2_O1/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 0x3a19(%rip), %rsi      # 0x7458
movq %rax, %rdi
callq 0x2080
testq %rax, %rax
je 0x3ab6
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x3a03(%rip), %rsi      # 0x745c
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3ac2
leaq 0x39f7(%rip), %rsi      # 0x7463
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3ac6
xorl %eax, %eax
callq 0x2e59
cmpl $0x3, (%rax)
jl 0x3aad
leaq 0x369d(%rip), %rsi      # 0x7128
leaq 0x39d6(%rip), %rdx      # 0x7468
leaq 0x39de(%rip), %r8       # 0x7477
movl $0x3, %edi
movl $0x132, %ecx            # imm = 0x132
movq %rbx, %r9
xorl %eax, %eax
callq 0x2e92
movb $0x3a, (%r15)
xorl %r15d, %r15d
jmp 0x3ad6
movl $0x0, (%r14)
movq %rbx, %r15
jmp 0x3ad6
xorl %eax, %eax
jmp 0x3acb
movl $0x1, %eax
movl %eax, (%r14)
movb $0x3a, (%r15)
addq $0x3, %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x3c78
leaq 0x94(%r14), %r13
leaq 0xc6(%r14), %r12
movq %r15, %rdi
movl $0x40, %esi
callq 0x20d0
testq %rax, %rax
je 0x3b50
movq %rax, %rbp
movq %r14, 0x18(%rsp)
movb $0x0, (%rax)
movq %r15, %rdi
movl $0x3a, %esi
callq 0x20d0
testq %rax, %rax
je 0x3b5f
movq %rax, %r14
movb $0x0, (%rax)
movl $0x31, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movq %r14, %rsi
incq %rsi
movl $0x31, %edx
movq %r12, %rdi
callq 0x2100
movb $0x3a, (%r14)
jmp 0x3b74
xorl %eax, %eax
movb %al, (%r13)
movb %al, (%r12)
jmp 0x3bfe
movl $0x31, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movb $0x0, (%r12)
movb $0x40, (%rbp)
cmpb $0x0, (%r13)
movq 0x18(%rsp), %r14
je 0x3b93
cmpb $0x0, (%r12)
je 0x3bc6
incq %rbp
movq %rbp, %r15
jmp 0x3bfe
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2e59
cmpl $0x3, (%rax)
jl 0x3bfe
leaq 0x357f(%rip), %rsi      # 0x7128
leaq 0x3900(%rip), %rdx      # 0x74b0
leaq 0x3919(%rip), %r8       # 0x74d0
xorl %r15d, %r15d
movl $0x3, %edi
movl $0x15b, %ecx            # imm = 0x15B
jmp 0x3bf7
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2e59
cmpl $0x3, (%rax)
jl 0x3bfe
leaq 0x354c(%rip), %rsi      # 0x7128
leaq 0x38cd(%rip), %rdx      # 0x74b0
leaq 0x38f3(%rip), %r8       # 0x74dd
xorl %r15d, %r15d
movl $0x3, %edi
movl $0x15f, %ecx            # imm = 0x15F
xorl %eax, %eax
callq 0x2e92
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x3c78
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x14(%rsp), %rcx
movq %r15, %rdi
callq 0x3747
testl %eax, %eax
jne 0x3c78
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x3c32
cmpb $0x0, (%rax)
jne 0x3c5c
movl (%r14), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
leaq 0x38ab(%rip), %rdx      # 0x74ec
cmoveq %rdx, %rcx
testl %eax, %eax
leaq 0x389c(%rip), %rax      # 0x74ea
cmovneq %rcx, %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3c91
addq $0x8, %r14
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rdx
movl 0x14(%rsp), %ecx
movq %r14, %rdi
callq 0x37dc
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2290
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x354f(%rip), %rdi      # 0x71e7
leaq 0x3489(%rip), %rsi      # 0x7128
leaq 0x3546(%rip), %rcx      # 0x71ec
movl $0x18b, %edx            # imm = 0x18B
callq 0x2140