// File: /workspace/github_c_makefile_star2_O3/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 0x3a1b(%rip), %rsi      # 0x7458
movq %rax, %rdi
callq 0x2080
testq %rax, %rax
je 0x3ab1
movq %rax, %r15
movb $0x0, (%rax)
leaq 0x3a05(%rip), %rsi      # 0x745c
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3aca
leaq 0x39f9(%rip), %rsi      # 0x7463
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3ace
xorl %eax, %eax
callq 0x2e49
cmpl $0x3, (%rax)
jl 0x3aab
leaq 0x369f(%rip), %rsi      # 0x7128
leaq 0x39d8(%rip), %rdx      # 0x7468
leaq 0x39e0(%rip), %r8       # 0x7477
movl $0x3, %edi
movl $0x132, %ecx            # imm = 0x132
movq %rbx, %r9
xorl %eax, %eax
callq 0x2e82
movb $0x3a, (%r15)
jmp 0x3ac0
movl $0x0, (%r14)
movq %rbx, %r15
testq %rbx, %rbx
jne 0x3ade
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3c6d
xorl %eax, %eax
jmp 0x3ad3
movl $0x1, %eax
movl %eax, (%r14)
movb $0x3a, (%r15)
addq $0x3, %r15
leaq 0x94(%r14), %r13
leaq 0xc6(%r14), %r12
movq %r15, %rdi
movl $0x40, %esi
callq 0x20d0
testq %rax, %rax
je 0x3b49
movq %rax, %rbp
movq %rbx, 0x10(%rsp)
movb $0x0, (%rax)
movq %r15, %rdi
movl $0x3a, %esi
callq 0x20d0
testq %rax, %rax
je 0x3b55
movq %rax, %rbx
movb $0x0, (%rax)
movl $0x31, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movq %rbx, %rsi
incq %rsi
movl $0x31, %edx
movq %r12, %rdi
callq 0x2100
movb $0x3a, (%rbx)
jmp 0x3b6a
xorl %eax, %eax
movb %al, (%r13)
movb %al, (%r12)
jmp 0x3b8f
movl $0x31, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movb $0x0, (%r12)
movb $0x40, (%rbp)
cmpb $0x0, (%r13)
movq 0x10(%rsp), %rbx
je 0x3c04
cmpb $0x0, (%r12)
je 0x3c36
incq %rbp
movq %rbp, %r15
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r15, %rdi
callq 0x3747
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x3c6d
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x3bc2
cmpb $0x0, (%rdx)
jne 0x3beb
movl (%r14), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
leaq 0x391b(%rip), %rdx      # 0x74ec
cmoveq %rdx, %rcx
testl %eax, %eax
leaq 0x390c(%rip), %rdx      # 0x74ea
cmovneq %rcx, %rdx
testq %rdx, %rdx
je 0x3c86
addq $0x8, %r14
movq 0x20(%rsp), %rsi
movl 0xc(%rsp), %ecx
movq %r14, %rdi
callq 0x37dc
movl %eax, %ebp
jmp 0x3c6d
xorl %eax, %eax
callq 0x2e49
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x3c6d
leaq 0x350c(%rip), %rsi      # 0x7128
leaq 0x388d(%rip), %rdx      # 0x74b0
leaq 0x38a6(%rip), %r8       # 0x74d0
movl $0x3, %edi
movl $0x15b, %ecx            # imm = 0x15B
jmp 0x3c66
xorl %eax, %eax
callq 0x2e49
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x3c6d
leaq 0x34da(%rip), %rsi      # 0x7128
leaq 0x385b(%rip), %rdx      # 0x74b0
leaq 0x3881(%rip), %r8       # 0x74dd
movl $0x3, %edi
movl $0x15f, %ecx            # imm = 0x15F
xorl %eax, %eax
callq 0x2e82
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 0x355a(%rip), %rdi      # 0x71e7
leaq 0x3494(%rip), %rsi      # 0x7128
leaq 0x3551(%rip), %rcx      # 0x71ec
movl $0x18b, %edx            # imm = 0x18B
callq 0x2140