LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
addq $0x148, %rax            # imm = 0x148
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x148(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xd0a7
movq 0x8(%rsp), %rax
cmpq 0x18(%rsp), %rax
jne 0xd0a5
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
jmp 0xd0a7
jmp 0xd07f
cmpq $0x0, 0x8(%rsp)
jne 0xd0e2
leaq 0x11222(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xd0e0
leaq 0x11218(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movq 0x18(%rsp), %rdx
movl $0x1, %edi
leaq 0xbb1f(%rip), %rsi      # 0x18bfb
movb $0x0, %al
callq *%rcx
jmp 0xd0ec
movq 0x18(%rsp), %rdi
callq 0x22e0
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x148(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xd143
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
callq 0x22e0
movq (%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0xd11a
movq 0x10(%rsp), %rax
movq $0x0, 0x148(%rax)
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_partition.c
// Function: cl_partition_table_get_byns
cl_partition_table *
cl_partition_table_get_byns(cl_cluster *asc, char *ns)
{
	cl_partition_table *pt = asc->partition_table_head;
	while (pt) {
		if (strcmp(ns, pt->ns)==0) return(pt);
		pt = pt->next;
	}
	return(0);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x148(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xd1ba
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
callq 0x2380
cmpl $0x0, %eax
jne 0xd1ab
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0xd1c3
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0xd17f
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movb %r8b, %al
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movw %cx, 0x1e(%rsp)
andb $0x1, %al
movb %al, 0x1d(%rsp)
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xd160
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xd25c
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xcfa0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xd25a
leaq 0x110a8(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xd255
leaq 0x1109e(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0xb9dc(%rip), %rsi      # 0x18c2d
movb $0x0, %al
callq *%rcx
jmp 0xd352
jmp 0xd25c
testb $0x1, 0x1d(%rsp)
je 0xd285
movq 0x28(%rsp), %rcx
movq 0x10(%rsp), %rax
addq $0x30, %rax
movzwl 0x1e(%rsp), %edx
imulq $0x38, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0xd352
movq 0x10(%rsp), %rax
addq $0x30, %rax
movzwl 0x1e(%rsp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
movq 0x8(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xd2df
movq 0x8(%rsp), %rax
movslq 0x4(%rsp), %rcx
movq 0x10(%rax,%rcx,8), %rax
cmpq 0x28(%rsp), %rax
jne 0xd2d0
jmp 0xd352
jmp 0xd2d2
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0xd2a7
movq 0x8(%rsp), %rcx
movl $0x5, %eax
cmpl 0x8(%rcx), %eax
jne 0xd32a
leaq 0x10fe3(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0xd31a
leaq 0x10fd9(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movl $0x3, %edi
leaq 0xb939(%rip), %rsi      # 0x18c4f
movb $0x0, %al
callq *%rcx
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0xd350
movq 0x28(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x8(%rsp), %rcx
movslq 0x8(%rcx), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0xd352
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movb %cl, %al
movw %dx, %cx
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movw %cx, 0x2e(%rsp)
andb $0x1, %al
movb %al, 0x2d(%rsp)
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xd160
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0xd3a8
movq $0x0, 0x40(%rsp)
jmp 0xd44a
testb $0x1, 0x2d(%rsp)
je 0xd3ce
movq 0x20(%rsp), %rax
addq $0x30, %rax
movzwl 0x2e(%rsp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0xd440
movq 0x20(%rsp), %rax
addq $0x30, %rax
movzwl 0x2e(%rsp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpl $0x0, 0x8(%rax)
je 0xd435
movl 0x1303f(%rip), %eax     # 0x20438
addl $0x1, %eax
movl %eax, 0x13036(%rip)     # 0x20438
movl 0x13030(%rip), %eax     # 0x20438
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movl 0xc(%rsp), %eax
movq 0x10(%rsp), %rcx
xorl %edx, %edx
divl 0x8(%rcx)
movq (%rsp), %rax
movl %edx, %ecx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
jmp 0xd43e
movq $0x0, 0x18(%rsp)
jmp 0xd440
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq 0x90(%rsp), %rax
movb 0x88(%rsp), %al
movl 0x80(%rsp), %r10d
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movl %ecx, 0x5c(%rsp)
movl %r8d, 0x58(%rsp)
movq %r9, 0x50(%rsp)
andb $0x1, %al
movb %al, 0x4f(%rsp)
movq 0x50(%rsp), %rsi
movl 0x80(%rsp), %edx
leaq 0x40(%rsp), %rdi
callq 0x5920
cmpl $0x0, %eax
jne 0xe28f
movq 0x90(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0x23e0
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x38(%rsp), %rcx
movslq 0x28(%rcx), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movq 0x38(%rsp), %rdi
callq 0x21c0
movq 0x30(%rsp), %rax
movq 0x68(%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movl 0x10(%rcx), %ecx
movl %ecx, 0x10(%rax)
movl 0x5c(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x14(%rax)
movl 0x58(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x40(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x20(%rax)
movl 0x80(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x28(%rax)
jmp 0xe2cd
movq 0x68(%rsp), %rdi
movq %rsp, %rsi
callq 0x12ea0
leaq 0x10035(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xe2cb
leaq 0x1002b(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movq %rsp, %rdx
movl $0x1, %edi
leaq 0xab99(%rip), %rsi      # 0x18e60
movb $0x0, %al
callq *%rcx
jmp 0xe2cd
movq 0x50(%rsp), %rdi
movl 0x80(%rsp), %esi
callq 0x56d0
xorl %eax, %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0xe3a4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x30(%rax)
je 0xe3a4
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x10(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jge 0xe38c
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rax
movslq 0xc(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdi
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rax
movslq 0xc(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %esi
callq 0x56d0
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rax
movslq 0xc(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdi
callq 0x22e0
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xe31d
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x22e0
movq 0x10(%rsp), %rdi
callq 0x22e0
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
movq %r8, 0x28(%rsp)
movl $0x38, %edi
callq 0x2310
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0xe3f0
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0xe4c2
movslq 0x34(%rsp), %rax
imulq $0x30, %rax, %rdi
callq 0x2310
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x20(%rsp), %rax
cmpq $0x0, 0x30(%rax)
jne 0xe42d
movq 0x20(%rsp), %rdi
callq 0x22e0
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0xe4c2
jmp 0xe42f
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2430
movq 0x20(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl 0x34(%rsp), %ecx
movq 0x20(%rsp), %rax
xorl %r8d, %r8d
xorl %r9d, %r9d
leaq -0x2de(%rip), %r10      # 0xe190
movl $0x1, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xdb60
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
callq 0x22d0
cmpl $-0x1, 0x1c(%rsp)
jne 0xe4ad
movq 0x20(%rsp), %rdi
callq 0xe2f0
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0xe4c2
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, (%rax)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
leaq 0x11ed1(%rip), %rdi     # 0x20440
movl $0x1, %esi
callq 0xe660
cmpq $0x1, %rax
je 0xe58c
movl $0x0, 0x14(%rsp)
jmp 0xe64e
movl $0x78, %edi
movl $0x1, %esi
callq 0x13e70
movq %rax, 0x11ea6(%rip)     # 0x20448
cmpl $0x0, 0x10(%rsp)
jg 0xe5b3
movl $0x1, 0x10(%rsp)
jmp 0xe5f7
cmpl $0x6, 0x10(%rsp)
jle 0xe5f5
movl $0x6, 0x10(%rsp)
leaq 0xfd0f(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0xe5f3
leaq 0xfd05(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0xa8a1(%rip), %rsi      # 0x18e8b
movl $0x6, %edx
movb $0x0, %al
callq *%rcx
jmp 0xe5f5
jmp 0xe5f7
movl 0x10(%rsp), %eax
movl %eax, 0x11e4f(%rip)     # 0x20450
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0xe646
movslq 0xc(%rsp), %rax
leaq 0x11e41(%rip), %rdi     # 0x20460
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x5f(%rip), %rdx        # 0xe690
movq %rcx, %rsi
callq 0x2500
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xe609
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: batch_worker_fn
static void *
batch_worker_fn(void *dummy)
{
	do {
		digest_work work;
		
		if (0 != cf_queue_pop(g_batch_q, &work, CF_QUEUE_FOREVER)) {
			cf_error("queue pop failed");
		}
		
		/* See function citrusleaf_batch_shutdown() for more details */
		if(work.digests==NULL) {
			pthread_exit(NULL);
		}

		int an_int = do_batch_monte( work.asc, work.info1, work.info2, work.ns, work.digests, work.nodes, work.n_digests, work.bins, work.operator, work.operations, work.n_ops, work.my_node, work.my_node_digest_count, work.cb, work.udata );
		
		cf_queue_push(work.complete_q, (void *) &an_int);
		
	} while (1);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq 0x11d98(%rip), %rdi     # 0x20448
leaq 0x58(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x14590
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0xe6ef
leaq 0xfc0a(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0xe6ed
leaq 0xfc03(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
xorl %edi, %edi
leaq 0xa836(%rip), %rsi      # 0x18f1f
movb $0x0, %al
callq *%rcx
jmp 0xe6ef
cmpq $0x0, 0x70(%rsp)
jne 0xe700
xorl %eax, %eax
movl %eax, %edi
callq 0x24e0
movq 0x58(%rsp), %rdi
movl 0x60(%rsp), %esi
movl 0x64(%rsp), %edx
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %r8
movq 0x78(%rsp), %r9
movl 0x80(%rsp), %r13d
movq 0x88(%rsp), %r12
movl 0x90(%rsp), %r15d
movq 0x98(%rsp), %r14
movl 0xa0(%rsp), %ebp
movq 0xc0(%rsp), %rbx
movl 0xc8(%rsp), %r11d
movq 0xa8(%rsp), %r10
movq 0xb0(%rsp), %rax
movl %r13d, (%rsp)
movq %r12, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movl %ebp, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movl %r11d, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0xe8b0
movl %eax, 0x54(%rsp)
movq 0xb8(%rsp), %rdi
leaq 0x54(%rsp), %rsi
callq 0x14300
movb $0x1, %al
testb $0x1, %al
jne 0xe6a9
jmp 0xe7b5
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x88, %rsp
cmpl $0x0, 0x11c72(%rip)     # 0x20450
jg 0xe7e5
jmp 0xe899
leaq 0x11bc8(%rip), %rax     # 0x203b4
movl (%rax), %eax
movl %eax, 0x8(%rsp)
callq 0x23d0
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jne 0xe899
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x2170
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x11c28(%rip), %eax     # 0x20450
jge 0xe848
movq 0x11c17(%rip), %rdi     # 0x20448
leaq 0x10(%rsp), %rsi
callq 0x14300
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xe81e
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x11bf6(%rip), %eax     # 0x20450
jge 0xe882
movslq 0xc(%rsp), %rcx
leaq 0x11bf8(%rip), %rax     # 0x20460
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2250
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xe850
movq 0x11bbf(%rip), %rdi     # 0x20448
callq 0x13ff0
movq $0x0, 0x11baf(%rip) # 0x20448
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: batch_decompress
static int
batch_decompress(uint8_t *in_buf, size_t in_sz, uint8_t **out_buf, size_t *out_sz) 
{
	z_stream 	strm;

	uint64_t now = cf_getms();
	
	strm.zalloc = Z_NULL;
    strm.zfree = Z_NULL;
    strm.opaque = Z_NULL;
    int rv = inflateInit(&strm);
    if (rv != Z_OK)
        return (-1);

    
    // first 8 bytes are the inflated size, allows efficient alloc (round up: the buf likes that)
    size_t  	b_sz_alloc = *(uint64_t *)in_buf;
    uint8_t 	*b = malloc(b_sz_alloc);
    if (0 == b) {
    	cf_error("batch_decompress: could not malloc %"PRIu64" bytes", b_sz_alloc);
    	inflateEnd(&strm);
    	return(-1);
    }
    
    strm.avail_in = in_sz - 8;
    strm.next_in = in_buf + 8;
    
	strm.avail_out = b_sz_alloc; // round up: seems to like that
	strm.next_out = b;

	rv = inflate(&strm, Z_FINISH);

	if (rv != Z_STREAM_END) {
		cf_error("could not deflate data: zlib error %d (check zlib.h)", rv);
		free(b);
		inflateEnd(&strm);
		return(-1);
	}
    	
	inflateEnd(&strm);
    
    *out_buf = b;
    *out_sz = b_sz_alloc - strm.avail_out;
	
	return(0);	
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rdx, 0x98(%rsp)
movq %rcx, 0x90(%rsp)
callq 0xfc70
movq %rax, 0x18(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x976a(%rip), %rsi      # 0x190a2
movl $0x70, %edx
callq 0x2230
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0xf95d
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0xfa9a
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
callq 0x2310
movq %rax, (%rsp)
xorl %eax, %eax
cmpq (%rsp), %rax
jne 0xf9c8
leaq 0xe94e(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0xf9ae
leaq 0xe947(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movq 0x8(%rsp), %rdx
xorl %edi, %edi
leaq 0x96ff(%rip), %rsi      # 0x190a9
movb $0x0, %al
callq *%rcx
leaq 0x20(%rsp), %rdi
callq 0x22a0
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0xfa9a
movq 0xa0(%rsp), %rax
subq $0x8, %rax
movl %eax, 0x28(%rsp)
movq 0xa8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rax
movl %eax, 0x40(%rsp)
movq (%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x20(%rsp), %rdi
movl $0x4, %esi
callq 0x21d0
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
je 0xfa5f
leaq 0xe8bc(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0xfa3f
leaq 0xe8b5(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movl 0x14(%rsp), %edx
xorl %edi, %edi
leaq 0x969b(%rip), %rsi      # 0x190d6
movb $0x0, %al
callq *%rcx
movq (%rsp), %rdi
callq 0x22e0
leaq 0x20(%rsp), %rdi
callq 0x22a0
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0xfa9a
leaq 0x20(%rsp), %rdi
callq 0x22a0
movq (%rsp), %rcx
movq 0x98(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rcx
movl 0x40(%rsp), %eax
subq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
movl $0x0, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_batch.c
// Function: write_fields_batch_digests
static uint8_t *
write_fields_batch_digests(uint8_t *buf, char *ns, int ns_len, cf_digest *digests, cl_cluster_node **nodes, int n_digests, 
	int n_my_digests, cl_cluster_node *my_node )
{
	
	// lay out the fields
	cl_msg_field *mf = (cl_msg_field *) buf;
	cl_msg_field *mf_tmp = mf;
	
	if (ns) {
		mf->type = CL_MSG_FIELD_TYPE_NAMESPACE;
		mf->field_sz = ns_len + 1;
		memcpy(mf->data, ns, ns_len);
		mf_tmp = cl_msg_field_get_next(mf);
		cl_msg_swap_field(mf);
		mf = mf_tmp;
	}

	mf->type = CL_MSG_FIELD_TYPE_DIGEST_RIPE_ARRAY;
	int digest_sz = sizeof(cf_digest) * n_my_digests;
	mf->field_sz = digest_sz + 1;
	uint8_t *b = mf->data;
	for (int i=0;i<n_digests;i++) {
		if (nodes[i] == my_node) { 
			memcpy(b, &digests[i], sizeof(cf_digest));
			b += sizeof(cf_digest);
		}
	}
		
	mf_tmp = cl_msg_field_get_next(mf);
	cl_msg_swap_field(mf);		
	mf = mf_tmp;

	return ( (uint8_t *) mf_tmp );
}

// Assembly:
subq $0x58, %rsp
movq 0x68(%rsp), %rax
movl 0x60(%rsp), %eax
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movl %r9d, 0x2c(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0xfb98
movq 0x20(%rsp), %rax
movb $0x0, 0x4(%rax)
movl 0x44(%rsp), %ecx
addl $0x1, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rdi
addq $0x5, %rdi
movq 0x48(%rsp), %rsi
movslq 0x44(%rsp), %rdx
callq 0x21e0
movq 0x20(%rsp), %rdi
callq 0xfac0
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x13cd0
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movb $0x6, 0x4(%rax)
movslq 0x60(%rsp), %rax
imulq $0x14, %rax, %rax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %ecx
addl $0x1, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
addq $0x5, %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0xfc38
movq 0x30(%rsp), %rax
movslq 0x4(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq 0x68(%rsp), %rax
jne 0xfc29
movq 0x8(%rsp), %rax
movq 0x38(%rsp), %rcx
movslq 0x4(%rsp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movl 0x10(%rcx), %ecx
movl %ecx, 0x10(%rax)
movq 0x8(%rsp), %rax
addq $0x14, %rax
movq %rax, 0x8(%rsp)
jmp 0xfc2b
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0xfbd2
movq 0x20(%rsp), %rdi
callq 0xfac0
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x13cd0
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movl 0xfd76(%rip), %ecx      # 0x204b8
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1077b
leaq 0xdb89(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x1076e
leaq 0xdb82(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
xorl %edi, %edi
leaq 0x8aeb(%rip), %rsi      # 0x19255
movb $0x0, %al
callq *%rcx
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x107fc
cmpl $0x20, 0xc(%rsp)
jbe 0x1078a
movl $0x20, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl 0xfd28(%rip), %ecx      # 0x204bc
cmpl %ecx, %eax
jbe 0x107e0
movl 0xfd1e(%rip), %eax      # 0x204bc
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0xc(%rsp), %eax
jae 0x107de
movl 0x4(%rsp), %eax
leaq 0xfd09(%rip), %rdi      # 0x204c0
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x47(%rip), %rdx        # 0x10810
movq %rcx, %rsi
callq 0x2500
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x107a2
jmp 0x107ea
movl 0xc(%rsp), %eax
movl %eax, 0xfcd2(%rip)      # 0x204bc
movl 0x10(%rsp), %eax
movl %eax, 0xfcb4(%rip)      # 0x204a8
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
leaq 0xf4c5(%rip), %rax      # 0x20490
cmpq $0x0, (%rax)
jne 0x10fd6
jmp 0x110bd
leaq 0xf3d7(%rip), %rax      # 0x203b4
movl (%rax), %eax
movl %eax, 0x8(%rsp)
callq 0x23d0
movl %eax, %ecx
movl 0x8(%rsp), %eax
cmpl %ecx, %eax
jne 0x110bd
movl $0x30, %edi
callq 0x2310
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2170
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl 0xf488(%rip), %ecx      # 0x204bc
cmpl %ecx, %eax
jae 0x11059
leaq 0xf451(%rip), %rax      # 0x20490
movq (%rax), %rdi
leaq 0x10(%rsp), %rsi
callq 0x14300
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1102a
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl 0xf451(%rip), %ecx      # 0x204bc
cmpl %ecx, %eax
jae 0x11096
movl 0xc(%rsp), %eax
movl %eax, %ecx
leaq 0xf444(%rip), %rax      # 0x204c0
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2250
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x11061
movq 0x10(%rsp), %rdi
callq 0x22e0
leaq 0xf3e9(%rip), %rax      # 0x20490
movq (%rax), %rdi
callq 0x13ff0
leaq 0xf3da(%rip), %rax      # 0x20490
movq $0x0, (%rax)
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rdi
addq $0x40, %rdi
callq 0x23e0
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x11894
cmpl $0x82, 0x4(%rsp)
jne 0x1185c
movq 0x8(%rsp), %rdi
addq $0x40, %rdi
callq 0x2220
jmp 0x11892
leaq 0xca75(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x11888
leaq 0xca6b(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movl $0x1, %edi
leaq 0x7cef(%rip), %rsi      # 0x19573
movb $0x0, %al
callq *%rcx
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x1189c
jmp 0x11894
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0xed14(%rip), %rcx      # 0x20610
cmpl 0x8(%rcx), %eax
jge 0x11953
movq 0xed08(%rip), %rax      # 0x20610
addq $0x38, %rax
movslq 0x14(%rsp), %rcx
imulq $0x2f9068, %rcx, %rcx   # imm = 0x2F9068
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
addq $0x70, %rdi
movq 0x18(%rsp), %rsi
callq 0x2380
cmpl $0x0, %eax
jne 0x11944
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x1195c
jmp 0x11946
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x118f1
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
movq %rdi, -0x10(%rsp)
movl $0x0, -0x14(%rsp)
movl -0x14(%rsp), %eax
movq 0xec88(%rip), %rcx      # 0x20610
cmpl 0x8(%rcx), %eax
jge 0x11a2f
movq 0xec78(%rip), %rax      # 0x20610
addq $0x38, %rax
movslq -0x14(%rsp), %rcx
imulq $0x2f9068, %rcx, %rcx   # imm = 0x2F9068
addq %rcx, %rax
movq %rax, -0x20(%rsp)
movq -0x20(%rsp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x24(%rsp)
movl $0x0, -0x28(%rsp)
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
jge 0x11a1d
movq -0x20(%rsp), %rax
movslq -0x28(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rsp), %rcx
movups (%rcx), %xmm1
movups (%rax), %xmm0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x11a0e
movq -0x20(%rsp), %rax
movq %rax, -0x8(%rsp)
jmp 0x11a38
jmp 0x11a10
movl -0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rsp)
jmp 0x119c4
jmp 0x11a1f
movl -0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0x1197d
movq $0x0, -0x8(%rsp)
movq -0x8(%rsp), %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rax
cmpq $0x0, 0xe95f(%rip)      # 0x20628
je 0x11ce2
movq 0xe956(%rip), %rdi      # 0x20628
callq 0x22e0
movq $0x0, 0xe946(%rip) # 0x20628
movl $0x0, 0xe944(%rip)      # 0x20630
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_init_seed_array
static cl_seed_node*
cl_shm_init_seed_array(int seed_count)
{
	if (seed_count > g_seed_count) {
		if (g_seed_array) {
			free(g_seed_array);
		}
		g_seed_array = (cl_seed_node*) malloc(seed_count * sizeof(cl_seed_node));
		g_seed_count = seed_count;
	}
	return g_seed_array;
}

// Assembly:
pushq %rax
movl %edi, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0xe921(%rip), %eax      # 0x20630
jle 0x11d46
cmpq $0x0, 0xe90f(%rip)      # 0x20628
je 0x11d27
movq 0xe906(%rip), %rdi      # 0x20628
callq 0x22e0
movslq 0x4(%rsp), %rax
imulq $0x58, %rax, %rdi
callq 0x2310
movq %rax, 0xe8ec(%rip)      # 0x20628
movl 0x4(%rsp), %eax
movl %eax, 0xe8ea(%rip)      # 0x20630
movq 0xe8db(%rip), %rax      # 0x20628
popq %rcx
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_request_n_partitions
static int
cl_shm_request_n_partitions(struct sockaddr_in* address_array, int address_count, int* n_partitions)
{
	// Loop through node's addresses and make request.
	for (int i = 0; i < address_count; i++) {
		if (cl_request_n_partitions(&address_array[i], n_partitions) == 0) {
			// Return on first successful request.
			return SHM_OK;
		}
	}
	return SHM_ERROR;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x1209d
movq 0x18(%rsp), %rdi
movslq 0x4(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x12c20
cmpl $0x0, %eax
jne 0x1208e
movl $0x0, 0x24(%rsp)
jmp 0x120a5
jmp 0x12090
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x1205a
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_request_node_info
static int
cl_shm_request_node_info(struct sockaddr_in* address_array, int address_count, cl_node_info* node_info)
{
	// Loop through node's addresses and make request.
	for (int i = 0; i < address_count; i++) {
		if (cl_request_node_info(&address_array[i], node_info) == 0) {
			// Return on first successful request.
			return SHM_OK;
		}
	}
	return SHM_ERROR;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x1210d
movq 0x18(%rsp), %rdi
movslq 0x4(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x124f0
cmpl $0x0, %eax
jne 0x120fe
movl $0x0, 0x24(%rsp)
jmp 0x12115
jmp 0x12100
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x120ca
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_add_node
static shm_ninfo*
cl_shm_add_node(cl_seed_node* seed)
{
	if (g_shm_pt->node_count >= g_max_nodes) {
		cf_error("Shared memory node limit breached: %d", g_max_nodes);
		return 0;
	}

	// Place the node at the last offset.
	shm_ninfo* shared_node = &(g_shm_pt->node_info[g_shm_pt->node_count]);

	// Copy node addresses.
	cl_shm_copy_addresses(seed, shared_node);

	// Initialise the lock - only the updater can initialize the node level mutex.
	size_t selfpid = getpid();

	if (selfpid == g_shm_pt->updater_id) {
	    pthread_mutexattr_t attr;
	    pthread_mutexattr_init(&attr);
	    pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
	    pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP);

	    if (pthread_mutex_init(&shared_node->ninfo_lock, &attr) != 0) {
			cf_warn("Shared memory node level mutex init failed pid %d", getpid());
			pthread_mutexattr_destroy(&attr);
			return 0;
	    }
	    pthread_mutexattr_destroy(&attr);
	}
	// Do not increase node count just yet.
	return shared_node;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0xe4e0(%rip), %rax      # 0x20610
movl 0x8(%rax), %eax
cmpl 0xe4ab(%rip), %eax      # 0x205e4
jl 0x12175
leaq 0xc196(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x12167
leaq 0xc18f(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movl 0xe48a(%rip), %edx      # 0x205e4
xorl %edi, %edi
leaq 0x7569(%rip), %rsi      # 0x196cc
movb $0x0, %al
callq *%rcx
movq $0x0, 0x30(%rsp)
jmp 0x12270
movq 0xe494(%rip), %rax      # 0x20610
addq $0x38, %rax
movq 0xe489(%rip), %rcx      # 0x20610
movslq 0x8(%rcx), %rcx
imulq $0x2f9068, %rcx, %rcx   # imm = 0x2F9068
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x12280
callq 0x23d0
cltq
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0xe44f(%rip), %rcx      # 0x20610
cmpq (%rcx), %rax
jne 0x12266
leaq 0x14(%rsp), %rdi
callq 0x2060
leaq 0x14(%rsp), %rdi
movl $0x1, %esi
callq 0x2330
leaq 0x14(%rsp), %rdi
movl $0x1, %esi
callq 0x2210
movq 0x20(%rsp), %rdi
addq $0x40, %rdi
leaq 0x14(%rsp), %rsi
callq 0x2430
cmpl $0x0, %eax
je 0x1225c
leaq 0xc0c7(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x12247
leaq 0xc0bd(%rip), %rax      # 0x1e2e0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x23d0
movq 0x8(%rsp), %rcx
movl %eax, %edx
movl $0x1, %edi
leaq 0x74af(%rip), %rsi      # 0x196f2
movb $0x0, %al
callq *%rcx
leaq 0x14(%rsp), %rdi
callq 0x2420
movq $0x0, 0x30(%rsp)
jmp 0x12270
leaq 0x14(%rsp), %rdi
callq 0x2420
movq 0x20(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_shm.c
// Function: cl_shm_request_replicas
static int
cl_shm_request_replicas(struct sockaddr_in* address_array, int address_count, cl_replicas* replicas)
{
	// Loop through node's addresses and make request.
	for (int i = 0; i < address_count; i++) {
		if (cl_request_replicas(&address_array[i], replicas) == 0) {
			// Return on first successful request.
			return SHM_OK;
		}
	}
	return SHM_ERROR;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq %rdx, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x1235d
movq 0x18(%rsp), %rdi
movslq 0x4(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x128f0
cmpl $0x0, %eax
jne 0x1234e
movl $0x0, 0x24(%rsp)
jmp 0x12365
jmp 0x12350
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x1231a
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/cl_request.c
// Function: cl_strncpy
bool
cl_strncpy(char* trg, const char* src, int len)
{
	int max = len - 1;
	int i = 0;

	while (*src) {
		if (i >= max) {
			*trg = 0;
			return true;
		}
		*trg++ = *src++;
		i++;
	}
	*trg = 0;
	return false;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movl %edx, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rsp)
movl $0x0, -0x24(%rsp)
movq -0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0x123e7
movl -0x24(%rsp), %eax
cmpl -0x20(%rsp), %eax
jl 0x123b4
movq -0x10(%rsp), %rax
movb $0x0, (%rax)
movb $0x1, -0x1(%rsp)
jmp 0x123f4
movq -0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rsp)
movb (%rax), %cl
movq -0x10(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rsp)
movb %cl, (%rax)
movl -0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rsp)
jmp 0x12391
movq -0x10(%rsp), %rax
movb $0x0, (%rax)
movb $0x0, -0x1(%rsp)
movb -0x1(%rsp), %al
andb $0x1, %al
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
leaq 0xe1ce(%rip), %rax      # 0x205e8
testb $0x1, (%rax)
je 0x124c5
movq 0x18(%rsp), %rdi
callq 0x118e0
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
je 0x124c3
movq (%rsp), %rdi
callq 0x11820
movq 0x8(%rsp), %rdi
addq $0x8, %rdi
movq (%rsp), %rsi
addq $0x70, %rsi
movl $0x14, %edx
callq 0x12370
movq (%rsp), %rax
movl 0x6c(%rax), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x28(%rax)
movq (%rsp), %rdi
addq $0x84, %rdi
callq 0x2520
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x20(%rax)
movq (%rsp), %rax
movb 0x2f9067(%rax), %cl
movq 0x8(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x2c(%rax)
movq (%rsp), %rdi
callq 0x118b0
movl $0x0, 0x24(%rsp)
jmp 0x124d8
jmp 0x124c5
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x124f0
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movb $0x0, 0x8(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x20(%rax)
movq 0x20(%rsp), %rax
movb $0x0, 0x2c(%rax)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rdx
leaq 0x71ea(%rip), %rsi      # 0x19724
movl $0x12c, %ecx            # imm = 0x12C
xorl %r8d, %r8d
movl $0x2710, %r9d           # imm = 0x2710
callq 0x17880
cmpl $0x0, %eax
je 0x12568
movq 0x20(%rsp), %rax
movb $0x1, 0x2c(%rax)
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x12661
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x12670
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x12659
movq 0x10(%rsp), %rdi
leaq 0x695c(%rip), %rsi      # 0x18f00
callq 0x2380
cmpl $0x0, %eax
jne 0x125cb
movq 0x20(%rsp), %rdi
addq $0x8, %rdi
movq 0x8(%rsp), %rsi
movl $0x14, %edx
callq 0x12370
jmp 0x12654
movq 0x10(%rsp), %rdi
leaq 0x7170(%rip), %rsi      # 0x19747
callq 0x2380
cmpl $0x0, %eax
jne 0x125f7
movq 0x8(%rsp), %rdi
callq 0x2460
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x28(%rax)
jmp 0x12652
movq 0x10(%rsp), %rdi
leaq 0x713b(%rip), %rsi      # 0x1973e
callq 0x2380
cmpl $0x0, %eax
jne 0x1261d
movq 0x8(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x12650
leaq 0xbcb4(%rip), %rax      # 0x1e2d8
movl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x1264e
leaq 0xbcaa(%rip), %rax      # 0x1e2e0
movq (%rax), %rcx
movq 0x10(%rsp), %rdx
movl $0x1, %edi
leaq 0x7112(%rip), %rsi      # 0x1975c
movb $0x0, %al
callq *%rcx
jmp 0x12650
jmp 0x12652
jmp 0x12654
jmp 0x12575
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)