// File: /workspace/github_c_makefile_star2_O3/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_get_node_names_byhostportlist
int
cl_cluster_get_node_names_byhostportlist(cl_cluster *asc, char *list_nodes, int *n_nodes, char **node_names)
{
	//get vector containing host:port
	cf_vector_define(host_str_v, sizeof(void *), 0);// host_str_v is vector of addr:port
	str_split(';', list_nodes, &host_str_v);

	uint size = cf_vector_size(&host_str_v);
	*n_nodes = size;
	*node_names = malloc(NODE_NAME_SIZE * size);
	if (*node_names == 0) {
		return(0);
	}

	char *nptr = *node_names;
	for (uint i=0; i<size; i++) {
		char *host_str = cf_vector_pointer_get(&host_str_v, i);
		cf_vector_define(host_port_v, sizeof(void *), 0);
		str_split(':', host_str, &host_port_v);
		if (cf_vector_size(&host_port_v) == 2) {
			char *host_s = cf_vector_pointer_get(&host_port_v, 0);
			char *port_s = cf_vector_pointer_get(&host_port_v, 1);
			uint port = atoi(port_s);
			cf_debug("host-port:%s:%d, ", host_s, port);
			char *info_name;
			char *value;
			if (0 == citrusleaf_info(host_s, port, "node", &info_name, 3000)) {
				citrusleaf_info_parse_single(info_name, &value);
				cf_debug("node-name:%s\n", value);
				memcpy(nptr, value, NODE_NAME_SIZE);
				nptr += (NODE_NAME_SIZE);
			} else {
				cf_debug("%s:%u is not accessible or timed out. \n", host_s, port);
				return (-2);
			}
			free(info_name);
		} else {
				cf_debug("Command line input format error for option l\n");
				return (-1);
		}
		cf_vector_destroy(&host_port_v);
	}
	cf_vector_destroy(&host_str_v);
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8a8, %rsp            # imm = 0x8A8
leaq 0x10(%rsp), %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0x4a0(%rsp), %rdx
movl $0x8, %esi
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
xorl %r13d, %r13d
movq %r12, %rdi
callq 0xe49a
movl $0x3b, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x81c6
movl 0xc(%r12), %ebp
leal (,%rbp,4), %eax
movl %ebp, (%r14)
leal (%rax,%rax,4), %edi
callq 0x22e0
testq %rax, %rax
movq %rax, (%rbx)
je 0x81b1
testl %ebp, %ebp
je 0x813d
movq %rax, %r14
leaq 0x58(%rsp), %r13
xorl %r15d, %r15d
leaq 0xa0(%rsp), %r12
leaq 0x10(%rsp), %rdi
movl %r15d, %esi
movq %r12, %rdx
callq 0xe7d4
movq 0xa0(%rsp), %rbx
movq %r13, %rdi
movl $0x8, %esi
movq %r12, %rdx
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0xe49a
movl $0x3a, %edi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x81c6
cmpl $0x2, 0x64(%rsp)
jne 0x814c
movq %rsp, %r12
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0xe7d4
movq (%rsp), %rbx
movq %r13, %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0xe7d4
movq (%rsp), %rdi
callq 0x2440
movl %eax, %r12d
leaq 0xe24d(%rip), %rax      # 0x162c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x80a3
leaq 0xe247(%rip), %rax      # 0x162d0
movl $0x3, %edi
leaq 0x795a(%rip), %rsi      # 0xf9ef
movq %rbx, %rdx
movl %r12d, %ecx
movq (%rax), %r8
xorl %eax, %eax
callq *%r8
movswl %r12w, %esi
movq %rbx, %rdi
leaq 0x7e1b(%rip), %rdx      # 0xfecc
movq %rsp, %rcx
movl $0xbb8, %r8d            # imm = 0xBB8
callq 0xed02
testl %eax, %eax
jne 0x817c
movq (%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xea14
leaq 0xe1ec(%rip), %rax      # 0x162c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x8102
leaq 0xe1e6(%rip), %rax      # 0x162d0
movl $0x3, %edi
leaq 0x790b(%rip), %rsi      # 0xfa01
movq (%rax), %rcx
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq *%rcx
movq 0x8(%rsp), %rax
movq (%rsp), %rdi
movl 0x10(%rax), %ecx
movl %ecx, 0x10(%r14)
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rax, 0x8(%r14)
movq %rcx, (%r14)
addq $0x14, %r14
callq 0x22c0
movq %r13, %rdi
callq 0xe580
incl %r15d
cmpl %r15d, %ebp
jne 0x7ff1
leaq 0x10(%rsp), %rdi
callq 0xe580
xorl %r13d, %r13d
jmp 0x81b1
leaq 0xe175(%rip), %rax      # 0x162c8
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x81b1
leaq 0xe169(%rip), %rax      # 0x162d0
leaq 0x78c9(%rip), %rsi      # 0xfa37
movl $0x3, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0x81b1
leaq 0xe145(%rip), %rax      # 0x162c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x81ab
leaq 0xe13f(%rip), %rax      # 0x162d0
leaq 0x7877(%rip), %rsi      # 0xfa0f
movl $0x3, %edi
movq %rbx, %rdx
movl %r12d, %ecx
movq (%rax), %r8
xorl %eax, %eax
callq *%r8
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
movl %r13d, %eax
addq $0x8a8, %rsp            # imm = 0x8A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq