// File: /workspace/github_c_makefile_star2_O1/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 $0x8c8, %rsp            # imm = 0x8C8
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0x78(%rsp), %r12
leaq 0x4c0(%rsp), %rdx
xorl %ebp, %ebp
movq %r12, %rdi
movl $0x8, %esi
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0xe924
movl $0x3b, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x83c5
movl 0xc(%r12), %r12d
movl %r12d, (%r14)
leal (,%r12,4), %eax
leal (%rax,%rax,4), %edi
callq 0x22e0
movq %rax, (%rbx)
testq %rax, %rax
je 0x83b1
testl %r12d, %r12d
setne %cl
je 0x8396
movq %rax, 0x20(%rsp)
leaq 0x78(%rsp), %r13
leaq 0xc0(%rsp), %rbp
xorl %r15d, %r15d
movb %cl, 0xf(%rsp)
movq %r13, %rdi
movl %r15d, %esi
movq %rbp, %rdx
callq 0xec6f
movq 0xc0(%rsp), %rbx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl $0x8, %esi
movq %rbp, %rdx
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0xe924
movl $0x3a, %edi
movq %rbx, %rsi
movq %r14, %rbx
movq %r14, %rdx
callq 0x83c5
cmpl $0x2, 0x3c(%rsp)
jne 0x82b2
movq %r12, %r13
movq %rbx, %rdi
xorl %esi, %esi
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0xec6f
movq 0x10(%rsp), %r12
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0xec6f
movq 0x10(%rsp), %rdi
callq 0x2440
movl %eax, %ebx
leaq 0xf09f(%rip), %rax      # 0x172c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x8250
leaq 0xf099(%rip), %rax      # 0x172d0
movq (%rax), %r8
movl $0x3, %edi
leaq 0x878b(%rip), %rsi      # 0x109d1
movq %r12, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq *%r8
movswl %bx, %esi
movq %r12, %rdi
leaq 0x8c4f(%rip), %rdx      # 0x10eac
leaq 0x10(%rsp), %rcx
movl $0xbb8, %r8d            # imm = 0xBB8
callq 0xf1a5
movl %eax, %ebp
testl %eax, %eax
je 0x82f0
leaq 0xf04e(%rip), %rax      # 0x172c8
movl (%rax), %eax
movl $0xfffffffe, 0x1c(%rsp) # imm = 0xFFFFFFFE
cmpl $0x3, %eax
jl 0x835d
leaq 0xf03c(%rip), %rax      # 0x172d0
movq (%rax), %r8
movl $0x3, %edi
leaq 0x874e(%rip), %rsi      # 0x109f1
movq %r12, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq *%r8
jmp 0x835d
leaq 0xf00f(%rip), %rax      # 0x172c8
movl (%rax), %eax
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x3, %eax
jl 0x82e9
leaq 0xf001(%rip), %rax      # 0x172d0
movq (%rax), %rcx
xorl %ebx, %ebx
movl $0x3, %edi
leaq 0x8739(%rip), %rsi      # 0x10a19
xorl %eax, %eax
callq *%rcx
jmp 0x8381
xorl %ebx, %ebx
jmp 0x8381
movq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xeeac
leaq 0xefc2(%rip), %rax      # 0x172c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x832c
leaq 0xefbc(%rip), %rax      # 0x172d0
movq (%rax), %rcx
movq 0x28(%rsp), %rdx
movl $0x3, %edi
leaq 0x86bb(%rip), %rsi      # 0x109e3
xorl %eax, %eax
callq *%rcx
movq 0x28(%rsp), %rax
movl 0x10(%rax), %ecx
movq 0x20(%rsp), %rdx
movl %ecx, 0x10(%rdx)
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdx)
movq %rcx, (%rdx)
addq $0x14, %rdx
movq %rdx, 0x20(%rsp)
movq 0x10(%rsp), %rdi
callq 0x22c0
movq %r13, %r12
leaq 0x30(%rsp), %rdi
testl %ebp, %ebp
leaq 0x78(%rsp), %r13
je 0x8372
xorl %ebx, %ebx
jmp 0x8379
callq 0xea0d
movb $0x1, %bl
leaq 0xc0(%rsp), %rbp
testb %bl, %bl
je 0x8398
incl %r15d
cmpl %r12d, %r15d
setb %cl
jne 0x8197
jmp 0x839c
jmp 0x839c
movb 0xf(%rsp), %cl
testb $0x1, %cl
movl 0x1c(%rsp), %ebp
jne 0x83b1
leaq 0x78(%rsp), %rdi
callq 0xea0d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8c8, %rsp            # imm = 0x8C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq