// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x908, %rsp            # imm = 0x908
movq %rdi, 0x8f8(%rsp)
movq %rsi, 0x8f0(%rsp)
movq %rdx, 0x8e8(%rsp)
movq %rcx, 0x8e0(%rsp)
leaq 0x4e0(%rsp), %rdx
leaq 0x498(%rsp), %rdi
movl $0x8, %esi
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0x16c50
movq 0x8f0(%rsp), %rsi
movl $0x3b, %edi
leaq 0x498(%rsp), %rdx
callq 0xbdb0
leaq 0x498(%rsp), %rdi
callq 0x9da0
movl %eax, 0x494(%rsp)
movl 0x494(%rsp), %ecx
movq 0x8e8(%rsp), %rax
movl %ecx, (%rax)
imull $0x14, 0x494(%rsp), %eax
movl %eax, %eax
movl %eax, %edi
callq 0x2310
movq %rax, %rcx
movq 0x8e0(%rsp), %rax
movq %rcx, (%rax)
movq 0x8e0(%rsp), %rax
cmpq $0x0, (%rax)
jne 0xbb45
movl $0x0, 0x904(%rsp)
jmp 0xbda0
movq 0x8e0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x488(%rsp)
movl $0x0, 0x484(%rsp)
movl 0x484(%rsp), %eax
cmpl 0x494(%rsp), %eax
jae 0xbd88
movl 0x484(%rsp), %esi
leaq 0x498(%rsp), %rdi
callq 0x9db0
movq %rax, 0x478(%rsp)
leaq 0x70(%rsp), %rdx
leaq 0x28(%rsp), %rdi
movl $0x8, %esi
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0x16c50
movq 0x478(%rsp), %rsi
movl $0x3a, %edi
leaq 0x28(%rsp), %rdx
callq 0xbdb0
leaq 0x28(%rsp), %rdi
callq 0x9da0
cmpl $0x2, %eax
jne 0xbd2f
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x9db0
movq %rax, 0x20(%rsp)
leaq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x9db0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x2460
movl %eax, 0x14(%rsp)
leaq 0x126c5(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0xbc42
leaq 0x126bb(%rip), %rax     # 0x1e2e0
movq (%rax), %r8
movq 0x20(%rsp), %rdx
movl 0x14(%rsp), %ecx
movl $0x3, %edi
leaq 0xcdfe(%rip), %rsi      # 0x18a3b
movb $0x0, %al
callq *%r8
movq 0x20(%rsp), %rdi
movl 0x14(%rsp), %eax
leaq 0xd2ae(%rip), %rdx      # 0x18f00
leaq 0x8(%rsp), %rcx
movl $0xbb8, %r8d            # imm = 0xBB8
movswl %ax, %esi
callq 0x17cf0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xbce0
movq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x17740
leaq 0x12657(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0xbcaa
leaq 0x1264d(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movq (%rsp), %rdx
movl $0x3, %edi
leaq 0xcda7(%rip), %rsi      # 0x18a4d
movb $0x0, %al
callq *%rcx
movq 0x488(%rsp), %rax
movq (%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movl 0x10(%rcx), %ecx
movl %ecx, 0x10(%rax)
movq 0x488(%rsp), %rax
addq $0x14, %rax
movq %rax, 0x488(%rsp)
jmp 0xbd23
leaq 0x125f1(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0xbd16
leaq 0x125e7(%rip), %rax     # 0x1e2e0
movq (%rax), %r8
movq 0x20(%rsp), %rdx
movl 0x14(%rsp), %ecx
movl $0x3, %edi
leaq 0xcd4a(%rip), %rsi      # 0x18a5b
movb $0x0, %al
callq *%r8
movl $0xfffffffe, 0x904(%rsp) # imm = 0xFFFFFFFE
jmp 0xbda0
movq 0x8(%rsp), %rdi
callq 0x22e0
jmp 0xbd68
leaq 0x125a2(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0xbd5b
leaq 0x12598(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movl $0x3, %edi
leaq 0xcd2c(%rip), %rsi      # 0x18a83
movb $0x0, %al
callq *%rcx
movl $0xffffffff, 0x904(%rsp) # imm = 0xFFFFFFFF
jmp 0xbda0
leaq 0x28(%rsp), %rdi
callq 0x16e10
movl 0x484(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x484(%rsp)
jmp 0xbb63
leaq 0x498(%rsp), %rdi
callq 0x16e10
movl $0x0, 0x904(%rsp)
movl 0x904(%rsp), %eax
addq $0x908, %rsp            # imm = 0x908
retq
nop