LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0xc2ed
testl %eax, %eax
jne 0x8893
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x8055
testq %rax, %rax
je 0x8857
addq $0x20, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0xebdb
jmp 0x8893
movq %rsp, %rdi
movq %r14, %rsi
callq 0x7de8
movq %rax, %r14
leaq 0x158(%rbx), %r15
movq %r15, %rdi
callq 0x23b0
addq $0xf8, %rbx
leaq 0x18(%rsp), %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
callq 0xeb9c
movq %r15, %rdi
callq 0x2190
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x148(%rdi), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x8ba2
movq %rsi, %rbx
movq %rdi, %r14
cmpw $0x0, 0x140(%r14)
je 0x8b8e
movq (%rsp), %rax
leaq 0x30(%rax), %r12
leaq 0x48(%rax), %r13
xorl %ebp, %ebp
imulq $0x38, %rbp, %rax
leaq (%r12,%rax), %r15
cmpq %rbx, (%r12,%rax)
jne 0x8b37
movq $0x0, (%r15)
movslq 0x8(%r15), %rax
testq %rax, %rax
jle 0x8b7a
movq $-0x20, %rdx
xorl %ecx, %ecx
cmpq %rbx, 0x18(%r13,%rdx)
je 0x8b5e
incq %rcx
addq $0x8, %rdx
cmpq %rcx, %rax
jne 0x8b49
jmp 0x8b7a
cmpq $0x3, %rcx
ja 0x8b76
leaq 0x18(%r13,%rdx), %rdi
leaq 0x20(%r13,%rdx), %rsi
negq %rdx
callq 0x2460
decl 0x8(%r15)
incq %rbp
movzwl 0x140(%r14), %eax
addq $0x38, %r13
cmpq %rax, %rbp
jb 0x8b22
movq (%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
testq %rax, %rax
jne 0x8b09
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movzwl 0x140(%rdi), %eax
imulq $0x38, %rax, %r12
addq $0x30, %r12
movq %r12, %rdi
callq 0x22e0
testq %rax, %rax
je 0x8c0d
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x2140
movq %r14, %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0x2240
movq 0x148(%rbx), %rax
movq %rax, (%r14)
movq %r14, 0x148(%rbx)
jmp 0x8c10
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rsi, %rdx
movq 0x148(%rdi), %rax
testq %rax, %rax
je 0x8c35
cmpq %rdx, %rax
je 0x8c5b
jmp 0x8c33
leaq 0xe68c(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0x8c6d
leaq 0xe688(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x7f3f(%rip), %rsi      # 0x10b91
movl $0x1, %edi
xorl %eax, %eax
jmpq *%rcx
movq (%rdx), %rax
movq %rax, 0x148(%rdi)
movq %rdx, %rdi
jmp 0x22c0
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8c91
movq (%rdi), %r14
callq 0x22c0
testq %r14, %r14
movq %r14, %rdi
jne 0x8c81
movq $0x0, 0x148(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r13
leaq 0x148(%rdi), %r15
movq (%r15), %r15
testq %r15, %r15
je 0x8d17
leaq 0x8(%r15), %rsi
movq %r12, %rdi
callq 0x2350
testl %eax, %eax
jne 0x8cfd
jmp 0x8d1a
xorl %r15d, %r15d
testq %r15, %r15
jne 0x8d32
movq %r13, %rdi
movq %r12, %rsi
callq 0x8bb1
movq %rax, %r15
testq %rax, %rax
je 0x8da8
movzwl %r14w, %eax
imulq $0x38, %rax, %rax
leaq 0x30(%r15,%rax), %r14
testb %bpl, %bpl
je 0x8d4c
movq %rbx, (%r14)
jmp 0x8ddc
movslq 0x8(%r14), %rax
testq %rax, %rax
jle 0x8d6a
leaq 0x10(%r14), %rcx
movq %rax, %rdx
cmpq %rbx, (%rcx)
je 0x8ddc
addq $0x8, %rcx
decq %rdx
jne 0x8d5c
cmpl $0x5, %eax
jne 0x8d9d
leaq 0xe552(%rip), %rax      # 0x172c8
movl (%rax), %eax
cmpl $0x3, %eax
jl 0x8d97
leaq 0xe54c(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x7e57(%rip), %rsi      # 0x10be5
movl $0x3, %edi
xorl %eax, %eax
callq *%rcx
movq %rbx, 0x10(%r14)
jmp 0x8ddc
movq %rbx, 0x10(%r14,%rax,8)
incl 0x8(%r14)
jmp 0x8ddc
leaq 0xe519(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0x8ddc
leaq 0xe515(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x7dfe(%rip), %rsi      # 0x10bc3
movl $0x1, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_get
cl_cluster_node *
cl_partition_table_get( cl_cluster *asc, char *ns, cl_partition_id pid, bool write)
{
	cl_partition_table *pt = cl_partition_table_get_byns(asc,ns);
	if (!pt)	{
#ifdef DEBUG        
        cf_debug("partition table: no partition table");
#endif        
        return(0);
    }
	
	cl_cluster_node *node;
	if (write) {

		node = pt->partitions[pid].write;

	}
	else {
		cl_partition *p = &pt->partitions[pid];
		if (p->n_read) {
			round_robin_counter++;
			uint32_t my_rr = round_robin_counter;
			node = p->read[ my_rr % p->n_read ];
		} else {
			node = 0;
		}
	}

#ifdef DEBUG_VERBOSE
		cf_debug("partition-table-get: ns %s pid %d write %d: node %s", ns, pid,write,
			node ? node->name : "nope");
#endif		
	
	return(node);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
addq $0x148, %r14            # imm = 0x148
movq (%r14), %r14
testq %r14, %r14
je 0x8e1d
leaq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x2350
testl %eax, %eax
jne 0x8e03
jmp 0x8e20
xorl %r14d, %r14d
testq %r14, %r14
je 0x8e58
movzwl %bp, %eax
imulq $0x38, %rax, %rax
leaq 0x30(%r14,%rax), %rcx
testb %bl, %bl
jne 0x8e53
movl 0x8(%rcx), %esi
testl %esi, %esi
je 0x8e58
movl 0x105e6(%rip), %eax     # 0x19428
incl %eax
movl %eax, 0x105de(%rip)     # 0x19428
xorl %edx, %edx
divl %esi
leaq 0x10(%rcx,%rdx,8), %rcx
movq (%rcx), %rax
jmp 0x8e5a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: direct_batchget_cb
int direct_batchget_cb(char *ns, cf_digest *keyd, char *set, uint32_t generation,
			uint32_t record_voidtime, cl_bin *bins, int n_bins, bool islast, void *udata)
{
	cl_bin* targetBins;

	if (citrusleaf_copy_bins(&targetBins, bins, n_bins) == 0) {
		cl_batchresult *br = (cl_batchresult *)udata;

		// Get record slot in a lock.
		pthread_mutex_lock(&br->lock);
		cl_rec *rec = &br->records[br->numrecs];
		br->numrecs++;
		pthread_mutex_unlock(&br->lock);

		// Copy data to record slot.
		memcpy(&rec->digest, keyd, sizeof(cf_digest));
		rec->generation = generation;
		rec->record_voidtime = record_voidtime;
		rec->bins = targetBins;
		rec->n_bins = n_bins;
	}
	else {
		// Do not include record in array.
		char digest[CF_DIGEST_KEY_SZ*2 + 3];
		cf_digest_string(keyd, digest);
		cf_warn("Failed to copy bin(s) for record digest %s", digest);
	}

	// We are supposed to free the bins in the callback.
	citrusleaf_bins_free(bins, n_bins);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %rbx
movl %r8d, %r14d
movl %ecx, %r12d
movq %rsi, %r15
movl 0x80(%rsp), %ebp
leaq 0x8(%rsp), %rdi
movq %r9, %rsi
movl %ebp, %edx
callq 0x488a
testl %eax, %eax
je 0x9692
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0xc628
leaq 0xdc60(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0x970a
leaq 0xdc58(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x778a(%rip), %rsi      # 0x10e0c
leaq 0x10(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq *%rcx
jmp 0x970a
movq 0x90(%rsp), %r13
movq %r13, %rdi
callq 0x23b0
movq 0x30(%r13), %rbp
movslq 0x28(%r13), %rax
movl %r14d, 0x4(%rsp)
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
incl %eax
movl %eax, 0x28(%r13)
movq %r13, %rdi
callq 0x2190
movq (%r15), %rax
movq 0x8(%r15), %rcx
movq %rax, (%rbp,%r14)
movq %rcx, 0x8(%rbp,%r14)
movl 0x10(%r15), %eax
movl %eax, 0x10(%rbp,%r14)
movl %r12d, 0x14(%rbp,%r14)
movl 0x4(%rsp), %eax
movl %eax, 0x18(%rbp,%r14)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rbp,%r14)
movl 0x80(%rsp), %eax
movl %eax, 0x28(%rbp,%r14)
movl 0x80(%rsp), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4755
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: citrusleaf_free_batchresult
void
citrusleaf_free_batchresult(cl_batchresult *br)
{
	if (br && br->records) {
		//We should free the bins in each of the records
		for (int i=0; i<(br->numrecs); i++) {
			citrusleaf_bins_free(br->records[i].bins, br->records[i].n_bins);
			free(br->records[i].bins);
		}

		//Finally free the record array and the whole structure
		free(br->records);
		free(br);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x978c
movq %rdi, %rbx
cmpq $0x0, 0x30(%rdi)
je 0x978c
cmpl $0x0, 0x28(%rbx)
jle 0x9776
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq 0x20(%rax,%r14), %rdi
movl 0x28(%rax,%r14), %esi
callq 0x4755
movq 0x30(%rbx), %rax
movq 0x20(%rax,%r14), %rdi
callq 0x22c0
incq %r15
movslq 0x28(%rbx), %rax
addq $0x30, %r14
cmpq %rax, %r15
jl 0x9745
movq 0x30(%rbx), %rdi
callq 0x22c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x22c0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: citrusleaf_get_many_digest_direct
cl_rv
citrusleaf_get_many_digest_direct(cl_cluster *asc, char *ns, const cf_digest *digests, int n_digests, cl_batchresult **br)
{
	//Fist allocate the result structure
	cl_batchresult *localbr = (cl_batchresult *) malloc(sizeof(struct cl_batchresult));
	if (localbr == NULL) {
		return CITRUSLEAF_FAIL_CLIENT;
	} else {
		//Assume that we are going to get all the records and allocate memory for them
		localbr->records = malloc(sizeof(struct cl_rec) * n_digests);
		if (localbr->records == NULL) {
			free(localbr);
			return CITRUSLEAF_FAIL_CLIENT;
		}
	}

	pthread_mutex_init(&localbr->lock, 0);

	//Call the actual batch-get with our internal callback function which will store the results in an array
	localbr->numrecs = 0;
	cl_rv rv = citrusleaf_get_many_digest(asc, ns, digests, n_digests, 0, 0, true, &direct_batchget_cb, localbr);

	pthread_mutex_destroy(&localbr->lock);

	//If something goes wrong we are responsible for freeing up the allocated memory. The caller may not free it.
	if (rv == CITRUSLEAF_FAIL_CLIENT) {
		citrusleaf_free_batchresult(localbr);
		return CITRUSLEAF_FAIL_CLIENT;
	} else {
		*br = localbr;
	}

	return CITRUSLEAF_OK;
	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, (%rsp)
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movl $0x38, %edi
callq 0x22e0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x984c
movq %rax, %r15
movslq %ebp, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
callq 0x22e0
movq %rax, 0x30(%r15)
testq %rax, %rax
je 0x983a
movq %r15, %rdi
xorl %esi, %esi
callq 0x2400
movl $0x0, 0x28(%r15)
leaq -0x1d9(%rip), %rax      # 0x9620
movl $0x1, %r10d
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r15
pushq %rax
pushq %r10
pushq %r10
callq 0x92ae
addq $0x20, %rsp
movl %eax, %ebp
movq %r15, %rdi
callq 0x22b0
cmpl $-0x1, %ebp
je 0x9844
movq (%rsp), %rax
movq %r15, (%rax)
xorl %ebx, %ebx
jmp 0x984c
movq %r15, %rdi
callq 0x22c0
jmp 0x984c
movq %r15, %rdi
callq 0x9725
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: citrusleaf_batch_init
cl_rv
citrusleaf_batch_init(int n_threads)
{
	if (cf_atomic32_incr(&batch_initialized) != 1) {
		return CITRUSLEAF_OK;
	}

	// create dispatch queue
	g_batch_q = cf_queue_create(sizeof(digest_work), true);

	if (n_threads <= 0) {
		n_threads = 1;
	}
	else if (n_threads > MAX_BATCH_THREADS) {
		n_threads = MAX_BATCH_THREADS;
		cf_warn("Batch threads are limited to %d", MAX_BATCH_THREADS);
	}

	g_batch_thread_count = n_threads;

	// create thread pool
	for (int i = 0; i < n_threads; i++) {
		pthread_create(&g_batch_th[i], 0, batch_worker_fn, 0);
	}
	return CITRUSLEAF_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xfba7(%rip), %rax      # 0x19430
movl $0x1, %ebp
movl $0x1, %ecx
lock
xaddl %ecx, (%rax)
testl %ecx, %ecx
jne 0x9928
movl %edi, %ebx
movl $0x78, %edi
movl $0x1, %esi
callq 0xcd6c
movq %rax, 0xfb81(%rip)      # 0x19438
testl %ebx, %ebx
jle 0x98f9
cmpl $0x7, %ebx
movl %ebx, %ebp
jl 0x98f9
leaq 0xd9ff(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0x98f4
leaq 0xd9fb(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x7558(%rip), %rsi      # 0x10e37
movl $0x6, %ebp
movl $0x1, %edi
movl $0x6, %edx
xorl %eax, %eax
callq *%rcx
jmp 0x98f9
movl $0x6, %ebp
movl %ebp, 0xfb41(%rip)      # 0x19440
movl %ebp, %r15d
leaq 0xfb47(%rip), %rbx      # 0x19450
leaq 0x25(%rip), %r14        # 0x9935
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x24e0
addq $0x8, %rbx
decq %r15
jne 0x9910
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: citrusleaf_batch_shutdown
void citrusleaf_batch_shutdown()
{
	if (g_batch_thread_count <= 0)
		return;

	/* 
	 * If a process is forked, the threads in it do not get spawned in the child process.
	 * In citrusleaf_init(), we are remembering the processid(g_init_pid) of the process who spawned the 
	 * background threads. If the current process is not the process who spawned the background threads
	 * then it cannot call pthread_join() on the threads which does not exist in this process.
	 */
	if(g_init_pid == getpid()) {
		digest_work work;

		memset(&work, 0, sizeof(digest_work));

		int i;

		for (i = 0; i < g_batch_thread_count; i++) {
			cf_queue_push(g_batch_q, &work);
		}

		for (i = 0; i < g_batch_thread_count; i++) {
			pthread_join(g_batch_th[i], NULL);
		}

		cf_queue_destroy(g_batch_q);
		g_batch_q = 0;
	}
}

// Assembly:
cmpl $0x0, 0xf043(%rip)      # 0x19440
jle 0xa4cb
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
leaq 0xef8f(%rip), %rax      # 0x193a4
movl (%rax), %ebx
callq 0x23a0
cmpl %eax, %ebx
jne 0xa4c0
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq $0x0, 0x70(%rsp)
cmpl $0x0, 0xefe7(%rip)      # 0x19440
jle 0xa479
xorl %ebp, %ebp
movq %rsp, %rbx
movq 0xefd1(%rip), %rdi      # 0x19438
movq %rbx, %rsi
callq 0xcf8b
incl %ebp
cmpl 0xefc9(%rip), %ebp      # 0x19440
jl 0xa460
cmpl $0x0, 0xefc0(%rip)      # 0x19440
jle 0xa4a9
leaq 0xefc7(%rip), %rbx      # 0x19450
xorl %r14d, %r14d
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x2220
incq %r14
movslq 0xefa0(%rip), %rax      # 0x19440
addq $0x8, %rbx
cmpq %rax, %r14
jl 0xa48c
movq 0xef88(%rip), %rdi      # 0x19438
callq 0xcdfe
movq $0x0, 0xef78(%rip) # 0x19438
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_async.c
// Function: citrusleaf_async_reinit
int citrusleaf_async_reinit(int size_limit, unsigned int num_receiver_threads)
{
	int num_threads;

	if (0 == cf_atomic32_get(g_async_initialized)) {
		cf_error("Async client not initialized cannot reinit");
		return -1;
	}
	
	if (num_receiver_threads > MAX_ASYNC_RECEIVER_THREADS) {
			//Limit the threads to the max value even if caller asks for it
			num_receiver_threads = MAX_ASYNC_RECEIVER_THREADS;
	}

	// If number of thread is increased create more threads
	if (num_receiver_threads > g_async_num_threads) {
		unsigned int i;
		for (i = g_async_num_threads; i < num_receiver_threads; i++) {
			pthread_create(&g_async_reciever[i], 0, async_receiver_fn, NULL);
		}
	}
	else {
		// else just reset the number the async threads will kill themselves
		cf_atomic32_set(&g_async_num_threads, num_receiver_threads);
	}

	cf_atomic32_set(&g_async_q_szlimit , size_limit);
	return ( 0 );

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0xe9c7(%rip)      # 0x194a8
je 0xab34
movl %edi, %ebx
cmpl $0x20, %esi
movl $0x20, %eax
cmovbl %esi, %eax
cmpl 0xe9b6(%rip), %eax      # 0x194ac
jbe 0xab5e
movl 0xe9ae(%rip), %ecx      # 0x194ac
cmpl %eax, %ecx
jae 0xab64
movl %eax, %r12d
leaq 0xe9a4(%rip), %rax      # 0x194b0
leaq (%rax,%rcx,8), %r14
subq %rcx, %r12
leaq 0x60(%rip), %r15        # 0xab7a
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x24e0
addq $0x8, %r14
decq %r12
jne 0xab1a
jmp 0xab64
leaq 0xc78d(%rip), %rax      # 0x172c8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x0, (%rax)
js 0xab6c
leaq 0xc784(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x6678(%rip), %rsi      # 0x111ce
xorl %edi, %edi
xorl %eax, %eax
callq *%rcx
jmp 0xab6c
movl %eax, 0xe948(%rip)      # 0x194ac
movl %ebx, 0xe92e(%rip)      # 0x19498
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_async.c
// Function: citrusleaf_async_shutdown
void
citrusleaf_async_shutdown()
{
	if (g_cl_async_q == 0)
		return;

	/*
	 * If a process is forked, the threads in it do not get spawned in the child process.
	 * In citrusleaf_init(), we are remembering the process id(g_init_pid) of the process who spawned the
	 * background threads. If the current process is not the process who spawned the background threads
	 * then it cannot call pthread_join() on the threads which does not exist in this process.
	 */
	if(g_init_pid == getpid()) {
		// Send shutdown message to each worker thread.
		cl_async_work *workitem = malloc(sizeof(cl_async_work));
		memset(workitem, 0, sizeof(cl_async_work));
		workitem->fd = -1;

		uint i;

		for (i = 0; i < g_async_num_threads; i++) {
			cf_queue_push(g_cl_async_q, &workitem);
		}

		for (i = 0; i < g_async_num_threads; i++) {
			pthread_join(g_async_reciever[i], NULL);
		}

		free(workitem);
		cf_queue_destroy(g_cl_async_q);
		g_cl_async_q = 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xe369(%rip), %r14      # 0x19480
cmpq $0x0, (%r14)
je 0xb1d4
leaq 0xe27c(%rip), %rax      # 0x193a4
movl (%rax), %ebx
callq 0x23a0
cmpl %eax, %ebx
jne 0xb1d4
movl $0x30, %edi
callq 0x22e0
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq %r15, 0x20(%rax)
movq %r15, (%rax)
movq %r15, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %r15, 0x28(%rax)
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
cmpl $0x0, 0xe33e(%rip)      # 0x194ac
je 0xb18c
leaq 0x8(%rsp), %rbx
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xcf8b
incl %r15d
cmpl 0xe322(%rip), %r15d     # 0x194ac
jb 0xb175
cmpl $0x0, 0xe319(%rip)      # 0x194ac
je 0xb1bb
leaq 0xe314(%rip), %rbx      # 0x194b0
xorl %r15d, %r15d
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x2220
incq %r15
movl 0xe2fa(%rip), %eax      # 0x194ac
addq $0x8, %rbx
cmpq %rax, %r15
jb 0xb19f
movq 0x8(%rsp), %rdi
callq 0x22c0
movq (%r14), %rdi
callq 0xcdfe
movq $0x0, (%r14)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_node_lock
int
cl_shm_node_lock(shm_ninfo* shared_node)
{
	int status = pthread_mutex_lock(&shared_node->ninfo_lock);

	if (status) {
		/* Check if the lock is in recoverable state */
		if (status == EOWNERDEAD){
			/* Make the lock consistent if the last owner of the lock died while holding the lock */
			/* We should ideally clean the memory here and then make the lock consistent */
			pthread_mutex_consistent_np(&shared_node->ninfo_lock);
		}
		else {
			 /* With Robust mutexes the lock gets in not recoverable state when the process holding the lock
			  * dies and the other process that gets the lock unlocks it without making it consistent
			  * (via pthread_mutex_consistent function) */
			cf_warn("Failed to lock shared memory node.");
			return SHM_ERROR;
		}
	}
	return SHM_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
addq $0x40, %r14
movq %r14, %rdi
callq 0x23b0
movl %eax, %ebx
testl %eax, %eax
je 0xbcd8
cmpl $0x82, %ebx
jne 0xbcad
movq %r14, %rdi
callq 0x21f0
xorl %ebx, %ebx
jmp 0xbcd8
leaq 0xb614(%rip), %rax      # 0x172c8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x0, (%rax)
jle 0xbcd8
leaq 0xb60b(%rip), %rax      # 0x172d0
movq (%rax), %rcx
leaq 0x581d(%rip), %rsi      # 0x114ec
movl $0x1, %edi
xorl %eax, %eax
callq *%rcx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_find_node_from_name
shm_ninfo*
cl_shm_find_node_from_name(const char* node_name)
{
    // Search nodes for node name
    for (int i = 0; i < g_shm_pt->node_count; i++) {
    	shm_ninfo* node_info = &g_shm_pt->node_info[i];

    	if (strcmp(node_info->node_name, node_name) == 0) {
			return node_info;
		}
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0xd8fa(%rip), %r14      # 0x19600
movslq 0x8(%r14), %r12
testq %r12, %r12
jle 0xbd3f
movq %rdi, %rbx
addq $0xa8, %r14
movq %r15, %r13
leaq -0x70(%r14), %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2350
testl %eax, %eax
cmovneq %r13, %r15
je 0xbd42
addq $0x2f9068, %r14         # imm = 0x2F9068
decq %r12
jne 0xbd19
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_find_node_from_address
shm_ninfo*
cl_shm_find_node_from_address(struct sockaddr_in* sa_in)
{
    // Search nodes for sockaddr
    for (int i = 0; i < g_shm_pt->node_count; i++) {
    	shm_ninfo* node_info = &g_shm_pt->node_info[i];
    	int max = node_info->address_count;

        //Search address for the current sockaddr
    	for (int j = 0; j < max; j++) {
    		if (memcmp(&node_info->address_array[j], sa_in, sizeof(struct sockaddr_in)) == 0) {
    			return node_info;
    		}
		}
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0xd8a6(%rip), %rcx      # 0x19600
movslq 0x8(%rcx), %rdx
testq %rdx, %rdx
jle 0xbdfb
leaq 0x38(%rcx), %rsi
addq $0x48, %rcx
xorl %r8d, %r8d
imulq $0x2f9068, %r8, %r10    # imm = 0x2F9068
movslq 0x68(%rsi,%r10), %r9
testq %r9, %r9
setg %r11b
jle 0xbde3
addq %rsi, %r10
movdqu (%r10), %xmm0
movdqu (%rdi), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %ebx
cmpl $0xffff, %ebx           # imm = 0xFFFF
je 0xbde0
movl $0x1, %r14d
movq %rcx, %rbx
movq %r14, %r11
cmpq %r14, %r9
je 0xbdd7
movdqu (%rbx), %xmm0
movdqu (%rdi), %xmm1
pcmpeqb %xmm0, %xmm1
pmovmskb %xmm1, %ebp
leaq 0x1(%r11), %r14
addq $0x10, %rbx
cmpl $0xffff, %ebp           # imm = 0xFFFF
jne 0xbdac
movq %r10, %rax
cmpq %r9, %r11
setb %r11b
jmp 0xbde3
movq %r10, %rax
testb %r11b, %r11b
jne 0xbdfd
incq %r8
addq $0x2f9068, %rcx         # imm = 0x2F9068
cmpq %rdx, %r8
jne 0xbd72
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_free_seed_array
static void
cl_shm_free_seed_array()
{
	if (g_seed_array) {
		free(g_seed_array);
		g_seed_array = 0;
	}
	g_seed_count = 0;
}

// Assembly:
movq 0xd7ba(%rip), %rdi      # 0x19618
testq %rdi, %rdi
je 0xbe78
pushq %rax
callq 0x22c0
movq $0x0, 0xd7a4(%rip) # 0x19618
addq $0x8, %rsp
movl $0x0, 0xd79e(%rip)      # 0x19620
retq
nop
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_get_node_info
int
cl_get_node_info(const char* node_name, struct sockaddr_in* sa_in, cl_node_info* node_info)
{
	if (g_shared_memory) {
		shm_ninfo* shared = cl_shm_find_node_from_name(node_name);

		if (shared) {
			// cf_debug("Use shared memory for node info.");
			cl_shm_node_lock(shared);
			cl_strncpy(node_info->node_name, shared->node_name, NODE_NAME_SIZE);
			node_info->partition_generation = shared->partition_generation;
			node_info->values = strdup(shared->services);
			node_info->services = node_info->values;
			node_info->dun = shared->dun;
			cl_shm_node_unlock(shared);
			return 0;
		}
	}
	// cf_debug("Issue request for node info.");
	return cl_request_node_info(sa_in, node_info);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
leaq 0xd707(%rip), %rax      # 0x195d8
cmpb $0x1, (%rax)
jne 0xbf50
callq 0xbcf6
testq %rax, %rax
je 0xbf50
movq %rax, %r15
movq %rax, %rdi
callq 0xbc80
leaq 0x8(%rbx), %rax
movb 0x70(%r15), %cl
testb %cl, %cl
je 0xbf14
xorl %edx, %edx
movb %cl, (%rax,%rdx)
movb 0x71(%r15,%rdx), %cl
leaq 0x1(%rdx), %rsi
testb %cl, %cl
je 0xbf11
cmpl $0x12, %edx
movq %rsi, %rdx
jb 0xbef9
addq %rsi, %rax
movb $0x0, (%rax)
movl 0x6c(%r15), %eax
movl %eax, 0x28(%rbx)
leaq 0x84(%r15), %rdi
callq 0x24f0
movq %rax, (%rbx)
movq %rax, 0x20(%rbx)
movb 0x2f9067(%r15), %al
movb %al, 0x2c(%rbx)
movq %r15, %rdi
callq 0xbce2
testq %r15, %r15
je 0xbf50
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xbf60
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_request_node_info
int
cl_request_node_info(struct sockaddr_in* sa_in, cl_node_info* node_info)
{
	node_info->node_name[0] = 0;
	node_info->partition_generation = 0;
	node_info->services = 0;
	node_info->dun = false;

	if (citrusleaf_info_host_limit(sa_in, "node\npartition-generation\nservices", &node_info->values, INFO_TIMEOUT_MS, false, 10000) != 0) {
		node_info->dun = true;
		return -1;
	}

	char* p = node_info->values;
	char* name;
	char* value;

	while ((p = get_name_value(p, &name, &value)) != 0) {
		if (strcmp(name, "node") == 0) {
			cl_strncpy(node_info->node_name, value, NODE_NAME_SIZE);
		}
		else if (strcmp(name, "partition-generation") == 0) {
			node_info->partition_generation = atoi(value);
		}
		else if (strcmp(name, "services") == 0) {
			node_info->services = value;
		}
		else {
			cf_warn("Invalid info name %s", name);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
xorl %eax, %eax
movb %al, 0x8(%rsi)
movl $0x0, 0x28(%rsi)
movq $0x0, 0x20(%rsi)
movb %al, 0x2c(%rsi)
leaq 0x5711(%rip), %rsi      # 0x1169d
movl $0x2710, %r9d           # imm = 0x2710
movq %rbx, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xeee1
testl %eax, %eax
je 0xbfb4
movb $0x1, 0x2c(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xc0c4
leaq 0x8(%rbx), %r12
movq (%rbx), %r13
leaq 0x4eea(%rip), %r14      # 0x10eac
cmpb $0x0, (%r13)
je 0xc007
xorl %ebp, %ebp
movq %r13, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0xbfe1
testl %ecx, %ecx
je 0xbfed
cmpl $0xa, %ecx
jne 0xbfe8
jmp 0xbfed
movb $0x0, (%rax)
leaq 0x1(%rax), %rbp
incq %rax
jmp 0xbfce
testq %rbp, %rbp
cmoveq %rax, %rbp
cmpb $0xa, %cl
jne 0xbfff
movb $0x0, (%rax)
incq %rax
movq %r13, %r15
movq %rax, %r13
jmp 0xc00a
xorl %r13d, %r13d
testq %r13, %r13
je 0xc0c2
movq %r15, %rdi
movq %r14, %rsi
callq 0x2350
testl %eax, %eax
je 0xc07a
movq %r15, %rdi
leaq 0x5694(%rip), %rsi      # 0x116c0
callq 0x2350
testl %eax, %eax
je 0xc0a9
movq %r15, %rdi
leaq 0x5678(%rip), %rsi      # 0x116b7
callq 0x2350
testl %eax, %eax
je 0xc0b9
leaq 0xb279(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0xbfc2
leaq 0xb271(%rip), %rax      # 0x172d0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0x5667(%rip), %rsi      # 0x116d5
movq %r15, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xbfc2
movb (%rbp), %al
testb %al, %al
movq %r12, %rcx
je 0xc0a1
xorl %edx, %edx
movb %al, (%r12,%rdx)
movb 0x1(%rbp,%rdx), %al
leaq 0x1(%rdx), %rcx
testb %al, %al
je 0xc09e
cmpl $0x12, %edx
movq %rcx, %rdx
jb 0xc086
addq %r12, %rcx
movb $0x0, (%rcx)
jmp 0xbfc2
movq %rbp, %rdi
callq 0x2440
movl %eax, 0x28(%rbx)
jmp 0xbfc2
movq %rbp, 0x20(%rbx)
jmp 0xbfc2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_get_replicas
int
cl_get_replicas(const char* node_name, struct sockaddr_in* sa_in, cl_replicas* replicas)
{
	if (g_shared_memory) {
		shm_ninfo* shared = cl_shm_find_node_from_name(node_name);

		if (shared) {
			// cf_debug("Use shared memory for replicas.");
			cl_shm_node_lock(shared);

			int wr_len = strlen(shared->write_replicas);
			int rr_len = strlen(shared->read_replicas);
			replicas->values = (char*)malloc(wr_len + rr_len + 2);

			replicas->write_replicas = replicas->values;
			memcpy(replicas->write_replicas, shared->write_replicas, wr_len);
			replicas->write_replicas[wr_len] = 0;

			replicas->read_replicas = replicas->values + wr_len + 1;
			memcpy(replicas->read_replicas, shared->read_replicas, rr_len);
			replicas->read_replicas[rr_len] = 0;

			cl_shm_node_unlock(shared);
			return 0;
		}
	}
	// cf_debug("Request replicas from server.");
	return cl_request_replicas(sa_in, replicas);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
leaq 0xd4e0(%rip), %rax      # 0x195d8
cmpb $0x1, (%rax)
jne 0xc1b4
callq 0xbcf6
testq %rax, %rax
je 0xc1b4
movq %rax, %r14
movq %rax, %rdi
callq 0xbc80
leaq 0x1065(%r14), %rdi
movq %rdi, (%rsp)
callq 0x20e0
movq %rax, %r13
movq %r14, %r15
addq $0x17d066, %r15         # imm = 0x17D066
movq %r15, %rdi
callq 0x20e0
movq %rax, %rbp
leal 0x2(%rax,%r13), %eax
movslq %eax, %rdi
callq 0x22e0
movq %rax, %r12
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
movslq %r13d, %r13
movq %rax, %rdi
movq (%rsp), %rsi
movq %r13, %rdx
callq 0x21b0
leaq (%r12,%r13), %rax
movq %rax, (%rsp)
xorl %eax, %eax
leaq 0x1(%r12,%r13), %rdi
movb %al, -0x1(%rdi)
xorl %r12d, %r12d
movq %rdi, 0x10(%rbx)
movslq %ebp, %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x21b0
movq (%rsp), %rax
movb %r12b, 0x1(%rbx,%rax)
movq %r14, %rdi
callq 0xbce2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc1cd
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_request_replicas
int
cl_request_replicas(struct sockaddr_in* sa_in, cl_replicas* replicas)
{
	replicas->write_replicas = 0;
	replicas->read_replicas = 0;

	if (citrusleaf_info_host_limit(sa_in, "replicas-read\nreplicas-write", &replicas->values, INFO_TIMEOUT_MS, false, 2000000) != 0) {
		return -1;
	}

	char* p = replicas->values;
	char* name;
	char* value;

	while ((p = get_name_value(p, &name, &value)) != 0) {
		if (strcmp(name, "replicas-write") == 0) {
			replicas->write_replicas = value;
		}
		else if (strcmp(name, "replicas-read") == 0) {
			replicas->read_replicas = value;
		}
		else {
			cf_warn("Invalid replicas name %s", name);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
xorl %eax, %eax
movq %rax, 0x10(%rsi)
movq %rax, 0x8(%rsi)
leaq 0x54fe(%rip), %rsi      # 0x116ea
movl $0x1e8480, %r9d         # imm = 0x1E8480
movq %rbx, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xeee1
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xc2d1
leaq 0x8(%rbx), %rbp
movq (%rbx), %r13
leaq 0x54d9(%rip), %r14      # 0x116f8
cmpb $0x0, (%r13)
je 0xc265
xorl %r15d, %r15d
movq %r13, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0xc23f
testl %ecx, %ecx
je 0xc24b
cmpl $0xa, %ecx
jne 0xc246
jmp 0xc24b
movb $0x0, (%rax)
leaq 0x1(%rax), %r15
incq %rax
jmp 0xc22c
testq %r15, %r15
cmoveq %rax, %r15
cmpb $0xa, %cl
jne 0xc25d
movb $0x0, (%rax)
incq %rax
movq %r13, %r12
movq %rax, %r13
jmp 0xc268
xorl %r13d, %r13d
testq %r13, %r13
je 0xc2cf
movq %r12, %rdi
movq %r14, %rsi
callq 0x2350
testl %eax, %eax
je 0xc2bd
movq %r12, %rdi
leaq 0x5481(%rip), %rsi      # 0x11707
callq 0x2350
testl %eax, %eax
je 0xc2c6
leaq 0xb032(%rip), %rax      # 0x172c8
cmpl $0x0, (%rax)
jle 0xc21f
leaq 0xb02e(%rip), %rax      # 0x172d0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0x5464(%rip), %rsi      # 0x11715
movq %r12, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xc21f
movq %r15, (%rbp)
jmp 0xc21f
movq %r15, 0x10(%rbx)
jmp 0xc21f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_get_node_name
int
cl_get_node_name(struct sockaddr_in* sa_in, char* node_name)
{
	if (g_shared_memory) {
		shm_ninfo* shared = cl_shm_find_node_from_address(sa_in);

		if (shared) {
			// cf_debug("Use shared memory for node name.");
			cl_shm_node_lock(shared);
			cl_strncpy(node_name, shared->node_name, NODE_NAME_SIZE);
			cl_shm_node_unlock(shared);
			return 0;
		}
	}
	return cl_request_node_name(sa_in, node_name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd2d9(%rip), %rax      # 0x195d8
cmpb $0x1, (%rax)
jne 0xc35c
movq %r14, %rdi
callq 0xbd4f
testq %rax, %rax
je 0xc35c
movq %rax, %r15
movq %rax, %rdi
callq 0xbc80
movb 0x70(%r15), %al
testb %al, %al
movq %rbx, %rcx
je 0xc344
xorl %edx, %edx
movb %al, (%rbx,%rdx)
movb 0x71(%r15,%rdx), %al
leaq 0x1(%rdx), %rcx
testb %al, %al
je 0xc341
cmpl $0x12, %edx
movq %rcx, %rdx
jb 0xc329
addq %rbx, %rcx
movb $0x0, (%rcx)
movq %r15, %rdi
callq 0xbce2
testq %r15, %r15
je 0xc35c
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xc36c
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_request_node_name
int
cl_request_node_name(struct sockaddr_in* sa_in, char* node_name)
{
	*node_name = 0;
	char* values;

	if (citrusleaf_info_host(sa_in, "node", &values, INFO_TIMEOUT_MS, false) != 0){
		return -1;
	}

	char* p = values;
	char* name;
	char* value;

	while ((p = get_name_value(p, &name, &value)) != 0) {
		if (strcmp(name, "node") == 0) {
			cl_strncpy(node_name, value, NODE_NAME_SIZE);
		}
		else {
			cf_warn("Invalid node name %s", name);
		}
	}
	free(values);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb $0x0, (%rsi)
leaq 0x4b28(%rip), %rsi      # 0x10eac
movq %rsp, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xeedc
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xc475
movq (%rsp), %r12
leaq 0x4afe(%rip), %r14      # 0x10eac
leaq 0xaf13(%rip), %r13      # 0x172c8
cmpb $0x0, (%r12)
je 0xc3fb
xorl %r15d, %r15d
movq %r12, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0xc3d5
testl %ecx, %ecx
je 0xc3e1
cmpl $0xa, %ecx
jne 0xc3dc
jmp 0xc3e1
movb $0x0, (%rax)
leaq 0x1(%rax), %r15
incq %rax
jmp 0xc3c2
testq %r15, %r15
cmoveq %rax, %r15
cmpb $0xa, %cl
jne 0xc3f3
movb $0x0, (%rax)
incq %rax
movq %r12, %rbp
movq %rax, %r12
jmp 0xc3fe
xorl %r12d, %r12d
testq %r12, %r12
je 0xc46a
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2350
testl %eax, %eax
je 0xc43b
cmpl $0x0, (%r13)
jle 0xc3b5
leaq 0xaeb0(%rip), %rax      # 0x172d0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0x52ff(%rip), %rsi      # 0x1172e
movq %rbp, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xc3b5
movb (%r15), %al
testb %al, %al
movq %rbx, %rcx
je 0xc462
xorl %edx, %edx
movb %al, (%rbx,%rdx)
movb 0x1(%r15,%rdx), %al
leaq 0x1(%rdx), %rcx
testb %al, %al
je 0xc45f
cmpl $0x12, %edx
movq %rcx, %rdx
jb 0xc447
addq %rbx, %rcx
movb $0x0, (%rcx)
jmp 0xc3b5
movq (%rsp), %rdi
callq 0x22c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_get_n_partitions
int
cl_get_n_partitions(struct sockaddr_in* sa_in, int* n_partitions)
{
	if (g_shared_memory) {
		int count = cl_shm_get_partition_count();

		if (count > 0) {
			*n_partitions = count;
			return 0;
		}
	}
	return cl_request_n_partitions(sa_in, n_partitions);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd143(%rip), %rax      # 0x195d8
cmpb $0x1, (%rax)
jne 0xc4b1
xorl %eax, %eax
callq 0xbceb
testl %eax, %eax
jle 0xc4b1
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xc4c3
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_request_n_partitions
int
cl_request_n_partitions(struct sockaddr_in* sa_in, int* n_partitions)
{
	*n_partitions = 0;
	char* values;

	if (citrusleaf_info_host(sa_in, "partitions", &values, INFO_TIMEOUT_MS, false) != 0) {
		return -1;
	}

	char* p = values;
	char* name;
	char* value;

	while ((p = get_name_value(p, &name, &value)) != 0) {
		if (strcmp(name, "partitions") == 0) {
			*n_partitions = atoi(value);
		}
		else {
			cf_warn("Invalid partitions %s", name);
		}
	}
	free(values);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl $0x0, (%rsi)
leaq 0x5265(%rip), %rsi      # 0x11743
movq %rsp, %rdx
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
callq 0xeedc
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xc5ae
movq (%rsp), %r13
leaq 0x523b(%rip), %r14      # 0x11743
leaq 0xadb9(%rip), %rbp      # 0x172c8
cmpb $0x0, (%r13)
je 0xc555
xorl %r12d, %r12d
movq %r13, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0xc52f
testl %ecx, %ecx
je 0xc53b
cmpl $0xa, %ecx
jne 0xc536
jmp 0xc53b
movb $0x0, (%rax)
leaq 0x1(%rax), %r12
incq %rax
jmp 0xc51c
testq %r12, %r12
cmoveq %rax, %r12
cmpb $0xa, %cl
jne 0xc54d
movb $0x0, (%rax)
incq %rax
movq %r13, %r15
movq %rax, %r13
jmp 0xc558
xorl %r13d, %r13d
testq %r13, %r13
je 0xc5a3
movq %r15, %rdi
movq %r14, %rsi
callq 0x2350
testl %eax, %eax
je 0xc594
cmpl $0x0, (%rbp)
jle 0xc50f
leaq 0xad57(%rip), %rax      # 0x172d0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0x51c6(%rip), %rsi      # 0x1174e
movq %r15, %rdx
xorl %eax, %eax
callq *%rcx
jmp 0xc50f
movq %r12, %rdi
callq 0x2440
movl %eax, (%rbx)
jmp 0xc50f
movq (%rsp), %rdi
callq 0x22c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cf_digest.c
// Function: cf_digest_string
void
cf_digest_string(cf_digest *digest, char* output)
{
	uint8_t *d = (uint8_t *) digest;
	char* p = output;

	*p++ = '0';
	*p++ = 'x';

	for (int i = 0; i < CF_DIGEST_KEY_SZ; i++) {
		sprintf(p, "%02x", d[i]);
		p += 2;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movw $0x7830, (%rsi)         # imm = 0x7830
addq $0x2, %rbx
movq $-0x14, %r12
leaq 0x5148(%rip), %r15      # 0x11795
movzbl 0x14(%r14,%r12), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2070
addq $0x2, %rbx
incq %r12
jne 0xc64d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cf_ll.c
// Function: cf_ll_delete_lockfree
void
cf_ll_delete_lockfree(cf_ll *ll, cf_ll_element *e )
{
	// make empty
	if (ll->sz == 1) {
		ll->head = 0;
		ll->tail = 0;
	}
	
	// head delete
	else if (e == ll->head) {
		ll->head = e->next;
		e->next->prev = 0;
	}
	// tail delete
	else if (e == ll->tail) {
		ll->tail = e->prev;
		e->prev->next = 0;
	}
	// we're in the middle somewhere
	else {
		e->prev->next = e->next;
		e->next->prev = e->prev;
	}
	
	ll->sz --;
	
	if (ll->destroy_fn)
		(ll->destroy_fn) (e);
}

// Assembly:
cmpl $0x1, 0x18(%rdi)
jne 0xc9ab
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movq %rax, (%rdi)
jmp 0xc9f3
cmpq %rsi, (%rdi)
je 0xc9cd
cmpq %rsi, 0x8(%rdi)
je 0xc9e0
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
movq %rax, (%rcx)
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rax)
jmp 0xc9f3
movq (%rsi), %rax
movq %rax, (%rdi)
movq (%rsi), %rax
movq $0x0, 0x8(%rax)
jmp 0xc9f3
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movq 0x8(%rsi), %rax
movq $0x0, (%rax)
decl 0x18(%rdi)
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0xca04
movq %rsi, %rdi
jmpq *%rax
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cf_ll.c
// Function: cf_ll_delete
void
cf_ll_delete(cf_ll *ll, cf_ll_element *e )
{
	// extra check for fun
	if (ll->sz == 0)	return;

	LL_LOCK(ll);

	cf_ll_delete_lockfree(ll, e);
	
	LL_UNLOCK(ll);
	
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x18(%rdi)
je 0xca48
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0x1c(%rdi)
jne 0xca24
leaq 0x20(%rbx), %rdi
callq 0x23b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc99a
cmpb $0x1, 0x1c(%rbx)
jne 0xca48
addq $0x20, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2190
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/sharpyfox[P]citrusleaf-client/src/cf_ll.c
// Function: cf_ll_reduce
int
cf_ll_reduce( cf_ll *ll, bool forward, cf_ll_reduce_fn fn, void *udata)
{
	int rv = 0;
	
	LL_LOCK(ll);
	
	cf_ll_element *cur = forward ? ll->head : ll->tail;
	
	while (cur) {
		
		if ( (rv = (*fn) (cur, udata) ) ) {
			
			if (rv == CF_LL_REDUCE_DELETE) {

				cf_ll_element *next = forward ? cur->next : cur->prev;
				// Calls the destructor on cur, can't touch it after that
				cf_ll_delete_lockfree(ll, cur);
				cur = next;
				
			}
			else
				goto Exit;
		}
		else {
			cur = forward ? cur->next : cur->prev;
		}
	}

Exit:		
	LL_UNLOCK(ll);
	return(rv);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x1, 0x1c(%rdi)
jne 0xca75
leaq 0x20(%rbx), %rdi
callq 0x23b0
xorb $0x1, %bpl
movzbl %bpl, %r13d
movq %rbx, (%rsp)
movq (%rbx,%r13,8), %r12
testq %r12, %r12
je 0xcac2
shll $0x3, %r13d
movq %r12, %rdi
movq %r14, %rsi
callq *%r15
movl %eax, %ebp
testl %eax, %eax
je 0xcab7
cmpl $0x1, %ebp
jne 0xcac4
movq (%r12,%r13), %rbx
movq (%rsp), %rdi
movq %r12, %rsi
callq 0xc99a
movq %rbx, %r12
jmp 0xcabb
movq (%r12,%r13), %r12
testq %r12, %r12
jne 0xca8e
jmp 0xcac4
xorl %ebp, %ebp
movq (%rsp), %rdi
cmpb $0x1, 0x1c(%rdi)
jne 0xcad7
addq $0x20, %rdi
callq 0x2190
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq