LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_exists_digest
extern cl_rv
citrusleaf_exists_digest(cl_cluster *asc, const char *ns, const cf_digest *digest, cl_bin *values, int n_values, int timeout_ms, uint32_t *cl_gen)
{
	
    if (!g_initialized) return(-1);
    
    	uint64_t trid=0;
	cl_write_parameters cl_w_p;
	cl_write_parameters_set_default(&cl_w_p);
	cl_w_p.timeout_ms = timeout_ms;

	return( do_the_full_monte( asc, CL_MSG_INFO1_READ | CL_MSG_INFO1_NOBINDATA, 0, 0, 
			ns, 0,0, digest, &values, CL_OP_READ, 0, &n_values, cl_gen, 
			&cl_w_p, &trid, NULL) );
}

// Assembly:
subq $0x88, %rsp
cmpb $0x1, 0x11445(%rip)     # 0x173a0
movq %rcx, 0x60(%rsp)
movl %r8d, 0x5c(%rsp)
jne 0x5ff4
movq 0x90(%rsp), %rcx
movq %rsi, %rax
leaq 0x68(%rsp), %rsi
leaq 0x70(%rsp), %r10
movabsq $0x200000000, %r8       # imm = 0x200000000
andq $0x0, 0x48(%rsp)
andq $0x0, 0x20(%rsp)
andq $0x0, (%rsp)
movq %rdx, 0x8(%rsp)
movl $0x1, 0x18(%rsp)
movq %r8, 0x10(%r10)
andq $0x0, (%rsi)
andl $0x0, (%r10)
movb $0x0, 0x4(%r10)
movl %r9d, 0xc(%r10)
movq %rsi, 0x40(%rsp)
movq %r10, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
leaq 0x5c(%rsp), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x60(%rsp), %rcx
movq %rcx, 0x10(%rsp)
pushq $0x21
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
xorl %r9d, %r9d
callq 0x5294
jmp 0x5ff7
pushq $-0x1
popq %rax
addq $0x88, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_get_all
extern cl_rv
citrusleaf_get_all(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, cl_bin **values, int *n_values, int timeout_ms, uint32_t *cl_gen)
{
	if ((values == 0) || (n_values == 0)) {
		cf_error("citrusleaf_get_all: illegal parameters passed");
		return(-1);
	}
    if (!g_initialized) return(-1);

	*values = 0;
	*n_values = 0;

    	uint64_t trid=0;
	cl_write_parameters cl_w_p;
	cl_write_parameters_set_default(&cl_w_p);
	cl_w_p.timeout_ms = timeout_ms;
	
	return( do_the_full_monte( asc, CL_MSG_INFO1_READ | CL_MSG_INFO1_GET_ALL, 0, 0, 
			ns, set, key, 0/*dig*/, values, CL_OP_READ, 0, n_values, 
			cl_gen, &cl_w_p, &trid, NULL) );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
testq %r8, %r8
movq %rdx, %r10
movq %rsi, %rax
setne %dl
testq %r9, %r9
setne %sil
testb %sil, %dl
jne 0x604d
leaq 0xf2a3(%rip), %rax      # 0x152c8
pushq $-0x1
popq %rbx
cmpl $0x0, (%rax)
js 0x60ea
leaq 0xf298(%rip), %rax      # 0x152d0
leaq 0x884c(%rip), %rsi      # 0xe88b
xorl %edi, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0x60ea
cmpb $0x1, 0x1134c(%rip)     # 0x173a0
jne 0x60e7
movq 0x98(%rsp), %rdx
movl 0x90(%rsp), %esi
leaq 0x58(%rsp), %r11
movabsq $0x200000000, %rbx      # imm = 0x200000000
leaq 0x60(%rsp), %r14
andq $0x0, (%r8)
andl $0x0, (%r9)
andq $0x0, 0x48(%rsp)
andq $0x0, 0x20(%rsp)
andq $0x0, 0x8(%rsp)
movq %r9, 0x28(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, (%rsp)
movl $0x1, 0x18(%rsp)
movq %rbx, 0x10(%r14)
andq $0x0, (%r11)
andl $0x0, (%r14)
movb $0x0, 0x4(%r14)
movq %r11, 0x40(%rsp)
movq %r14, 0x38(%rsp)
movl %esi, 0xc(%r14)
movq %rdx, 0x30(%rsp)
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
movq %r10, %r9
callq 0x5294
movl %eax, %ebx
jmp 0x60ea
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_get_all_digest_getsetname
extern cl_rv
citrusleaf_get_all_digest_getsetname(cl_cluster *asc, const char *ns, const cf_digest *digest, 
	cl_bin **values, int *n_values, int timeout_ms, uint32_t *cl_gen, char **setname)
{
	if ((values == 0) || (n_values == 0)) {
		cf_error("citrusleaf_get_all: illegal parameters passed");
		return(-1);
	}
    if (!g_initialized) return(-1);

	*values = 0;
	*n_values = 0;

    	uint64_t trid=0;
	cl_write_parameters cl_w_p;
	cl_write_parameters_set_default(&cl_w_p);
	cl_w_p.timeout_ms = timeout_ms;

	int info1 = CL_MSG_INFO1_READ | CL_MSG_INFO1_GET_ALL;
	// Currently, the setname is returned only if XDS bit is set (for backward compatibility reasons).
	// This will/should be made the default in the future.
	if (setname != NULL) {
		info1 |= CL_MSG_INFO1_XDS;
	}
	
	return( do_the_full_monte( asc, info1, 0, 0, ns, 0, 0, digest, values, 
			CL_OP_READ, 0, n_values, cl_gen, &cl_w_p, &trid, setname) );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
testq %rcx, %rcx
movq %rsi, %rax
setne %sil
testq %r8, %r8
setne %r10b
testb %r10b, %sil
jne 0x6140
leaq 0xf1b0(%rip), %rax      # 0x152c8
pushq $-0x1
popq %rbx
cmpl $0x0, (%rax)
js 0x61e9
leaq 0xf1a5(%rip), %rax      # 0x152d0
leaq 0x8759(%rip), %rsi      # 0xe88b
xorl %edi, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0x61e9
cmpb $0x1, 0x11259(%rip)     # 0x173a0
jne 0x61e6
movq 0x98(%rsp), %r10
leaq 0x58(%rsp), %rbx
movabsq $0x200000000, %rsi      # imm = 0x200000000
leaq 0x60(%rsp), %r14
andq $0x0, (%rcx)
andl $0x0, (%r8)
movq 0x90(%rsp), %r11
movq %r8, 0x28(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rax, %r8
movl $0x1, 0x18(%rsp)
movq %rsi, 0x10(%r14)
andq $0x0, (%rbx)
andl $0x0, (%r14)
xorl %esi, %esi
movb $0x0, 0x4(%r14)
movl %r9d, 0xc(%r14)
movq %rbx, 0x40(%rsp)
movq %r14, 0x38(%rsp)
testq %r10, %r10
movq %r10, 0x48(%rsp)
movq %r11, 0x30(%rsp)
setne %sil
andq $0x0, 0x20(%rsp)
andq $0x0, (%rsp)
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
shll $0x4, %esi
orl $0x3, %esi
callq 0x5294
movl %eax, %ebx
jmp 0x61e9
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_delete_verify
extern cl_rv
citrusleaf_delete_verify(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, const cl_write_parameters *cl_w_p)
{
    if (!g_initialized) return(-1);
    
    	uint64_t trid=0;
	return( do_the_full_monte( asc, CL_MSG_INFO1_VERIFY, CL_MSG_INFO2_DELETE | CL_MSG_INFO2_WRITE, 
			0, ns, set, key, 0, 0, 0, 0, 0, NULL, cl_w_p, &trid, NULL) );
}

// Assembly:
cmpb $0x1, 0x110da(%rip)     # 0x173a0
jne 0x6327
subq $0x58, %rsp
movq %rsi, %rax
leaq 0x50(%rsp), %rsi
andq $0x0, 0x48(%rsp)
andq $0x0, 0x30(%rsp)
andq $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x18(%rsp)
andq $0x0, 0x10(%rsp)
andq $0x0, 0x8(%rsp)
movq %rdx, %r9
movq %r8, 0x38(%rsp)
movq %rcx, (%rsp)
andq $0x0, (%rsi)
movq %rsi, 0x40(%rsp)
pushq $0x8
popq %rsi
pushq $0x3
popq %rdx
xorl %ecx, %ecx
movq %rax, %r8
callq 0x5294
addq $0x58, %rsp
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_calculate_digest
extern int
citrusleaf_calculate_digest(const char *set, const cl_object *key, cf_digest *digest)
{
	int set_len = set ? strlen(set) : 0;
	
	// make the key as it's laid out for digesting
	// THIS IS A STRIPPED DOWN VERSION OF THE CODE IN write_fields ABOVE
	// MUST STAY IN SYNC!!!
	uint8_t k[key->sz + 1];
	switch (key->type) {
		case CL_STR:
			k[0] = key->type;
			memcpy(&k[1], key->u.str, key->sz);
			break;
		case CL_INT:
			k[0] = key->type;
			value_to_op_int(key->u.i64,&k[1]);
			break;
		case CL_BLOB:
		case CL_JAVA_BLOB:
		case CL_CSHARP_BLOB:
		case CL_PYTHON_BLOB:
		case CL_RUBY_BLOB:
		case CL_PHP_BLOB:
			k[0] = key->type;
			memcpy(&k[1], key->u.blob, key->sz);
			break;
		default:
			cf_error(" transmit key: unknown citrusleaf type %d", key->type);
			return(-1);
	}

	cf_digest_compute2((char *)set, set_len, k, key->sz + 1, digest);
	
	return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rdi, %rdi
movq %rdx, -0x30(%rbp)
je 0x6355
movq %r14, %rdi
callq 0x20e0
movslq %eax, %r15
jmp 0x6358
xorl %r15d, %r15d
movq 0x8(%rbx), %r12
movq %rsp, %r13
leaq 0x10(%r12), %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
movl (%rbx), %edx
leal -0x1(%rdx), %eax
cmpl $0xa, %eax
ja 0x63e0
leaq 0x8421(%rip), %rcx      # 0xe7a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb %dl, (%r13)
movq 0x10(%rbx), %rsi
leaq 0x1(%r13), %rdi
movq %r12, %rdx
callq 0x21b0
movq -0x30(%rbp), %r8
incq %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x6408
xorl %ebx, %ebx
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x3, (%r13)
jmp 0x638c
movb $0x1, (%r13)
movq 0x10(%rbx), %rax
bswapq %rax
movq %rax, 0x1(%r13)
jmp 0x639c
leaq 0xeee1(%rip), %rax      # 0x152c8
pushq $-0x1
popq %rbx
cmpl $0x0, (%rax)
js 0x63b6
leaq 0xeeda(%rip), %rax      # 0x152d0
leaq 0x84bc(%rip), %rsi      # 0xe8b9
xorl %edi, %edi
movq (%rax), %rcx
xorl %eax, %eax
callq *%rcx
jmp 0x63b6
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/../include/citrusleaf/cf_digest.h
// Function: cf_digest_compute2
static inline void
cf_digest_compute2(void *data1, size_t len1, void *data2, size_t len2, cf_digest *d)
{
	if (len1 == 0) {
		RIPEMD160((const unsigned char *) data2, len2, (unsigned char *) d->digest);
	}
	else {
		RIPEMD160_CTX c;
		RIPEMD160_Init(&c);
		RIPEMD160_Update(&c, data1, len1);
		RIPEMD160_Update(&c, data2, len2);
		RIPEMD160_Final( (unsigned char *)(d->digest), &c);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
testq %rsi, %rsi
je 0x646d
leaq 0x8(%rsp), %rbp
movq %rdi, %r13
movq %rsi, %r12
movq %rbp, %rdi
callq 0x2370
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x23c0
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x23c0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2490
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2480
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_operate
extern cl_rv
citrusleaf_operate(cl_cluster *asc, const char *ns, const char *set, const cl_object *key, cl_operation *operations, int n_operations, const cl_write_parameters *cl_w_p,  int replace, uint32_t *generation)
{
    if (!g_initialized) return(-1);
    
	// see if there are any read or write bits ---
	//   (this is slightly obscure c usage....)
	int info1 = 0, info2 = 0, info3 = 0;
	uint64_t trid=0;

	for (int i=0;i<n_operations;i++) {
		switch (operations[i].op) {
		case CL_OP_WRITE:
		case CL_OP_MC_INCR:
		case CL_OP_INCR:
		case CL_OP_APPEND:
		case CL_OP_PREPEND:
		case CL_OP_MC_APPEND:
		case CL_OP_MC_PREPEND:
		case CL_OP_MC_TOUCH:
		case CL_OP_TOUCH:
			info2 = CL_MSG_INFO2_WRITE;
			break;
		case CL_OP_READ:
			info1 = CL_MSG_INFO1_READ;
			break;
		default:
			break;
		}
		
		if (info1 && info2) break;
	}
	

	if (replace)
		info3 = CL_MSG_INFO3_REPLACE;

	return( do_the_full_monte( asc, info1, info2, info3, ns, set, key, 0, 0, 0, 
			&operations, &n_operations, generation, cl_w_p, &trid, NULL) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x1, 0x10f02(%rip)     # 0x173a0
movq %r8, 0x10(%rsp)
movl %r9d, 0x4(%rsp)
jne 0x651c
movq 0x60(%rsp), %rbx
movl 0x58(%rsp), %ebp
movq 0x50(%rsp), %r14
movq %rsi, %r11
andq $0x0, 0x8(%rsp)
xorl %esi, %esi
testl %r9d, %r9d
movq %rcx, %rax
movq %rdx, %r10
cmovlel %esi, %r9d
addq $0x40, %r8
incq %r9
pushq $0x1
popq %rcx
xorl %edx, %edx
decq %r9
je 0x6525
movl (%r8), %r15d
leal -0x2(%r15), %r12d
cmpl $0x8, %r12d
jae 0x650b
movl %ecx, %edx
addq $0x48, %r8
testl %esi, %esi
setne %r15b
testl %edx, %edx
setne %r12b
andb %r15b, %r12b
cmpb $0x1, %r12b
jne 0x64dc
jmp 0x6521
cmpl $0x1, %r15d
je 0x6518
testl %r15d, %r15d
je 0x64ee
jmp 0x64f0
movl %ecx, %esi
jmp 0x64f0
pushq $-0x1
popq %rax
jmp 0x655f
movl %ecx, %esi
movl %ecx, %edx
xorl %ecx, %ecx
testl %ebp, %ebp
leaq 0x8(%rsp), %r15
leaq 0x4(%rsp), %r12
leaq 0x10(%rsp), %r13
movq %r11, %r8
movq %r10, %r9
setne %cl
shll $0x3, %ecx
pushq $0x0
pushq %r15
pushq %r14
pushq %rbx
pushq %r12
pushq %r13
pushq $0x0
pushq $0x0
pushq $0x0
pushq %rax
callq 0x5294
addq $0x50, %rsp
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_init
int citrusleaf_init() 
{
	extern char *citrusleaf_build_string;
	cf_info("Aerospike client version %s", citrusleaf_build_string);

	// remember the process id which is spawning the background threads.
	// only this process can call a pthread_join() on the threads that it spawned.
	g_init_pid = getpid();

	citrusleaf_cluster_init();

#ifdef DEBUG_HISTOGRAM	
    if (NULL == (cf_hist = cf_histogram_create("transaction times")))
        cf_error("couldn't create histogram for client");
#endif	

    g_initialized = true;
    
	return(0);
}

// Assembly:
pushq %rax
leaq 0xed45(%rip), %rax      # 0x152c8
movl (%rax), %eax
cmpl $0x2, %eax
jl 0x65ac
leaq 0xed3f(%rip), %rax      # 0x152d0
leaq 0x834b(%rip), %rsi      # 0xe8e3
movq (%rax), %rcx
leaq 0xed36(%rip), %rax      # 0x152d8
movq (%rax), %rdx
pushq $0x2
popq %rdi
xorl %eax, %eax
callq *%rcx
callq 0x23a0
leaq 0x10dec(%rip), %rcx     # 0x173a4
movl %eax, (%rcx)
xorl %eax, %eax
callq 0x7e29
movb $0x1, 0x10dd8(%rip)     # 0x173a0
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: citrusleaf_shutdown
void citrusleaf_shutdown(void) {

	if (g_initialized == false)
		return;

	citrusleaf_cluster_shutdown();
	citrusleaf_batch_shutdown();
	citrusleaf_async_shutdown();

	if (g_shared_memory) {
		citrusleaf_shm_free();
	}

	g_initialized = false;
}

// Assembly:
cmpb $0x1, 0x10dcd(%rip)     # 0x173a0
jne 0x6607
pushq %rax
callq 0x6db9
xorl %eax, %eax
callq 0x98ab
xorl %eax, %eax
callq 0xa3fc
leaq 0x10fe8(%rip), %rax     # 0x175d8
cmpb $0x1, (%rax)
jne 0x65fc
xorl %eax, %eax
callq 0xafdc
movb $0x0, 0x10d9d(%rip)     # 0x173a0
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_get_byaddr
cl_cluster_node *
cl_cluster_node_get_byaddr(cl_cluster *asc, struct sockaddr_in *sa_in)
{
	// No need to lock nodes list because this function is only called by
	// cluster_tend() thread which has exclusive write access.
	for (uint i=0;i<cf_vector_size(&asc->node_v);i++) {
		cl_cluster_node *cn = cf_vector_pointer_get(&asc->node_v, i);
		for (uint j=0;j<cf_vector_size(&cn->sockaddr_in_v);j++) {
			struct sockaddr_in *node_sa_in = cf_vector_getp(&cn->sockaddr_in_v, j);
			if (memcmp(sa_in, node_sa_in, sizeof(struct sockaddr_in) ) == 0 ) {
				return(cn);
			}
		}
	}
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
addq $0xf8, %rdi
movq %rsi, %rbx
xorl %ebp, %ebp
movq %rdi, (%rsp)
cmpl 0x104(%r14), %ebp
jae 0x66ad
movl %ebp, %esi
callq 0x66c2
movq %rax, %r13
movq %rax, %r12
xorl %r15d, %r15d
addq $0x20, %r13
cmpl 0x2c(%r12), %r15d
jae 0x66a5
movq %r13, %rdi
movl %r15d, %esi
callq 0xd9c7
movdqu (%rax), %xmm0
movdqu (%rbx), %xmm1
incl %r15d
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x6677
jmp 0x66b0
movq (%rsp), %rdi
incl %ebp
jmp 0x665a
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: citrusleaf_cluster_create
cl_cluster *
citrusleaf_cluster_create(void)
{
    if (! g_clust_initialized )    return(0);
    
	cl_cluster *asc = malloc(sizeof(cl_cluster));
	if (!asc)	return(0);
	
	asc->state = 0;
	asc->follow = true;
	asc->nbconnect = false;
	asc->found_all = false;
	asc->last_node = 0;
	asc->ref_count = 1;
	// Default is 0 so the cluster uses global tend period.
	// For the cluster user has to specifically set the own
	// value
	asc->tend_speed = 0;
	
	pthread_mutex_init(&asc->LOCK, 0);
	
	cf_vector_pointer_init(&asc->host_str_v, 10, 0);
	cf_vector_integer_init(&asc->host_port_v, 10, 0);
	cf_vector_pointer_init(&asc->host_addr_map_v, 10, 0);
	cf_vector_pointer_init(&asc->node_v, 10, 0);
	
	pthread_mutex_lock(&cluster_ll_LOCK);
	cf_ll_append(&cluster_ll, (cf_ll_element *) asc);
	pthread_mutex_unlock(&cluster_ll_LOCK);
	
	asc->n_partitions = 0;
	asc->partition_table_head = 0;
	
	return(asc);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x10cc0(%rip), %rax     # 0x173a8
cmpl $0x0, (%rax)
je 0x67a2
movl $0x180, %edi            # imm = 0x180
callq 0x22e0
testq %rax, %rax
je 0x67a2
andl $0x0, 0x10(%rax)
movw $0x1, 0x14(%rax)
movb $0x0, 0x16(%rax)
leaq 0x158(%rax), %rdi
xorl %esi, %esi
movq %rax, %rbx
andl $0x0, 0xf0(%rax)
movq $0x1, 0x150(%rax)
callq 0x2400
leaq 0x18(%rbx), %rdi
callq 0x67af
leaq 0x60(%rbx), %rdi
pushq $0x4
popq %rsi
pushq $0xa
popq %rdx
xorl %ecx, %ecx
callq 0xd5b8
leaq 0xa8(%rbx), %rdi
callq 0x67af
movq %rbx, %rdi
addq $0xf8, %rdi
callq 0x67af
leaq 0x10c3f(%rip), %r14     # 0x173b0
movq %r14, %rdi
callq 0x23b0
leaq 0x10c58(%rip), %rdi     # 0x173d8
movq %rbx, %rsi
callq 0xb90c
movq %r14, %rdi
callq 0x2190
andw $0x0, 0x140(%rbx)
andq $0x0, 0x148(%rbx)
jmp 0x67a4
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: citrusleaf_cluster_destroy
void
citrusleaf_cluster_destroy(cl_cluster *asc)
{
	// First remove the entry from global linked list of clusters
	// so that the tender function will not look into it.
	// As there is no destruction function specified in cf_ll_init()
	// the element will not freed in cf_ll_delete. It will just be 
	// removed from the linked list. So we need to free it later in
	// this function
	pthread_mutex_lock(&cluster_ll_LOCK);
	cf_ll_delete( &cluster_ll , (cf_ll_element *) asc);
	pthread_mutex_unlock(&cluster_ll_LOCK);

retry:
	pthread_mutex_lock(&asc->LOCK);
	if (asc->state & CLS_TENDER_RUNNING) {
		//If tender process is active, we cannot destroy at the moment
		pthread_mutex_unlock(&asc->LOCK);
		sleep(1);
		goto retry;
	}
	asc->state |= CLS_FREED;
	pthread_mutex_unlock(&asc->LOCK);

	for (uint i=0;i<cf_vector_size(&asc->host_str_v);i++) {
		char * host_str = cf_vector_pointer_get(&asc->host_str_v, i);
		free(host_str);
	}
	cf_vector_destroy(&asc->host_str_v);
	cf_vector_destroy(&asc->host_port_v);
	
	for (uint i=0;i<cf_vector_size(&asc->host_addr_map_v);i++) {
		cl_addrmap * addr_map_str = cf_vector_pointer_get(&asc->host_addr_map_v, i);
		free(addr_map_str->orig);
		free(addr_map_str->alt);
		free(addr_map_str);
	}
	cf_vector_destroy(&asc->host_addr_map_v);

	for (uint i=0;i<cf_vector_size(&asc->node_v);i++) {
		cl_cluster_node *cn = cf_vector_pointer_get(&asc->node_v, i);
		cl_cluster_node_release(cn);
	}
	cf_vector_destroy(&asc->node_v);
	
	cl_partition_table_destroy_all(asc);
	
	pthread_mutex_destroy(&asc->LOCK);
	free(asc);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x10806(%rip), %r14     # 0x173b0
movq %rdi, %rbx
movq %r14, %rdi
callq 0x23b0
leaq 0x1081c(%rip), %rdi     # 0x173d8
movq %rbx, %rsi
callq 0xba78
movq %r14, %rdi
callq 0x2190
leaq 0x158(%rbx), %r14
pushq $0x1
popq %rbp
movq %r14, %rdi
callq 0x23b0
movl 0x10(%rbx), %eax
testb $0x1, %al
je 0x6bf6
movq %r14, %rdi
callq 0x2190
movl %ebp, %edi
callq 0x2180
jmp 0x6bd6
orl $0x2, %eax
movq %r14, %rdi
movl %eax, 0x10(%rbx)
callq 0x2190
leaq 0x18(%rbx), %r15
xorl %ebp, %ebp
cmpl 0x24(%rbx), %ebp
jae 0x6c25
movq %r15, %rdi
movl %ebp, %esi
callq 0x66c2
movq %rax, %rdi
callq 0x22c0
incl %ebp
jmp 0x6c0a
movq %r15, %rdi
callq 0xd724
leaq 0x60(%rbx), %rdi
callq 0xd724
leaq 0xa8(%rbx), %r15
xorl %ebp, %ebp
cmpl 0xb4(%rbx), %ebp
jae 0x6c72
movq %r15, %rdi
movl %ebp, %esi
callq 0x66c2
movq (%rax), %rdi
movq %rax, %r12
callq 0x22c0
movq 0x8(%r12), %rdi
callq 0x22c0
movq %r12, %rdi
callq 0x22c0
incl %ebp
jmp 0x6c3f
movq %r15, %rdi
callq 0xd724
leaq 0xf8(%rbx), %r15
xorl %ebp, %ebp
cmpl 0x104(%rbx), %ebp
jae 0x6ca1
movq %r15, %rdi
movl %ebp, %esi
callq 0x66c2
movq %rax, %rdi
callq 0x6cc9
incl %ebp
jmp 0x6c83
movq %r15, %rdi
callq 0xd724
movq %rbx, %rdi
callq 0x8315
movq %r14, %rdi
callq 0x22b0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x22c0
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_release
void
cl_cluster_node_release(cl_cluster_node *cn)
{
	int i;
	cl_async_work *aw;
	if (0 == cf_client_rc_release(cn)) {
		
		cf_vector_destroy(&cn->sockaddr_in_v);
		
		// Drain out the queue and close the FDs
		int rv;
		do {
			int	fd;
			rv = cf_queue_pop(cn->conn_q, &fd, CF_QUEUE_NOWAIT);
			if (rv == CF_QUEUE_OK)
				close(fd);
		} while (rv == CF_QUEUE_OK);
		do {
			int	fd;
			rv = cf_queue_pop(cn->conn_q_asyncfd, &fd, CF_QUEUE_NOWAIT);
			if (rv == CF_QUEUE_OK)
				close(fd);
		} while (rv == CF_QUEUE_OK);

		do {
			//When we reach this point, ideally there should not be any workitems.
			rv = cf_queue_pop(cn->asyncwork_q, &aw, CF_QUEUE_NOWAIT);
			if (rv == CF_QUEUE_OK) {
				free(aw);
			}
		} while (rv == CF_QUEUE_OK);

		//We want to delete all the workitems of this node
		if (g_cl_async_hashtab) {
			shash_reduce_delete(g_cl_async_hashtab, cl_del_node_asyncworkitems, cn);
		}

		//Now that all the workitems are released the FD can be closed
		if (cn->asyncfd != -1) {
			close(cn->asyncfd);
			cn->asyncfd = -1;
		}

		cf_queue_destroy(cn->conn_q);
		cf_queue_destroy(cn->conn_q_asyncfd);
		cf_queue_destroy(cn->asyncwork_q);
		pthread_mutex_destroy(&cn->LOCK);
		cf_client_rc_free(cn);
	}
	
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %esi, %esi
movq %rdi, %rbx
callq 0xb6de
testq %rax, %rax
jne 0x6db1
leaq 0x20(%rbx), %rdi
callq 0xd724
movq %rsp, %r14
movq 0x70(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xc163
testl %eax, %eax
jne 0x6d08
movl (%rsp), %edi
callq 0x2550
jmp 0x6cec
movq %rsp, %r14
movq 0x78(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xc163
testl %eax, %eax
jne 0x6d27
movl (%rsp), %edi
callq 0x2550
jmp 0x6d0b
movq %rsp, %r14
movq 0x88(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xc163
testl %eax, %eax
jne 0x6d4a
movq (%rsp), %rdi
callq 0x22c0
jmp 0x6d2a
leaq 0x1086f(%rip), %rax     # 0x175c0
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6d68
leaq 0x2c3a(%rip), %rsi      # 0x999a
movq %rbx, %rdx
callq 0x40be
movl 0x80(%rbx), %edi
cmpl $-0x1, %edi
je 0x6d7f
callq 0x2550
orl $-0x1, 0x80(%rbx)
movq 0x70(%rbx), %rdi
callq 0xbe9d
movq 0x78(%rbx), %rdi
callq 0xbe9d
movq 0x88(%rbx), %rdi
callq 0xbe9d
leaq 0x90(%rbx), %rdi
callq 0x22b0
movq %rbx, %rdi
callq 0xb725
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: citrusleaf_cluster_add_addr_map
void
citrusleaf_cluster_add_addr_map(cl_cluster *asc, char *orig, char *alt)
{
	int	i, vsz;
	cl_addrmap *oldmap=NULL, *newmap=NULL;


	//Search if the given mapping already exists
	vsz = asc->host_addr_map_v.len;
	for (i=0; i<vsz; i++)
	{
		oldmap = cf_vector_pointer_get(&asc->host_addr_map_v, i);
		if (oldmap && strcmp(oldmap->orig, orig) == 0) {
			//The original address is already in the map. update its alternative.
			free(oldmap->alt); //free the old string.
			oldmap->alt = strdup(alt);
			return;
		}
	}

	//We need to add the supplied map only if does not already exist
	if (i==vsz) {
		cl_addrmap *newmap = (cl_addrmap *) malloc(sizeof(struct cl_addrmap));
		if (newmap == NULL) {
			return;
		}

		newmap->orig = strdup(orig);
		newmap->alt = strdup(alt);
		cf_vector_pointer_append(&asc->host_addr_map_v, newmap);
		//cf_debug("Adding the mapping %x:%s->%s", newmap, orig, alt);
	} 
	else {
		//cf_debug("Mapping %s->%s already exists", oldmap->orig, oldmap->alt);
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0xb4(%rdi), %r13d
movq %rdi, %r14
xorl %ebp, %ebp
movl $0x0, %ebx
movq %rsi, %r15
movq %rdx, (%rsp)
addq $0xa8, %r14
testl %r13d, %r13d
cmovgl %r13d, %ebx
cmpl %ebp, %ebx
je 0x7408
movq %r14, %rdi
movl %ebp, %esi
callq 0x66c2
testq %rax, %rax
je 0x7404
movq (%rax), %rdi
movq %r15, %rsi
movq %rax, %r12
callq 0x2350
testl %eax, %eax
je 0x7450
incl %ebp
jmp 0x73df
testl %r13d, %r13d
js 0x7468
pushq $0x10
popq %rdi
callq 0x22e0
testq %rax, %rax
je 0x7468
movq %r15, %rdi
movq %rax, %r12
callq 0x24f0
movq (%rsp), %rdi
movq %rax, (%r12)
callq 0x24f0
movq %rax, 0x8(%r12)
movq %r14, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6dff
movq 0x8(%r12), %rdi
callq 0x22c0
movq (%rsp), %rdi
callq 0x24f0
movq %rax, 0x8(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_create
cl_cluster_node *
cl_cluster_node_create(char *name, struct sockaddr_in *sa_in)
{
	int i;
	cl_cluster_node *cn = cf_client_rc_alloc( sizeof(cl_cluster_node ) );
	if (!cn)	return(0);
	
	strcpy(cn->name, name);

	cn->dun_score = 0;
	cn->dunned = false;
	
	cf_vector_init(&cn->sockaddr_in_v, sizeof( struct sockaddr_in ), 5, 0);
	cf_vector_append(&cn->sockaddr_in_v, sa_in);
	
	cn->conn_q = cf_queue_create( sizeof(int), true );
	cn->conn_q_asyncfd = cf_queue_create( sizeof(int), true );

	cn->asyncfd = -1;
	cn->asyncwork_q = cf_queue_create(sizeof(cl_async_work *), true);
	
	cn->partition_generation = 0xFFFFFFFF;
	
	pthread_mutex_init(&cn->LOCK, 0);
	
	return(cn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
movl $0xb8, %edi
movq %rsi, %r14
callq 0xb706
movq %rax, %rbx
testq %rax, %rax
je 0x7703
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
movl $0x0, 0x14(%rbx)
movb $0x0, 0x18(%rbx)
leaq 0x20(%rbx), %r15
pushq $0x10
popq %rsi
pushq $0x5
popq %rdx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0xd5b8
movq %r15, %rdi
movq %r14, %rsi
callq 0xd8b7
pushq $0x4
popq %r14
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0xbe10
movq %r14, %rdi
movl %ebp, %esi
movq %rax, 0x70(%rbx)
callq 0xbe10
movq %rax, 0x78(%rbx)
orl $-0x1, 0x80(%rbx)
pushq $0x8
popq %rdi
movl %ebp, %esi
callq 0xbe10
movq %rax, 0x88(%rbx)
orl $-0x1, 0x68(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
addq $0x90, %rdi
callq 0x2400
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_get_random
cl_cluster_node *
cl_cluster_node_get_random(cl_cluster *asc)
{
	cl_cluster_node *cn;
	
	uint node_v_sz = cf_vector_size(&asc->node_v);
	if (node_v_sz == 0) {
#ifdef DEBUG		
		cf_debug("cluster node get: no nodes in this cluster");
#endif		
		return(0);
	}

	uint i=0;
	do {
		asc->last_node ++;
		if (asc->last_node >= node_v_sz)	asc->last_node = 0;
		int node_i = asc->last_node;

#ifdef DEBUG_VERBOSE		
		cf_debug("cluster node get: vsize %d choosing %d",
			cf_vector_size(&asc->node_v), node_i);
#endif		

		cn = cf_vector_pointer_get(&asc->node_v, node_i);
		i++;
        
	} while( (cn->dunned == true) && (i <= node_v_sz) );

#ifdef DEBUG    
    cf_debug("   random node chosen: %s",cn->name);
#endif    
    
	// grab a reservation
	cf_client_rc_reserve(cn);

	return(cn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x104(%rdi), %ebp
xorl %r12d, %r12d
testl %ebp, %ebp
je 0x7772
movq %rdi, %rbx
leaq 0xf8(%rdi), %r14
pushq $0x1
popq %r13
movl 0xf0(%rbx), %esi
movq %r14, %rdi
incl %esi
cmpl %ebp, %esi
cmovael %r12d, %esi
movl %esi, 0xf0(%rbx)
callq 0x66c2
cmpb $0x1, 0x18(%rax)
movq %rax, %r15
jne 0x7768
leal 0x1(%r13), %eax
cmpl %ebp, %r13d
movl %eax, %r13d
jbe 0x7737
movq %r15, %rdi
callq 0xb6d0
jmp 0x7775
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_get
cl_cluster_node *
cl_cluster_node_get(cl_cluster *asc, const char *ns, const cf_digest *d, bool write)
{
	cl_cluster_node	*cn;	
	pthread_mutex_lock(&asc->LOCK);

	// first, try to get one that matches this digest
	cn = cl_partition_table_get(asc, (char *)ns, cl_partition_getid(asc->n_partitions, (cf_digest *) d) , write);
	if (cn && (cn->dunned == false)) {
#ifdef DEBUG_VERBOSE		
		cf_debug("cluster node get: found match key %"PRIx64" node %s (%s):",
											*(uint64_t*)d, cn->name, write?"write":"read");
#endif		
		cf_client_rc_reserve(cn);
		pthread_mutex_unlock(&asc->LOCK);
		return(cn);
	}
#ifdef DEBUG_VERBOSE	
	cf_debug("cluster node get: not found, try random key %"PRIx64, *(uint64_t *)d);
#endif	
	
	cn = cl_cluster_node_get_random(asc);
	pthread_mutex_unlock(&asc->LOCK);
	return(cn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x158(%rdi), %rbx
movq %rdi, %r14
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r12
movq %rbx, %rdi
callq 0x23b0
movl 0x140(%r14), %eax
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %ecx
decl %eax
andw (%r15), %ax
movzwl %ax, %edx
callq 0x8457
testq %rax, %rax
je 0x77d4
cmpb $0x0, 0x18(%rax)
movq %rax, %r15
je 0x77e1
movq %r14, %rdi
callq 0x7711
movq %rax, %r15
jmp 0x77e9
movq %r15, %rdi
callq 0xb6d0
movq %rbx, %rdi
callq 0x2190
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_get_node_names
void 
cl_cluster_get_node_names(cl_cluster *asc, int *n_nodes, char **node_names)
{
	pthread_mutex_lock(&asc->LOCK);
	uint size = cf_vector_size(&asc->node_v);
	*n_nodes = size;

	if (size == 0) {
		*node_names = 0;
		pthread_mutex_unlock(&asc->LOCK);
		return;
	}

	*node_names = malloc(NODE_NAME_SIZE * size);
	if (*node_names == 0) {
		pthread_mutex_unlock(&asc->LOCK);
		return;
	}

	char *nptr = *node_names;
	for (uint i = 0; i < size; i++) {
		cl_cluster_node *cn = cf_vector_pointer_get(&asc->node_v, i);
		memcpy(nptr, cn->name, NODE_NAME_SIZE);
		nptr += NODE_NAME_SIZE;
	}
	pthread_mutex_unlock(&asc->LOCK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x158(%rdi), %rbx
movq %rdi, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rbx, %rdi
callq 0x23b0
movl 0x104(%r14), %r13d
testl %r13d, %r13d
movl %r13d, (%r15)
je 0x7879
imull $0x14, %r13d, %edi
callq 0x22e0
testq %rax, %rax
movq %rax, (%r12)
je 0x787e
movq %rax, %r15
addq $0xf8, %r14
xorl %ebp, %ebp
cmpl %ebp, %r13d
je 0x787e
movq %r14, %rdi
movl %ebp, %esi
callq 0x66c2
movq (%rax), %rcx
movq 0x8(%rax), %rdx
incl %ebp
movq %rcx, (%r15)
movq %rdx, 0x8(%r15)
movl 0x10(%rax), %eax
movl %eax, 0x10(%r15)
addq $0x14, %r15
jmp 0x784d
andq $0x0, (%r12)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2190
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_get_byname
cl_cluster_node *
cl_cluster_node_get_byname(cl_cluster *asc, char *name)
{
	pthread_mutex_lock(&asc->LOCK);

	for (uint i = 0; i < cf_vector_size(&asc->node_v); i++) {
		cl_cluster_node *cn = cf_vector_pointer_get(&asc->node_v, i);
		if (strcmp(name, cn->name) == 0) {
			pthread_mutex_unlock(&asc->LOCK);
			return(cn);
		}
	}
	pthread_mutex_unlock(&asc->LOCK);
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x158(%rdi), %rbx
movq %rdi, %r12
movq %rsi, %r15
movq %rbx, %rdi
callq 0x23b0
leaq 0xf8(%r12), %r13
xorl %ebp, %ebp
cmpl 0x104(%r12), %ebp
jae 0x78e8
movq %r13, %rdi
movl %ebp, %esi
callq 0x66c2
movq %r15, %rdi
movq %rax, %rsi
movq %rax, %r14
callq 0x2350
incl %ebp
testl %eax, %eax
jne 0x78be
jmp 0x78eb
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x2190
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: str_split
static void
str_split(char split_c, char *str, cf_vector *v)
{
	char *prev = str;
	while (*str) {
		if (split_c == *str) {
			*str = 0;
			cf_vector_append(v, &prev);
			prev = str+1;
		}
		str++;
	}
	if (prev != str) {
		cf_vector_append(v, &prev);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsp, %r14
movq %rdx, %rbx
movl %edi, %ebp
movq %rsi, %r15
movq %rsi, (%r14)
movb (%r15), %al
testb %al, %al
je 0x7b59
cmpb %bpl, %al
jne 0x7b54
movq %rbx, %rdi
movq %r14, %rsi
movb $0x0, (%r15)
callq 0xd8b7
leaq 0x1(%r15), %rsi
movq %rsi, (%rsp)
incq %r15
jmp 0x7b31
cmpq %rsi, %r15
je 0x7b69
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xd8b7
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_fd_get
int
cl_cluster_node_fd_get(cl_cluster_node *cn, bool asyncfd, bool nbconnect)
{
	int fd;
#if ONEASYNCFD
	if (asyncfd == true) {
		if (cn->asyncfd == -1) {
			cn->asyncfd = cl_cluster_node_fd_create(cn, true);
		} 
		fd = cn->asyncfd;
		return fd;
	}
#endif
	cf_queue *q;
	if (asyncfd == true) {
		q = cn->conn_q_asyncfd;
	} else {
		q = cn->conn_q;
	}
	
	int rv = cf_queue_pop(q, &fd, CF_QUEUE_NOWAIT);
	if (rv == CF_QUEUE_OK)
		;
	else if (rv == CF_QUEUE_EMPTY) {
		if ((asyncfd == true) || (nbconnect == true)) {
			//Use a non-blocking socket for async client
			fd = cl_cluster_node_fd_create(cn, true);
		} else {
			fd = cl_cluster_node_fd_create(cn, false);
		}
	}
	else {
		fd = -1;
	}

	return fd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %eax
movq %rdi, %rbx
movl %edx, %r14d
movl %esi, %ebp
leaq 0xc(%rsp), %rsi
xorl %edx, %edx
movq 0x70(%rdi,%rax,8), %rdi
callq 0xc163
cmpl $-0x2, %eax
je 0x7d3b
testl %eax, %eax
jne 0x7d4c
movl 0xc(%rsp), %eax
jmp 0x7d5b
orb %r14b, %bpl
cmpb $0x1, %bpl
jne 0x7d51
pushq $0x1
popq %rsi
movq %rbx, %rdi
jmp 0x7d56
pushq $-0x1
popq %rax
jmp 0x7d5b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7ba2
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cl_cluster_node_fd_put
void
cl_cluster_node_fd_put(cl_cluster_node *cn, int fd, bool asyncfd)
{
#if ONEASYNCFD
	return;	//FD does not get closed. It just lies around.
#endif
	cf_queue *q;
	if (asyncfd == true) {
		q = cn->conn_q_asyncfd;
		// Async queue is used by XDS. It can open lot of connections 
		// depending on batch-size. Dont worry about limiting the pool.
		cf_queue_push(q, &fd);
	} else {
		q = cn->conn_q;
		if (! cf_queue_push_limit(q, &fd, 300)) {
			close(fd);
		}
	}
}

// Assembly:
pushq %rax
testl %edx, %edx
movl %esi, 0x4(%rsp)
je 0x7d7d
movq 0x78(%rdi), %rdi
leaq 0x4(%rsp), %rsi
callq 0xc01b
jmp 0x7d9d
movq 0x70(%rdi), %rdi
leaq 0x4(%rsp), %rsi
movl $0x12c, %edx            # imm = 0x12C
callq 0xc0bc
testb %al, %al
jne 0x7d9d
movl 0x4(%rsp), %edi
callq 0x2550
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cluster_get_n_partitions
void
cluster_get_n_partitions( cl_cluster *asc, cf_vector *sockaddr_in_v )
{
	// check if someone found the value
	if (asc->n_partitions != 0)
		return;

	for (uint i=0;i<cf_vector_size(sockaddr_in_v);i++) {
		struct sockaddr_in *sa_in = cf_vector_getp(sockaddr_in_v, i);
		int n_partitions = 0;

		if (cl_get_n_partitions(sa_in, &n_partitions) != 0) {
			continue;
		}
		asc->n_partitions = n_partitions;
		break;
	}
}

// Assembly:
cmpw $0x0, 0x140(%rdi)
je 0x7daa
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x4(%rsp), %r15
cmpl 0xc(%r14), %ebp
jae 0x7df2
movq %r14, %rdi
movl %ebp, %esi
callq 0xd9c7
andl $0x0, 0x4(%rsp)
movq %rax, %rdi
movq %r15, %rsi
callq 0xb5c5
testl %eax, %eax
je 0x7de6
incl %ebp
jmp 0x7dbe
movzwl 0x4(%rsp), %eax
movw %ax, 0x140(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: citrusleaf_cluster_init
int citrusleaf_cluster_init()
{
    if (g_clust_initialized) {
    	return(0);
	}
    
    // No destruction function is used.
	// NOTE: A destruction function should not be used because elements
	// in this list are used even after they are removed from the list.
	// Refer to the function citrusleaf_cluster_destroy() for more info.
	cf_ll_init(&cluster_ll, 0, false);
	
    g_clust_initialized = 1;
   	g_clust_tend_speed = 1;
	pthread_create( &tender_thr, 0, cluster_tender_fn, 0);

	return(0);	
}

// Assembly:
pushq %rbx
leaq 0xf577(%rip), %rbx      # 0x173a8
cmpl $0x0, (%rbx)
jne 0x7e68
leaq 0xf59b(%rip), %rdi      # 0x173d8
xorl %esi, %esi
xorl %edx, %edx
callq 0xbc6d
pushq $0x1
popq %rax
leaq 0xf5d0(%rip), %rdi      # 0x17420
leaq 0x15(%rip), %rdx        # 0x7e6c
xorl %esi, %esi
xorl %ecx, %ecx
movl %eax, (%rbx)
movl %eax, 0xd45d(%rip)      # 0x152c0
callq 0x24e0
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cluster_tender_fn
static void *
cluster_tender_fn(void *gcc_is_ass)
{
	uint64_t cnt = 1;
	do {
		sleep(1);
		
		// if tend period is non zero tend at that period
		// otherwise at default period
		cf_ll_element *e = cf_ll_get_head(&cluster_ll);
		while (e) {
			int period = ((cl_cluster *)e)->tend_speed;
			if (period) {
				if ((cnt % period) == 0) {
					cluster_tend( (cl_cluster *) e);
				}
			} else {
				if ((cnt % g_clust_tend_speed) == 0) {
					cluster_tend( (cl_cluster *) e);
				}
			}
			e = cf_ll_get_next(e);
		}
		cnt++;
	} while (1);
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x1
popq %rbx
pushq $0x1
popq %rbp
leaq 0xf558(%rip), %r15      # 0x173d8
movl %ebp, %edi
callq 0x2180
movq %r15, %r14
movq (%r14), %r14
testq %r14, %r14
je 0x7ebc
movslq 0x154(%r14), %rcx
testq %rcx, %rcx
jne 0x7ea5
movslq 0xd41b(%rip), %rcx      # 0x152c0
movq %rbx, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x7e8a
movq %r14, %rdi
callq 0x6e10
jmp 0x7e8a
incq %rbx
jmp 0x7e80
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_cluster.c
// Function: cluster_ping_address
static void
cluster_ping_address(cl_cluster *asc, struct sockaddr_in *sa_in)
{
	char node_name[NODE_NAME_SIZE];

	if (cl_get_node_name(sa_in, node_name) != 0) {
		return;
	}
		
	// if new nodename, add to cluster
	cl_cluster_node *cn = cl_cluster_node_get_byname(asc, node_name);
	if (!cn) {
		/*
		if (cf_debug_enabled()) {
			cf_debug("%s node unknown, creating new", node_name);
			dump_sockaddr_in("New node is ",sa_in);
		}
		*/
		cl_cluster_node *node = cl_cluster_node_create(node_name, sa_in);

		// Appends must be locked regardless of only being called from tend thread, because
		// other threads reads need to wait on their locks for the append to complete.
		pthread_mutex_lock(&asc->LOCK);
		cf_vector_pointer_append(&asc->node_v, node);
		pthread_mutex_unlock(&asc->LOCK);
	}
	// if not new, add address to node
	else {
		cf_vector_append_unique(&cn->sockaddr_in_v, sa_in);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
movq %r14, %rdi
callq 0xb499
testl %eax, %eax
jne 0x7f68
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x7894
testq %rax, %rax
je 0x7f31
addq $0x20, %rax
movq %r14, %rsi
movq %rax, %rdi
callq 0xd8f6
jmp 0x7f68
movq %rsp, %rdi
movq %r14, %rsi
callq 0x765b
leaq 0x158(%rbx), %r15
movq %rax, %r14
movq %r15, %rdi
callq 0x23b0
addq $0xf8, %rbx
movq %r14, %rsi
movq %rbx, %rdi
callq 0x6dff
movq %r15, %rdi
callq 0x2190
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_remove_node
void
cl_partition_table_remove_node( cl_cluster *asc, cl_cluster_node *node )
{
#ifdef DEBUG
	cf_debug("remove node %s",node->name);
#endif	
	
	cl_partition_table *pt = asc->partition_table_head;
	while(pt) {
		
		for (int i=0;i<asc->n_partitions;i++) {
			cl_partition *p = &pt->partitions[i];
			if (p->write == node) p->write = 0;
			for (int j=0;j<p->n_read;j++) {
				if (p->read[j] == node) {
					if (j < MAX_REPLICA_COUNT-1)
						// overlapping copies must use memmove!
						memmove(&p->read[j], &p->read[j+1], 
							((MAX_REPLICA_COUNT - 1) - j) * sizeof(cl_cluster_node *) );
					p->n_read--;
					break;
				}
			}
		}
		
		pt = pt->next;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x148(%rdi), %rax
pushq $-0x20
popq %rdi
movq (%rax), %rax
testq %rax, %rax
je 0x8266
leaq 0x30(%rax), %r13
leaq 0x40(%rax), %rbp
xorl %r15d, %r15d
movq %rax, (%rsp)
movzwl 0x140(%r14), %eax
cmpq %rax, %r15
jae 0x825d
imulq $0x38, %r15, %rax
cmpq %rbx, (%r13,%rax)
leaq (%r13,%rax), %r12
jne 0x8204
andq $0x0, (%r12)
movl 0x8(%r12), %eax
movl $0x0, %esi
movq %rdi, %rdx
testl %eax, %eax
cmovgl %eax, %esi
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x8254
cmpq %rbx, (%rbp,%rcx,8)
je 0x822d
incq %rcx
addq $0x8, %rdx
jmp 0x8218
cmpq $0x3, %rcx
ja 0x824d
leaq (%rbp,%rcx,8), %rdi
leaq 0x8(%rbp,%rcx,8), %rsi
negq %rdx
callq 0x2460
pushq $-0x20
popq %rdi
movl 0x8(%r12), %eax
decl %eax
movl %eax, 0x8(%r12)
incq %r15
addq $0x38, %rbp
jmp 0x81e2
movq (%rsp), %rax
jmp 0x81c7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_create
cl_partition_table *
cl_partition_table_create(cl_cluster *asc, char *ns) 
{
#ifdef DEBUG
	cf_debug("partition table create: npartitions %d", asc->n_partitions);
#endif

	cl_partition_table *pt = malloc( sizeof(cl_partition_table) + (sizeof(cl_partition) * asc->n_partitions) );
	if (!pt)	return(0);
	memset(pt, 0, sizeof(cl_partition_table) + (sizeof(cl_partition) * asc->n_partitions) );
	strcpy( pt->ns, ns );
	
	pt->next = asc->partition_table_head;
	asc->partition_table_head = pt;

	return(pt);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movzwl 0x140(%rdi), %eax
movq %rsi, %r14
movq %rdi, %rbx
imulq $0x38, %rax, %rsi
addq $0x30, %rsi
pushq $0x1
popq %rdi
callq 0x2170
movq %rax, %r15
testq %rax, %rax
je 0x82bf
movq %r15, %rdi
movq %r14, %rsi
addq $0x8, %rdi
callq 0x2240
movq 0x148(%rbx), %rax
movq %rax, (%r15)
movq %r15, 0x148(%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_destroy
void
cl_partition_table_destroy(cl_cluster *asc, cl_partition_table *pt)
{
	cl_partition_table **prev = &asc->partition_table_head;
	cl_partition_table *now = asc->partition_table_head;
	while ( now ) {
		if (now == pt) {
			*prev = pt->next;
			break;
		}
	}
#ifdef EXTRA_CHECKS	
	if (now == 0) {
		cf_warn("warning! passed in partition table %p not in list", pt);
		return;
	}
#endif

	free(pt);
}

// Assembly:
movq 0x148(%rdi), %rax
movq %rsi, %rdx
testq %rax, %rax
je 0x82de
cmpq %rdx, %rax
je 0x8302
jmp 0x82dc
leaq 0xcfe3(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0x8314
leaq 0xcfdf(%rip), %rax      # 0x152d0
leaq 0x68b7(%rip), %rsi      # 0xebaf
movq (%rax), %rcx
pushq $0x1
popq %rdi
xorl %eax, %eax
jmpq *%rcx
movq (%rdx), %rax
movq %rax, 0x148(%rdi)
movq %rdx, %rdi
jmp 0x22c0
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_destroy_all
void
cl_partition_table_destroy_all(cl_cluster *asc)
{
	cl_partition_table *now = asc->partition_table_head;
	while (now ) {
		void *t = now->next;
		free( now );
		now = t;
	}
	asc->partition_table_head = 0;
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x148(%rdi), %rdi
testq %rdi, %rdi
je 0x8335
movq (%rdi), %r14
callq 0x22c0
movq %r14, %rdi
jmp 0x8323
andq $0x0, 0x148(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_set
void
cl_partition_table_set( cl_cluster *asc, cl_cluster_node *node, char *ns, cl_partition_id pid, bool write)
{
	//cf_debug("Set %s %d", ns, pid);
	cl_partition_table *pt = cl_partition_table_get_byns(asc, ns);

	if (!pt) {
		pt = cl_partition_table_create(asc, ns);
		if (!pt) {
			cf_warn("Failed to create partition table.");
			return;
		}
	}
	//cf_info("Set %s partition %s:%u", write? "write":"read", ns, pid);

	if (write) {
		pt->partitions[pid].write = node;
	}
	else {
		cl_partition *p = &pt->partitions[pid];

		for (int i = 0; i < p->n_read ; i++) {
			if (p->read[i] == node) {
				return; // already in!
			}
		}

		if (MAX_REPLICA_COUNT == p->n_read) {
			// full, replace 0
			cf_debug("read replica set full");
			p->read[0] = node;
		}
		else {
			p->read[p->n_read] = node;
			p->n_read++;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdx, %rsi
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r15
movq %rdi, %r12
callq 0x8345
testq %rax, %rax
jne 0x83ad
movq %r12, %rdi
movq %r15, %rsi
callq 0x8275
testq %rax, %rax
je 0x841a
movzwl %r14w, %ecx
imulq $0x38, %rcx, %rcx
testb %bpl, %bpl
leaq 0x30(%rax,%rcx), %rax
je 0x83c7
movq %rbx, (%rax)
jmp 0x844e
movslq 0x8(%rax), %rcx
leaq 0x10(%rax), %r14
xorl %edx, %edx
movq %r14, %rsi
testl %ecx, %ecx
cmovgl %ecx, %edx
subq $0x1, %rdx
jb 0x83ea
cmpq %rbx, (%rsi)
leaq 0x8(%rsi), %rsi
jne 0x83d9
jmp 0x844e
cmpl $0x5, %ecx
jne 0x8446
leaq 0xced2(%rip), %rax      # 0x152c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x8415
leaq 0xcecc(%rip), %rax      # 0x152d0
leaq 0x67f8(%rip), %rsi      # 0xec03
movq (%rax), %rcx
pushq $0x3
popq %rdi
xorl %eax, %eax
callq *%rcx
movq %rbx, (%r14)
jmp 0x844e
leaq 0xcea7(%rip), %rax      # 0x152c8
cmpl $0x0, (%rax)
jle 0x844e
leaq 0xcea3(%rip), %rax      # 0x152d0
leaq 0x67ad(%rip), %rsi      # 0xebe1
movq (%rax), %rcx
pushq $0x1
popq %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movq %rbx, 0x10(%rax,%rcx,8)
incl 0x8(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq