// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cluster_partitions_process
static void
cluster_partitions_process(cl_cluster *asc, cl_cluster_node *cn, char *partitions, bool write) 
{
	// Partitions format: <namespace1>:<partition id1>;<namespace2>:<partition id2>; ...
	// Warning: This method walks on partitions string argument.
	char *p = partitions;

	while (*p)
	{
		char *partition_str = p;
		// loop till split and set it to null
		while ((*p) && (*p != ';')) {
			p++;
		}
		if (*p == ';'){
			*p = 0;
			p++;
		}
		cf_vector_define(partition_v, sizeof(void *), 0);
		str_split(':', partition_str, &partition_v);

		unsigned int vsize = cf_vector_size(&partition_v);
		if (vsize == 2) {
			char *namespace_s = cf_vector_pointer_get(&partition_v,0);
			char *partid_s = cf_vector_pointer_get(&partition_v,1);

			// it's coming over the wire, so validate it
			char *ns = trim(namespace_s);
			int len = strlen(ns);

			if (len == 0 || len > 31) {
				cf_warn("Invalid partition namespace %s", ns);
				goto Next;
			}

			int partid = atoi(partid_s);

			if (partid < 0 || partid >= (int)asc->n_partitions) {
				cf_warn("Invalid partition id %s. max=%u", partid_s, asc->n_partitions);
				goto Next;
			}
				
			pthread_mutex_lock(&asc->LOCK);
			cl_partition_table_set(asc, cn, ns, partid, write);
			pthread_mutex_unlock(&asc->LOCK);
		}
		else {
			cf_warn("Invalid partition vector size %u. element=%s", vsize, partition_str);
		}
Next:
		cf_vector_destroy(&partition_v);
	}
}

// Assembly:
subq $0x4b8, %rsp            # imm = 0x4B8
movb %cl, %al
movq %rdi, 0x4b0(%rsp)
movq %rsi, 0x4a8(%rsp)
movq %rdx, 0x4a0(%rsp)
andb $0x1, %al
movb %al, 0x49f(%rsp)
movq 0x4a0(%rsp), %rax
movq %rax, 0x490(%rsp)
movq 0x490(%rsp), %rax
cmpb $0x0, (%rax)
je 0xcd23
movq 0x490(%rsp), %rax
movq %rax, 0x488(%rsp)
movq 0x490(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xf(%rsp)
je 0xcae6
movq 0x490(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xcaf0
jmp 0xcb06
movq 0x490(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x490(%rsp)
jmp 0xcabb
movq 0x490(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
jne 0xcb35
movq 0x490(%rsp), %rax
movb $0x0, (%rax)
movq 0x490(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x490(%rsp)
leaq 0x80(%rsp), %rdx
leaq 0x38(%rsp), %rdi
movl $0x8, %esi
movl $0x400, %ecx            # imm = 0x400
xorl %r8d, %r8d
callq 0x16c50
movq 0x488(%rsp), %rsi
movl $0x3a, %edi
leaq 0x38(%rsp), %rdx
callq 0xbdb0
leaq 0x38(%rsp), %rdi
callq 0x9da0
movl %eax, 0x34(%rsp)
cmpl $0x2, 0x34(%rsp)
jne 0xccd7
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x9db0
movq %rax, 0x28(%rsp)
leaq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x9db0
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0xcd30
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x2100
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0xcbd4
cmpl $0x1f, 0x14(%rsp)
jle 0xcc0a
leaq 0x116fd(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xcc05
leaq 0x116f3(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movq 0x18(%rsp), %rdx
movl $0x1, %edi
leaq 0xbf8e(%rip), %rsi      # 0x18b8f
movb $0x0, %al
callq *%rcx
jmp 0xcd14
movq 0x20(%rsp), %rdi
callq 0x2460
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
jl 0xcc36
movl 0x10(%rsp), %eax
movq 0x4b0(%rsp), %rcx
movzwl 0x140(%rcx), %ecx
cmpl %ecx, %eax
jl 0xcc7c
leaq 0x1169b(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xcc77
leaq 0x11691(%rip), %rax     # 0x1e2e0
movq (%rax), %r8
movq 0x20(%rsp), %rdx
movq 0x4b0(%rsp), %rax
movzwl 0x140(%rax), %ecx
movl $0x1, %edi
leaq 0xbf3c(%rip), %rsi      # 0x18bae
movb $0x0, %al
callq *%r8
jmp 0xcd14
movq 0x4b0(%rsp), %rdi
addq $0x158, %rdi            # imm = 0x158
callq 0x23e0
movq 0x4b0(%rsp), %rdi
movq 0x4a8(%rsp), %rsi
movq 0x18(%rsp), %rdx
movl 0x10(%rsp), %eax
movw %ax, %cx
movb 0x49f(%rsp), %al
andb $0x1, %al
movzwl %cx, %ecx
movzbl %al, %r8d
callq 0xd1d0
movq 0x4b0(%rsp), %rdi
addq $0x158, %rdi            # imm = 0x158
callq 0x21c0
jmp 0xcd12
leaq 0x115fa(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xcd10
leaq 0x115f0(%rip), %rax     # 0x1e2e0
movq (%rax), %r8
movl 0x34(%rsp), %edx
movq 0x488(%rsp), %rcx
movl $0x1, %edi
leaq 0xbec3(%rip), %rsi      # 0x18bce
movb $0x0, %al
callq *%r8
jmp 0xcd12
jmp 0xcd14
leaq 0x38(%rsp), %rdi
callq 0x16e10
jmp 0xca9a
addq $0x4b8, %rsp            # imm = 0x4B8
retq
nopl (%rax,%rax)